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 3 (#71457)

Marius Andrae1b4f9e062b8
diff --git a/.kearc b/.kearc
index 208cf05b0fab..a611dbcfb89e 100644
--- a/.kearc
+++ b/.kearc
@@ -22,20 +22,20 @@
"./products/session_summaries",
"./.kea-inline-separator-02",
"./.kea-inline-separator-02-b",
- "./.kea-inline-batch-03-slot-01",
- "./.kea-inline-batch-03-slot-02",
- "./.kea-inline-batch-03-slot-03",
- "./.kea-inline-batch-03-slot-04",
- "./.kea-inline-batch-03-slot-05",
- "./.kea-inline-batch-03-slot-06",
- "./.kea-inline-batch-03-slot-07",
- "./.kea-inline-batch-03-slot-08",
- "./.kea-inline-batch-03-slot-09",
- "./.kea-inline-batch-03-slot-10",
- "./.kea-inline-batch-03-slot-11",
- "./.kea-inline-batch-03-slot-12",
- "./.kea-inline-batch-03-slot-13",
- "./.kea-inline-batch-03-slot-14",
+ "./frontend/src/models",
+ "./frontend/src/queries",
+ "./frontend/src/scenes/comments",
+ "./frontend/src/scenes/feature-flags",
+ "./frontend/src/scenes/health",
+ "./frontend/src/scenes/projectLogic.ts",
+ "./frontend/src/scenes/session-recordings",
+ "./frontend/src/scenes/welcome",
+ "./frontend/src/scenes/wizard",
+ "./products/alerts",
+ "./products/data_modeling",
+ "./products/notifications",
+ "./products/skills",
+ "./products/visual_review",
"./.kea-inline-separator-03",
"./.kea-inline-separator-03-b",
"./.kea-inline-batch-04-slot-01",
diff --git a/frontend/src/lib/components/PropertyFilters/utils.test.ts b/frontend/src/lib/components/PropertyFilters/utils.test.ts
index 4d377efdfba6..7f273ee49b6e 100644
--- a/frontend/src/lib/components/PropertyFilters/utils.test.ts
+++ b/frontend/src/lib/components/PropertyFilters/utils.test.ts
@@ -12,7 +12,7 @@ import {
taxonomicFilterTypeToPropertyFilterType,
} from 'lib/components/PropertyFilters/utils'
-import { propertyDefinitionsModelType } from '~/models/propertyDefinitionsModelType'
+import type { propertyDefinitionsModelType } from '~/models/propertyDefinitionsModel'
import { BreakdownFilter } from '~/queries/schema/schema-general'
import {
diff --git a/frontend/src/lib/components/PropertyFilters/utils.ts b/frontend/src/lib/components/PropertyFilters/utils.ts
index 285b56a058fc..d0f626270db9 100644
--- a/frontend/src/lib/components/PropertyFilters/utils.ts
+++ b/frontend/src/lib/components/PropertyFilters/utils.ts
@@ -9,7 +9,7 @@ import {
} from 'lib/utils/operators'
import { capitalizeFirstLetter } from 'lib/utils/strings'
-import { propertyDefinitionsModelType } from '~/models/propertyDefinitionsModelType'
+import type { propertyDefinitionsModelType } from '~/models/propertyDefinitionsModel'
import { extractExpressionComment } from '~/queries/nodes/DataTable/utils'
import { BreakdownFilter } from '~/queries/schema/schema-general'
import { getCoreFilterDefinition } from '~/taxonomy/helpers'
diff --git a/frontend/src/lib/components/TaxonomicFilter/menu/PreviewPane.test.ts b/frontend/src/lib/components/TaxonomicFilter/menu/PreviewPane.test.ts
index 2823efa295d8..2eba1a649644 100644
--- a/frontend/src/lib/components/TaxonomicFilter/menu/PreviewPane.test.ts
+++ b/frontend/src/lib/components/TaxonomicFilter/menu/PreviewPane.test.ts
@@ -1,6 +1,6 @@
import { urls } from 'scenes/urls'
-import { propertyDefinitionsModelType } from '~/models/propertyDefinitionsModelType'
+import type { propertyDefinitionsModelType } from '~/models/propertyDefinitionsModel'
import { PropertyDefinition } from '~/types'
import { TaxonomicFilterGroup, TaxonomicFilterGroupType } from '../types'
diff --git a/frontend/src/models/actionsModel.ts b/frontend/src/models/actionsModel.ts
index ea13325fd3ce..252701040708 100644
--- a/frontend/src/models/actionsModel.ts
+++ b/frontend/src/models/actionsModel.ts
@@ -1,4 +1,4 @@
-import { connect, events, kea, path, props, selectors } from 'kea'
+import { MakeLogicType, connect, events, kea, path, props, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
@@ -7,7 +7,7 @@ import { isAuthenticatedTeam, teamLogic } from 'scenes/teamLogic'
import { ActionType } from '~/types'
-import type { actionsModelType } from './actionsModelType'
+import type { TeamPublicType, TeamType } from '../types'
export interface ActionsModelProps {
params?: string
@@ -17,6 +17,110 @@ export function findActionName(id: number): string | null {
return actionsModel.findMounted()?.values.actions.find((a) => a.id === id)?.name || null
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface actionsModelValues {
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ actions: ActionType[]
+ actionsById: Partial<Record<number | string, ActionType>>
+ actionsGrouped: {
+ label: string
+ options: {
+ label: string | null
+ value: number
+ }[]
+ }[]
+ actionsLoading: boolean
+ actionsSorted: ActionType[]
+ pin: any
+ pinLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface actionsModelActions {
+ loadActions: () => any
+ loadActionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadActionsSuccess: (
+ actions: ActionType[],
+ payload?: any
+ ) => {
+ actions: ActionType[]
+ payload?: any
+ }
+ pinAction: (action: ActionType) => ActionType
+ pinActionFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ pinActionSuccess: (
+ pin: void,
+ payload?: ActionType
+ ) => {
+ pin: void
+ payload?: ActionType
+ }
+ unpinAction: (action: ActionType) => ActionType
+ unpinActionFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ unpinActionSuccess: (
+ pin: void,
+ payload?: ActionType
+ ) => {
+ pin: void
+ payload?: ActionType
+ }
+ updateAction: (action: ActionType) => ActionType
+ updateActionFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateActionSuccess: (
+ actions: ActionType[],
+ payload?: ActionType
+ ) => {
+ actions: ActionType[]
+ payload?: ActionType
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface actionsModelMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ actionsGrouped: (actions: ActionType[]) => {
+ label: string
+ options: {
+ label: string | null
+ value: number
+ }[]
+ }[]
+ actionsById: (actions: ActionType[]) => Partial<Record<number | string, ActionType>>
+ actionsSorted: (actions: ActionType[]) => ActionType[]
+ }
+}
+
+export type actionsModelType = MakeLogicType<
+ actionsModelValues,
+ actionsModelActions,
+ ActionsModelProps,
+ actionsModelMeta
+>
+
export const actionsModel = kea<actionsModelType>([
props({} as ActionsModelProps),
path(['models', 'actionsModel']),
@@ -65,7 +169,7 @@ export const actionsModel = kea<actionsModelType>([
],
actionsById: [
(s) => [s.actions],
- (actions): Partial<Record<string | number, ActionType>> =>
+ (actions: ActionType[]): Partial<Record<string | number, ActionType>> =>
Object.fromEntries(actions.map((action) => [action.id, action])),
],
actionsSorted: [
diff --git a/frontend/src/models/annotationsModel.ts b/frontend/src/models/annotationsModel.ts
index b97ba94326e4..822b45334221 100644
--- a/frontend/src/models/annotationsModel.ts
+++ b/frontend/src/models/annotationsModel.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 api from 'lib/api'
@@ -9,7 +9,7 @@ import { isAuthenticatedTeam, teamLogic } from 'scenes/teamLogic'
import { AnnotationType, RawAnnotationType } from '~/types'
-import type { annotationsModelType } from './annotationsModelType'
+import type { TeamPublicType, TeamType } from '../types'
export type AnnotationData = Pick<RawAnnotationType, 'date_marker' | 'scope' | 'content' | 'dashboard_item'>
export type AnnotationDataWithoutInsight = Omit<AnnotationData, 'dashboard_item'>
@@ -30,6 +30,128 @@ export function serializeAnnotation(annotation: AnnotationType): RawAnnotationTy
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface annotationsModelValues {
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ timezone: string // teamLogic
+ annotations: AnnotationType[]
+ annotationsLoading: boolean
+ loadingNext: boolean
+ next: string | null
+ rawAnnotations: RawAnnotationType[]
+ rawAnnotationsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface annotationsModelActions {
+ appendAnnotations: (annotations: RawAnnotationType[]) => {
+ annotations: RawAnnotationType[]
+ }
+ createAnnotationGenerically: (annotationData: AnnotationData) => AnnotationData
+ createAnnotationGenericallyFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ createAnnotationGenericallySuccess: (
+ rawAnnotations: void,
+ payload?: AnnotationData
+ ) => {
+ rawAnnotations: void
+ payload?: AnnotationData
+ }
+ deleteAnnotation: (annotation: AnnotationType) => {
+ annotation: AnnotationType
+ }
+ deleteAnnotationFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deleteAnnotationSuccess: (
+ rawAnnotations: AnnotationType[],
+ payload?: {
+ annotation: AnnotationType
+ }
+ ) => {
+ rawAnnotations: AnnotationType[]
+ payload?: {
+ annotation: AnnotationType
+ }
+ }
+ loadAnnotations: () => any
+ loadAnnotationsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAnnotationsNext: () => boolean
+ loadAnnotationsSuccess: (
+ rawAnnotations: RawAnnotationType[],
+ payload?: any
+ ) => {
+ rawAnnotations: RawAnnotationType[]
+ payload?: any
+ }
+ replaceAnnotation: (annotation: RawAnnotationType) => {
+ annotation: RawAnnotationType
+ }
+ setNext: (next: string | null) => {
+ next: string | null
+ }
+ updateAnnotation: ({
+ annotationId,
+ annotationData,
+ }: {
+ annotationData: AnnotationDataWithoutInsight
+ annotationId: RawAnnotationType['id']
+ }) => {
+ annotationId: RawAnnotationType[]
+ annotationData: AnnotationDataWithoutInsight
+ }
+ updateAnnotationFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateAnnotationSuccess: (
+ rawAnnotations: void,
+ payload?: {
+ annotationId: RawAnnotationType[]
+ annotationData: AnnotationDataWithoutInsight
+ }
+ ) => {
+ rawAnnotations: void
+ payload?: {
+ annotationId: RawAnnotationType[]
+ annotationData: AnnotationDataWithoutInsight
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface annotationsModelMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ annotations: (rawAnnotations: RawAnnotationType[], timezone: string) => AnnotationType[]
+ annotationsLoading: (rawAnnotationsLoading: boolean) => boolean
+ }
+}
+
+export type annotationsModelType = MakeLogicType<
+ annotationsModelValues,
+ annotationsModelActions,
+ Record<string, any>,
+ annotationsModelMeta
+>
+
export const annotationsModel = kea<annotationsModelType>([
path(['models', 'annotationsModel']),
connect(() => ({ values: [teamLogic, ['currentTeam', 'timezone']] })),
@@ -106,11 +228,14 @@ export const annotationsModel = kea<annotationsModelType>([
selectors({
annotations: [
(s) => [s.rawAnnotations, s.timezone],
- (rawAnnotations, timezone): AnnotationType[] => {
+ (rawAnnotations: RawAnnotationType[], timezone: string): AnnotationType[] => {
return rawAnnotations.map((annotation): AnnotationType => deserializeAnnotation(annotation, timezone))
},
],
- annotationsLoading: [(s) => [s.rawAnnotationsLoading], (rawAnnotationsLoading) => rawAnnotationsLoading],
+ annotationsLoading: [
+ (s) => [s.rawAnnotationsLoading],
+ (rawAnnotationsLoading: boolean) => rawAnnotationsLoading,
+ ],
}),
listeners(({ actions, values }) => ({
loadAnnotationsNext: async () => {
diff --git a/frontend/src/models/cohortsModel.ts b/frontend/src/models/cohortsModel.ts
index 30d3f34a63af..fb50c627b621 100644
--- a/frontend/src/models/cohortsModel.ts
+++ b/frontend/src/models/cohortsModel.ts
@@ -1,4 +1,15 @@
-import { actions, afterMount, beforeUnmount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ beforeUnmount,
+ connect,
+ kea,
+ listeners,
+ path,
+ reducers,
+ selectors,
+} from 'kea'
import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
import { v4 as uuidv4 } from 'uuid'
@@ -29,7 +40,7 @@ import {
FilterLogicalOperator,
} from '~/types'
-import type { cohortsModelType } from './cohortsModelType'
+import type { TeamPublicType, TeamType } from '../types'
const POLL_TIMEOUT = 5000
@@ -136,6 +147,94 @@ function isCohortTaxonomicListKey(key: unknown[]): boolean {
return key[1] === TaxonomicFilterGroupType.Cohorts || key[1] === TaxonomicFilterGroupType.CohortsWithAllUsers
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface cohortsModelValues {
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ allCohorts: CountedPaginatedResponse<CohortType>
+ allCohortsLoading: boolean
+ cohorts: CountedPaginatedResponse<CohortType>
+ cohortsById: Partial<Record<number | string, CohortType>>
+ cohortsLoading: boolean
+ count: number
+ pollTimeout: number | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface cohortsModelActions {
+ cohortCreated: (cohort: CohortType) => {
+ cohort: CohortType
+ }
+ deleteCohort: (cohort: Partial<CohortType>) => {
+ cohort: Partial<CohortType>
+ }
+ hydrateAllCohortsFromExport: (cohorts: Pick<CohortType, 'id' | 'name'>[]) => {
+ cohorts: Pick<CohortType, 'id' | 'name'>[]
+ }
+ loadAllCohorts: () => any
+ loadAllCohortsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAllCohortsSuccess: (
+ allCohorts: {
+ count: number
+ results: CohortType[]
+ },
+ payload?: any
+ ) => {
+ allCohorts: {
+ count: number
+ results: CohortType[]
+ }
+ payload?: any
+ }
+ loadCohorts: () => any
+ loadCohortsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadCohortsSuccess: (
+ cohorts: {
+ count: number
+ results: CohortType[]
+ },
+ payload?: any
+ ) => {
+ cohorts: {
+ count: number
+ results: CohortType[]
+ }
+ payload?: any
+ }
+ setPollTimeout: (pollTimeout: number | null) => {
+ pollTimeout: number | null
+ }
+ updateCohort: (cohort: CohortType) => {
+ cohort: CohortType
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface cohortsModelMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ cohortsById: (allCohorts: CountedPaginatedResponse<CohortType>) => Partial<Record<number | string, CohortType>>
+ count: (cohorts: CountedPaginatedResponse<CohortType>) => number
+ }
+}
+
+export type cohortsModelType = MakeLogicType<
+ cohortsModelValues,
+ cohortsModelActions,
+ Record<string, any>,
+ cohortsModelMeta
+>
+
export const cohortsModel = kea<cohortsModelType>([
path(['models', 'cohortsModel']),
connect(() => ({
@@ -269,10 +368,10 @@ export const cohortsModel = kea<cohortsModelType>([
selectors({
cohortsById: [
(s) => [s.allCohorts],
- (allCohorts): Partial<Record<string | number, CohortType>> =>
+ (allCohorts: CountedPaginatedResponse<CohortType>): Partial<Record<string | number, CohortType>> =>
Object.fromEntries(allCohorts.results.map((cohort) => [cohort.id, cohort])),
],
- count: [(selectors) => [selectors.cohorts], (cohorts) => cohorts.count],
+ count: [(selectors) => [selectors.cohorts], (cohorts: CountedPaginatedResponse<CohortType>) => cohorts.count],
}),
listeners(({ actions }) => ({
// Flush the TaxonomicFilter cohort cache whenever cohorts mutate
diff --git a/frontend/src/models/dashboardsModel.tsx b/frontend/src/models/dashboardsModel.tsx
index 860e654806aa..bef0942ad4d6 100644
--- a/frontend/src/models/dashboardsModel.tsx
+++ b/frontend/src/models/dashboardsModel.tsx
@@ -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 { router } from 'kea-router'
@@ -18,7 +18,7 @@ import { tagsModel } from '~/models/tagsModel'
import { getQueryBasedDashboard } from '~/queries/nodes/InsightViz/utils'
import { DashboardBasicType, DashboardTile, DashboardType, InsightShortId, QueryBasedInsightModel } from '~/types'
-import type { dashboardsModelType } from './dashboardsModelType'
+import type { Node } from '../queries/schema/schema-general'
export function mergeTileTextUpdatesIntoDashboard(
dashboard: DashboardType<QueryBasedInsightModel>,
@@ -64,6 +64,277 @@ export function mergeTileTextUpdatesIntoDashboard(
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardsModelValues {
+ dashboard: DashboardType<QueryBasedInsightModel> | null
+ dashboardLoading: boolean
+ dashboardsLoading: boolean
+ nameSortedDashboards: (DashboardBasicType | DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>)[]
+ pagedDashboards: PaginatedResponse<DashboardBasicType> | null
+ pagedDashboardsLoading: boolean
+ pagingDashboardsCompleted: boolean
+ pinSortedDashboards: (DashboardBasicType | DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>)[]
+ pinnedDashboards: (DashboardBasicType | DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>)[]
+ rawDashboards: Record<string, DashboardBasicType | DashboardType<QueryBasedInsightModel>>
+ redirect: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardsModelActions {
+ loadTags: () => any // tagsModel
+ addDashboardSuccess: (dashboard: DashboardType<QueryBasedInsightModel>) => {
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>
+ }
+ dashboardsFullyLoaded: () => {
+ value: true
+ }
+ delayedDeleteDashboard: (id: number) => {
+ id: number
+ }
+ deleteDashboard: ({ id, deleteInsights }: any) => any
+ deleteDashboardFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deleteDashboardSuccess: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>,
+ payload?: any
+ ) => {
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>
+ payload?: any
+ }
+ duplicateDashboard: ({
+ id,
+ name,
+ show,
+ duplicateTiles,
+ }: {
+ duplicateTiles?: boolean
+ id: number
+ name?: string
+ show?: boolean
+ }) => {
+ duplicateTiles: boolean
+ id: number
+ name: string
+ show: boolean
+ }
+ duplicateDashboardFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ duplicateDashboardSuccess: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>,
+ payload?: {
+ duplicateTiles: boolean
+ id: number
+ name: string
+ show: boolean
+ }
+ ) => {
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>
+ payload?: {
+ duplicateTiles: boolean
+ id: number
+ name: string
+ show: boolean
+ }
+ }
+ loadDashboards: (url?: string) => string
+ loadDashboardsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadDashboardsSuccess: (
+ pagedDashboards:
+ | {
+ count: number
+ next: null
+ previous: null
+ results: DashboardBasicType[]
+ }
+ | {
+ count?: undefined
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>[]
+ },
+ payload?: string
+ ) => {
+ pagedDashboards:
+ | {
+ count: number
+ next: null
+ previous: null
+ results: DashboardBasicType[]
+ }
+ | {
+ count?: undefined
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>[]
+ }
+ payload?: string
+ }
+ pinDashboard: (
+ id: number,
+ source: DashboardEventSource
+ ) => {
+ id: number
+ source: DashboardEventSource
+ }
+ pinDashboardFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ pinDashboardSuccess: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>,
+ payload?: {
+ id: number
+ source: DashboardEventSource
+ }
+ ) => {
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>
+ payload?: {
+ id: number
+ source: DashboardEventSource
+ }
+ }
+ restoreDashboard: ({ id }: any) => any
+ restoreDashboardFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ restoreDashboardSuccess: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>,
+ payload?: any
+ ) => {
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>
+ payload?: any
+ }
+ setDiveSourceId: (id: InsightShortId | null) => {
+ id: InsightShortId | null
+ }
+ tileAddedToDashboard: (dashboardId: number) => {
+ dashboardId: number
+ }
+ tileMovedToDashboard: (
+ tile: DashboardTile<QueryBasedInsightModel>,
+ dashboardId: number
+ ) => {
+ dashboardId: number
+ tile: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>
+ }
+ tileRemovedFromDashboard: ({
+ tile,
+ dashboardId,
+ }: {
+ dashboardId?: number
+ tile?: DashboardTile<QueryBasedInsightModel>
+ }) => {
+ dashboardId: number | undefined
+ tile: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>> | undefined
+ }
+ unpinDashboard: (
+ id: number,
+ source: DashboardEventSource
+ ) => {
+ id: number
+ source: DashboardEventSource
+ }
+ unpinDashboardFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ unpinDashboardSuccess: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>,
+ payload?: {
+ id: number
+ source: DashboardEventSource
+ }
+ ) => {
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>
+ payload?: {
+ id: number
+ source: DashboardEventSource
+ }
+ }
+ updateDashboard: ({ id, allowUndo, discardResult, ...payload }: any) => any
+ updateDashboardFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateDashboardInsight: (
+ insight: QueryBasedInsightModel,
+ extraDashboardIds?: number[],
+ sourceDashboardId?: number
+ ) => {
+ extraDashboardIds: number[] | undefined
+ insight: QueryBasedInsightModel<Node<Record<string, any>>>
+ sourceDashboardId: number | undefined
+ }
+ updateDashboardSuccess: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null | undefined,
+ payload?: any
+ ) => {
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null | undefined
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardsModelMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ nameSortedDashboards: (
+ rawDashboards: Record<
+ string,
+ DashboardBasicType | DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>
+ >
+ ) => (DashboardBasicType | DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>)[]
+ pinSortedDashboards: (
+ nameSortedDashboards: (
+ | DashboardBasicType
+ | DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>
+ )[]
+ ) => (DashboardBasicType | DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>)[]
+ dashboardsLoading: (pagedDashboardsLoading: boolean, pagingDashboardsCompleted: boolean) => boolean
+ pinnedDashboards: (
+ nameSortedDashboards: (
+ | DashboardBasicType
+ | DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>
+ )[]
+ ) => (DashboardBasicType | DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>)[]
+ }
+}
+
+export type dashboardsModelType = MakeLogicType<
+ dashboardsModelValues,
+ dashboardsModelActions,
+ Record<string, any>,
+ dashboardsModelMeta
+>
+
export const dashboardsModel = kea<dashboardsModelType>([
path(['models', 'dashboardsModel']),
connect(() => ({
@@ -329,7 +600,7 @@ export const dashboardsModel = kea<dashboardsModelType>([
selectors(({ selectors }) => ({
nameSortedDashboards: [
() => [selectors.rawDashboards],
- (rawDashboards) => {
+ (rawDashboards: Record<string, DashboardBasicType | DashboardType<QueryBasedInsightModel>>) => {
return Object.values(rawDashboards)
.filter((dashboard) => !(dashboard.name ?? 'Untitled').startsWith(GENERATED_DASHBOARD_PREFIX))
.sort(nameCompareFunction)
@@ -338,7 +609,12 @@ export const dashboardsModel = kea<dashboardsModelType>([
/** Display dashboards are additionally sorted by pin status: pinned first. */
pinSortedDashboards: [
() => [selectors.nameSortedDashboards],
- (nameSortedDashboards) => {
+ (
+ nameSortedDashboards: (
+ | DashboardBasicType
+ | DashboardType<QueryBasedInsightModel<import('../queries/schema').Node<Record<string, any>>>>
+ )[]
+ ) => {
return [...nameSortedDashboards].sort(
(a, b) => (Number(b.pinned) - Number(a.pinned)) * 10 + nameCompareFunction(a, b)
)
@@ -346,11 +622,17 @@ export const dashboardsModel = kea<dashboardsModelType>([
],
dashboardsLoading: [
() => [selectors.pagedDashboardsLoading, selectors.pagingDashboardsCompleted],
- (pagedDashboardsLoading, pagingDashboardsCompleted) => pagedDashboardsLoading || !pagingDashboardsCompleted,
+ (pagedDashboardsLoading: boolean, pagingDashboardsCompleted: boolean) =>
+ pagedDashboardsLoading || !pagingDashboardsCompleted,
],
pinnedDashboards: [
() => [selectors.nameSortedDashboards],
- (nameSortedDashboards) => {
+ (
+ nameSortedDashboards: (
+ | DashboardBasicType
+ | DashboardType<QueryBasedInsightModel<import('../queries/schema').Node<Record<string, any>>>>
+ )[]
+ ) => {
const pinnedDashboards = nameSortedDashboards.filter((dashboard) => dashboard.pinned)
return [...pinnedDashboards].sort((a, b) => {
diff --git a/frontend/src/models/groupsModel.ts b/frontend/src/models/groupsModel.ts
index 58b32849af61..6b988446b381 100644
--- a/frontend/src/models/groupsModel.ts
+++ b/frontend/src/models/groupsModel.ts
@@ -1,4 +1,4 @@
-import { afterMount, connect, kea, listeners, path, selectors } from 'kea'
+import { MakeLogicType, afterMount, connect, kea, listeners, path, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { subscriptions } from 'kea-subscriptions'
@@ -10,13 +10,149 @@ import { projectLogic } from 'scenes/projectLogic'
import { GroupType, GroupTypeIndex } from '~/types'
-import type { groupsModelType } from './groupsModelType'
-
export interface Noun {
singular: string
plural: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface groupsModelValues {
+ groupsAccessStatus: GroupsAccessStatus // groupsAccessLogic
+ groupsEnabled: boolean // groupsAccessLogic
+ currentProjectId: number | null // projectLogic
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun
+ groupNamesTaxonomicTypes: TaxonomicFilterGroupType[]
+ groupTypes: Map<GroupTypeIndex, GroupType>
+ groupTypesLoading: boolean
+ groupTypesRaw: Array<GroupType>
+ groupTypesRawLoading: boolean
+ groupsTaxonomicTypes: TaxonomicFilterGroupType[]
+ showGroupsOptions: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface groupsModelActions {
+ createDetailDashboard: (groupTypeIndex: number) => number
+ createDetailDashboardFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ createDetailDashboardSuccess: (
+ groupTypesRaw: any[],
+ payload?: number
+ ) => {
+ groupTypesRaw: any[]
+ payload?: number
+ }
+ deleteGroupType: (groupTypeIndex: number) => number
+ deleteGroupTypeFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deleteGroupTypeSuccess: (
+ groupTypesRaw: never[],
+ payload?: number
+ ) => {
+ groupTypesRaw: never[]
+ payload?: number
+ }
+ loadAllGroupTypes: () => any
+ loadAllGroupTypesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAllGroupTypesSuccess: (
+ groupTypesRaw: GroupType[],
+ payload?: any
+ ) => {
+ groupTypesRaw: GroupType[]
+ payload?: any
+ }
+ removeDetailDashboard: (dashboardId: number) => number
+ removeDetailDashboardFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ removeDetailDashboardSuccess: (
+ groupTypesRaw: GroupType[],
+ payload?: number
+ ) => {
+ groupTypesRaw: GroupType[]
+ payload?: number
+ }
+ setDefaultColumns: ({ groupTypeIndex, defaultColumns }: { defaultColumns: string[]; groupTypeIndex: number }) => {
+ groupTypeIndex: number
+ defaultColumns: string[]
+ }
+ setDefaultColumnsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ setDefaultColumnsSuccess: (
+ groupTypesRaw: any[],
+ payload?: {
+ groupTypeIndex: number
+ defaultColumns: string[]
+ }
+ ) => {
+ groupTypesRaw: any[]
+ payload?: {
+ groupTypeIndex: number
+ defaultColumns: string[]
+ }
+ }
+ updateGroupTypesMetadata: (payload: Array<GroupType>) => Array<GroupType>
+ updateGroupTypesMetadataFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateGroupTypesMetadataSuccess: (
+ groupTypesRaw: GroupType[],
+ payload?: Array<GroupType>
+ ) => {
+ groupTypesRaw: GroupType[]
+ payload?: Array<GroupType>
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface groupsModelMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ groupTypes: (groupTypesRaw: GroupType[]) => Map<GroupTypeIndex, GroupType>
+ groupTypesLoading: (groupTypesRawLoading: boolean) => boolean
+ showGroupsOptions: (
+ groupsAccessStatus: GroupsAccessStatus,
+ groupsEnabled: boolean,
+ groupTypes: Map<GroupTypeIndex, GroupType>
+ ) => boolean
+ groupsTaxonomicTypes: (groupTypes: Map<GroupTypeIndex, GroupType>) => TaxonomicFilterGroupType[]
+ groupNamesTaxonomicTypes: (groupTypes: Map<GroupTypeIndex, GroupType>) => TaxonomicFilterGroupType[]
+ aggregationLabel: (
+ groupTypes: Map<GroupTypeIndex, GroupType>
+ ) => (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun
+ }
+}
+
+export type groupsModelType = MakeLogicType<groupsModelValues, groupsModelActions, Record<string, any>, groupsModelMeta>
+
export const groupsModel = kea<groupsModelType>([
path(['models', 'groupsModel']),
connect(() => ({
@@ -84,21 +220,21 @@ export const groupsModel = kea<groupsModelType>([
selectors({
groupTypes: [
(s) => [s.groupTypesRaw],
- (groupTypesRaw) =>
+ (groupTypesRaw: Array<GroupType>) =>
new Map<GroupTypeIndex, GroupType>(
(groupTypesRaw ?? []).map((groupType) => [groupType.group_type_index, groupType])
),
],
- groupTypesLoading: [(s) => [s.groupTypesRawLoading], (groupTypesRawLoading) => groupTypesRawLoading],
+ groupTypesLoading: [(s) => [s.groupTypesRawLoading], (groupTypesRawLoading: boolean) => groupTypesRawLoading],
showGroupsOptions: [
(s) => [s.groupsAccessStatus, s.groupsEnabled, s.groupTypes],
- (status, enabled, groupTypes) =>
+ (status: GroupsAccessStatus, enabled: boolean, groupTypes: Map<GroupTypeIndex, GroupType>) =>
status !== GroupsAccessStatus.Hidden || (enabled && Array.from(groupTypes.values()).length > 0),
],
groupsTaxonomicTypes: [
(s) => [s.groupTypes],
- (groupTypes): TaxonomicFilterGroupType[] => {
+ (groupTypes: Map<GroupTypeIndex, GroupType>): TaxonomicFilterGroupType[] => {
return Array.from(groupTypes.values()).map(
(groupType: GroupType) =>
`${TaxonomicFilterGroupType.GroupsPrefix}_${groupType.group_type_index}` as TaxonomicFilterGroupType
@@ -107,7 +243,7 @@ export const groupsModel = kea<groupsModelType>([
],
groupNamesTaxonomicTypes: [
(s) => [s.groupTypes],
- (groupTypes): TaxonomicFilterGroupType[] => {
+ (groupTypes: Map<GroupTypeIndex, GroupType>): TaxonomicFilterGroupType[] => {
return Array.from(groupTypes.values()).map(
(groupType: GroupType) =>
`${TaxonomicFilterGroupType.GroupNamesPrefix}_${groupType.group_type_index}` as TaxonomicFilterGroupType
@@ -116,7 +252,7 @@ export const groupsModel = kea<groupsModelType>([
],
aggregationLabel: [
(s) => [s.groupTypes],
- (groupTypes) =>
+ (groupTypes: Map<GroupTypeIndex, GroupType>) =>
(groupTypeIndex: number | null | undefined, deferToUserWording: boolean = false): Noun => {
if (groupTypeIndex != undefined) {
const groupType = groupTypes.get(groupTypeIndex as GroupTypeIndex)
diff --git a/frontend/src/models/insightsModel.tsx b/frontend/src/models/insightsModel.tsx
index a66a4e938eae..e3b0647edf47 100644
--- a/frontend/src/models/insightsModel.tsx
+++ b/frontend/src/models/insightsModel.tsx
@@ -1,4 +1,4 @@
-import { actions, connect, kea, listeners, path } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path } from 'kea'
import { LemonDialog, LemonInput } from '@posthog/lemon-ui'
@@ -9,7 +9,36 @@ import { teamLogic } from 'scenes/teamLogic'
import { QueryBasedInsightModel } from '~/types'
-import type { insightsModelType } from './insightsModelType'
+import type { Node } from '../queries/schema/schema-general'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightsModelActions {
+ duplicateInsight: (item: QueryBasedInsightModel) => {
+ item: QueryBasedInsightModel<Node<Record<string, any>>>
+ }
+ duplicateInsightSuccess: (item: QueryBasedInsightModel) => {
+ item: QueryBasedInsightModel<Node<Record<string, any>>>
+ }
+ insightsAddedToDashboard: ({ dashboardId, insightIds }: { dashboardId: number; insightIds: number[] }) => {
+ dashboardId: number
+ insightIds: number[]
+ }
+ renameInsight: (item: QueryBasedInsightModel) => {
+ item: QueryBasedInsightModel<Node<Record<string, any>>>
+ }
+ renameInsightSuccess: (item: QueryBasedInsightModel) => {
+ item: QueryBasedInsightModel<Node<Record<string, any>>>
+ }
+ updateInsightDirect: (
+ item: QueryBasedInsightModel,
+ updates: Partial<QueryBasedInsightModel>
+ ) => {
+ item: QueryBasedInsightModel<Node<Record<string, any>>>
+ updates: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>
+ }
+}
+
+export type insightsModelType = MakeLogicType<{}, insightsModelActions>
export const insightsModel = kea<insightsModelType>([
path(['models', 'insightsModel']),
diff --git a/frontend/src/models/notebooksModel.ts b/frontend/src/models/notebooksModel.ts
index af74adeb20ea..750e82a14ce0 100644
--- a/frontend/src/models/notebooksModel.ts
+++ b/frontend/src/models/notebooksModel.ts
@@ -1,4 +1,4 @@
-import { BuiltLogic, actions, connect, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, BuiltLogic, actions, connect, kea, listeners, path, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
import posthog from 'posthog-js'
@@ -20,7 +20,7 @@ import { deleteFromTree, getLastNewFolder, refreshTreeItem } from '~/layout/pane
import { InsightVizNode, Node, ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
import { DashboardType, QueryBasedInsightModel } from '~/types'
-import type { notebooksModelType } from './notebooksModelType'
+import type { NotebookType } from '../scenes/notebooks/types'
// Queue for operations that arrive before the Notebook component mounts its
// kea logic. `openNotebook` pushes here; `notebookLogic.afterMount` drains.
@@ -77,6 +77,115 @@ export const openNotebook = async (
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface notebooksModelValues {
+ currentProjectId: number | null // projectLogic
+ notebookTemplates: NotebookType[]
+ notebookTemplatesLoading: boolean
+ notebooks: NotebookListItemType[]
+ notebooksLoading: boolean
+ scratchpadNotebook: NotebookListItemType
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface notebooksModelActions {
+ createNotebook: (
+ location: NotebookTarget,
+ title?: string,
+ content?: JSONContent[],
+ onCreate?: (notebook: BuiltLogic<notebookLogicType>) => void,
+ shortId?: string
+ ) => {
+ content: JSONContent[] | undefined
+ location: NotebookTarget
+ onCreate: ((notebook: BuiltLogic<notebookLogicType>) => void) | undefined
+ shortId: string | undefined
+ title: string | undefined
+ }
+ createNotebookFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ createNotebookFromDashboard: (dashboard: DashboardType<QueryBasedInsightModel>) => {
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>
+ }
+ createNotebookSuccess: (
+ notebooks: NotebookListItemType[],
+ payload?: {
+ content: JSONContent[] | undefined
+ location: NotebookTarget
+ onCreate: ((notebook: BuiltLogic<notebookLogicType>) => void) | undefined
+ shortId: string | undefined
+ title: string | undefined
+ }
+ ) => {
+ notebooks: NotebookListItemType[]
+ payload?: {
+ content: JSONContent[] | undefined
+ location: NotebookTarget
+ onCreate: ((notebook: BuiltLogic<notebookLogicType>) => void) | undefined
+ shortId: string | undefined
+ title: string | undefined
+ }
+ }
+ deleteNotebook: (
+ shortId: NotebookListItemType['short_id'],
+ title?: string
+ ) => {
+ shortId: string
+ title: string | undefined
+ }
+ deleteNotebookFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deleteNotebookSuccess: (
+ notebooks: NotebookListItemType[],
+ payload?: {
+ shortId: string
+ title: string | undefined
+ }
+ ) => {
+ notebooks: NotebookListItemType[]
+ payload?: {
+ shortId: string
+ title: string | undefined
+ }
+ }
+ loadNotebooks: () => {
+ value: true
+ }
+ receiveNotebookUpdate: (notebook: NotebookListItemType) => {
+ notebook: NotebookListItemType
+ }
+ receiveNotebookUpdateFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ receiveNotebookUpdateSuccess: (
+ notebooks: NotebookListItemType[],
+ payload?: {
+ notebook: NotebookListItemType
+ }
+ ) => {
+ notebooks: NotebookListItemType[]
+ payload?: {
+ notebook: NotebookListItemType
+ }
+ }
+}
+
+export type notebooksModelType = MakeLogicType<notebooksModelValues, notebooksModelActions>
+
export const notebooksModel = kea<notebooksModelType>([
path(['scenes', 'notebooks', 'Notebook', 'notebooksModel']),
actions({
diff --git a/frontend/src/models/primaryEventPropertiesModel.ts b/frontend/src/models/primaryEventPropertiesModel.ts
index b324ed970d26..9ca5c82bf091 100644
--- a/frontend/src/models/primaryEventPropertiesModel.ts
+++ b/frontend/src/models/primaryEventPropertiesModel.ts
@@ -1,4 +1,4 @@
-import { actions, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, listeners, path, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import posthog from 'posthog-js'
@@ -6,7 +6,72 @@ import api from 'lib/api'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { hasTaxonomyPrimaryProperty } from 'lib/utils/events'
-import type { primaryEventPropertiesModelType } from './primaryEventPropertiesModelType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface primaryEventPropertiesModelValues {
+ loadedEventNames: string[]
+ primaryProperties: Record<string, string>
+ primaryPropertiesLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface primaryEventPropertiesModelActions {
+ ensureLoadedForEvents: (eventNames: string[]) => {
+ eventNames: string[]
+ }
+ loadPrimaryProperties: ({ names }: { names: string[] }) => {
+ names: string[]
+ }
+ loadPrimaryPropertiesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPrimaryPropertiesSuccess: (
+ primaryProperties: Record<string, string>,
+ payload?: {
+ names: string[]
+ }
+ ) => {
+ primaryProperties: Record<string, string>
+ payload?: {
+ names: string[]
+ }
+ }
+ refreshLoadedPrimaryProperties: () => {
+ value: true
+ }
+ updatePrimaryProperty: ({ eventName, propertyKey }: { eventName: string; propertyKey: string | null }) => {
+ eventName: string
+ propertyKey: string | null
+ }
+ updatePrimaryPropertyFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updatePrimaryPropertySuccess: (
+ primaryProperties: Record<string, string>,
+ payload?: {
+ eventName: string
+ propertyKey: string | null
+ }
+ ) => {
+ primaryProperties: Record<string, string>
+ payload?: {
+ eventName: string
+ propertyKey: string | null
+ }
+ }
+}
+
+export type primaryEventPropertiesModelType = MakeLogicType<
+ primaryEventPropertiesModelValues,
+ primaryEventPropertiesModelActions
+>
export const primaryEventPropertiesModel = kea<primaryEventPropertiesModelType>([
path(['models', 'primaryEventPropertiesModel']),
diff --git a/frontend/src/models/propertyDefinitionsModel.ts b/frontend/src/models/propertyDefinitionsModel.ts
index f1f4ee183757..43ea7fa401b3 100644
--- a/frontend/src/models/propertyDefinitionsModel.ts
+++ b/frontend/src/models/propertyDefinitionsModel.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 api, { ApiMethodOptions, CountedPaginatedResponse } from 'lib/api'
import { TaxonomicFilterValue } from 'lib/components/TaxonomicFilter/types'
@@ -21,8 +21,8 @@ import {
PropertyType,
} from '~/types'
+import type { GroupType } from '../types'
import { groupsModel } from './groupsModel'
-import type { propertyDefinitionsModelType } from './propertyDefinitionsModelType'
export type PropertyDefinitionStorage = Record<string, PropertyDefinition | PropertyDefinitionState>
@@ -192,6 +192,137 @@ const constructValuesEndpoint = (
)
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface propertyDefinitionsModelValues {
+ groupTypes: Map<GroupTypeIndex, GroupType> // groupsModel
+ currentTeamId: number | null // teamLogic
+ describeProperty: (
+ s: TaxonomicFilterValue,
+ type: PropertyDefinitionType,
+ groupTypeIndex?: number
+ ) => PropertyType | null
+ eventMetadataPropertyDefinitions: PropertyDefinition[]
+ formatPropertyValueForDisplay: FormatPropertyValueForDisplayFunction
+ getPropertyDefinition: (
+ s: TaxonomicFilterValue,
+ type: PropertyDefinitionType,
+ groupTypeIndex?: number
+ ) => PropertyDefinition | null
+ options: Record<string, Option>
+ pendingProperties: string[]
+ personMetadataPropertyDefinitions: PropertyDefinition[]
+ propertyDefinitionStorage: PropertyDefinitionStorage
+ propertyDefinitionsByType: (type: string, groupTypeIndex?: number | null) => PropertyDefinition[]
+ rawPropertyDefinitionStorage: PropertyDefinitionStorage
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface propertyDefinitionsModelActions {
+ abortAnyRunningQuery: () => {
+ value: true
+ }
+ fetchAllPendingDefinitions: () => {
+ value: true
+ }
+ loadPropertyDefinitions: (
+ propertyKeys: string[],
+ type: PropertyDefinitionType,
+ groupTypeIndex?: number | null
+ ) => {
+ groupTypeIndex: number | null | undefined
+ propertyKeys: string[]
+ type: PropertyDefinitionType
+ }
+ loadPropertyValues: (payload: {
+ endpoint: string | undefined
+ eventNames?: string[]
+ newInput: string | undefined
+ properties?: {
+ key: string
+ values: string | string[]
+ }[]
+ propertyKey: string
+ refresh?: string
+ type: PropertyDefinitionType
+ }) => {
+ endpoint: string | undefined
+ eventNames?: string[] | undefined
+ newInput: string | undefined
+ properties?:
+ | {
+ key: string
+ values: string | string[]
+ }[]
+ | undefined
+ propertyKey: string
+ refresh?: string | undefined
+ type: PropertyDefinitionType
+ }
+ setOptions: (
+ key: string,
+ values: PropValue[],
+ allowCustomValues: boolean,
+ refreshing?: boolean
+ ) => {
+ allowCustomValues: boolean
+ key: string
+ refreshing: boolean | undefined
+ values: PropValue[]
+ }
+ setOptionsError: (key: string) => {
+ key: string
+ }
+ setOptionsLoading: (key: string) => {
+ key: string
+ }
+ setOptionsSearchInput: (
+ key: string,
+ searchInput: string
+ ) => {
+ key: string
+ searchInput: string
+ }
+ updatePropertyDefinitions: (propertyDefinitions: PropertyDefinitionStorage) => {
+ propertyDefinitions: PropertyDefinitionStorage
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface propertyDefinitionsModelMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ pendingProperties: (propertyDefinitionStorage: PropertyDefinitionStorage) => string[]
+ propertyDefinitionsByType: (
+ propertyDefinitionStorage: PropertyDefinitionStorage
+ ) => (type: string, groupTypeIndex?: number | null) => PropertyDefinition[]
+ propertyDefinitionStorage: (
+ rawPropertyDefinitionStorage: PropertyDefinitionStorage,
+ eventMetadataPropertyDefinitions: PropertyDefinition[],
+ personMetadataPropertyDefinitions: PropertyDefinition[]
+ ) => PropertyDefinitionStorage
+ getPropertyDefinition: (
+ propertyDefinitionStorage: PropertyDefinitionStorage
+ ) => (
+ s: TaxonomicFilterValue,
+ type: PropertyDefinitionType,
+ groupTypeIndex?: number
+ ) => PropertyDefinition | null
+ describeProperty: (
+ propertyDefinitionStorage: PropertyDefinitionStorage
+ ) => (s: TaxonomicFilterValue, type: PropertyDefinitionType, groupTypeIndex?: number) => PropertyType | null
+ formatPropertyValueForDisplay: (
+ propertyDefinitionStorage: PropertyDefinitionStorage
+ ) => FormatPropertyValueForDisplayFunction
+ eventMetadataPropertyDefinitions: (groupTypes: Map<GroupTypeIndex, GroupType>) => PropertyDefinition[]
+ }
+}
+
+export type propertyDefinitionsModelType = MakeLogicType<
+ propertyDefinitionsModelValues,
+ propertyDefinitionsModelActions,
+ Record<string, any>,
+ propertyDefinitionsModelMeta
+>
+
export const propertyDefinitionsModel = kea<propertyDefinitionsModelType>([
path(['models', 'propertyDefinitionsModel']),
connect(() => ({
@@ -508,14 +639,16 @@ export const propertyDefinitionsModel = kea<propertyDefinitionsModelType>([
selectors({
pendingProperties: [
(s) => [s.propertyDefinitionStorage],
- (propertyDefinitionStorage): string[] =>
+ (propertyDefinitionStorage: PropertyDefinitionStorage): string[] =>
Object.keys(propertyDefinitionStorage).filter(
(key) => propertyDefinitionStorage[key] === PropertyDefinitionState.Pending
),
],
propertyDefinitionsByType: [
(s) => [s.propertyDefinitionStorage],
- (propertyDefinitionStorage): ((type: string, groupTypeIndex?: number | null) => PropertyDefinition[]) => {
+ (
+ propertyDefinitionStorage: PropertyDefinitionStorage
+ ): ((type: string, groupTypeIndex?: number | null) => PropertyDefinition[]) => {
return (type, groupTypeIndex) => {
const keyPrefix = type === 'group' ? `${type}/${groupTypeIndex}/` : `${type}/`
@@ -532,8 +665,8 @@ export const propertyDefinitionsModel = kea<propertyDefinitionsModelType>([
s.personMetadataPropertyDefinitions,
],
(
- rawPropertyDefinitionStorage,
- eventMetadataPropertyDefinitions,
+ rawPropertyDefinitionStorage: PropertyDefinitionStorage,
+ eventMetadataPropertyDefinitions: PropertyDefinition[],
personMetadataPropertyDefinitions: PropertyDefinition[]
): PropertyDefinitionStorage => {
const eventMetadataDefinitions = Object.fromEntries(
@@ -558,7 +691,7 @@ export const propertyDefinitionsModel = kea<propertyDefinitionsModelType>([
getPropertyDefinition: [
(s) => [s.propertyDefinitionStorage],
(
- propertyDefinitionStorage
+ propertyDefinitionStorage: PropertyDefinitionStorage
): ((
s: TaxonomicFilterValue,
type: PropertyDefinitionType,
@@ -582,7 +715,7 @@ export const propertyDefinitionsModel = kea<propertyDefinitionsModelType>([
describeProperty: [
(s) => [s.propertyDefinitionStorage],
(
- propertyDefinitionStorage
+ propertyDefinitionStorage: PropertyDefinitionStorage
): ((
s: TaxonomicFilterValue,
type: PropertyDefinitionType,
@@ -604,7 +737,7 @@ export const propertyDefinitionsModel = kea<propertyDefinitionsModelType>([
],
formatPropertyValueForDisplay: [
(s) => [s.propertyDefinitionStorage],
- (propertyDefinitionStorage): FormatPropertyValueForDisplayFunction => {
+ (propertyDefinitionStorage: PropertyDefinitionStorage): FormatPropertyValueForDisplayFunction => {
return (
propertyName?: BreakdownKeyType,
valueToFormat?: PropertyFilterValue | undefined,
@@ -671,7 +804,7 @@ export const propertyDefinitionsModel = kea<propertyDefinitionsModelType>([
],
eventMetadataPropertyDefinitions: [
(s) => [s.groupTypes],
- (groupTypes) => {
+ (groupTypes: Map<GroupTypeIndex, import('~/types').GroupType>) => {
const definitions = [
{
id: 'event',
diff --git a/frontend/src/models/recentItemsModel.ts b/frontend/src/models/recentItemsModel.ts
index 79f2d966c2aa..ecb33b099bc1 100644
--- a/frontend/src/models/recentItemsModel.ts
+++ b/frontend/src/models/recentItemsModel.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'
@@ -9,7 +9,7 @@ import { teamLogic } from 'scenes/teamLogic'
import { FileSystemEntry } from '~/queries/schema/schema-general'
-import type { recentItemsModelType } from './recentItemsModelType'
+import type { TeamPublicType } from '../types'
const RECENTS_FETCH_LIMIT = 20
/**
@@ -20,6 +20,66 @@ const RECENTS_FETCH_LIMIT = 20
*/
const LOADER_TIMEOUT_MS = 10000
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface recentItemsModelValues {
+ recents: FileSystemEntry[]
+ recentsHasLoaded: boolean
+ recentsLoading: boolean
+ sceneLogViewsByRef: Record<string, string>
+ sceneLogViewsByRefLoading: boolean
+ sceneLogViewsHasLoaded: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface recentItemsModelActions {
+ loadCurrentTeamSuccess: (
+ currentTeam: TeamPublicType | null,
+ payload?: any
+ ) => {
+ currentTeam: TeamPublicType | null
+ payload?: any
+ } // teamLogic
+ loadRecents: () => any
+ loadRecentsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRecentsSuccess: (
+ recents: FileSystemEntry[],
+ payload?: any
+ ) => {
+ recents: FileSystemEntry[]
+ payload?: any
+ }
+ loadSceneLogViews: () => any
+ loadSceneLogViewsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSceneLogViewsSuccess: (
+ sceneLogViewsByRef: Record<string, string>,
+ payload?: any
+ ) => {
+ sceneLogViewsByRef: Record<string, string>
+ payload?: any
+ }
+ recordView: (
+ type: string,
+ ref: string
+ ) => {
+ ref: string
+ type: string
+ }
+}
+
+export type recentItemsModelType = MakeLogicType<recentItemsModelValues, recentItemsModelActions>
+
export const recentItemsModel = kea<recentItemsModelType>([
path(['models', 'recentItemsModel']),
diff --git a/frontend/src/models/tagsModel.ts b/frontend/src/models/tagsModel.ts
index cacfc55e4aa5..c3fe9fcbfa78 100644
--- a/frontend/src/models/tagsModel.ts
+++ b/frontend/src/models/tagsModel.ts
@@ -1,9 +1,34 @@
-import { kea, path } from 'kea'
+import { MakeLogicType, kea, path } from 'kea'
import { lazyLoaders } from 'kea-loaders'
import api from 'lib/api'
-import type { tagsModelType } from './tagsModelType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tagsModelValues {
+ tags: string[]
+ tagsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tagsModelActions {
+ loadTags: () => any
+ loadTagsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadTagsSuccess: (
+ tags: string[],
+ payload?: any
+ ) => {
+ tags: string[]
+ payload?: any
+ }
+}
+
+export type tagsModelType = MakeLogicType<tagsModelValues, tagsModelActions>
export const tagsModel = kea<tagsModelType>([
path(['models', 'tagsModel']),
diff --git a/frontend/src/queries/QueryEditor/queryEditorLogic.ts b/frontend/src/queries/QueryEditor/queryEditorLogic.ts
index 9ff51e2050b0..e17e56e267e2 100644
--- a/frontend/src/queries/QueryEditor/queryEditorLogic.ts
+++ b/frontend/src/queries/QueryEditor/queryEditorLogic.ts
@@ -1,12 +1,10 @@
-import { actions, kea, key, listeners, path, props, propsChanged, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, key, listeners, path, props, propsChanged, reducers, selectors } from 'kea'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { QueryEditorProps } from '~/queries/QueryEditor/QueryEditor'
import { Node } from '~/queries/schema/schema-general'
-import type { queryEditorLogicType } from './queryEditorLogicType'
-
function prettyJSON(source: string): string {
try {
return JSON.stringify(JSON.parse(source), null, 2) + '\n'
@@ -19,6 +17,49 @@ export interface QueryEditorLogicProps extends QueryEditorProps {
key: number
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface queryEditorLogicValues {
+ JSONQuery: Node | null
+ error: string | null
+ inputChanged: boolean
+ parsedQuery: {
+ error: string | null
+ JSONQuery: Node | null
+ }
+ queryInput: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface queryEditorLogicActions {
+ saveQuery: () => {
+ value: true
+ }
+ setQueryInput: (queryInput: string) => {
+ queryInput: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface queryEditorLogicMeta {
+ key: number
+ __keaTypeGenInternalSelectorTypes: {
+ parsedQuery: (queryInput: string) => {
+ error: string | null
+ JSONQuery: Node | null
+ }
+ JSONQuery: (parsedQuery: { error: string | null; JSONQuery: Node | null }) => Node | null
+ error: (parsedQuery: { error: string | null; JSONQuery: Node | null }) => string | null
+ inputChanged: (query: string, queryInput: string) => boolean
+ }
+}
+
+export type queryEditorLogicType = MakeLogicType<
+ queryEditorLogicValues,
+ queryEditorLogicActions,
+ QueryEditorLogicProps,
+ queryEditorLogicMeta
+>
+
export const queryEditorLogic = kea<queryEditorLogicType>([
path(['queries', 'QueryEditor', 'queryEditorLogic']),
props({} as QueryEditorLogicProps),
@@ -38,7 +79,7 @@ export const queryEditorLogic = kea<queryEditorLogicType>([
selectors({
parsedQuery: [
(s) => [s.queryInput],
- (query): { JSONQuery: Node | null; error: string | null } => {
+ (query: string): { JSONQuery: Node | null; error: string | null } => {
let JSONQuery: Node | null = null
let error = null
try {
@@ -51,7 +92,7 @@ export const queryEditorLogic = kea<queryEditorLogicType>([
],
JSONQuery: [(s) => [s.parsedQuery], ({ JSONQuery }): Node | null => JSONQuery],
error: [(s) => [s.parsedQuery], ({ error }): string | null => error],
- inputChanged: [(s, p) => [p.query, s.queryInput], (query, queryInput) => query !== queryInput],
+ inputChanged: [(s, p) => [p.query, s.queryInput], (query: string, queryInput: string) => query !== queryInput],
}),
listeners(({ actions, props, values }) => ({
saveQuery: () => {
diff --git a/frontend/src/queries/nodes/DataNode/dataNodeCollectionLogic.ts b/frontend/src/queries/nodes/DataNode/dataNodeCollectionLogic.ts
index cbf1002f46ae..6d4651e7c287 100644
--- a/frontend/src/queries/nodes/DataNode/dataNodeCollectionLogic.ts
+++ b/frontend/src/queries/nodes/DataNode/dataNodeCollectionLogic.ts
@@ -1,9 +1,7 @@
-import { actions, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { RefreshType } from '~/queries/schema/schema-general'
-import type { dataNodeCollectionLogicType } from './dataNodeCollectionLogicType'
-
export interface DataNodeRegisteredProps {
id: string
loadData: (refresh?: RefreshType) => void
@@ -21,6 +19,53 @@ export interface DataNodeStatus {
export type DataNodeStatusMap = Record<string, DataNodeStatus | undefined>
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dataNodeCollectionLogicValues {
+ areAnyLoading: boolean
+ collectionNodeStatus: DataNodeStatusMap
+ mountedDataNodes: DataNodeRegisteredProps[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dataNodeCollectionLogicActions {
+ cancelAllLoading: () => {}
+ collectionNodeLoadData: (id: string) => {
+ id: string
+ }
+ collectionNodeLoadDataFailure: (id: string) => {
+ id: string
+ }
+ collectionNodeLoadDataSuccess: (id: string) => {
+ id: string
+ }
+ mountDataNode: (
+ id: string,
+ props: DataNodeRegisteredProps
+ ) => {
+ id: string
+ props: DataNodeRegisteredProps
+ }
+ reloadAll: () => {}
+ unmountDataNode: (id: string) => {
+ id: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dataNodeCollectionLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ areAnyLoading: (collectionNodeStatus: DataNodeStatusMap) => boolean
+ }
+}
+
+export type dataNodeCollectionLogicType = MakeLogicType<
+ dataNodeCollectionLogicValues,
+ dataNodeCollectionLogicActions,
+ DataNodeCollectionProps,
+ dataNodeCollectionLogicMeta
+>
+
export const dataNodeCollectionLogic = kea<dataNodeCollectionLogicType>([
path(['queries', 'nodes', 'dataNodeCollectionLogic']),
props({} as DataNodeCollectionProps),
diff --git a/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts b/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts
index 50777d6d90c6..54b2e9c1be29 100644
--- a/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts
+++ b/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts
@@ -1,5 +1,6 @@
import clsx from 'clsx'
import {
+ MakeLogicType,
actions,
afterMount,
beforeUnmount,
@@ -87,7 +88,21 @@ import {
} from '~/queries/utils'
import { TeamType } from '~/types'
-import type { dataNodeLogicType } from './dataNodeLogicType'
+import type { TeamPublicType, UserType } from '../../../types'
+import type {
+ HogQLAutocompleteResponse,
+ HogQLMetadataResponse,
+ HogQueryResponse,
+ LogAttributesQueryResponse,
+ LogValuesQueryResponse,
+ LogsQueryResponse,
+ MetricsQueryResponse,
+ TraceSpansAggregationQueryResponse,
+ TraceSpansAttributeBreakdownQueryResponse,
+ TraceSpansQueryResponse,
+ TraceSpansTreeQueryResponse,
+} from '../../schema/schema-general'
+import type { DataNodeRegisteredProps } from './dataNodeCollectionLogic'
export interface DataNodeLogicProps {
key: string
@@ -214,6 +229,620 @@ function addTags<T extends Record<string, any>, N extends DataNode<T> | DataVisu
return result as N
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dataNodeLogicValues {
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ currentTeamId: number | null // teamLogic
+ user: UserType | null // userLogic
+ autoLoadRunning: boolean
+ autoLoadStarted: boolean
+ autoLoadToggled: boolean
+ backToSourceQuery: InsightVizNode | null
+ canLoadNewData: boolean
+ canLoadNextData: boolean
+ dataLimit: number | null
+ dataLoading: boolean
+ elapsedTime: number | null
+ filteredCount: number | null
+ filteredCountLoading: boolean
+ filteredCountQuery: DataNode | null
+ getInsightRefreshButtonDisabledReason: () => string
+ hasActiveFilters: boolean
+ hasMoreData: boolean
+ highlightedRows: Set<any>
+ isRefresh: boolean
+ isShowingCachedResults: boolean
+ lastRefresh: string | null
+ loadingStart: number | null
+ loadingTimeSeconds: number
+ newDataLoading: boolean
+ newQuery: DataNode | null
+ nextAllowedRefresh: string | null
+ nextDataLoading: boolean
+ nextQuery: DataNode | null
+ numberOfRows: number | null
+ pollResponse: Record<string, QueryStatus | null> | null
+ query: DataNode<Record<string, any>>
+ queryCancelled: boolean
+ queryId: string | null
+ queryLog: HogQLQueryResponse | null
+ queryLogLoading: boolean
+ queryLogQueryId: string | null
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ responseError: string | null
+ responseErrorObject: Record<string, any> | null
+ responseLoading: boolean
+ shouldCalculateCount: boolean
+ timings: QueryTiming[] | null
+ totalCount: number | null
+ totalCountLoading: boolean
+ totalCountQuery: DataNode | null
+ variableOverridesAreSet: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dataNodeLogicActions {
+ collectionNodeLoadData: (id: string) => {
+ id: string
+ } // dataNodeCollectionLogic
+ collectionNodeLoadDataFailure: (id: string) => {
+ id: string
+ } // dataNodeCollectionLogic
+ collectionNodeLoadDataSuccess: (id: string) => {
+ id: string
+ } // dataNodeCollectionLogic
+ mountDataNode: (
+ id: string,
+ props: DataNodeRegisteredProps
+ ) => {
+ id: string
+ props: DataNodeRegisteredProps
+ } // dataNodeCollectionLogic
+ unmountDataNode: (id: string) => {
+ id: string
+ } // dataNodeCollectionLogic
+ abortAnyRunningQuery: () => {
+ value: true
+ }
+ abortQuery: (payload: { queryId: string }) => {
+ queryId: string
+ }
+ cancelQuery: () => {
+ value: true
+ }
+ clearResponse: () => {
+ value: true
+ }
+ clearResponseFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ clearResponseSuccess: (
+ response: null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ response: null
+ payload?: {
+ value: true
+ }
+ }
+ highlightRows: (rows: any[]) => {
+ rows: any[]
+ }
+ loadData: (
+ refresh?: RefreshType,
+ alreadyRunningQueryId?: string,
+ overrideQuery?: DataNode<Record<string, any>>
+ ) => {
+ overrideQuery: DataNode<Record<string, any>> | undefined
+ pollOnly: boolean
+ queryId: string
+ refresh: RefreshType | undefined
+ }
+ loadDataFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ 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
+ }
+ ) => {
+ 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
+ }
+ }
+ loadFilteredCount: () => {
+ value: true
+ }
+ loadFilteredCountFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadFilteredCountSuccess: (
+ filteredCount: number | null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ filteredCount: number | null
+ payload?: {
+ value: true
+ }
+ }
+ loadNewData: () => any
+ loadNewDataFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadNewDataSuccess: (
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null,
+ payload?: any
+ ) => {
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ payload?: any
+ }
+ loadNextData: () => any
+ loadNextDataFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadNextDataSuccess: (
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null,
+ payload?: any
+ ) => {
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ payload?: any
+ }
+ loadQueryLog: (queryId: any) => any
+ loadQueryLogFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadQueryLogSuccess: (
+ queryLog: HogQLQueryResponse<any[]>,
+ payload?: any
+ ) => {
+ queryLog: HogQLQueryResponse<any[]>
+ payload?: any
+ }
+ loadTotalCount: () => any
+ loadTotalCountFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadTotalCountSuccess: (
+ totalCount: number | null,
+ payload?: any
+ ) => {
+ totalCount: number | null
+ payload?: any
+ }
+ resetLoadingTimer: () => {
+ value: true
+ }
+ setElapsedTime: (elapsedTime: number) => {
+ elapsedTime: number
+ }
+ setLoadingTime: (seconds: number) => {
+ seconds: number
+ }
+ setPollResponse: (status: QueryStatus | null) => {
+ status: QueryStatus | null
+ }
+ setQueryLogQueryId: (queryId: string) => {
+ queryId: string
+ }
+ setResponse: (
+ response: Exclude<AnyResponseType, undefined>
+ ) =>
+ | ErrorTrackingQueryResponse
+ | EventsQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogsQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | TraceSpansTreeQueryResponse
+ setResponseFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ setResponseSuccess: (
+ response:
+ | ErrorTrackingQueryResponse
+ | EventsQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogsQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | TraceSpansTreeQueryResponse,
+ payload?:
+ | ErrorTrackingQueryResponse
+ | EventsQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogsQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | TraceSpansTreeQueryResponse
+ ) => {
+ response:
+ | ErrorTrackingQueryResponse
+ | EventsQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogsQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | TraceSpansTreeQueryResponse
+ payload?:
+ | ErrorTrackingQueryResponse
+ | EventsQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogsQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | TraceSpansTreeQueryResponse
+ }
+ startAutoLoad: () => {
+ value: true
+ }
+ stopAutoLoad: () => {
+ value: true
+ }
+ toggleAutoLoad: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dataNodeLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ variableOverridesAreSet: (arg: any) => boolean
+ isShowingCachedResults: (arg: any, arg2: any, isRefresh: boolean) => boolean
+ query: (query: DataNode<Record<string, any>>) => DataNode<Record<string, any>>
+ newQuery: (
+ query: DataNode<Record<string, any>>,
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ ) => DataNode | null
+ canLoadNewData: (newQuery: DataNode<Record<string, any>> | null, isShowingCachedResults: boolean) => boolean
+ nextQuery: (
+ query: DataNode<Record<string, any>>,
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null,
+ responseError: string | null,
+ dataLoading: boolean,
+ isShowingCachedResults: boolean,
+ arg: any
+ ) => DataNode | null
+ canLoadNextData: (nextQuery: DataNode<Record<string, any>> | null, isShowingCachedResults: boolean) => boolean
+ hasMoreData: (
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ ) => boolean
+ dataLimit: (
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ ) => number | null
+ backToSourceQuery: (query: DataNode<Record<string, any>>) => InsightVizNode | null
+ autoLoadRunning: (autoLoadToggled: boolean, autoLoadStarted: boolean, dataLoading: boolean) => boolean
+ lastRefresh: (
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ ) => string | null
+ nextAllowedRefresh: (
+ query: DataNode<Record<string, any>>,
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ ) => string | null
+ getInsightRefreshButtonDisabledReason: (
+ nextAllowedRefresh: string | null,
+ lastRefresh: string | null
+ ) => () => string
+ timings: (
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ ) => QueryTiming[] | null
+ numberOfRows: (
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ ) => number | null
+ hasActiveFilters: (query: DataNode<Record<string, any>>) => boolean
+ totalCountQuery: (query: DataNode<Record<string, any>>) => DataNode | null
+ filteredCountQuery: (query: DataNode<Record<string, any>>, hasActiveFilters: boolean) => DataNode | null
+ }
+}
+
+export type dataNodeLogicType = MakeLogicType<
+ dataNodeLogicValues,
+ dataNodeLogicActions,
+ DataNodeLogicProps,
+ dataNodeLogicMeta
+>
+
export const dataNodeLogic = kea<dataNodeLogicType>([
path(['queries', 'nodes', 'dataNodeLogic']),
key((props) => props.key),
@@ -769,7 +1398,7 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
],
isShowingCachedResults: [
(s) => [(_, props) => props.cachedResults ?? null, (_, props) => props.query, s.isRefresh],
- (cachedResults: AnyResponseType | null, query: DataNode, isRefresh): boolean => {
+ (cachedResults: AnyResponseType | null, query: DataNode, isRefresh: boolean): boolean => {
if (isRefresh) {
return false
}
@@ -780,10 +1409,27 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
)
},
],
- query: [(_, p) => [p.query], (query) => query],
+ query: [(_, p) => [p.query], (query: DataNode<Record<string, any>>) => query],
newQuery: [
(s, p) => [p.query, s.response],
- (query, response): DataNode | null => {
+ (
+ query: DataNode<Record<string, any>>,
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLQueryResponse<any[]>
+ | Record<string, any>
+ | SessionsQueryResponse
+ | null
+ | import('~/queries/schema/schema-general').HogQLAutocompleteResponse
+ | import('~/queries/schema/schema-general').HogQLMetadataResponse
+ | 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').TraceSpansAggregationQueryResponse
+ | import('~/queries/schema/schema-general').TraceSpansAttributeBreakdownQueryResponse
+ | import('~/queries/schema/schema-general').TraceSpansQueryResponse
+ ): DataNode | null => {
if (!isEventsQuery(query)) {
return null
}
@@ -809,7 +1455,8 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
],
canLoadNewData: [
(s) => [s.newQuery, s.isShowingCachedResults],
- (newQuery, isShowingCachedResults) => (isShowingCachedResults ? false : !!newQuery),
+ (newQuery: DataNode | null, isShowingCachedResults: boolean) =>
+ isShowingCachedResults ? false : !!newQuery,
],
nextQuery: [
(s, p) => [
@@ -821,11 +1468,25 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
(_, props) => props.maxPaginationLimit,
],
(
- query,
- response,
- responseError,
- dataLoading,
- isShowingCachedResults,
+ query: DataNode<Record<string, any>>,
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLQueryResponse<any[]>
+ | Record<string, any>
+ | SessionsQueryResponse
+ | null
+ | import('~/queries/schema/schema-general').HogQLAutocompleteResponse
+ | import('~/queries/schema/schema-general').HogQLMetadataResponse
+ | 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').TraceSpansAggregationQueryResponse
+ | import('~/queries/schema/schema-general').TraceSpansAttributeBreakdownQueryResponse
+ | import('~/queries/schema/schema-general').TraceSpansQueryResponse,
+ responseError: string | null,
+ dataLoading: boolean,
+ isShowingCachedResults: boolean,
maxPaginationLimit
): DataNode | null => {
if (isShowingCachedResults) {
@@ -934,24 +1595,57 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
],
canLoadNextData: [
(s) => [s.nextQuery, s.isShowingCachedResults],
- (nextQuery, isShowingCachedResults) => (isShowingCachedResults ? false : !!nextQuery),
+ (nextQuery: DataNode | null, isShowingCachedResults: boolean) =>
+ isShowingCachedResults ? false : !!nextQuery,
],
hasMoreData: [
(s) => [s.response],
- (response): boolean => {
+ (
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLQueryResponse<any[]>
+ | Record<string, any>
+ | SessionsQueryResponse
+ | null
+ | import('~/queries/schema/schema-general').HogQLAutocompleteResponse
+ | import('~/queries/schema/schema-general').HogQLMetadataResponse
+ | 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').TraceSpansAggregationQueryResponse
+ | import('~/queries/schema/schema-general').TraceSpansAttributeBreakdownQueryResponse
+ | import('~/queries/schema/schema-general').TraceSpansQueryResponse
+ ): boolean => {
return response && 'hasMore' in response && response.hasMore
},
],
dataLimit: [
// get limit from response
(s) => [s.response],
- (response): number | null => {
+ (
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLQueryResponse<any[]>
+ | Record<string, any>
+ | SessionsQueryResponse
+ | null
+ | import('~/queries/schema/schema-general').HogQLAutocompleteResponse
+ | import('~/queries/schema/schema-general').HogQLMetadataResponse
+ | 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').TraceSpansAggregationQueryResponse
+ | import('~/queries/schema/schema-general').TraceSpansAttributeBreakdownQueryResponse
+ | import('~/queries/schema/schema-general').TraceSpansQueryResponse
+ ): number | null => {
return response && 'limit' in response ? (response.limit ?? null) : null
},
],
backToSourceQuery: [
(s) => [s.query],
- (query): InsightVizNode | null => {
+ (query: DataNode<Record<string, any>>): InsightVizNode | null => {
const insightSource =
(isActorsQuery(query) && isInsightActorsQuery(query.source) ? query.source.source : null) ??
(isEventsQuery(query) && isInsightActorsQuery(query.source) ? query.source.source : null)
@@ -968,17 +1662,51 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
],
autoLoadRunning: [
(s) => [s.autoLoadToggled, s.autoLoadStarted, s.dataLoading],
- (autoLoadToggled, autoLoadStarted, dataLoading) => autoLoadToggled && autoLoadStarted && !dataLoading,
+ (autoLoadToggled: boolean, autoLoadStarted: boolean, dataLoading: boolean) =>
+ autoLoadToggled && autoLoadStarted && !dataLoading,
],
lastRefresh: [
(s) => [s.response],
- (response): string | null => {
+ (
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLQueryResponse<any[]>
+ | Record<string, any>
+ | SessionsQueryResponse
+ | null
+ | import('~/queries/schema/schema-general').HogQLAutocompleteResponse
+ | import('~/queries/schema/schema-general').HogQLMetadataResponse
+ | 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').TraceSpansAggregationQueryResponse
+ | import('~/queries/schema/schema-general').TraceSpansAttributeBreakdownQueryResponse
+ | import('~/queries/schema/schema-general').TraceSpansQueryResponse
+ ): string | null => {
return response && 'last_refresh' in response ? response.last_refresh : null
},
],
nextAllowedRefresh: [
(s, p) => [p.query, s.response],
- (query, response): string | null => {
+ (
+ query: DataNode<Record<string, any>>,
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLQueryResponse<any[]>
+ | Record<string, any>
+ | SessionsQueryResponse
+ | null
+ | import('~/queries/schema/schema-general').HogQLAutocompleteResponse
+ | import('~/queries/schema/schema-general').HogQLMetadataResponse
+ | 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').TraceSpansAggregationQueryResponse
+ | import('~/queries/schema/schema-general').TraceSpansAttributeBreakdownQueryResponse
+ | import('~/queries/schema/schema-general').TraceSpansQueryResponse
+ ): string | null => {
return isInsightQueryNode(query) && response && 'next_allowed_client_refresh' in response
? response.next_allowed_client_refresh
: null
@@ -1012,13 +1740,45 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
],
timings: [
(s) => [s.response],
- (response): QueryTiming[] | null => {
+ (
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLQueryResponse<any[]>
+ | Record<string, any>
+ | SessionsQueryResponse
+ | null
+ | import('~/queries/schema/schema-general').HogQLAutocompleteResponse
+ | import('~/queries/schema/schema-general').HogQLMetadataResponse
+ | 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').TraceSpansAggregationQueryResponse
+ | import('~/queries/schema/schema-general').TraceSpansAttributeBreakdownQueryResponse
+ | import('~/queries/schema/schema-general').TraceSpansQueryResponse
+ ): QueryTiming[] | null => {
return response && 'timings' in response ? response.timings : null
},
],
numberOfRows: [
(s) => [s.response],
- (response): number | null => {
+ (
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLQueryResponse<any[]>
+ | Record<string, any>
+ | SessionsQueryResponse
+ | null
+ | import('~/queries/schema/schema-general').HogQLAutocompleteResponse
+ | import('~/queries/schema/schema-general').HogQLMetadataResponse
+ | 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').TraceSpansAggregationQueryResponse
+ | import('~/queries/schema/schema-general').TraceSpansAttributeBreakdownQueryResponse
+ | import('~/queries/schema/schema-general').TraceSpansQueryResponse
+ ): number | null => {
if (!response) {
return null
}
diff --git a/frontend/src/queries/nodes/DataTable/ColumnConfigurator/columnConfiguratorLogic.tsx b/frontend/src/queries/nodes/DataTable/ColumnConfigurator/columnConfiguratorLogic.tsx
index 43e6419c5e55..1a6f99ffd3f8 100644
--- a/frontend/src/queries/nodes/DataTable/ColumnConfigurator/columnConfiguratorLogic.tsx
+++ b/frontend/src/queries/nodes/DataTable/ColumnConfigurator/columnConfiguratorLogic.tsx
@@ -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'
@@ -10,8 +23,6 @@ import { groupsModel } from '~/models/groupsModel'
import { HOGQL_COLUMNS_KEY } from '~/queries/nodes/DataTable/defaultEventsQuery'
import { GroupTypeIndex } from '~/types'
-import type { columnConfiguratorLogicType } from './columnConfiguratorLogicType'
-
export interface ColumnConfiguratorLogicProps {
key: string
columns: string[]
@@ -26,6 +37,102 @@ export interface ColumnConfiguratorLogicProps {
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface columnConfiguratorLogicValues {
+ columns: string[]
+ context: {
+ eventDefinitionId?: string | undefined
+ groupTypeIndex?: GroupTypeIndex | undefined
+ type: 'event_definition' | 'groups' | 'team_columns'
+ }
+ modalVisible: boolean
+ saveAsDefault: boolean
+ savedColumnConfiguration: {
+ columns: string[]
+ id: string
+ } | null
+ savedColumnConfigurationLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface columnConfiguratorLogicActions {
+ reportDataTableColumnsUpdated: (context_type: string) => {
+ context_type: string
+ } // eventUsageLogic
+ setDefaultColumns: (args_0: { defaultColumns: string[]; groupTypeIndex: number }) => {
+ defaultColumns: string[]
+ groupTypeIndex: number
+ } // groupsModel
+ hideModal: () => {
+ value: true
+ }
+ loadSavedColumnConfiguration: () => any
+ loadSavedColumnConfigurationFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSavedColumnConfigurationSuccess: (
+ savedColumnConfiguration: {
+ columns: string[]
+ id: string
+ } | null,
+ payload?: any
+ ) => {
+ savedColumnConfiguration: {
+ columns: string[]
+ id: string
+ } | null
+ payload?: any
+ }
+ moveColumn: (
+ oldIndex: number,
+ newIndex: number
+ ) => {
+ newIndex: number
+ oldIndex: number
+ }
+ save: () => {
+ value: true
+ }
+ selectColumn: (column: string) => {
+ column: string
+ }
+ setColumns: (columns: string[]) => {
+ columns: string[]
+ }
+ showModal: () => {
+ value: true
+ }
+ toggleSaveAsDefault: () => {
+ value: true
+ }
+ unselectColumn: (column: string) => {
+ column: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface columnConfiguratorLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ context: (arg: any) => {
+ eventDefinitionId?: string | undefined
+ groupTypeIndex?: GroupTypeIndex | undefined
+ type: 'event_definition' | 'groups' | 'team_columns'
+ }
+ }
+}
+
+export type columnConfiguratorLogicType = MakeLogicType<
+ columnConfiguratorLogicValues,
+ columnConfiguratorLogicActions,
+ ColumnConfiguratorLogicProps,
+ columnConfiguratorLogicMeta
+>
+
export const columnConfiguratorLogic = kea<columnConfiguratorLogicType>([
props({} as ColumnConfiguratorLogicProps),
path(['queries', 'nodes', 'DataTable', 'columnConfiguratorLogic']),
diff --git a/frontend/src/queries/nodes/DataTable/TableView/tableViewLogic.ts b/frontend/src/queries/nodes/DataTable/TableView/tableViewLogic.ts
index c4dbc65c6607..4d81c3d14285 100644
--- a/frontend/src/queries/nodes/DataTable/TableView/tableViewLogic.ts
+++ b/frontend/src/queries/nodes/DataTable/TableView/tableViewLogic.ts
@@ -1,6 +1,7 @@
import { deepEqual as equal } from 'fast-equals'
-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 { lazyLoaders } from 'kea-loaders'
import posthog from 'posthog-js'
@@ -19,7 +20,7 @@ import { AnyPropertyFilter, PropertyOperator } from '~/types'
import { ColumnConfigurationApi } from 'products/product_analytics/frontend/generated/api.schemas'
-import type { tableViewLogicType } from './tableViewLogicType'
+import type { UserType } from '../../../../types'
export type TableViewSupportedQueryType = ActorsQuery | GroupsQuery | EventsQuery
@@ -123,6 +124,225 @@ function getQueryFromView(
} as EventsQuery
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tableViewLogicValues {
+ user: UserType | null // userLogic
+ canEditCurrentView: boolean
+ currentView: ColumnConfigurationApi | null
+ hasUnsavedChanges: boolean
+ isCreating: boolean
+ isNewViewFormSubmitting: boolean
+ isNewViewFormValid: boolean
+ newViewForm: {
+ name: string
+ visibility: 'private' | 'shared'
+ }
+ newViewFormAllErrors: Record<string, any>
+ newViewFormChanged: boolean
+ newViewFormErrors: DeepPartialMap<
+ {
+ name: string
+ visibility: 'private' | 'shared'
+ },
+ ValidationErrorType
+ >
+ newViewFormHasErrors: boolean
+ newViewFormManualErrors: Record<string, any>
+ newViewFormTouched: boolean
+ newViewFormTouches: Record<string, boolean>
+ newViewFormValidationErrors: DeepPartialMap<
+ {
+ name: string
+ visibility: 'private' | 'shared'
+ },
+ ValidationErrorType
+ >
+ showDeleteConfirm: string | null
+ showNewViewFormErrors: boolean
+ views: ColumnConfigurationApi[]
+ viewsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tableViewLogicActions {
+ applyView: (view: ColumnConfigurationApi) => {
+ view: ColumnConfigurationApi
+ }
+ deleteView: (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: () => {
+ value: true
+ }
+ loadViewsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadViewsSuccess: (
+ views: ColumnConfigurationApi[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ views: ColumnConfigurationApi[]
+ payload?: {
+ value: true
+ }
+ }
+ resetNewViewForm: (values?: { name: string; visibility: 'private' | 'shared' }) => {
+ values?: {
+ name: string
+ visibility: 'private' | 'shared'
+ }
+ }
+ saveCurrentAsView: (
+ name: string,
+ visibility: 'private' | 'shared'
+ ) => {
+ name: string
+ visibility: 'private' | 'shared'
+ }
+ saveCurrentAsViewFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ saveCurrentAsViewSuccess: (
+ views: ColumnConfigurationApi[],
+ payload?: {
+ name: string
+ visibility: 'private' | 'shared'
+ }
+ ) => {
+ views: ColumnConfigurationApi[]
+ payload?: {
+ name: string
+ visibility: 'private' | 'shared'
+ }
+ }
+ setCurrentView: (view: ColumnConfigurationApi | null) => {
+ view: ColumnConfigurationApi | 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: 'private' | 'shared'
+ }>
+ ) => {
+ values: DeepPartial<{
+ name: string
+ visibility: 'private' | 'shared'
+ }>
+ }
+ setShowDeleteConfirm: (viewId: string | null) => {
+ viewId: string | null
+ }
+ submitNewViewForm: () => {
+ value: boolean
+ }
+ submitNewViewFormFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitNewViewFormRequest: (newViewForm: { name: string; visibility: 'private' | 'shared' }) => {
+ newViewForm: {
+ name: string
+ visibility: 'private' | 'shared'
+ }
+ }
+ submitNewViewFormSuccess: (newViewForm: { name: string; visibility: 'private' | 'shared' }) => {
+ newViewForm: {
+ name: string
+ visibility: 'private' | 'shared'
+ }
+ }
+ touchNewViewFormField: (key: string) => {
+ key: string
+ }
+ updateView: (
+ 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 tableViewLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ hasUnsavedChanges: (currentView: ColumnConfigurationApi | null, arg: any) => boolean
+ canEditCurrentView: (currentView: ColumnConfigurationApi | null, user: UserType | null) => boolean
+ }
+}
+
+export type tableViewLogicType = MakeLogicType<
+ tableViewLogicValues,
+ tableViewLogicActions,
+ TableViewLogicProps,
+ tableViewLogicMeta
+>
+
export const tableViewLogic = kea<tableViewLogicType>([
props({} as TableViewLogicProps),
// Include the team id so a team switch yields a fresh logic instance
@@ -230,7 +450,7 @@ export const tableViewLogic = kea<tableViewLogicType>([
selectors(() => ({
hasUnsavedChanges: [
(s) => [s.currentView, (_, props) => props.query],
- (currentView, query): boolean => {
+ (currentView: ColumnConfigurationApi | null, query): boolean => {
if (!currentView) {
return false
}
@@ -240,7 +460,7 @@ export const tableViewLogic = kea<tableViewLogicType>([
],
canEditCurrentView: [
(s) => [s.currentView, s.user],
- (currentView, user): boolean => {
+ (currentView: ColumnConfigurationApi | null, user: null | import('~/types').UserType): boolean => {
if (!currentView || !user) {
return false
}
diff --git a/frontend/src/queries/nodes/DataTable/dataTableLogic.ts b/frontend/src/queries/nodes/DataTable/dataTableLogic.ts
index 2ca3daa9fa4e..7da2acbaf5f9 100644
--- a/frontend/src/queries/nodes/DataTable/dataTableLogic.ts
+++ b/frontend/src/queries/nodes/DataTable/dataTableLogic.ts
@@ -1,4 +1,16 @@
-import { actions, connect, kea, key, listeners, path, props, propsChanged, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ connect,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ propsChanged,
+ reducers,
+ selectors,
+} from 'kea'
import { FEATURE_FLAGS } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
@@ -22,7 +34,22 @@ import {
import { QueryContext } from '~/queries/types'
import { isDataTableNode, isEventsQuery } from '~/queries/utils'
-import type { dataTableLogicType } from './dataTableLogicType'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { TeamPublicType, TeamType } from '../../../types'
+import type {
+ ErrorTrackingQueryResponse,
+ HogQLAutocompleteResponse,
+ HogQLMetadataResponse,
+ HogQLQueryResponse,
+ HogQueryResponse,
+ LogAttributesQueryResponse,
+ LogValuesQueryResponse,
+ MetricsQueryResponse,
+ SessionsQueryResponse,
+ TraceSpansAggregationQueryResponse,
+ TraceSpansAttributeBreakdownQueryResponse,
+ TraceSpansQueryResponse,
+} from '../../schema/schema-general'
import { getColumnsForQuery, removeExpressionComment } from './utils'
export interface DataTableLogicProps {
@@ -44,6 +71,133 @@ export interface DataTableRow {
export const loadingColumn = Symbol('...')
export const errorColumn = Symbol('Error!')
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dataTableLogicValues {
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null // dataNodeLogic
+ responseError: string | null // dataNodeLogic
+ responseLoading: boolean // dataNodeLogic
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ expandedRowsFor: (tabId: string | undefined, vizKey: string) => number[] // tabUiStateLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ canSort: boolean
+ columnsInQuery: string[]
+ columnsInResponse: string[] | null
+ context: any
+ dataTableRows: DataTableRow[] | null
+ expandedRows: number[]
+ orderBy: string[] | null
+ queryWithDefaults: RequiredExcept<
+ Omit<DataTableNode, 'response'>,
+ 'contextKey' | 'defaultColumns' | 'tags' | 'version'
+ >
+ sourceFeatures: Set<QueryFeature>
+ sourceKind: NodeKind | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dataTableLogicActions {
+ toggleExpandedRow: (
+ tabId: string | undefined,
+ vizKey: string,
+ rowIndex: number
+ ) => {
+ rowIndex: number
+ tabId: string
+ vizKey: string
+ } // tabUiStateLogic
+ setColumnsInQuery: (columns: HogQLExpression[]) => {
+ columns: string[]
+ }
+ toggleRowExpanded: (rowIndex: number) => {
+ rowIndex: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dataTableLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ context: (arg: any) => any
+ expandedRows: (expandedRowsFor: (tabId: string | undefined, vizKey: string) => number[], arg: any) => number[]
+ sourceKind: (query: DataTableNode) => NodeKind | null
+ sourceFeatures: (query: DataTableNode, arg: any) => Set<QueryFeature>
+ orderBy: (query: DataTableNode, sourceFeatures: Set<QueryFeature>) => string[] | null
+ columnsInResponse: (
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ ) => string[] | null
+ dataTableRows: (
+ sourceKind: NodeKind | null,
+ orderBy: string[] | null,
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null,
+ columnsInResponse: string[] | null,
+ arg: any,
+ currentTeam: TeamPublicType | TeamType | null
+ ) => DataTableRow[] | null
+ queryWithDefaults: (
+ query: DataTableNode,
+ columnsInQuery: string[],
+ featureFlags: FeatureFlagsSet,
+ arg: any
+ ) => RequiredExcept<Omit<DataTableNode, 'response'>, 'contextKey' | 'defaultColumns' | 'tags' | 'version'>
+ canSort: (
+ queryWithDefaults: RequiredExcept<
+ Omit<DataTableNode, 'response'>,
+ 'contextKey' | 'defaultColumns' | 'tags' | 'version'
+ >,
+ sourceFeatures: Set<QueryFeature>
+ ) => boolean
+ }
+}
+
+export type dataTableLogicType = MakeLogicType<
+ dataTableLogicValues,
+ dataTableLogicActions,
+ DataTableLogicProps,
+ dataTableLogicMeta
+>
+
export const dataTableLogic = kea<dataTableLogicType>([
props({} as DataTableLogicProps),
key((props) => {
@@ -97,10 +251,10 @@ export const dataTableLogic = kea<dataTableLogicType>([
expandedRowsFor(undefined, vizKey),
{ resultEqualityCheck: objectsEqual },
],
- sourceKind: [(_, p) => [p.query], (query): NodeKind | null => query.source?.kind],
+ sourceKind: [(_, p) => [p.query], (query: DataTableNode): NodeKind | null => query.source?.kind],
sourceFeatures: [
(_, p) => [p.query, (_, props) => props.context],
- (query, context): Set<QueryFeature> => {
+ (query: DataTableNode, context): Set<QueryFeature> => {
const sourceFeatures = getQueryFeatures(query.source)
if (context?.extraDataTableQueryFeatures) {
for (const feature of context.extraDataTableQueryFeatures) {
@@ -112,7 +266,7 @@ export const dataTableLogic = kea<dataTableLogicType>([
],
orderBy: [
(s, p) => [p.query, s.sourceFeatures],
- (query, sourceFeatures): string[] | null =>
+ (query: DataTableNode, sourceFeatures: Set<QueryFeature>): string[] | null =>
sourceFeatures.has(QueryFeature.selectAndOrderByColumns)
? 'orderBy' in query.source // might not be EventsQuery, but something else with orderBy
? ((query.source as EventsQuery).orderBy ?? null)
@@ -214,8 +368,8 @@ export const dataTableLogic = kea<dataTableLogicType>([
(s, p) => [p.query, s.columnsInQuery, s.featureFlags, (_, props) => props.context],
(
query: DataTableNode,
- columnsInQuery,
- featureFlags,
+ columnsInQuery: string[],
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet,
context
): RequiredExcept<
Omit<DataTableNode, 'response'>,
@@ -276,7 +430,7 @@ export const dataTableLogic = kea<dataTableLogicType>([
],
canSort: [
(s) => [s.queryWithDefaults, s.sourceFeatures],
- (query: DataTableNode, sourceFeatures): boolean =>
+ (query: DataTableNode, sourceFeatures: Set<QueryFeature>): boolean =>
sourceFeatures.has(QueryFeature.selectAndOrderByColumns) && !!query.allowSorting,
],
}),
diff --git a/frontend/src/queries/nodes/DataTable/dataTableSavedFiltersLogic.ts b/frontend/src/queries/nodes/DataTable/dataTableSavedFiltersLogic.ts
index 53974ec60211..a52d9374e611 100644
--- a/frontend/src/queries/nodes/DataTable/dataTableSavedFiltersLogic.ts
+++ b/frontend/src/queries/nodes/DataTable/dataTableSavedFiltersLogic.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 { router } from 'kea-router'
import { v4 as uuidv4 } from 'uuid'
@@ -6,8 +6,6 @@ import { getCurrentTeamId } from 'lib/utils/getAppContext'
import { DataTableNode } from '~/queries/schema/schema-general'
-import type { dataTableSavedFiltersLogicType } from './dataTableSavedFiltersLogicType'
-
export interface DataTableSavedFilter {
id: string
name: string
@@ -25,6 +23,61 @@ export interface DataTableSavedFiltersLogicProps {
// Scope by team so saved filters don't leak across projects (e.g. after impersonation).
const getStorageKey = (uniqueKey: string, teamId: number): string => `datatable-saved-filters.${teamId}.${uniqueKey}`
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dataTableSavedFiltersLogicValues {
+ appliedSavedFilter: DataTableSavedFilter | null
+ hasUnsavedFilterChanges: boolean
+ savedFilters: DataTableSavedFilter[]
+ showSavedFilters: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dataTableSavedFiltersLogicActions {
+ applySavedFilter: (filter: DataTableSavedFilter) => {
+ filter: DataTableSavedFilter
+ }
+ createSavedFilter: (name: string) => {
+ name: string
+ }
+ deleteSavedFilter: (id: string) => {
+ id: string
+ }
+ loadSavedFilterFromUrl: () => {
+ value: true
+ }
+ setAppliedSavedFilter: (filter: DataTableSavedFilter | null) => {
+ filter: DataTableSavedFilter | null
+ }
+ setShowSavedFilters: (show: boolean) => {
+ show: boolean
+ }
+ updateSavedFilter: (
+ id: string,
+ updates: Partial<DataTableSavedFilter>
+ ) => {
+ id: string
+ updates: Partial<DataTableSavedFilter>
+ }
+ updateUrlWithSavedFilter: (filterId: string | null) => {
+ filterId: string | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dataTableSavedFiltersLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ hasUnsavedFilterChanges: (appliedSavedFilter: DataTableSavedFilter | null, arg: any) => boolean
+ }
+}
+
+export type dataTableSavedFiltersLogicType = MakeLogicType<
+ dataTableSavedFiltersLogicValues,
+ dataTableSavedFiltersLogicActions,
+ DataTableSavedFiltersLogicProps,
+ dataTableSavedFiltersLogicMeta
+>
+
export const dataTableSavedFiltersLogic = kea<dataTableSavedFiltersLogicType>([
props({} as DataTableSavedFiltersLogicProps),
// Include the team id so a team switch yields a fresh logic instance
@@ -148,7 +201,7 @@ export const dataTableSavedFiltersLogic = kea<dataTableSavedFiltersLogicType>([
selectors(() => ({
hasUnsavedFilterChanges: [
(s) => [s.appliedSavedFilter, (_, props) => props.query],
- (appliedSavedFilter, currentQuery): boolean => {
+ (appliedSavedFilter: DataTableSavedFilter | null, currentQuery): boolean => {
if (!appliedSavedFilter) {
return false
}
diff --git a/frontend/src/queries/nodes/DataTable/insightActorsQueryOptionsLogic.ts b/frontend/src/queries/nodes/DataTable/insightActorsQueryOptionsLogic.ts
index ecd18b1eb550..c7dc1e50ab86 100644
--- a/frontend/src/queries/nodes/DataTable/insightActorsQueryOptionsLogic.ts
+++ b/frontend/src/queries/nodes/DataTable/insightActorsQueryOptionsLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, kea, path, props, propsChanged } from 'kea'
+import { MakeLogicType, actions, afterMount, kea, path, props, propsChanged } from 'kea'
import { loaders } from 'kea-loaders'
import { performQuery } from '~/queries/query'
@@ -10,7 +10,48 @@ import {
} from '~/queries/schema/schema-general'
import { isInsightActorsQuery, setLatestVersionsOnQuery } from '~/queries/utils'
-import type { insightActorsQueryOptionsLogicType } from './insightActorsQueryOptionsLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightActorsQueryOptionsLogicValues {
+ insightActorsQueryOptions: InsightActorsQueryOptionsResponse | null
+ insightActorsQueryOptionsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightActorsQueryOptionsLogicActions {
+ load: () => {
+ value: true
+ }
+ loadFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSuccess: (
+ insightActorsQueryOptions: InsightActorsQueryOptionsResponse | null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ insightActorsQueryOptions: InsightActorsQueryOptionsResponse | null
+ payload?: {
+ value: true
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightActorsQueryOptionsLogicProps {
+ key: string
+ query: InsightActorsQuery
+}
+
+export type insightActorsQueryOptionsLogicType = MakeLogicType<
+ insightActorsQueryOptionsLogicValues,
+ insightActorsQueryOptionsLogicActions,
+ insightActorsQueryOptionsLogicProps
+>
export const insightActorsQueryOptionsLogic = kea<insightActorsQueryOptionsLogicType>([
path(['queries', 'nodes', 'DataTable', 'sourceQueryOptionsLogic']),
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Charts/lineGraphLogic.ts b/frontend/src/queries/nodes/DataVisualization/Components/Charts/lineGraphLogic.ts
index 89d85fce15cd..685d9cfac866 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Charts/lineGraphLogic.ts
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Charts/lineGraphLogic.ts
@@ -1,11 +1,33 @@
-import { actions, kea, key, path, props, reducers } from 'kea'
-
-import type { lineGraphLogicType } from './lineGraphLogicType'
+import { MakeLogicType, actions, kea, key, path, props, reducers } from 'kea'
export interface LineGraphLogicProps {
key: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface lineGraphLogicValues {
+ hoveredDatasetIndex: number | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface lineGraphLogicActions {
+ setHoveredDatasetIndex: (hoveredDatasetIndex: number | null) => {
+ hoveredDatasetIndex: number | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface lineGraphLogicMeta {
+ key: string
+}
+
+export type lineGraphLogicType = MakeLogicType<
+ lineGraphLogicValues,
+ lineGraphLogicActions,
+ LineGraphLogicProps,
+ lineGraphLogicMeta
+>
+
export const lineGraphLogic = kea<lineGraphLogicType>([
path(['queries', 'nodes', 'DataVisualization', 'Components', 'Charts', 'lineGraphLogic']),
props({ key: '' } as LineGraphLogicProps),
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/ConditionalFormatting/conditionalFormattingLogic.ts b/frontend/src/queries/nodes/DataVisualization/Components/ConditionalFormatting/conditionalFormattingLogic.ts
index 19b30633b632..3d6f62df7d8f 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/ConditionalFormatting/conditionalFormattingLogic.ts
+++ b/frontend/src/queries/nodes/DataVisualization/Components/ConditionalFormatting/conditionalFormattingLogic.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 { loaders } from 'kea-loaders'
import { subscriptions } from 'kea-subscriptions'
@@ -8,13 +8,80 @@ import { ConditionalFormattingRule } from '~/queries/schema/schema-general'
import { dataVisualizationLogic } from '../../dataVisualizationLogic'
import { FORMATTING_TEMPLATES, FormattingTemplate } from '../../types'
-import type { conditionalFormattingLogicType } from './conditionalFormattingLogicType'
export interface ConditionalFormattingLogicProps {
rule: ConditionalFormattingRule
key: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface conditionalFormattingLogicValues {
+ hog: any[] | null
+ hogLoading: boolean
+ rule: ConditionalFormattingRule
+ template: FormattingTemplate
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface conditionalFormattingLogicActions {
+ updateConditionalFormattingRule: (
+ rule: ConditionalFormattingRule,
+ deleteRule?: boolean | undefined
+ ) => {
+ colorMode: string
+ deleteRule: boolean | undefined
+ rule: ConditionalFormattingRule
+ } // dataVisualizationLogic
+ compileHog: ({ hog }: any) => any
+ compileHogFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ compileHogSuccess: (
+ hog: any[],
+ payload?: any
+ ) => {
+ hog: any[]
+ payload?: any
+ }
+ deleteRule: () => {
+ value: true
+ }
+ selectColor: (color: string) => {
+ color: string
+ }
+ selectColumn: (columnName: string) => {
+ columnName: string
+ }
+ selectTemplate: (templateId: string) => {
+ templateId: string
+ }
+ updateBytecode: (bytecode: any[]) => {
+ bytecode: any[]
+ }
+ updateInput: (input: string) => {
+ input: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface conditionalFormattingLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ template: (rule: ConditionalFormattingRule) => FormattingTemplate
+ }
+}
+
+export type conditionalFormattingLogicType = MakeLogicType<
+ conditionalFormattingLogicValues,
+ conditionalFormattingLogicActions,
+ ConditionalFormattingLogicProps,
+ conditionalFormattingLogicMeta
+>
+
export const conditionalFormattingLogic = kea<conditionalFormattingLogicType>([
key((props) => props.rule.id),
path(['queries', 'nodes', 'DataVisualization', 'Components', 'conditionalFormattingLogic']),
@@ -55,7 +122,7 @@ export const conditionalFormattingLogic = kea<conditionalFormattingLogicType>([
selectors({
template: [
(s) => [s.rule],
- (rule): FormattingTemplate => {
+ (rule: ConditionalFormattingRule): FormattingTemplate => {
const template = FORMATTING_TEMPLATES.find((n) => n.id === rule.templateId)
if (!template) {
return FORMATTING_TEMPLATES[0]
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Variables/variableDataLogic.ts b/frontend/src/queries/nodes/DataVisualization/Components/Variables/variableDataLogic.ts
index ec531104e999..290a5791f84d 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Variables/variableDataLogic.ts
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Variables/variableDataLogic.ts
@@ -1,4 +1,4 @@
-import { afterMount, kea, path } from 'kea'
+import { MakeLogicType, afterMount, kea, path } from 'kea'
import { loaders } from 'kea-loaders'
import { lemonToast } from '@posthog/lemon-ui'
@@ -8,7 +8,48 @@ import api from 'lib/api'
import { isSharedView } from '~/exporter/exporterViewLogic'
import { Variable } from '../../types'
-import type { variableDataLogicType } from './variableDataLogicType'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface variableDataLogicValues {
+ variables: Variable[]
+ variablesLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface variableDataLogicActions {
+ deleteVariable: (variableId: string) => string
+ deleteVariableFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deleteVariableSuccess: (
+ variables: Variable[],
+ payload?: string
+ ) => {
+ variables: Variable[]
+ payload?: string
+ }
+ loadVariables: () => any
+ loadVariablesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadVariablesSuccess: (
+ variables: Variable[],
+ payload?: any
+ ) => {
+ variables: Variable[]
+ payload?: any
+ }
+}
+
+export type variableDataLogicType = MakeLogicType<variableDataLogicValues, variableDataLogicActions>
export const variableDataLogic = kea<variableDataLogicType>([
path(['queries', 'nodes', 'DataVisualization', 'Components', 'Variables', 'variableDataLogic']),
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Variables/variableModalLogic.ts b/frontend/src/queries/nodes/DataVisualization/Components/Variables/variableModalLogic.ts
index 3882dee877c0..210edc500ed5 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Variables/variableModalLogic.ts
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Variables/variableModalLogic.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 { lemonToast } from '@posthog/lemon-ui'
@@ -9,6 +9,7 @@ import { teamLogic } from 'scenes/teamLogic'
import { QueryBasedInsightModel } from '~/types'
+import type { HogQLVariable, Node } from '../../../../schema/schema-general'
import {
BooleanVariable,
DateVariable,
@@ -19,7 +20,6 @@ import {
VariableType,
} from '../../types'
import { variableDataLogic } from './variableDataLogic'
-import type { variableModalLogicType } from './variableModalLogicType'
import { variablesLogic } from './variablesLogic'
const DEFAULT_VARIABLE: StringVariable = {
@@ -89,6 +89,71 @@ const getDefaultVariableForType = (variableType: VariableType): Variable => {
throw new Error(`Unsupported variable type ${variableType}`)
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface variableModalLogicValues {
+ currentTeamId: number | null // teamLogic
+ insightsLoading: boolean
+ insightsUsingVariable: QueryBasedInsightModel[]
+ isModalOpen: boolean
+ isSaving: boolean
+ modalType: 'existing' | 'new'
+ variable: Variable
+ variableType: VariableType
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface variableModalLogicActions {
+ loadVariables: () => any // variableDataLogic
+ addVariable: (variable: HogQLVariable) => {
+ variable: HogQLVariable
+ } // variablesLogic
+ updateInternalSelectedVariable: (variable: HogQLVariable) => {
+ variable: HogQLVariable
+ } // variablesLogic
+ changeTypeExistingVariable: (variableType: VariableType) => {
+ variableType: VariableType
+ }
+ closeModal: () => {
+ value: true
+ }
+ openExistingVariableModal: (variable: Variable) => {
+ variable: Variable
+ }
+ openNewVariableModal: (variableType: VariableType) => {
+ variableType: VariableType
+ }
+ save: () => {
+ value: true
+ }
+ saveFailure: () => {
+ value: true
+ }
+ saveSuccess: () => {
+ value: true
+ }
+ setInsightsLoading: (loading: boolean) => {
+ loading: boolean
+ }
+ setInsightsUsingVariable: (insights: QueryBasedInsightModel[]) => {
+ insights: QueryBasedInsightModel<Node<Record<string, any>>>[]
+ }
+ updateVariable: (variable: Variable) => {
+ variable: Variable
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface variableModalLogicMeta {
+ key: string
+}
+
+export type variableModalLogicType = MakeLogicType<
+ variableModalLogicValues,
+ variableModalLogicActions,
+ AddVariableLogicProps,
+ variableModalLogicMeta
+>
+
export const variableModalLogic = kea<variableModalLogicType>([
path(['queries', 'nodes', 'DataVisualization', 'Components', 'Variables', 'variableLogic']),
props({ key: '' } as AddVariableLogicProps),
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Variables/variablesLogic.ts b/frontend/src/queries/nodes/DataVisualization/Components/Variables/variablesLogic.ts
index a325e0f40dbb..113e82b492f3 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Variables/variablesLogic.ts
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Variables/variablesLogic.ts
@@ -1,4 +1,16 @@
-import { actions, connect, kea, key, listeners, path, props, propsChanged, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ connect,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ propsChanged,
+ reducers,
+ selectors,
+} from 'kea'
import { subscriptions } from 'kea-subscriptions'
import { objectsEqual } from 'lib/utils/objects'
@@ -11,10 +23,10 @@ import {
import { DataVisualizationNode, HogQLVariable } from '~/queries/schema/schema-general'
import { DashboardType } from '~/types'
+import type { DataNode, RefreshType } from '../../../../schema/schema-general'
import { dataVisualizationLogic } from '../../dataVisualizationLogic'
import { Variable, VariableType } from '../../types'
import { variableDataLogic } from './variableDataLogic'
-import type { variablesLogicType } from './variablesLogicType'
export interface VariablesLogicProps {
key: string
@@ -40,6 +52,131 @@ const convertValueToCorrectType = (value: string, type: VariableType): number |
return value
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface variablesLogicValues {
+ query: DataVisualizationNode // dataVisualizationLogic
+ variables: Variable[] // variableDataLogic
+ variablesLoading: boolean // variableDataLogic
+ editorQuery: string | null
+ filteredVariables: (Variable & {
+ selected: boolean
+ })[]
+ internalSelectedVariables: HogQLVariable[]
+ queryVariableCodeNames: string[]
+ searchTerm: string
+ showVariablesBar: boolean
+ variablesForInsight: Variable[]
+ variablesNotInQuery: Variable[]
+ variablesUsedInQuery: Variable[]
+ variablesWithValues: Variable[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface variablesLogicActions {
+ 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
+ } // dataVisualizationLogic
+ setQuery: (setter: (node: DataVisualizationNode) => DataVisualizationNode) => {
+ setter: (node: DataVisualizationNode) => DataVisualizationNode
+ } // dataVisualizationLogic
+ loadVariables: () => any // variableDataLogic
+ _addVariable: (variable: HogQLVariable) => {
+ variable: HogQLVariable
+ }
+ _removeVariable: (variableId: string) => {
+ variableId: string
+ }
+ addVariable: (variable: HogQLVariable) => {
+ variable: HogQLVariable
+ }
+ addVariables: (variables: HogQLVariable[]) => {
+ variables: HogQLVariable[]
+ }
+ clickVariable: (
+ variable: Variable & {
+ selected: boolean
+ }
+ ) => {
+ variable: Variable & {
+ selected: boolean
+ }
+ }
+ removeVariable: (variableId: string) => {
+ variableId: string
+ }
+ resetVariables: () => {
+ value: true
+ }
+ setEditorQuery: (query: string) => {
+ query: string
+ }
+ setSearchTerm: (search: string) => {
+ search: string
+ }
+ updateInternalSelectedVariable: (variable: HogQLVariable) => {
+ variable: HogQLVariable
+ }
+ updateSourceQuery: () => {
+ value: true
+ }
+ updateVariableValue: (
+ variableId: string,
+ value: any,
+ isNull: boolean
+ ) => {
+ allVariables: Variable[]
+ isNull: boolean
+ value: any
+ variableId: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface variablesLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ queryVariableCodeNames: (editorQuery: string | null, arg: any) => string[]
+ variablesWithValues: (variables: Variable[], internalSelectedVariables: HogQLVariable[]) => Variable[]
+ variablesForInsight: (
+ variables: Variable[],
+ internalSelectedVariables: HogQLVariable[],
+ queryVariableCodeNames: string[]
+ ) => Variable[]
+ showVariablesBar: (arg: any) => boolean
+ filteredVariables: (
+ variables: Variable[],
+ searchTerm: string,
+ internalSelectedVariables: HogQLVariable[]
+ ) => (Variable & {
+ selected: boolean
+ })[]
+ variablesUsedInQuery: (
+ variablesWithValues: Variable[],
+ queryVariableCodeNames: string[],
+ searchTerm: string
+ ) => Variable[]
+ variablesNotInQuery: (
+ variablesWithValues: Variable[],
+ queryVariableCodeNames: string[],
+ searchTerm: string
+ ) => Variable[]
+ }
+}
+
+export type variablesLogicType = MakeLogicType<
+ variablesLogicValues,
+ variablesLogicActions,
+ VariablesLogicProps,
+ variablesLogicMeta
+>
+
export const variablesLogic = kea<variablesLogicType>([
path(['queries', 'nodes', 'DataVisualization', 'Components', 'Variables', 'variablesLogic']),
props({ key: '' } as VariablesLogicProps),
@@ -173,14 +310,14 @@ export const variablesLogic = kea<variablesLogicType>([
selectors({
queryVariableCodeNames: [
(s) => [s.editorQuery, (_, props) => props.sourceQuery?.source?.query],
- (editorQuery, sourceQuery): string[] => {
+ (editorQuery: string | null, sourceQuery): string[] => {
const matches = getVariablesFromQuery(editorQuery ?? sourceQuery ?? '')
return Array.from(new Set(matches.filter((match): match is string => Boolean(match))))
},
],
variablesWithValues: [
(s) => [s.variables, s.internalSelectedVariables],
- (variables, internalSelectedVariables): Variable[] => {
+ (variables: Variable[], internalSelectedVariables: HogQLVariable[]): Variable[] => {
return variables.map((variable) => {
const selectedVariable = internalSelectedVariables.find(
(selected) => selected.variableId === variable.id
@@ -199,7 +336,11 @@ export const variablesLogic = kea<variablesLogicType>([
],
variablesForInsight: [
(s) => [s.variables, s.internalSelectedVariables, s.queryVariableCodeNames],
- (variables, internalSelectedVariables, queryVariableCodeNames): Variable[] => {
+ (
+ variables: Variable[],
+ internalSelectedVariables: HogQLVariable[],
+ queryVariableCodeNames: string[]
+ ): Variable[] => {
if (!variables.length || !internalSelectedVariables.length) {
return []
}
@@ -227,7 +368,11 @@ export const variablesLogic = kea<variablesLogicType>([
],
filteredVariables: [
(s) => [s.variables, s.searchTerm, s.internalSelectedVariables],
- (variables, searchTerm, internalSelectedVariables): (Variable & { selected: boolean })[] => {
+ (
+ variables: Variable[],
+ searchTerm: string,
+ internalSelectedVariables: HogQLVariable[]
+ ): (Variable & { selected: boolean })[] => {
const selectedVariableIds = new Set(internalSelectedVariables.map((variable) => variable.variableId))
const trimmedSearch = searchTerm.trim().toLowerCase()
@@ -252,7 +397,7 @@ export const variablesLogic = kea<variablesLogicType>([
],
variablesUsedInQuery: [
(s) => [s.variablesWithValues, s.queryVariableCodeNames, s.searchTerm],
- (variablesWithValues, queryVariableCodeNames, searchTerm): Variable[] => {
+ (variablesWithValues: Variable[], queryVariableCodeNames: string[], searchTerm: string): Variable[] => {
const queryCodeNames = new Set(queryVariableCodeNames)
const trimmedSearch = searchTerm.trim().toLowerCase()
@@ -273,7 +418,7 @@ export const variablesLogic = kea<variablesLogicType>([
],
variablesNotInQuery: [
(s) => [s.variablesWithValues, s.queryVariableCodeNames, s.searchTerm],
- (variablesWithValues, queryVariableCodeNames, searchTerm): Variable[] => {
+ (variablesWithValues: Variable[], queryVariableCodeNames: string[], searchTerm: string): Variable[] => {
const queryCodeNames = new Set(queryVariableCodeNames)
const trimmedSearch = searchTerm.trim().toLowerCase()
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.ts b/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.ts
index b1957da72900..f808ed9d1420 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.ts
+++ b/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.ts
@@ -1,10 +1,26 @@
-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 { DataColorTheme } from 'lib/colors'
import { dataThemeLogic, getColorFromToken } from 'scenes/dataThemeLogic'
+import type {
+ ChartSettings,
+ DataVisualizationNode,
+ ErrorTrackingQueryResponse,
+ HogQLAutocompleteResponse,
+ HogQLMetadataResponse,
+ HogQLQueryResponse,
+ HogQueryResponse,
+ LogAttributesQueryResponse,
+ LogValuesQueryResponse,
+ MetricsQueryResponse,
+ SessionsQueryResponse,
+ TraceSpansAggregationQueryResponse,
+ TraceSpansAttributeBreakdownQueryResponse,
+ TraceSpansQueryResponse,
+} from '../../../schema/schema-general'
import { AxisSeries, AxisSeriesSettings, SelectedYAxis, dataVisualizationLogic } from '../dataVisualizationLogic'
-import type { seriesBreakdownLogicType } from './seriesBreakdownLogicType'
+import type { Column } from '../dataVisualizationLogic'
/**
* Sentinel used to key result customizations for null / undefined breakdown values.
@@ -85,6 +101,123 @@ export interface SeriesBreakdownLogicProps {
key: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface seriesBreakdownLogicValues {
+ getTheme: (themeId: number | string | null | undefined) => DataColorTheme | null // dataThemeLogic
+ chartSettings: ChartSettings // dataVisualizationLogic
+ columns: Column[] // dataVisualizationLogic
+ query: DataVisualizationNode // dataVisualizationLogic
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null // dataVisualizationLogic
+ selectedXAxis: string | null // dataVisualizationLogic
+ selectedYAxis: (SelectedYAxis | null)[] | null // dataVisualizationLogic
+ breakdownColumnValues: string[]
+ selectedSeriesBreakdownColumn: string | null | undefined
+ seriesBreakdownData: BreakdownSeriesData<number | null>
+ showSeriesBreakdown: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface seriesBreakdownLogicActions {
+ clearAxis: () => {
+ value: true
+ } // dataVisualizationLogic
+ setQuery: (setter: (node: DataVisualizationNode) => DataVisualizationNode) => {
+ setter: (node: DataVisualizationNode) => DataVisualizationNode
+ } // dataVisualizationLogic
+ addSeriesBreakdown: (columnName: string | null) => {
+ columnName: string | null
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ }
+ deleteSeriesBreakdown: () => {}
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface seriesBreakdownLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ selectedSeriesBreakdownColumn: (query: DataVisualizationNode) => string | null | undefined
+ showSeriesBreakdown: (selectedSeriesBreakdownColumn: string | null | undefined) => boolean
+ breakdownColumnValues: (
+ selectedSeriesBreakdownColumn: string | null | undefined,
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null,
+ columns: Column[]
+ ) => string[]
+ seriesBreakdownData: (
+ selectedSeriesBreakdownColumn: string | null | undefined,
+ breakdownColumnValues: string[],
+ selectedYAxis: (SelectedYAxis | null)[] | null,
+ selectedXAxis: string | null,
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null,
+ columns: Column[],
+ chartSettings: ChartSettings,
+ getTheme: (themeId: number | string | null | undefined) => DataColorTheme | null
+ ) => BreakdownSeriesData<number | null>
+ }
+}
+
+export type seriesBreakdownLogicType = MakeLogicType<
+ seriesBreakdownLogicValues,
+ seriesBreakdownLogicActions,
+ SeriesBreakdownLogicProps,
+ seriesBreakdownLogicMeta
+>
+
export const seriesBreakdownLogic = kea<seriesBreakdownLogicType>([
path(['queries', 'nodes', 'DataVisualization', 'Components', 'seriesBreakdownLogic']),
key((props) => props.key),
@@ -105,17 +238,36 @@ export const seriesBreakdownLogic = kea<seriesBreakdownLogicType>([
selectors({
selectedSeriesBreakdownColumn: [
(s) => [s.query],
- (query): string | null | undefined => {
+ (query: import('../../../schema').DataVisualizationNode): string | null | undefined => {
return query?.chartSettings?.seriesBreakdownColumn
},
],
showSeriesBreakdown: [
(s) => [s.selectedSeriesBreakdownColumn],
- (selectedSeriesBreakdownColumn): boolean => selectedSeriesBreakdownColumn !== undefined,
+ (selectedSeriesBreakdownColumn: string | null | undefined): boolean =>
+ selectedSeriesBreakdownColumn !== undefined,
],
breakdownColumnValues: [
(s) => [s.selectedSeriesBreakdownColumn, s.response, s.columns],
- (breakdownColumn, response, columns): string[] => {
+ (
+ breakdownColumn: string | null | undefined,
+ response:
+ | Record<string, any>
+ | null
+ | import('../../../schema').ErrorTrackingQueryResponse
+ | import('../../../schema').HogQLAutocompleteResponse
+ | import('../../../schema').HogQLMetadataResponse
+ | import('../../../schema').HogQLQueryResponse<any[]>
+ | import('../../../schema').HogQueryResponse
+ | import('../../../schema').LogAttributesQueryResponse
+ | import('../../../schema').LogValuesQueryResponse
+ | import('../../../schema').MetricsQueryResponse
+ | import('../../../schema').SessionsQueryResponse
+ | import('../../../schema').TraceSpansAggregationQueryResponse
+ | import('../../../schema').TraceSpansAttributeBreakdownQueryResponse
+ | import('../../../schema').TraceSpansQueryResponse,
+ columns: import('../dataVisualizationLogic').Column[]
+ ): string[] => {
if (!response || breakdownColumn === null) {
return []
}
@@ -143,13 +295,27 @@ export const seriesBreakdownLogic = kea<seriesBreakdownLogicType>([
s.getTheme,
],
(
- selectedBreakdownColumn,
- breakdownColumnValues,
- ySeries,
- xSeries,
- response,
- columns,
- chartSettings,
+ selectedBreakdownColumn: string | null | undefined,
+ breakdownColumnValues: string[],
+ ySeries: (SelectedYAxis | null)[] | null,
+ xSeries: string | null,
+ response:
+ | Record<string, any>
+ | null
+ | import('../../../schema').ErrorTrackingQueryResponse
+ | import('../../../schema').HogQLAutocompleteResponse
+ | import('../../../schema').HogQLMetadataResponse
+ | import('../../../schema').HogQLQueryResponse<any[]>
+ | import('../../../schema').HogQueryResponse
+ | import('../../../schema').LogAttributesQueryResponse
+ | import('../../../schema').LogValuesQueryResponse
+ | import('../../../schema').MetricsQueryResponse
+ | import('../../../schema').SessionsQueryResponse
+ | import('../../../schema').TraceSpansAggregationQueryResponse
+ | import('../../../schema').TraceSpansAttributeBreakdownQueryResponse
+ | import('../../../schema').TraceSpansQueryResponse,
+ columns: import('../dataVisualizationLogic').Column[],
+ chartSettings: import('../../../schema').ChartSettings,
getTheme: (themeId: string | number | null | undefined) => DataColorTheme | null
): BreakdownSeriesData<number | null> => {
if (
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/ySeriesLogic.ts b/frontend/src/queries/nodes/DataVisualization/Components/ySeriesLogic.ts
index de7ce44ae990..2eb00777cd60 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/ySeriesLogic.ts
+++ b/frontend/src/queries/nodes/DataVisualization/Components/ySeriesLogic.ts
@@ -1,5 +1,6 @@
-import { actions, connect, kea, key, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, path, props, reducers, selectors } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { getSeriesColor } from 'lib/colors'
@@ -9,7 +10,7 @@ import {
EmptyYAxisSeries,
dataVisualizationLogic,
} from '../dataVisualizationLogic'
-import type { ySeriesLogicType } from './ySeriesLogicType'
+import type { AxisSeriesSettings } from '../dataVisualizationLogic'
export interface YSeriesLogicProps {
series: AxisSeries<number | null>
@@ -22,6 +23,278 @@ export enum YSeriesSettingsTab {
Display = 'display',
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface ySeriesLogicValues {
+ activeSettingsTab: YSeriesSettingsTab
+ canOpenSettings: boolean
+ display: {
+ color: string
+ displayType: 'area' | 'auto' | 'bar' | 'line'
+ label: string
+ trendLine: boolean
+ yAxisPosition: 'left' | 'right'
+ }
+ displayAllErrors: Record<string, any>
+ displayChanged: boolean
+ displayErrors: DeepPartialMap<
+ {
+ color: string
+ displayType: 'area' | 'auto' | 'bar' | 'line'
+ label: string
+ trendLine: boolean
+ yAxisPosition: 'left' | 'right'
+ },
+ ValidationErrorType
+ >
+ displayHasErrors: boolean
+ displayManualErrors: Record<string, any>
+ displayTouched: boolean
+ displayTouches: Record<string, boolean>
+ displayValidationErrors: DeepPartialMap<
+ {
+ color: string
+ displayType: 'area' | 'auto' | 'bar' | 'line'
+ label: string
+ trendLine: boolean
+ yAxisPosition: 'left' | 'right'
+ },
+ ValidationErrorType
+ >
+ formatting: {
+ decimalPlaces: number | undefined
+ prefix: string
+ style: 'none' | 'number' | 'percent' | 'short'
+ suffix: string
+ }
+ formattingAllErrors: Record<string, any>
+ formattingChanged: boolean
+ formattingErrors: DeepPartialMap<
+ {
+ decimalPlaces: number | undefined
+ prefix: string
+ style: 'none' | 'number' | 'percent' | 'short'
+ suffix: string
+ },
+ ValidationErrorType
+ >
+ formattingHasErrors: boolean
+ formattingManualErrors: Record<string, any>
+ formattingTouched: boolean
+ formattingTouches: Record<string, boolean>
+ formattingValidationErrors: DeepPartialMap<
+ {
+ decimalPlaces: number | undefined
+ prefix: string
+ style: 'none' | 'number' | 'percent' | 'short'
+ suffix: string
+ },
+ ValidationErrorType
+ >
+ isDisplaySubmitting: boolean
+ isDisplayValid: boolean
+ isFormattingSubmitting: boolean
+ isFormattingValid: boolean
+ isSettingsOpen: boolean
+ showDisplayErrors: boolean
+ showFormattingErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface ySeriesLogicActions {
+ updateSeriesIndex: (
+ seriesIndex: number,
+ columnName: string,
+ settings?: AxisSeriesSettings | undefined
+ ) => {
+ columnName: string
+ seriesIndex: number
+ settings: AxisSeriesSettings | undefined
+ } // dataVisualizationLogic
+ resetDisplay: (values?: {
+ color: string
+ displayType: 'area' | 'auto' | 'bar' | 'line'
+ label: string
+ trendLine: boolean
+ yAxisPosition: 'left' | 'right'
+ }) => {
+ values?: {
+ color: string
+ displayType: 'area' | 'auto' | 'bar' | 'line'
+ label: string
+ trendLine: boolean
+ yAxisPosition: 'left' | 'right'
+ }
+ }
+ resetFormatting: (values?: {
+ decimalPlaces: number | undefined
+ prefix: string
+ style: 'none' | 'number' | 'percent' | 'short'
+ suffix: string
+ }) => {
+ values?: {
+ decimalPlaces: number | undefined
+ prefix: string
+ style: 'none' | 'number' | 'percent' | 'short'
+ suffix: string
+ }
+ }
+ setDisplayManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setDisplayValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setDisplayValues: (
+ values: DeepPartial<{
+ color: string
+ displayType: 'area' | 'auto' | 'bar' | 'line'
+ label: string
+ trendLine: boolean
+ yAxisPosition: 'left' | 'right'
+ }>
+ ) => {
+ values: DeepPartial<{
+ color: string
+ displayType: 'area' | 'auto' | 'bar' | 'line'
+ label: string
+ trendLine: boolean
+ yAxisPosition: 'left' | 'right'
+ }>
+ }
+ setFormattingManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setFormattingValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setFormattingValues: (
+ values: DeepPartial<{
+ decimalPlaces: number | undefined
+ prefix: string
+ style: 'none' | 'number' | 'percent' | 'short'
+ suffix: string
+ }>
+ ) => {
+ values: DeepPartial<{
+ decimalPlaces: number | undefined
+ prefix: string
+ style: 'none' | 'number' | 'percent' | 'short'
+ suffix: string
+ }>
+ }
+ setSettingsOpen: (open: boolean) => {
+ open: boolean
+ }
+ setSettingsTab: (tab: YSeriesSettingsTab) => {
+ tab: YSeriesSettingsTab
+ }
+ submitDisplay: () => {
+ value: boolean
+ }
+ submitDisplayFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitDisplayRequest: (display: {
+ color: string
+ displayType: 'area' | 'auto' | 'bar' | 'line'
+ label: string
+ trendLine: boolean
+ yAxisPosition: 'left' | 'right'
+ }) => {
+ display: {
+ color: string
+ displayType: 'area' | 'auto' | 'bar' | 'line'
+ label: string
+ trendLine: boolean
+ yAxisPosition: 'left' | 'right'
+ }
+ }
+ submitDisplaySuccess: (display: {
+ color: string
+ displayType: 'area' | 'auto' | 'bar' | 'line'
+ label: string
+ trendLine: boolean
+ yAxisPosition: 'left' | 'right'
+ }) => {
+ display: {
+ color: string
+ displayType: 'area' | 'auto' | 'bar' | 'line'
+ label: string
+ trendLine: boolean
+ yAxisPosition: 'left' | 'right'
+ }
+ }
+ submitFormatting: () => {
+ value: boolean
+ }
+ submitFormattingFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitFormattingRequest: (formatting: {
+ decimalPlaces: number | undefined
+ prefix: string
+ style: 'none' | 'number' | 'percent' | 'short'
+ suffix: string
+ }) => {
+ formatting: {
+ decimalPlaces: number | undefined
+ prefix: string
+ style: 'none' | 'number' | 'percent' | 'short'
+ suffix: string
+ }
+ }
+ submitFormattingSuccess: (formatting: {
+ decimalPlaces: number | undefined
+ prefix: string
+ style: 'none' | 'number' | 'percent' | 'short'
+ suffix: string
+ }) => {
+ formatting: {
+ decimalPlaces: number | undefined
+ prefix: string
+ style: 'none' | 'number' | 'percent' | 'short'
+ suffix: string
+ }
+ }
+ touchDisplayField: (key: string) => {
+ key: string
+ }
+ touchFormattingField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface ySeriesLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ canOpenSettings: (series: AxisSeries<number | null>) => boolean
+ }
+}
+
+export type ySeriesLogicType = MakeLogicType<
+ ySeriesLogicValues,
+ ySeriesLogicActions,
+ YSeriesLogicProps,
+ ySeriesLogicMeta
+>
+
export const ySeriesLogic = kea<ySeriesLogicType>([
path(['queries', 'nodes', 'DataVisualization', 'Components', 'ySeriesLogic']),
key((props) => `${props.series?.column?.name ?? 'new'}-${props.seriesIndex ?? 0}`),
@@ -50,7 +323,7 @@ export const ySeriesLogic = kea<ySeriesLogicType>([
selectors({
canOpenSettings: [
(_s, p) => [p.series],
- (series) => {
+ (series: AxisSeries<number | null>) => {
return series !== EmptyYAxisSeries
},
],
diff --git a/frontend/src/queries/nodes/DataVisualization/dataVisualizationLogic.ts b/frontend/src/queries/nodes/DataVisualization/dataVisualizationLogic.ts
index 5ceac450becd..e91ad77241b1 100644
--- a/frontend/src/queries/nodes/DataVisualization/dataVisualizationLogic.ts
+++ b/frontend/src/queries/nodes/DataVisualization/dataVisualizationLogic.ts
@@ -1,4 +1,5 @@
import {
+ MakeLogicType,
actions,
afterMount,
connect,
@@ -12,6 +13,7 @@ import {
selectors,
sharedListeners,
} from 'kea'
+import type { BreakPointFunction } from 'kea'
import { subscriptions } from 'kea-subscriptions'
import mergeObject from 'lodash.merge'
@@ -39,9 +41,24 @@ import {
import { QueryContext } from '~/queries/types'
import { ChartDisplayType, DashboardType } from '~/types'
+import type {
+ DataNode,
+ ErrorTrackingQueryResponse,
+ HogQLAutocompleteResponse,
+ HogQLMetadataResponse,
+ HogQLQueryResponse,
+ HogQueryResponse,
+ LogAttributesQueryResponse,
+ LogValuesQueryResponse,
+ MetricsQueryResponse,
+ RefreshType,
+ SessionsQueryResponse,
+ TraceSpansAggregationQueryResponse,
+ TraceSpansAttributeBreakdownQueryResponse,
+ TraceSpansQueryResponse,
+} from '../../schema/schema-general'
import { dataNodeLogic } from '../DataNode/dataNodeLogic'
import { QueryFeature, getQueryFeatures } from '../DataTable/queryFeatures'
-import type { dataVisualizationLogicType } from './dataVisualizationLogicType'
import { ColumnScalar, FORMATTING_TEMPLATES } from './types'
export enum SideBarTab {
@@ -392,6 +409,346 @@ const shouldUseFirstNumericColumnAsContinuousChartXAxis = (
return numericalColumns.every((column) => selectedYAxisNames.has(column.name))
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dataVisualizationLogicValues {
+ queryCancelled: boolean // dataNodeLogic
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null // dataNodeLogic
+ responseError: string | null // dataNodeLogic
+ responseLoading: boolean // dataNodeLogic
+ activeSceneId: string | null // sceneLogic
+ currentTeamId: number | null // teamLogic
+ isDarkModeOn: boolean // themeLogic
+ activeSideBarTab: SideBarTab
+ autoVisualizationType: ChartDisplayType
+ chartSettings: ChartSettings
+ columns: Column[]
+ conditionalFormattingRules: ConditionalFormattingRule[]
+ conditionalFormattingRulesPanelActiveKeys: string[]
+ dashboardId: any
+ dataVisualizationProps: DataVisualizationLogicProps
+ effectiveVisualizationType: ChartDisplayType
+ hasDateTimeColumns: boolean
+ isChartSettingsPanelOpen: boolean
+ isColumnPinned: (columnName: string) => boolean
+ isPinningEnabled: boolean
+ isShowingCachedResults: boolean
+ isTableVisualization: boolean
+ isTransposed: boolean
+ numericalColumns: Column[]
+ pinnedColumns: string[]
+ presetChartHeight: boolean
+ query: DataVisualizationNode
+ selectedXAxis: string | null
+ selectedYAxis: (SelectedYAxis | null)[] | null
+ showEditingUI: boolean
+ showResultControls: boolean
+ showTableSettings: boolean
+ sourceFeatures: Set<QueryFeature>
+ sourceTabularColumns: AxisSeries<any>[]
+ sourceTabularData: TableDataCell<any>[][]
+ tabularColumnSettings: (SelectedYAxis | null)[] | null
+ tabularColumns: AxisSeries<any>[]
+ tabularData: TableDataCell<any>[][]
+ visualizationType: ChartDisplayType
+ xData: AxisSeries<string> | null
+ yData: AxisSeries<number | null>[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dataVisualizationLogicActions {
+ 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
+ } // dataNodeLogic
+ _setQuery: (node: DataVisualizationNode) => {
+ node: DataVisualizationNode
+ }
+ addConditionalFormattingRule: (rule?: ConditionalFormattingRule) => {
+ isDarkModeOn: boolean
+ rule:
+ | ConditionalFormattingRule
+ | {
+ id: string
+ }
+ }
+ addSeries: (
+ columnName?: string,
+ settings?: AxisSeriesSettings
+ ) => {
+ allColumns: Column[]
+ columnName: string | undefined
+ settings: AxisSeriesSettings | undefined
+ }
+ addYSeries: (
+ columnName?: string,
+ settings?: AxisSeriesSettings
+ ) => {
+ allNumericalColumns: Column[]
+ columnName: string | undefined
+ settings: AxisSeriesSettings | undefined
+ }
+ clearAxis: () => {
+ value: true
+ }
+ deleteYSeries: (seriesIndex: number) => {
+ seriesIndex: number
+ }
+ setConditionalFormattingRulesPanelActiveKeys: (keys: string[]) => {
+ keys: string[]
+ }
+ setQuery: (setter: (node: DataVisualizationNode) => DataVisualizationNode) => {
+ setter: (node: DataVisualizationNode) => DataVisualizationNode
+ }
+ setSideBarTab: (tab: SideBarTab) => {
+ tab: SideBarTab
+ }
+ setTransposeResults: (transpose: boolean) => {
+ transpose: boolean
+ }
+ setVisualizationType: (visualizationType: ChartDisplayType) => {
+ visualizationType: ChartDisplayType
+ }
+ toggleChartSettingsPanel: (open?: boolean) => {
+ open: boolean | undefined
+ }
+ toggleColumnPin: (columnName: string) => {
+ columnName: string
+ }
+ updateChartSettings: (settings: ChartSettings) => {
+ settings: ChartSettings
+ }
+ updateConditionalFormattingRule: (
+ rule: ConditionalFormattingRule,
+ deleteRule?: boolean
+ ) => {
+ colorMode: string
+ deleteRule: boolean | undefined
+ rule: ConditionalFormattingRule
+ }
+ updateSeries: (
+ columnName: string,
+ settings?: AxisSeriesSettings
+ ) => {
+ columnName: string
+ settings: AxisSeriesSettings | undefined
+ }
+ updateSeriesIndex: (
+ seriesIndex: number,
+ columnName: string,
+ settings?: AxisSeriesSettings
+ ) => {
+ columnName: string
+ seriesIndex: number
+ settings: AxisSeriesSettings | undefined
+ }
+ updateXSeries: (columnName: string) => {
+ columnName: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dataVisualizationLogicMeta {
+ key: string
+ sharedListeners: {
+ axesChanged: (
+ payload: any,
+ breakpoint: BreakPointFunction,
+ action: {
+ type: string
+ payload: any
+ },
+ previousState: any
+ ) => void | Promise<void>
+ conditionalFormattingRules: (
+ payload: any,
+ breakpoint: BreakPointFunction,
+ action: {
+ type: string
+ payload: any
+ },
+ previousState: any
+ ) => void | Promise<void>
+ pinnedColumnsChanged: (
+ payload: any,
+ breakpoint: BreakPointFunction,
+ action: {
+ type: string
+ payload: any
+ },
+ previousState: any
+ ) => void | Promise<void>
+ }
+ __keaTypeGenInternalSelectorTypes: {
+ columns: (
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ ) => Column[]
+ numericalColumns: (columns: Column[]) => Column[]
+ hasDateTimeColumns: (columns: Column[]) => boolean
+ dashboardId: (arg: any) => any
+ showEditingUI: (arg: boolean | undefined, dashboardId: any) => boolean
+ showResultControls: (arg: boolean | undefined, dashboardId: any) => boolean
+ presetChartHeight: (key: string, dashboardId: any, activeSceneId: string | null) => boolean
+ sourceFeatures: (query: DataVisualizationNode) => Set<QueryFeature>
+ isShowingCachedResults: (arg: any) => boolean
+ isTransposed: (query: DataVisualizationNode) => boolean
+ yData: (
+ selectedYAxis: (SelectedYAxis | null)[] | null,
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null,
+ columns: Column[],
+ chartSettings: ChartSettings
+ ) => AxisSeries<number | null>[]
+ xData: (
+ selectedXAxis: string | null,
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null,
+ columns: Column[]
+ ) => AxisSeries<string> | null
+ sourceTabularColumns: (
+ tabularColumnSettings: (SelectedYAxis | null)[] | null,
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null,
+ columns: Column[]
+ ) => AxisSeries<any>[]
+ sourceTabularData: (
+ sourceTabularColumns: AxisSeries<any>[],
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null,
+ chartSettings: ChartSettings
+ ) => TableDataCell<any>[][]
+ tabularColumns: (
+ sourceTabularColumns: AxisSeries<any>[],
+ sourceTabularData: TableDataCell<any>[][],
+ isTransposed: boolean
+ ) => AxisSeries<any>[]
+ tabularData: (
+ sourceTabularColumns: AxisSeries<any>[],
+ sourceTabularData: TableDataCell<any>[][],
+ isTransposed: boolean
+ ) => TableDataCell<any>[][]
+ dataVisualizationProps: (arg: any) => DataVisualizationLogicProps
+ effectiveVisualizationType: (
+ visualizationType: ChartDisplayType,
+ autoVisualizationType: ChartDisplayType
+ ) => ChartDisplayType
+ autoVisualizationType: (
+ columns: Column[],
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ ) => ChartDisplayType
+ isTableVisualization: (effectiveVisualizationType: ChartDisplayType) => boolean
+ showTableSettings: (effectiveVisualizationType: ChartDisplayType) => boolean
+ isColumnPinned: (pinnedColumns: string[]) => (columnName: string) => boolean
+ isPinningEnabled: (activeSceneId: string | null, isTransposed: boolean) => boolean
+ }
+}
+
+export type dataVisualizationLogicType = MakeLogicType<
+ dataVisualizationLogicValues,
+ dataVisualizationLogicActions,
+ DataVisualizationLogicProps,
+ dataVisualizationLogicMeta
+>
+
export const dataVisualizationLogic = kea<dataVisualizationLogicType>([
key((props) => props.key),
path(['queries', 'nodes', 'DataVisualization', 'dataVisualizationLogic']),
@@ -783,7 +1140,23 @@ export const dataVisualizationLogic = kea<dataVisualizationLogicType>([
selectors({
columns: [
(s) => [s.response],
- (response): Column[] => {
+ (
+ response:
+ | 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
+ ): Column[] => {
if (!response) {
return []
}
@@ -811,18 +1184,18 @@ export const dataVisualizationLogic = kea<dataVisualizationLogicType>([
],
numericalColumns: [
(s) => [s.columns],
- (columns): Column[] => {
+ (columns: Column[]): Column[] => {
return columns.filter((n) => n.type.isNumerical)
},
],
hasDateTimeColumns: [
(s) => [s.columns],
- (columns): boolean => columns.some((column) => ['DATE', 'DATETIME'].includes(column.type.name)),
+ (columns: Column[]): boolean => columns.some((column) => ['DATE', 'DATETIME'].includes(column.type.name)),
],
dashboardId: [() => [(_, props) => props.dashboardId], (dashboardId) => dashboardId ?? null],
showEditingUI: [
(s) => [(_, props: DataVisualizationLogicProps) => props.editMode, s.dashboardId],
- (editMode, dashboardId) => {
+ (editMode: boolean | undefined, dashboardId) => {
if (dashboardId) {
return false
}
@@ -831,7 +1204,7 @@ export const dataVisualizationLogic = kea<dataVisualizationLogicType>([
],
showResultControls: [
(s) => [(_, props: DataVisualizationLogicProps) => props.editMode, s.dashboardId],
- (editMode, dashboardId) => {
+ (editMode: boolean | undefined, dashboardId) => {
if (editMode) {
return true
}
@@ -841,7 +1214,7 @@ export const dataVisualizationLogic = kea<dataVisualizationLogicType>([
],
presetChartHeight: [
(s, props) => [props.key, s.dashboardId, s.activeSceneId],
- (key, dashboardId, activeSceneId) => {
+ (key: string, dashboardId, activeSceneId: string | null) => {
// Keys for SQL editor visualizations can render outside the SQLEditor scene,
// e.g. in embedded mode, so key matching keeps sizing consistent.
const sqlEditorVisualization =
@@ -856,15 +1229,40 @@ export const dataVisualizationLogic = kea<dataVisualizationLogicType>([
return !key.includes('new-SQL') && !dashboardId && !sqlEditorVisualization
},
],
- sourceFeatures: [(_, props) => [props.query], (query): Set<QueryFeature> => getQueryFeatures(query.source)],
+ sourceFeatures: [
+ (_, props) => [props.query],
+ (query: DataVisualizationNode): Set<QueryFeature> => getQueryFeatures(query.source),
+ ],
isShowingCachedResults: [
() => [(_, props) => props.cachedResults ?? null],
(cachedResults: AnyResponseType | null): boolean => !!cachedResults,
],
- isTransposed: [(s) => [s.query], (query): boolean => query.tableSettings?.transpose ?? false],
+ isTransposed: [
+ (s) => [s.query],
+ (query: DataVisualizationNode): boolean => query.tableSettings?.transpose ?? false,
+ ],
yData: [
(s) => [s.selectedYAxis, s.response, s.columns, s.chartSettings],
- (ySeries, response, columns, chartSettings): AxisSeries<number | null>[] => {
+ (
+ ySeries: (SelectedYAxis | null)[] | null,
+ response:
+ | 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,
+ columns: Column[],
+ chartSettings: ChartSettings
+ ): AxisSeries<number | null>[] => {
if (!response || ySeries === null || ySeries.length === 0) {
return [EmptyYAxisSeries]
}
@@ -926,7 +1324,25 @@ export const dataVisualizationLogic = kea<dataVisualizationLogicType>([
],
xData: [
(s) => [s.selectedXAxis, s.response, s.columns],
- (xSeries, response, columns): AxisSeries<string> | null => {
+ (
+ xSeries: string | null,
+ response:
+ | 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,
+ columns: Column[]
+ ): AxisSeries<string> | null => {
if (!response) {
return {
column: {
@@ -973,7 +1389,25 @@ export const dataVisualizationLogic = kea<dataVisualizationLogicType>([
],
sourceTabularColumns: [
(s) => [s.tabularColumnSettings, s.response, s.columns],
- (tabularColumnSettings, response, columns): AxisSeries<any>[] => {
+ (
+ tabularColumnSettings: (SelectedYAxis | null)[] | null,
+ response:
+ | 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,
+ columns: Column[]
+ ): AxisSeries<any>[] => {
if (!response) {
return []
}
@@ -991,7 +1425,25 @@ export const dataVisualizationLogic = kea<dataVisualizationLogicType>([
],
sourceTabularData: [
(s) => [s.sourceTabularColumns, s.response, s.chartSettings],
- (sourceTabularColumns, response, chartSettings): TableDataCell<any>[][] => {
+ (
+ sourceTabularColumns: AxisSeries<any>[],
+ response:
+ | 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,
+ chartSettings: ChartSettings
+ ): TableDataCell<any>[][] => {
if (!response) {
return []
}
@@ -1076,7 +1528,11 @@ export const dataVisualizationLogic = kea<dataVisualizationLogicType>([
],
tabularColumns: [
(s) => [s.sourceTabularColumns, s.sourceTabularData, s.isTransposed],
- (sourceTabularColumns, sourceTabularData, isTransposed): AxisSeries<any>[] => {
+ (
+ sourceTabularColumns: AxisSeries<any>[],
+ sourceTabularData: TableDataCell<any>[][],
+ isTransposed: boolean
+ ): AxisSeries<any>[] => {
if (!isTransposed) {
return sourceTabularColumns
}
@@ -1129,7 +1585,11 @@ export const dataVisualizationLogic = kea<dataVisualizationLogicType>([
],
tabularData: [
(s) => [s.sourceTabularColumns, s.sourceTabularData, s.isTransposed],
- (sourceTabularColumns, sourceTabularData, isTransposed): TableDataCell<any>[][] => {
+ (
+ sourceTabularColumns: AxisSeries<any>[],
+ sourceTabularData: TableDataCell<any>[][],
+ isTransposed: boolean
+ ): TableDataCell<any>[][] => {
if (!isTransposed) {
return sourceTabularData
}
@@ -1156,7 +1616,7 @@ export const dataVisualizationLogic = kea<dataVisualizationLogicType>([
dataVisualizationProps: [() => [(_, props) => props], (props): DataVisualizationLogicProps => props],
effectiveVisualizationType: [
(s) => [s.visualizationType, s.autoVisualizationType],
- (visualizationType, autoVisualizationType): ChartDisplayType => {
+ (visualizationType: ChartDisplayType, autoVisualizationType: ChartDisplayType): ChartDisplayType => {
if (visualizationType === ChartDisplayType.Auto) {
return autoVisualizationType
}
@@ -1166,24 +1626,41 @@ export const dataVisualizationLogic = kea<dataVisualizationLogicType>([
],
autoVisualizationType: [
(s) => [s.columns, s.response],
- (columns, response): ChartDisplayType => getAutoVisualizationType(columns, response),
+ (
+ columns: Column[],
+ response:
+ | 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
+ ): ChartDisplayType => getAutoVisualizationType(columns, response),
],
isTableVisualization: [
(s) => [s.effectiveVisualizationType],
- (visualizationType): boolean =>
+ (visualizationType: ChartDisplayType): boolean =>
// BoldNumber relies on yAxis formatting so it's considered a table visualization
visualizationType === ChartDisplayType.ActionsTable ||
visualizationType === ChartDisplayType.BoldNumber,
],
showTableSettings: [
(s) => [s.effectiveVisualizationType],
- (visualizationType): boolean =>
+ (visualizationType: ChartDisplayType): boolean =>
visualizationType === ChartDisplayType.ActionsTable ||
visualizationType === ChartDisplayType.BoldNumber,
],
isColumnPinned: [
(s) => [s.pinnedColumns],
- (pinnedColumns) =>
+ (pinnedColumns: string[]) =>
(columnName: string): boolean => {
return pinnedColumns.includes(columnName)
},
diff --git a/frontend/src/queries/nodes/DataVisualization/displayLogic.ts b/frontend/src/queries/nodes/DataVisualization/displayLogic.ts
index da023a4c3269..a45fc910d8e7 100644
--- a/frontend/src/queries/nodes/DataVisualization/displayLogic.ts
+++ b/frontend/src/queries/nodes/DataVisualization/displayLogic.ts
@@ -1,16 +1,68 @@
import * as d3 from 'd3'
-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 { subscriptions } from 'kea-subscriptions'
import { GoalLine } from '~/queries/schema/schema-general'
+import type { ChartSettings, DataVisualizationNode } from '../../schema/schema-general'
import { dataVisualizationLogic } from './dataVisualizationLogic'
-import type { displayLogicType } from './displayLogicType'
+import type { AxisSeries } from './dataVisualizationLogic'
export interface DisplayLogicProps {
key: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface displayLogicValues {
+ chartSettings: ChartSettings // dataVisualizationLogic
+ query: DataVisualizationNode // dataVisualizationLogic
+ yData: AxisSeries<number | null>[] // dataVisualizationLogic
+ goalLines: GoalLine[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface displayLogicActions {
+ _setQuery: (node: DataVisualizationNode) => {
+ node: DataVisualizationNode
+ } // dataVisualizationLogic
+ setQuery: (setter: (node: DataVisualizationNode) => DataVisualizationNode) => {
+ setter: (node: DataVisualizationNode) => DataVisualizationNode
+ } // dataVisualizationLogic
+ updateChartSettings: (settings: ChartSettings) => {
+ settings: ChartSettings
+ } // dataVisualizationLogic
+ addGoalLine: () => {
+ yData: AxisSeries<number | null>[]
+ }
+ removeGoalLine: (goalLineIndex: number) => {
+ goalLineIndex: number
+ }
+ setGoalLines: (goalLines: GoalLine[]) => {
+ goalLines: GoalLine[]
+ }
+ updateGoalLine: (
+ goalLineIndex: number,
+ key: string,
+ value: boolean | number | string
+ ) => {
+ goalLineIndex: number
+ key: string
+ value: boolean | number | string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface displayLogicMeta {
+ key: string
+}
+
+export type displayLogicType = MakeLogicType<
+ displayLogicValues,
+ displayLogicActions,
+ DisplayLogicProps,
+ displayLogicMeta
+>
+
export const displayLogic = kea<displayLogicType>([
key((props) => props.key),
path(['queries', 'nodes', 'DataVisualization', 'displayLogic']),
diff --git a/frontend/src/queries/nodes/HogQLQuery/hogQLQueryEditorLogic.tsx b/frontend/src/queries/nodes/HogQLQuery/hogQLQueryEditorLogic.tsx
index b432a61c800a..68addcf725dd 100644
--- a/frontend/src/queries/nodes/HogQLQuery/hogQLQueryEditorLogic.tsx
+++ b/frontend/src/queries/nodes/HogQLQuery/hogQLQueryEditorLogic.tsx
@@ -1,5 +1,17 @@
import type { Monaco } from '@monaco-editor/react'
-import { actions, connect, kea, key, listeners, path, props, propsChanged, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ connect,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ propsChanged,
+ reducers,
+ selectors,
+} from 'kea'
import { combineUrl } from 'kea-router'
// Note: we can only import types and not values from monaco-editor, because otherwise some Monaco code breaks
// auto reload in development. Specifically, on this line:
@@ -23,7 +35,8 @@ import { teamLogic } from 'scenes/teamLogic'
import { DataNode, HogQLQuery, NodeKind } from '~/queries/schema/schema-general'
-import type { hogQLQueryEditorLogicType } from './hogQLQueryEditorLogicType'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { DataWarehouseSavedQuery } from '../../../types'
export interface HogQLQueryEditorLogicProps {
key: string | number
@@ -36,6 +49,84 @@ export interface HogQLQueryEditorLogicProps {
queryResponse?: Record<string, any>
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogQLQueryEditorLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ currentProjectId: number | string // teamLogic
+ aiAvailable: boolean | undefined
+ prompt: string
+ promptError: string | null
+ promptLoading: boolean
+ queryInput: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogQLQueryEditorLogicActions {
+ updateView: (
+ query: string,
+ types: string[][]
+ ) => {
+ query: string
+ types: string[][]
+ } // dataWarehouseSettingsSceneLogic
+ createDataWarehouseSavedQuery: (
+ view: Partial<DataWarehouseSavedQuery> & {
+ dag_id?: string
+ folder_id?: string | null
+ types: string[][]
+ }
+ ) => Partial<DataWarehouseSavedQuery> & {
+ dag_id?: string
+ folder_id?: string | null
+ types: string[][]
+ } // dataWarehouseViewsLogic
+ draftFromMetadataFix: (prompt: string) => {
+ prompt: string
+ }
+ draftFromPrompt: () => {
+ value: true
+ }
+ draftFromPromptComplete: () => {
+ value: true
+ }
+ onUpdateView: () => {
+ value: true
+ }
+ saveAsView: () => {
+ value: true
+ }
+ saveAsViewSuccess: (name: string) => {
+ name: string
+ }
+ saveQuery: (queryOverride?: string) => {
+ queryOverride: string | undefined
+ }
+ setPrompt: (prompt: string) => {
+ prompt: string
+ }
+ setPromptError: (error: string | null) => {
+ error: string | null
+ }
+ setQueryInput: (queryInput: string) => {
+ queryInput: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogQLQueryEditorLogicMeta {
+ key: number | string
+ __keaTypeGenInternalSelectorTypes: {
+ aiAvailable: (preflight: null | import('../../../types').PreflightStatus) => boolean | undefined
+ }
+}
+
+export type hogQLQueryEditorLogicType = MakeLogicType<
+ hogQLQueryEditorLogicValues,
+ hogQLQueryEditorLogicActions,
+ HogQLQueryEditorLogicProps,
+ hogQLQueryEditorLogicMeta
+>
+
export const hogQLQueryEditorLogic = kea<hogQLQueryEditorLogicType>([
path(['queries', 'nodes', 'HogQLQuery', 'hogQLQueryEditorLogic']),
props({} as HogQLQueryEditorLogicProps),
@@ -93,7 +184,10 @@ export const hogQLQueryEditorLogic = kea<hogQLQueryEditorLogicType>([
],
})),
selectors({
- aiAvailable: [() => [preflightLogic.selectors.preflight], (preflight) => preflight?.openai_available],
+ aiAvailable: [
+ () => [preflightLogic.selectors.preflight],
+ (preflight: null | import('../../../types').PreflightStatus) => preflight?.openai_available,
+ ],
}),
listeners(({ actions, props, values }) => ({
saveQuery: ({ queryOverride }) => {
diff --git a/frontend/src/queries/nodes/InsightViz/PropertyGroupFilters/propertyGroupFilterLogic.ts b/frontend/src/queries/nodes/InsightViz/PropertyGroupFilters/propertyGroupFilterLogic.ts
index 63d68fe1dee9..21630f18dd8b 100644
--- a/frontend/src/queries/nodes/InsightViz/PropertyGroupFilters/propertyGroupFilterLogic.ts
+++ b/frontend/src/queries/nodes/InsightViz/PropertyGroupFilters/propertyGroupFilterLogic.ts
@@ -1,4 +1,4 @@
-import { actions, kea, key, listeners, path, props, propsChanged, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, key, listeners, path, props, propsChanged, reducers, selectors } from 'kea'
import { convertPropertiesToPropertyGroup, isValidPropertyFilter } from 'lib/components/PropertyFilters/utils'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
@@ -13,14 +13,69 @@ import {
PropertyGroupFilterValue,
} from '~/types'
-import type { propertyGroupFilterLogicType } from './propertyGroupFilterLogicType'
-
export type PropertyGroupFilterLogicProps = {
pageKey: string
query: ProductAnalyticsInsightQueryNode
setQuery: (node: ProductAnalyticsInsightQueryNode) => void
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface propertyGroupFilterLogicValues {
+ filters: PropertyGroupFilter
+ propertyGroupFilter: PropertyGroupFilter
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface propertyGroupFilterLogicActions {
+ addFilterGroup: () => {
+ value: true
+ }
+ duplicateFilterGroup: (propertyGroupIndex: number) => {
+ propertyGroupIndex: number
+ }
+ removeFilterGroup: (filterGroup: number) => {
+ filterGroup: number
+ }
+ setFilters: (filters: PropertyGroupFilter) => {
+ filters: PropertyGroupFilter
+ }
+ setInnerPropertyGroupType: (
+ type: FilterLogicalOperator,
+ index: number
+ ) => {
+ index: number
+ type: FilterLogicalOperator
+ }
+ setOuterPropertyGroupsType: (type: FilterLogicalOperator) => {
+ type: FilterLogicalOperator
+ }
+ setPropertyFilters: (
+ properties: any,
+ index: number
+ ) => {
+ index: number
+ properties: any
+ }
+ update: (propertyGroupIndex?: number) => {
+ propertyGroupIndex: number | undefined
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface propertyGroupFilterLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ propertyGroupFilter: (filters: PropertyGroupFilter) => PropertyGroupFilter
+ }
+}
+
+export type propertyGroupFilterLogicType = MakeLogicType<
+ propertyGroupFilterLogicValues,
+ propertyGroupFilterLogicActions,
+ PropertyGroupFilterLogicProps,
+ propertyGroupFilterLogicMeta
+>
+
export const propertyGroupFilterLogic = kea<propertyGroupFilterLogicType>([
path(['queries', 'nodes', 'InsightViz', 'PropertyGroupFilters', 'propertyGroupFilterLogic']),
props({} as PropertyGroupFilterLogicProps),
@@ -123,7 +178,7 @@ export const propertyGroupFilterLogic = kea<propertyGroupFilterLogicType>([
})),
selectors({
- propertyGroupFilter: [(s) => [s.filters], (propertyGroupFilter) => propertyGroupFilter],
+ propertyGroupFilter: [(s) => [s.filters], (propertyGroupFilter: PropertyGroupFilter) => propertyGroupFilter],
}),
])
diff --git a/frontend/src/queries/nodes/InsightViz/resultCustomizationsModalLogic.ts b/frontend/src/queries/nodes/InsightViz/resultCustomizationsModalLogic.ts
index 6fb7c9602221..4619243cfda3 100644
--- a/frontend/src/queries/nodes/InsightViz/resultCustomizationsModalLogic.ts
+++ b/frontend/src/queries/nodes/InsightViz/resultCustomizationsModalLogic.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 { DataColorToken } from 'lib/colors'
import { funnelDataLogic } from 'scenes/funnels/funnelDataLogic'
@@ -16,7 +16,108 @@ import { IndexedTrendResult } from 'scenes/trends/types'
import { ResultCustomizationBy, TrendsFilter } from '~/queries/schema/schema-general'
import { FlattenedFunnelStepByBreakdown, InsightLogicProps } from '~/types'
-import type { resultCustomizationsModalLogicType } from './resultCustomizationsModalLogicType'
+import type { DataColorTheme } from '../../../lib/colors'
+import type { FunnelStepWithConversionMetrics } from '../../../types'
+import type {
+ InsightFilter,
+ ResultCustomizationByPosition,
+ ResultCustomizationByValue,
+} from '../../schema/schema-general'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface resultCustomizationsModalLogicValues {
+ funnelsResultCustomizations: Record<string, ResultCustomizationByValue> | undefined // funnelDataLogic
+ getFunnelsColorToken: (
+ dataset: FlattenedFunnelStepByBreakdown | FunnelStepWithConversionMetrics
+ ) => [DataColorTheme | null, DataColorToken | null] // funnelDataLogic
+ insightFilter: InsightFilter | null | undefined // insightVizDataLogic
+ isFunnels: boolean // insightVizDataLogic
+ isStickiness: boolean // insightVizDataLogic
+ isTrends: boolean // insightVizDataLogic
+ getTrendsColorToken: (dataset: IndexedTrendResult) => [DataColorTheme | null, DataColorToken | null] // trendsDataLogic
+ resultCustomizationBy: ResultCustomizationBy // trendsDataLogic
+ trendsResultCustomizations:
+ | Record<string, ResultCustomizationByValue>
+ | Record<number, ResultCustomizationByPosition>
+ | undefined // trendsDataLogic
+ colorToken: DataColorToken | null
+ colorTokenFromQuery: DataColorToken | null
+ dataset: FlattenedFunnelStepByBreakdown | IndexedTrendResult | null
+ localColorToken: DataColorToken | null
+ localColorTokenTouched: boolean
+ modalVisible: boolean
+ resultCustomizations:
+ | Record<string, ResultCustomizationByValue>
+ | Record<number, ResultCustomizationByPosition>
+ | null
+ | undefined
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface resultCustomizationsModalLogicActions {
+ updateInsightFilter: (insightFilter: InsightFilter) => {
+ insightFilter: InsightFilter
+ } // insightVizDataLogic
+ clearColorToken: () => {
+ value: true
+ }
+ closeModal: () => {
+ value: true
+ }
+ openModal: (dataset: FlattenedFunnelStepByBreakdown | IndexedTrendResult) => {
+ dataset: FlattenedFunnelStepByBreakdown | IndexedTrendResult
+ }
+ save: () => {
+ value: true
+ }
+ setColorToken: (token: DataColorToken) => {
+ token: DataColorToken
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface resultCustomizationsModalLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ modalVisible: (dataset: FlattenedFunnelStepByBreakdown | IndexedTrendResult | null) => boolean
+ colorToken: (
+ localColorToken: DataColorToken | null,
+ localColorTokenTouched: boolean,
+ colorTokenFromQuery: DataColorToken | null
+ ) => DataColorToken | null
+ colorTokenFromQuery: (
+ isTrends: boolean,
+ isStickiness: boolean,
+ isFunnels: boolean,
+ getTrendsColorToken: (dataset: IndexedTrendResult) => [DataColorTheme | null, DataColorToken | null],
+ getFunnelsColorToken: (
+ dataset: FlattenedFunnelStepByBreakdown | FunnelStepWithConversionMetrics
+ ) => [DataColorTheme | null, DataColorToken | null],
+ dataset: FlattenedFunnelStepByBreakdown | IndexedTrendResult | null
+ ) => DataColorToken | null
+ resultCustomizations: (
+ isTrends: boolean,
+ isStickiness: boolean,
+ isFunnels: boolean,
+ trendsResultCustomizations:
+ | Record<string, ResultCustomizationByValue>
+ | Record<number, ResultCustomizationByPosition>
+ | undefined,
+ funnelsResultCustomizations: Record<string, ResultCustomizationByValue> | undefined
+ ) =>
+ | Record<string, ResultCustomizationByValue>
+ | Record<number, ResultCustomizationByPosition>
+ | null
+ | undefined
+ }
+}
+
+export type resultCustomizationsModalLogicType = MakeLogicType<
+ resultCustomizationsModalLogicValues,
+ resultCustomizationsModalLogicActions,
+ InsightLogicProps,
+ resultCustomizationsModalLogicMeta
+>
export const resultCustomizationsModalLogic = kea<resultCustomizationsModalLogicType>([
props({} as InsightLogicProps),
@@ -72,21 +173,31 @@ export const resultCustomizationsModalLogic = kea<resultCustomizationsModalLogic
}),
selectors({
- modalVisible: [(s) => [s.dataset], (dataset): boolean => dataset !== null],
+ modalVisible: [
+ (s) => [s.dataset],
+ (dataset: FlattenedFunnelStepByBreakdown | IndexedTrendResult | null): boolean => dataset !== null,
+ ],
colorToken: [
(s) => [s.localColorToken, s.localColorTokenTouched, s.colorTokenFromQuery],
- (localColorToken, localColorTokenTouched, colorTokenFromQuery): DataColorToken | null =>
- localColorTokenTouched ? localColorToken : colorTokenFromQuery,
+ (
+ localColorToken: DataColorToken | null,
+ localColorTokenTouched: boolean,
+ colorTokenFromQuery: DataColorToken | null
+ ): DataColorToken | null => (localColorTokenTouched ? localColorToken : colorTokenFromQuery),
],
colorTokenFromQuery: [
(s) => [s.isTrends, s.isStickiness, s.isFunnels, s.getTrendsColorToken, s.getFunnelsColorToken, s.dataset],
(
- isTrends,
- isStickiness,
- isFunnels,
- getTrendsColorToken,
- getFunnelsColorToken,
- dataset
+ isTrends: boolean,
+ isStickiness: boolean,
+ isFunnels: boolean,
+ getTrendsColorToken: (
+ dataset: IndexedTrendResult
+ ) => [null | import('lib/colors').DataColorTheme, DataColorToken | null],
+ getFunnelsColorToken: (
+ dataset: FlattenedFunnelStepByBreakdown | import('~/types').FunnelStepWithConversionMetrics
+ ) => [null | import('lib/colors').DataColorTheme, DataColorToken | null],
+ dataset: FlattenedFunnelStepByBreakdown | IndexedTrendResult | null
): DataColorToken | null => {
if (!dataset) {
return null
@@ -109,7 +220,18 @@ export const resultCustomizationsModalLogic = kea<resultCustomizationsModalLogic
s.trendsResultCustomizations,
s.funnelsResultCustomizations,
],
- (isTrends, isStickiness, isFunnels, trendsResultCustomizations, funnelsResultCustomizations) => {
+ (
+ isTrends: boolean,
+ isStickiness: boolean,
+ isFunnels: boolean,
+ trendsResultCustomizations:
+ | Record<string, import('~/queries/schema/schema-general').ResultCustomizationByValue>
+ | Record<number, import('~/queries/schema/schema-general').ResultCustomizationByPosition>
+ | undefined,
+ funnelsResultCustomizations:
+ | Record<string, import('~/queries/schema/schema-general').ResultCustomizationByValue>
+ | undefined
+ ) => {
if (isTrends || isStickiness) {
return trendsResultCustomizations
} else if (isFunnels) {
diff --git a/frontend/src/scenes/comments/commentsLogic.ts b/frontend/src/scenes/comments/commentsLogic.ts
index 29804a1cd3ba..572bf539e35a 100644
--- a/frontend/src/scenes/comments/commentsLogic.ts
+++ b/frontend/src/scenes/comments/commentsLogic.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 { subscriptions } from 'kea-subscriptions'
@@ -13,7 +13,8 @@ import { userLogic } from 'scenes/userLogic'
import { sidePanelDiscussionLogic } from '~/layout/navigation-3000/sidepanel/panels/discussion/sidePanelDiscussionLogic'
import { CommentType } from '~/types'
-import type { commentsLogicType } from './commentsLogicType'
+import type { UserType } from '../../types'
+import type { OrganizationMemberType } from '../../types'
import { discussionsSlug, getTextContent } from './utils'
export type CommentsLogicProps = {
@@ -34,6 +35,255 @@ export type CommentContext = {
callback?: (event: { sent: boolean }) => void
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface commentsLogicValues {
+ meFirstMembers: OrganizationMemberType[] // membersLogic
+ currentProjectId: number | string // teamLogic
+ user: UserType | null // userLogic
+ commentContexts: Record<string, string>
+ comments: CommentType[] | null
+ commentsLoading: boolean
+ commentsWithReplies: CommentWithRepliesType[]
+ disabledReasonFor: (comment: CommentType) => string | null
+ editingComment: CommentType | null
+ editingCommentExistingMentions: number[] | null
+ editingCommentRichContentEditor: RichContentEditorType | null
+ emojiReactionsByComment: Record<string, Record<string, CommentType[]>>
+ isEditingCommentEmpty: boolean
+ isEmpty: boolean
+ isMyComment: (comment: CommentType) => boolean
+ itemContext: CommentContext | null
+ key: string
+ replyingCommentId: string | null
+ richContentEditor: RichContentEditorType | null
+ selectedCommentId: string | null
+ sortedComments: CommentType[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface commentsLogicActions {
+ ensureAllMembersLoaded: () => {
+ value: true
+ } // membersLogic
+ incrementCommentCount: () => any // sidePanelDiscussionLogic
+ scrollToLastComment: () => {
+ value: true
+ } // sidePanelDiscussionLogic
+ clearItemContext: () => {
+ value: true
+ }
+ completeComment: (comment: CommentType) => {
+ comment: CommentType
+ }
+ completeCommentFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ completeCommentSuccess: (
+ comments: CommentType[],
+ payload?: {
+ comment: CommentType
+ }
+ ) => {
+ comments: CommentType[]
+ payload?: {
+ comment: CommentType
+ }
+ }
+ deleteComment: (comment: CommentType) => {
+ comment: CommentType
+ }
+ deleteCommentFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deleteCommentSuccess: (
+ comments: CommentType[] | null,
+ payload?: {
+ comment: CommentType
+ }
+ ) => {
+ comments: CommentType[] | null
+ payload?: {
+ comment: CommentType
+ }
+ }
+ focusComposer: () => {
+ value: true
+ }
+ loadComments: () => {
+ value: true
+ }
+ loadCommentsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadCommentsSuccess: (
+ comments: CommentType[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ comments: CommentType[]
+ payload?: {
+ value: true
+ }
+ }
+ maybeLoadComments: () => {
+ value: true
+ }
+ onEditingCommentRichContentEditorUpdate: (isEmpty: boolean) => {
+ isEmpty: boolean
+ }
+ onRichContentEditorUpdate: (isEmpty: boolean) => {
+ isEmpty: boolean
+ }
+ persistEditedComment: () => {
+ value: true
+ }
+ persistEditedCommentFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ persistEditedCommentSuccess: (
+ comments: CommentType[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ comments: CommentType[]
+ payload?: {
+ value: true
+ }
+ }
+ reopenComment: (comment: CommentType) => {
+ comment: CommentType
+ }
+ reopenCommentFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ reopenCommentSuccess: (
+ comments: CommentType[],
+ payload?: {
+ comment: CommentType
+ }
+ ) => {
+ comments: CommentType[]
+ payload?: {
+ comment: CommentType
+ }
+ }
+ sendComposedContent: (asTask?: boolean) => {
+ asTask: boolean
+ }
+ sendComposedContentFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ sendComposedContentSuccess: (
+ comments: CommentType[],
+ payload?: {
+ asTask: boolean
+ }
+ ) => {
+ comments: CommentType[]
+ payload?: {
+ asTask: boolean
+ }
+ }
+ sendEmojiReaction: (
+ emoji: string,
+ sourceCommentId: string
+ ) => {
+ emoji: string
+ sourceCommentId: string
+ }
+ sendEmojiReactionFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ sendEmojiReactionSuccess: (
+ comments: CommentType[],
+ payload?: {
+ emoji: string
+ sourceCommentId: string
+ }
+ ) => {
+ comments: CommentType[]
+ payload?: {
+ emoji: string
+ sourceCommentId: string
+ }
+ }
+ setCommentContexts: (contexts: Record<string, string>) => {
+ contexts: Record<string, string>
+ }
+ setEditingComment: (comment: CommentType | null) => {
+ comment: CommentType | null
+ }
+ setEditingCommentRichContentEditor: (editor: RichContentEditorType | null) => {
+ editor: RichContentEditorType | null
+ }
+ setItemContext: (
+ context: Record<string, any> | null,
+ callback?: (event: { sent: boolean }) => void
+ ) => {
+ callback: ((event: { sent: boolean }) => void) | undefined
+ context: Record<string, any> | null
+ }
+ setReplyingComment: (commentId: string | null) => {
+ commentId: string | null
+ }
+ setRichContentEditor: (editor: RichContentEditorType) => {
+ editor: RichContentEditorType
+ }
+ setSelectedComment: (commentId: string | null) => {
+ commentId: string | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface commentsLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ key: (arg: any) => string
+ sortedComments: (comments: CommentType[] | null) => CommentType[]
+ commentsWithReplies: (sortedComments: CommentType[]) => CommentWithRepliesType[]
+ emojiReactionsByComment: (sortedComments: CommentType[]) => Record<string, Record<string, CommentType[]>>
+ isMyComment: (user: UserType | null) => (comment: CommentType) => boolean
+ disabledReasonFor: (user: UserType | null) => (comment: CommentType) => string | null
+ }
+}
+
+export type commentsLogicType = MakeLogicType<
+ commentsLogicValues,
+ commentsLogicActions,
+ CommentsLogicProps,
+ commentsLogicMeta
+>
+
export const commentsLogic = kea<commentsLogicType>([
path(() => ['scenes', 'notebooks', 'Notebook', 'commentsLogic']),
props({} as CommentsLogicProps),
@@ -328,14 +578,14 @@ export const commentsLogic = kea<commentsLogicType>([
key: [() => [(_, props) => props], (props): string => `${props.scope}-${props.item_id || ''}`],
sortedComments: [
(s) => [s.comments],
- (comments) => {
+ (comments: CommentType[] | null) => {
return comments?.sort((a, b) => (a.created_at > b.created_at ? 1 : -1)) ?? []
},
],
commentsWithReplies: [
(s) => [s.sortedComments],
- (sortedComments) => {
+ (sortedComments: CommentType[]) => {
// NOTE: We build a tree of comments and replies here.
// Comments may have been deleted so if we have a reply to a comment that no longer exists,
// we still create the CommentWithRepliesType but with a null comment.
@@ -394,14 +644,14 @@ export const commentsLogic = kea<commentsLogicType>([
isMyComment: [
(s) => [s.user],
- (user) => {
+ (user: null | import('~/types').UserType) => {
return (comment: CommentType): boolean => comment.created_by?.uuid === user?.uuid
},
],
disabledReasonFor: [
(s) => [s.user],
- (user) => {
+ (user: null | import('~/types').UserType) => {
return (comment: CommentType): string | null =>
comment.created_by?.uuid === user?.uuid ? null : 'You can only delete your own comments'
},
diff --git a/frontend/src/scenes/dashboard/dashboardLogic.tsx b/frontend/src/scenes/dashboard/dashboardLogic.tsx
index b5a60070181a..262b9a40ff45 100644
--- a/frontend/src/scenes/dashboard/dashboardLogic.tsx
+++ b/frontend/src/scenes/dashboard/dashboardLogic.tsx
@@ -907,7 +907,7 @@ export const dashboardLogic = kea<dashboardLogicType>([
} as DashboardType<QueryBasedInsightModel>
},
[dashboardsModel.actionTypes.tileMovedToDashboard]: (state, { tile, dashboardId }) => {
- if (state?.id === dashboardId) {
+ if (state && state.id === dashboardId) {
return {
...state,
tiles: [...state.tiles, tile],
@@ -917,7 +917,15 @@ export const dashboardLogic = kea<dashboardLogicType>([
},
[dashboardsModel.actionTypes.updateDashboardInsight]: (
state,
- { insight, extraDashboardIds, sourceDashboardId }
+ {
+ insight,
+ extraDashboardIds,
+ sourceDashboardId,
+ }: {
+ insight: QueryBasedInsightModel
+ extraDashboardIds?: number[]
+ sourceDashboardId?: number
+ }
) => {
if (sourceDashboardId != null && sourceDashboardId !== props.id) {
// Insight payload is from another dashboard's refresh; merged query/date range must not leak here.
@@ -2141,7 +2149,15 @@ export const dashboardLogic = kea<dashboardLogicType>([
actions.applyPendingInsertion()
}
},
- [dashboardsModel.actionTypes.updateDashboardInsight]: ({ insight, extraDashboardIds, sourceDashboardId }) => {
+ [dashboardsModel.actionTypes.updateDashboardInsight]: ({
+ insight,
+ extraDashboardIds,
+ sourceDashboardId,
+ }: {
+ insight: QueryBasedInsightModel
+ extraDashboardIds?: number[]
+ sourceDashboardId?: number
+ }) => {
if (sourceDashboardId != null && sourceDashboardId !== props.id) {
// Same rationale as the reducer: ignore refresh payloads scoped to another dashboard.
return
diff --git a/frontend/src/scenes/dashboard/duplicateDashboardLogic.ts b/frontend/src/scenes/dashboard/duplicateDashboardLogic.ts
index 7694911e5bd5..53c8dc1e63b5 100644
--- a/frontend/src/scenes/dashboard/duplicateDashboardLogic.ts
+++ b/frontend/src/scenes/dashboard/duplicateDashboardLogic.ts
@@ -6,6 +6,7 @@ import { urls } from 'scenes/urls'
import { dashboardsModel } from '~/models/dashboardsModel'
import { insightsModel } from '~/models/insightsModel'
+import { DashboardType, QueryBasedInsightModel } from '~/types'
import type { duplicateDashboardLogicType } from './duplicateDashboardLogicType'
@@ -63,7 +64,13 @@ export const duplicateDashboardLogic = kea<duplicateDashboardLogicType>([
hideDuplicateDashboardModal: () => {
actions.resetDuplicateDashboard()
},
- [dashboardsModel.actionTypes.duplicateDashboardSuccess]: ({ dashboard, payload }) => {
+ [dashboardsModel.actionTypes.duplicateDashboardSuccess]: ({
+ dashboard,
+ payload,
+ }: {
+ dashboard: DashboardType<QueryBasedInsightModel>
+ payload?: Pick<DuplicateDashboardForm, 'duplicateTiles' | 'show'>
+ }) => {
actions.hideDuplicateDashboardModal()
if (!payload?.duplicateTiles) {
diff --git a/frontend/src/scenes/feature-flags/defaultEvaluationContextsLogic.ts b/frontend/src/scenes/feature-flags/defaultEvaluationContextsLogic.ts
index 54ec563ae372..8a47539269aa 100644
--- a/frontend/src/scenes/feature-flags/defaultEvaluationContextsLogic.ts
+++ b/frontend/src/scenes/feature-flags/defaultEvaluationContextsLogic.ts
@@ -1,11 +1,11 @@
-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 api from 'lib/api'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { teamLogic } from 'scenes/teamLogic'
-import type { defaultEvaluationContextsLogicType } from './defaultEvaluationContextsLogicType'
+import type { TeamPublicType, TeamType } from '../../types'
export interface DefaultEvaluationContext {
id: number | string
@@ -19,6 +19,204 @@ export interface DefaultEvaluationContextsResponse {
enabled: boolean
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface defaultEvaluationContextsLogicValues {
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ availableContexts: string[]
+ canAddMoreContexts: boolean
+ contexts: DefaultEvaluationContext[]
+ defaultEvaluationContexts: DefaultEvaluationContextsResponse | null
+ defaultEvaluationContextsLoading: boolean
+ hiddenContexts: string[]
+ isAdding: boolean
+ isEnabled: boolean
+ newContextInput: string
+ pendingContextName: string | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface defaultEvaluationContextsLogicActions {
+ updateCurrentTeam: (payload: Partial<TeamType>) => Partial<TeamType> // teamLogic
+ addContext: (contextName: string) => {
+ contextName: string
+ }
+ addContextFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ addContextSuccess: (
+ defaultEvaluationContexts: {
+ available_contexts: any[]
+ default_evaluation_contexts: {
+ id: any
+ name: any
+ }[]
+ enabled: boolean
+ hidden_contexts: string[]
+ } | null,
+ payload?: {
+ contextName: string
+ }
+ ) => {
+ defaultEvaluationContexts: {
+ available_contexts: any[]
+ default_evaluation_contexts: {
+ id: any
+ name: any
+ }[]
+ enabled: boolean
+ hidden_contexts: string[]
+ } | null
+ payload?: {
+ contextName: string
+ }
+ }
+ hideContext: (contextName: string) => {
+ contextName: string
+ }
+ hideContextFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ hideContextSuccess: (
+ defaultEvaluationContexts: {
+ available_contexts: string[]
+ default_evaluation_contexts: DefaultEvaluationContext[]
+ enabled: boolean
+ hidden_contexts: string[]
+ } | null,
+ payload?: {
+ contextName: string
+ }
+ ) => {
+ defaultEvaluationContexts: {
+ available_contexts: string[]
+ default_evaluation_contexts: DefaultEvaluationContext[]
+ enabled: boolean
+ hidden_contexts: string[]
+ } | null
+ payload?: {
+ contextName: string
+ }
+ }
+ loadDefaultEvaluationContexts: () => {
+ value: true
+ }
+ loadDefaultEvaluationContextsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadDefaultEvaluationContextsSuccess: (
+ defaultEvaluationContexts: DefaultEvaluationContextsResponse | null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ defaultEvaluationContexts: DefaultEvaluationContextsResponse | null
+ payload?: {
+ value: true
+ }
+ }
+ removeContext: (contextName: string) => {
+ contextName: string
+ }
+ removeContextFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ removeContextSuccess: (
+ defaultEvaluationContexts: {
+ available_contexts: string[]
+ default_evaluation_contexts: DefaultEvaluationContext[]
+ enabled: boolean
+ hidden_contexts: string[]
+ } | null,
+ payload?: {
+ contextName: string
+ }
+ ) => {
+ defaultEvaluationContexts: {
+ available_contexts: string[]
+ default_evaluation_contexts: DefaultEvaluationContext[]
+ enabled: boolean
+ hidden_contexts: string[]
+ } | null
+ payload?: {
+ contextName: string
+ }
+ }
+ setIsAdding: (isAdding: boolean) => {
+ isAdding: boolean
+ }
+ setNewContextInput: (value: string) => {
+ value: string
+ }
+ toggleEnabled: (enabled: boolean) => {
+ enabled: boolean
+ }
+ unhideContext: (contextName: string) => {
+ contextName: string
+ }
+ unhideContextFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ unhideContextSuccess: (
+ defaultEvaluationContexts: {
+ available_contexts: string[]
+ default_evaluation_contexts: DefaultEvaluationContext[]
+ enabled: boolean
+ hidden_contexts: string[]
+ } | null,
+ payload?: {
+ contextName: string
+ }
+ ) => {
+ defaultEvaluationContexts: {
+ available_contexts: string[]
+ default_evaluation_contexts: DefaultEvaluationContext[]
+ enabled: boolean
+ hidden_contexts: string[]
+ } | null
+ payload?: {
+ contextName: string
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface defaultEvaluationContextsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ contexts: (defaultEvaluationContexts: DefaultEvaluationContextsResponse | null) => DefaultEvaluationContext[]
+ availableContexts: (defaultEvaluationContexts: DefaultEvaluationContextsResponse | null) => string[]
+ hiddenContexts: (defaultEvaluationContexts: DefaultEvaluationContextsResponse | null) => string[]
+ isEnabled: (currentTeam: TeamPublicType | TeamType | null) => boolean
+ canAddMoreContexts: (contexts: DefaultEvaluationContext[]) => boolean
+ }
+}
+
+export type defaultEvaluationContextsLogicType = MakeLogicType<
+ defaultEvaluationContextsLogicValues,
+ defaultEvaluationContextsLogicActions,
+ Record<string, any>,
+ defaultEvaluationContextsLogicMeta
+>
+
export const defaultEvaluationContextsLogic = kea<defaultEvaluationContextsLogicType>([
path(['scenes', 'feature-flags', 'defaultEvaluationContextsLogic']),
@@ -232,16 +430,30 @@ export const defaultEvaluationContextsLogic = kea<defaultEvaluationContextsLogic
selectors({
contexts: [
(s) => [s.defaultEvaluationContexts],
- (data): DefaultEvaluationContext[] => data?.default_evaluation_contexts || [],
+ (data: DefaultEvaluationContextsResponse | null): DefaultEvaluationContext[] =>
+ data?.default_evaluation_contexts || [],
],
- availableContexts: [(s) => [s.defaultEvaluationContexts], (data): string[] => data?.available_contexts || []],
+ availableContexts: [
+ (s) => [s.defaultEvaluationContexts],
+ (data: DefaultEvaluationContextsResponse | null): string[] => data?.available_contexts || [],
+ ],
- hiddenContexts: [(s) => [s.defaultEvaluationContexts], (data): string[] => data?.hidden_contexts || []],
+ hiddenContexts: [
+ (s) => [s.defaultEvaluationContexts],
+ (data: DefaultEvaluationContextsResponse | null): string[] => data?.hidden_contexts || [],
+ ],
- isEnabled: [(s) => [s.currentTeam], (team): boolean => team?.default_evaluation_contexts_enabled || false],
+ isEnabled: [
+ (s) => [s.currentTeam],
+ (team: null | import('../../types').TeamPublicType | import('../../types').TeamType): boolean =>
+ team?.default_evaluation_contexts_enabled || false,
+ ],
- canAddMoreContexts: [(s) => [s.contexts], (contexts): boolean => contexts.length < 10],
+ canAddMoreContexts: [
+ (s) => [s.contexts],
+ (contexts: DefaultEvaluationContext[]): boolean => contexts.length < 10,
+ ],
}),
afterMount(({ actions }) => {
diff --git a/frontend/src/scenes/feature-flags/defaultReleaseConditionsLogic.ts b/frontend/src/scenes/feature-flags/defaultReleaseConditionsLogic.ts
index e2cb81169d2f..1cb119ce2341 100644
--- a/frontend/src/scenes/feature-flags/defaultReleaseConditionsLogic.ts
+++ b/frontend/src/scenes/feature-flags/defaultReleaseConditionsLogic.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 api from 'lib/api'
@@ -8,7 +8,7 @@ import { teamLogic } from 'scenes/teamLogic'
import { FeatureFlagFilters, FeatureFlagGroupType } from '~/types'
-import type { defaultReleaseConditionsLogicType } from './defaultReleaseConditionsLogicType'
+import type { TeamPublicType, TeamType } from '../../types'
import { uniformAggregationGroupTypeIndex } from './defaultReleaseConditionsUtils'
export interface DefaultReleaseConditionsResponse {
@@ -43,6 +43,83 @@ export async function resolveDefaultReleaseConditions(
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface defaultReleaseConditionsLogicValues {
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ defaultReleaseConditions: DefaultReleaseConditionsResponse | null
+ defaultReleaseConditionsLoading: boolean
+ filtersForEditor: FeatureFlagFilters
+ groups: FeatureFlagGroupType[]
+ hasChanges: boolean
+ isEnabled: boolean
+ localEnabled: boolean
+ localGroups: FeatureFlagGroupType[] | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface defaultReleaseConditionsLogicActions {
+ discardChanges: () => {
+ value: true
+ }
+ loadDefaultReleaseConditions: () => any
+ loadDefaultReleaseConditionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadDefaultReleaseConditionsSuccess: (
+ defaultReleaseConditions: DefaultReleaseConditionsResponse | null,
+ payload?: any
+ ) => {
+ defaultReleaseConditions: DefaultReleaseConditionsResponse | null
+ payload?: any
+ }
+ saveDefaultReleaseConditions: () => any
+ saveDefaultReleaseConditionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ saveDefaultReleaseConditionsSuccess: (
+ defaultReleaseConditions: DefaultReleaseConditionsResponse,
+ payload?: any
+ ) => {
+ defaultReleaseConditions: DefaultReleaseConditionsResponse
+ payload?: any
+ }
+ setLocalEnabled: (enabled: boolean) => {
+ enabled: boolean
+ }
+ setLocalGroups: (groups: FeatureFlagGroupType[]) => {
+ groups: FeatureFlagGroupType[]
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface defaultReleaseConditionsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ isEnabled: (localEnabled: boolean) => boolean
+ groups: (localGroups: FeatureFlagGroupType[] | null) => FeatureFlagGroupType[]
+ filtersForEditor: (groups: FeatureFlagGroupType[]) => FeatureFlagFilters
+ hasChanges: (
+ localGroups: FeatureFlagGroupType[] | null,
+ localEnabled: boolean,
+ defaultReleaseConditions: DefaultReleaseConditionsResponse | null
+ ) => boolean
+ }
+}
+
+export type defaultReleaseConditionsLogicType = MakeLogicType<
+ defaultReleaseConditionsLogicValues,
+ defaultReleaseConditionsLogicActions,
+ Record<string, any>,
+ defaultReleaseConditionsLogicMeta
+>
+
export const defaultReleaseConditionsLogic = kea<defaultReleaseConditionsLogicType>([
path(['scenes', 'feature-flags', 'defaultReleaseConditionsLogic']),
@@ -114,13 +191,16 @@ export const defaultReleaseConditionsLogic = kea<defaultReleaseConditionsLogicTy
})),
selectors({
- isEnabled: [(s) => [s.localEnabled], (enabled): boolean => enabled],
+ isEnabled: [(s) => [s.localEnabled], (enabled: boolean): boolean => enabled],
- groups: [(s) => [s.localGroups], (localGroups): FeatureFlagGroupType[] => localGroups ?? []],
+ groups: [
+ (s) => [s.localGroups],
+ (localGroups: FeatureFlagGroupType[] | null): FeatureFlagGroupType[] => localGroups ?? [],
+ ],
filtersForEditor: [
(s) => [s.groups],
- (groups): FeatureFlagFilters => ({
+ (groups: FeatureFlagGroupType[]): FeatureFlagFilters => ({
groups: groups.length > 0 ? groups : [{ properties: [], rollout_percentage: 0, variant: null }],
multivariate: null,
payloads: {},
@@ -130,7 +210,11 @@ export const defaultReleaseConditionsLogic = kea<defaultReleaseConditionsLogicTy
hasChanges: [
(s) => [s.localGroups, s.localEnabled, s.defaultReleaseConditions],
- (localGroups, localEnabled, saved): boolean => {
+ (
+ localGroups: FeatureFlagGroupType[] | null,
+ localEnabled: boolean,
+ saved: DefaultReleaseConditionsResponse | null
+ ): boolean => {
if (!saved) {
return false
}
diff --git a/frontend/src/scenes/feature-flags/featureFlagConditionWarningLogic.ts b/frontend/src/scenes/feature-flags/featureFlagConditionWarningLogic.ts
index b7696f656d36..566c9aed6584 100644
--- a/frontend/src/scenes/feature-flags/featureFlagConditionWarningLogic.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagConditionWarningLogic.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 { isPropertyFilterWithOperator } from 'lib/components/PropertyFilters/utils'
import { stringifyWithBigInts } from 'lib/utils/json'
@@ -6,8 +6,6 @@ import { stringifyWithBigInts } from 'lib/utils/json'
import { cohortsModel } from '~/models/cohortsModel'
import { AnyPropertyFilter, CohortType, FeatureFlagEvaluationRuntime, PropertyFilterType } from '~/types'
-import type { featureFlagConditionWarningLogicType } from './featureFlagConditionWarningLogicType'
-
export interface FeatureFlagConditionWarningLogicProps {
properties: AnyPropertyFilter[]
evaluationRuntime: FeatureFlagEvaluationRuntime
@@ -17,6 +15,31 @@ const REGEX_LOOKAHEAD = /(?<!\\)\(\?[=!]/ // (?= or (?!
const REGEX_LOOKBEHIND = /(?<!\\)\(\?<[=!]/ // or (?<!
const REGEX_BACKREFERENCE = /(?<!\\)\\[1-9]/ // \1 through \9
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagConditionWarningLogicValues {
+ cohortsById: Partial<Record<number | string, CohortType>> // cohortsModel
+ warning: string | undefined
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagConditionWarningLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ warning: (
+ cohortsById: Partial<Record<number | string, CohortType>>,
+ properties: AnyPropertyFilter[],
+ evaluationRuntime: FeatureFlagEvaluationRuntime
+ ) => string | undefined
+ }
+}
+
+export type featureFlagConditionWarningLogicType = MakeLogicType<
+ featureFlagConditionWarningLogicValues,
+ {},
+ FeatureFlagConditionWarningLogicProps,
+ featureFlagConditionWarningLogicMeta
+>
+
export const featureFlagConditionWarningLogic = kea<featureFlagConditionWarningLogicType>([
path(['scenes', 'feature-flags', 'featureFlagConditionWarningLogic']),
props({} as FeatureFlagConditionWarningLogicProps),
diff --git a/frontend/src/scenes/feature-flags/featureFlagConfirmationLogic.ts b/frontend/src/scenes/feature-flags/featureFlagConfirmationLogic.ts
index 740c98b8e09b..9a78c3f91398 100644
--- a/frontend/src/scenes/feature-flags/featureFlagConfirmationLogic.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagConfirmationLogic.ts
@@ -1,11 +1,10 @@
-import { actions, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { objectsEqual } from 'lib/utils/objects'
import { FeatureFlagType } from '~/types'
import { openConfirmationModal } from './ConfirmationModal'
-import type { featureFlagConfirmationLogicType } from './featureFlagConfirmationLogicType'
import { DependentFlag } from './featureFlagLogic'
/**
@@ -155,6 +154,41 @@ export interface FeatureFlagConfirmationLogicProps {
onConfirm: () => void
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagConfirmationLogicValues {
+ flagChanges: string[]
+ hasChanges: boolean
+ showSaveConfirmModal: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagConfirmationLogicActions {
+ confirmChanges: () => {
+ value: true
+ }
+ setFlagChanges: (changes: string[]) => {
+ changes: string[]
+ }
+ showConfirmationModal: (show: boolean) => {
+ show: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagConfirmationLogicMeta {
+ key: number | 'new'
+ __keaTypeGenInternalSelectorTypes: {
+ hasChanges: (flagChanges: string[]) => boolean
+ }
+}
+
+export type featureFlagConfirmationLogicType = MakeLogicType<
+ featureFlagConfirmationLogicValues,
+ featureFlagConfirmationLogicActions,
+ FeatureFlagConfirmationLogicProps,
+ featureFlagConfirmationLogicMeta
+>
+
export const featureFlagConfirmationLogic = kea<featureFlagConfirmationLogicType>([
path(['scenes', 'feature-flags', 'featureFlagConfirmationLogic']),
props({} as FeatureFlagConfirmationLogicProps),
diff --git a/frontend/src/scenes/feature-flags/featureFlagConfirmationSettingsLogic.ts b/frontend/src/scenes/feature-flags/featureFlagConfirmationSettingsLogic.ts
index 52dd58b8ff10..31818f338350 100644
--- a/frontend/src/scenes/feature-flags/featureFlagConfirmationSettingsLogic.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagConfirmationSettingsLogic.ts
@@ -1,16 +1,110 @@
-import { afterMount, connect, kea, listeners, path } from 'kea'
+import { MakeLogicType, afterMount, connect, kea, listeners, path } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { loaders } from 'kea-loaders'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { teamLogic } from 'scenes/teamLogic'
-import type { featureFlagConfirmationSettingsLogicType } from './featureFlagConfirmationSettingsLogicType'
+import type { TeamPublicType, TeamType } from '../../types'
export type ConfirmationMessageForm = {
message: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagConfirmationSettingsLogicValues {
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ confirmationMessage: string | null
+ confirmationMessageForm: ConfirmationMessageForm
+ confirmationMessageFormAllErrors: Record<string, any>
+ confirmationMessageFormChanged: boolean
+ confirmationMessageFormErrors: DeepPartialMap<ConfirmationMessageForm, ValidationErrorType>
+ confirmationMessageFormHasErrors: boolean
+ confirmationMessageFormManualErrors: Record<string, any>
+ confirmationMessageFormTouched: boolean
+ confirmationMessageFormTouches: Record<string, boolean>
+ confirmationMessageFormValidationErrors: DeepPartialMap<ConfirmationMessageForm, ValidationErrorType>
+ confirmationMessageLoading: boolean
+ isConfirmationMessageFormSubmitting: boolean
+ isConfirmationMessageFormValid: boolean
+ showConfirmationMessageFormErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagConfirmationSettingsLogicActions {
+ loadCurrentTeamSuccess: (
+ currentTeam: TeamPublicType | null,
+ payload?: any
+ ) => {
+ currentTeam: TeamPublicType | null
+ payload?: any
+ } // teamLogic
+ updateCurrentTeam: (payload: Partial<TeamType>) => Partial<TeamType> // teamLogic
+ updateCurrentTeamSuccess: (
+ currentTeam: TeamPublicType | TeamType,
+ payload?: Partial<TeamType>
+ ) => {
+ currentTeam: TeamPublicType | TeamType
+ payload?: Partial<TeamType>
+ } // teamLogic
+ resetConfirmationMessageForm: (values?: ConfirmationMessageForm) => {
+ values?: ConfirmationMessageForm
+ }
+ setConfirmationMessageFormManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setConfirmationMessageFormValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setConfirmationMessageFormValues: (values: DeepPartial<ConfirmationMessageForm>) => {
+ values: DeepPartial<ConfirmationMessageForm>
+ }
+ submitConfirmationMessageForm: () => {
+ value: boolean
+ }
+ submitConfirmationMessageFormFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitConfirmationMessageFormRequest: (confirmationMessageForm: ConfirmationMessageForm) => {
+ confirmationMessageForm: ConfirmationMessageForm
+ }
+ submitConfirmationMessageFormSuccess: (confirmationMessageForm: ConfirmationMessageForm) => {
+ confirmationMessageForm: ConfirmationMessageForm
+ }
+ touchConfirmationMessageFormField: (key: string) => {
+ key: string
+ }
+ updateConfirmationMessage: (data: ConfirmationMessageForm) => ConfirmationMessageForm
+ updateConfirmationMessageFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateConfirmationMessageSuccess: (
+ confirmationMessage: string,
+ payload?: ConfirmationMessageForm
+ ) => {
+ confirmationMessage: string
+ payload?: ConfirmationMessageForm
+ }
+}
+
+export type featureFlagConfirmationSettingsLogicType = MakeLogicType<
+ featureFlagConfirmationSettingsLogicValues,
+ featureFlagConfirmationSettingsLogicActions
+>
+
export const featureFlagConfirmationSettingsLogic = kea<featureFlagConfirmationSettingsLogicType>([
path(['scenes', 'feature-flags', 'featureFlagConfirmationSettingsLogic']),
diff --git a/frontend/src/scenes/feature-flags/featureFlagEvaluationContextsLogic.ts b/frontend/src/scenes/feature-flags/featureFlagEvaluationContextsLogic.ts
index 373244905912..432b3966dd4b 100644
--- a/frontend/src/scenes/feature-flags/featureFlagEvaluationContextsLogic.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagEvaluationContextsLogic.ts
@@ -1,6 +1,5 @@
-import { actions, kea, key, listeners, path, props, propsChanged, reducers } from 'kea'
+import { MakeLogicType, actions, kea, key, listeners, path, props, propsChanged, reducers } from 'kea'
-import type { featureFlagEvaluationContextsLogicType } from './featureFlagEvaluationContextsLogicType'
import { featureFlagLogic } from './featureFlagLogic'
export interface FeatureFlagEvaluationContextsLogicProps {
@@ -11,6 +10,54 @@ export interface FeatureFlagEvaluationContextsLogicProps {
evaluationContexts: string[]
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagEvaluationContextsLogicValues {
+ isEditingContexts: boolean
+ isEditingTags: boolean
+ localEvaluationContexts: string[]
+ localTags: string[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagEvaluationContextsLogicActions {
+ cancelEditingContexts: () => {
+ value: true
+ }
+ cancelEditingTags: () => {
+ value: true
+ }
+ saveContexts: () => {
+ value: true
+ }
+ saveTags: () => {
+ value: true
+ }
+ setIsEditingContexts: (isEditing: boolean) => {
+ isEditing: boolean
+ }
+ setIsEditingTags: (isEditing: boolean) => {
+ isEditing: boolean
+ }
+ setLocalEvaluationContexts: (evaluationContexts: string[]) => {
+ evaluationContexts: string[]
+ }
+ setLocalTags: (tags: string[]) => {
+ tags: string[]
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagEvaluationContextsLogicMeta {
+ key: string
+}
+
+export type featureFlagEvaluationContextsLogicType = MakeLogicType<
+ featureFlagEvaluationContextsLogicValues,
+ featureFlagEvaluationContextsLogicActions,
+ FeatureFlagEvaluationContextsLogicProps,
+ featureFlagEvaluationContextsLogicMeta
+>
+
export const featureFlagEvaluationContextsLogic = kea<featureFlagEvaluationContextsLogicType>([
path(['scenes', 'feature-flags', 'featureFlagEvaluationContextsLogic']),
props({} as FeatureFlagEvaluationContextsLogicProps),
diff --git a/frontend/src/scenes/feature-flags/featureFlagIntentWarningLogic.ts b/frontend/src/scenes/feature-flags/featureFlagIntentWarningLogic.ts
index 65575b9328d1..e7281fecf078 100644
--- a/frontend/src/scenes/feature-flags/featureFlagIntentWarningLogic.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagIntentWarningLogic.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 { isPropertyFilterWithOperator } from 'lib/components/PropertyFilters/utils'
import { FEATURE_FLAGS, INSTANTLY_AVAILABLE_PROPERTIES } from 'lib/constants'
@@ -14,7 +14,7 @@ import {
PropertyFilterType,
} from '~/types'
-import type { featureFlagIntentWarningLogicType } from './featureFlagIntentWarningLogicType'
+import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
import { featureFlagLogic, FeatureFlagLogicProps } from './featureFlagLogic'
export type FlagIntent = 'local-eval' | 'first-page-load'
@@ -40,6 +40,45 @@ function isGroupBroad(group: FeatureFlagGroupType): boolean {
return hasNoProperties && isFullRollout
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagIntentWarningLogicValues {
+ cohortsById: Partial<Record<number | string, CohortType>> // cohortsModel
+ enabledFeatures: FeatureFlagsSet // enabledFeaturesLogic
+ featureFlag: FeatureFlagType // featureFlagLogic
+ flagIntent: FlagIntent | null // featureFlagLogic
+ intentIssues: string[]
+ issuesExpanded: boolean
+ unreachableGroups: Set<number>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagIntentWarningLogicActions {
+ toggleIssuesExpanded: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagIntentWarningLogicMeta {
+ key: number | 'link' | 'new'
+ __keaTypeGenInternalSelectorTypes: {
+ unreachableGroups: (featureFlag: FeatureFlagType) => Set<number>
+ intentIssues: (
+ featureFlag: FeatureFlagType,
+ flagIntent: FlagIntent | null,
+ cohortsById: Partial<Record<number | string, CohortType>>,
+ enabledFeatures: FeatureFlagsSet
+ ) => string[]
+ }
+}
+
+export type featureFlagIntentWarningLogicType = MakeLogicType<
+ featureFlagIntentWarningLogicValues,
+ featureFlagIntentWarningLogicActions,
+ FeatureFlagLogicProps,
+ featureFlagIntentWarningLogicMeta
+>
+
export const featureFlagIntentWarningLogic = kea<featureFlagIntentWarningLogicType>([
path(['scenes', 'feature-flags', 'featureFlagIntentWarningLogic']),
props({} as FeatureFlagLogicProps),
diff --git a/frontend/src/scenes/feature-flags/featureFlagLogic.ts b/frontend/src/scenes/feature-flags/featureFlagLogic.ts
index a9ad3acf9188..2793064d32be 100644
--- a/frontend/src/scenes/feature-flags/featureFlagLogic.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagLogic.ts
@@ -1,6 +1,7 @@
import { CronExpressionParser } from 'cron-parser'
import cronstrue from 'cronstrue'
import {
+ MakeLogicType,
actions,
afterMount,
connect,
@@ -13,7 +14,9 @@ import {
selectors,
sharedListeners,
} from 'kea'
+import type { BreakPointFunction } from 'kea'
import { DeepPartialMap, ValidationErrorType, forms } from 'kea-forms'
+import type { DeepPartial, FieldName } from 'kea-forms'
import { loaders } from 'kea-loaders'
import { beforeUnload, router, urlToAction } from 'kea-router'
import { CombinedLocation } from 'kea-router/lib/utils'
@@ -87,14 +90,32 @@ import {
} from 'products/feature_flags/frontend/generated/api'
import type { CopyFlagsDependencyRequirementsResponseApi } from 'products/feature_flags/frontend/generated/api.schemas'
+import type { CopyFlagsResponseApi } from '../../../../products/feature_flags/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 { Node } from '../../queries/schema/schema-general'
+import type {
+ AnyPropertyFilter,
+ Experiment,
+ FeatureFlagFilters,
+ MinimalEarlyAccessFeatureType,
+ OrganizationType,
+ SidePanelTab,
+ TeamPublicType,
+ TeamType,
+ UserBasicType,
+ UserType,
+} from '../../types'
import { organizationLogic } from '../organizationLogic'
import { teamLogic } from '../teamLogic'
import { defaultEvaluationContextsLogic } from './defaultEvaluationContextsLogic'
+import type { DefaultEvaluationContextsResponse } from './defaultEvaluationContextsLogic'
import { defaultReleaseConditionsLogic, resolveDefaultReleaseConditions } from './defaultReleaseConditionsLogic'
+import type { DefaultReleaseConditionsResponse } from './defaultReleaseConditionsLogic'
import { uniformAggregationGroupTypeIndex } from './defaultReleaseConditionsUtils'
import { checkFeatureFlagConfirmation } from './featureFlagConfirmationLogic'
import type { FlagIntent } from './featureFlagIntentWarningLogic'
-import type { featureFlagLogicType } from './featureFlagLogicType'
import { flagToggleKey, updateFlagActiveInProject } from './updateFlagActiveInProject'
const VALID_INTENTS: FlagIntent[] = ['local-eval', 'first-page-load']
@@ -650,6 +671,1238 @@ function cleanFilterGroups(groups?: FeatureFlagGroupType[]): FeatureFlagGroupTyp
return groups.map(({ sort_key, ...rest }: FeatureFlagGroupType) => rest)
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagLogicValues {
+ defaultEvaluationContexts: DefaultEvaluationContextsResponse | null // defaultEvaluationContextsLogic
+ defaultReleaseConditions: DefaultReleaseConditionsResponse | null // defaultReleaseConditionsLogic
+ enabledFeatures: FeatureFlagsSet // enabledFeaturesLogic
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun // groupsModel
+ currentOrganization: OrganizationType | null // organizationLogic
+ currentOrganizationId: string // organizationLogic
+ currentProjectId: number | null // projectLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ currentTeamId: number | null // teamLogic
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean // userLogic
+ user: UserType | null // userLogic
+ accessDeniedToFeatureFlag: boolean
+ activeRecurringSchedules: ScheduledChangeType[]
+ activeSchedules: ScheduledChangeType[]
+ activeTab: FeatureFlagsTab
+ aggregationTargetName: string
+ areVariantRolloutsValid: boolean
+ breadcrumbs: Breadcrumb[]
+ canCreateEarlyAccessFeature: boolean
+ canCreatePairedSchedule: boolean
+ completedSchedules: ScheduledChangeType[]
+ copyDependencies: boolean
+ copyDependencyRequirements: CopyFlagsDependencyRequirementsResponseApi | null
+ copyDependencyRequirementsLoading: boolean
+ copyDestinationProject: number | null
+ copySchedule: boolean
+ cronExpression: string | null
+ cronPreview: string | null
+ customPairDisableCron: string
+ customPairDisableCronPreview: string | null
+ customPairEnableCron: string
+ customPairEnableCronPreview: string | null
+ dependentFlags: DependentFlag[]
+ dependentFlagsLoading: boolean
+ disableCopiedFlag: boolean
+ earlyAccessFeaturesList: MinimalEarlyAccessFeatureType[]
+ emailDomain: string
+ endDate: Dayjs | null
+ expandAdvancedOnEdit: boolean
+ experiment: any
+ experimentLoading: boolean
+ featureFlag: FeatureFlagType
+ featureFlagActiveUpdate: FeatureFlagType | null
+ featureFlagActiveUpdateLoading: boolean
+ featureFlagAllErrors: Record<string, any>
+ featureFlagChanged: boolean
+ featureFlagCopy: any
+ featureFlagCopyLoading: boolean
+ featureFlagErrors: DeepPartialMap<
+ {
+ _create_in_folder?: string | null | undefined
+ _should_create_usage_dashboard?: boolean | undefined
+ active: boolean
+ archived: boolean
+ bucketing_identifier?: FeatureFlagBucketingIdentifier | null | undefined
+ can_edit: boolean
+ created_at: string | null
+ created_by: UserBasicType | null
+ deleted: boolean
+ ensure_experience_continuity: boolean
+ evaluation_contexts: string[]
+ evaluation_runtime: FeatureFlagEvaluationRuntime
+ experiment_set: number[] | null
+ experiment_set_metadata:
+ | {
+ id: number
+ is_running: boolean
+ name: string
+ }[]
+ | null
+ features: MinimalEarlyAccessFeatureType[] | null
+ filters: FeatureFlagFilters
+ has_encrypted_payloads: boolean
+ has_enriched_analytics?: boolean | undefined
+ id: number | null
+ is_remote_configuration: boolean
+ is_used_in_replay_settings?: boolean | undefined
+ key: string
+ last_called_at?: string | null | undefined
+ last_modified_by: UserBasicType | null
+ name: string
+ status: 'ACTIVE' | 'ARCHIVED' | 'DELETED' | 'STALE' | 'UNKNOWN'
+ surveys: Survey[] | null
+ tags: string[]
+ updated_at: string | null
+ usage_dashboard?: number | undefined
+ user_access_level: AccessControlLevel
+ version: number | null
+ },
+ ValidationErrorType
+ >
+ featureFlagHasErrors: boolean
+ featureFlagKey: string
+ featureFlagLoading: boolean
+ featureFlagManualErrors: Record<string, any>
+ featureFlagMissing: boolean
+ featureFlagRefresh: FeatureFlagType | null
+ featureFlagRefreshLoading: boolean
+ featureFlagTouched: boolean
+ featureFlagTouches: Record<string, boolean>
+ featureFlagValidationErrors: DeepPartialMap<
+ {
+ _create_in_folder?: string | null | undefined
+ _should_create_usage_dashboard?: boolean | undefined
+ active: boolean
+ archived: boolean
+ bucketing_identifier?: FeatureFlagBucketingIdentifier | null | undefined
+ can_edit: boolean
+ created_at: string | null
+ created_by: UserBasicType | null
+ deleted: boolean
+ ensure_experience_continuity: boolean
+ evaluation_contexts: string[]
+ evaluation_runtime: FeatureFlagEvaluationRuntime
+ experiment_set: number[] | null
+ experiment_set_metadata:
+ | {
+ id: number
+ is_running: boolean
+ name: string
+ }[]
+ | null
+ features: MinimalEarlyAccessFeatureType[] | null
+ filters: FeatureFlagFilters
+ has_encrypted_payloads: boolean
+ has_enriched_analytics?: boolean | undefined
+ id: number | null
+ is_remote_configuration: boolean
+ is_used_in_replay_settings?: boolean | undefined
+ key: string
+ last_called_at?: string | null | undefined
+ last_modified_by: UserBasicType | null
+ name: string
+ status: 'ACTIVE' | 'ARCHIVED' | 'DELETED' | 'STALE' | 'UNKNOWN'
+ surveys: Survey[] | null
+ tags: string[]
+ updated_at: string | null
+ usage_dashboard?: number | undefined
+ user_access_level: AccessControlLevel
+ version: number | null
+ },
+ ValidationErrorType
+ >
+ flagIntent: FlagIntent | null
+ flagStatus: FeatureFlagStatusResponse | null
+ flagStatusLoading: boolean
+ flagType: 'boolean' | 'multivariate' | 'remote_config'
+ flagTypeString:
+ | 'Multiple variants with rollout percentages (A/B/n test)'
+ | 'Release toggle (boolean)'
+ | 'Remote configuration (single payload)'
+ hasEarlyAccessFeatures: boolean
+ hasEncryptedPayloadBeenSaved: boolean | undefined
+ hasExperiment: boolean | null
+ hasSurveys: boolean | null
+ hasUnsavedChanges: boolean
+ isDraftExperiment: boolean
+ isEditingFlag: boolean
+ isFeatureFlagSubmitting: boolean
+ isFeatureFlagValid: boolean
+ isFormDirty: boolean
+ isRecurring: boolean
+ multivariateEnabled: boolean
+ newCohort: CohortType | null
+ newCohortLoading: boolean
+ newEarlyAccessFeature: EarlyAccessFeatureType | null
+ newEarlyAccessFeatureLoading: boolean
+ newSurvey: Survey | null
+ newSurveyLoading: boolean
+ nonEmptyVariants: MultivariateFlagVariant[]
+ openVariants: string[]
+ originalFeatureFlag: FeatureFlagType | null
+ pausedRecurringSchedules: ScheduledChangeType[]
+ payloadExpanded: boolean
+ projectFlagsToggling: Record<string, boolean>
+ projectTreeRef: ProjectTreeRef
+ projectsWithCurrentFlag: OrganizationFeatureFlag[]
+ projectsWithCurrentFlagLoading: boolean
+ properties: AnyPropertyFilter[]
+ propertySelectErrors: any
+ props: any
+ recordingFilterForFlag: Partial<RecordingUniversalFilters>
+ recurrenceInterval: RecurrenceInterval | null
+ relatedInsights: QueryBasedInsightModel[]
+ relatedInsightsLoading: boolean
+ repeatsValue: RecurrenceInterval | 'cron' | 'none'
+ roleBasedAccessEnabled: boolean
+ scheduleDateMarker: any
+ schedulePayload: ScheduleFlagPayload
+ schedulePayloadErrors: any
+ schedulePreset: PairedPresetKey | null
+ scheduledChange: ScheduledChangeType
+ scheduledChangeLoading: boolean
+ scheduledChangeOperation: ScheduledChangeOperationType
+ scheduledChanges: ScheduledChangeType[]
+ scheduledChangesLoading: boolean
+ showFeatureFlagErrors: boolean
+ showImplementation: boolean
+ sidePanelContext: SidePanelSceneContext | null
+ templateExpanded: boolean
+ templates: Array<{
+ description: string
+ getValues: (flag: FeatureFlagType) => Partial<FeatureFlagType>
+ id: string
+ name: string
+ }>
+ upcomingOneTimeSchedules: ScheduledChangeType[]
+ urlIntentApplied: boolean
+ urlTemplateApplied: boolean
+ variantErrors: VariantError[]
+ variantRolloutSum: number
+ variants: MultivariateFlagVariant[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagLogicActions {
+ loadDefaultEvaluationContexts: () => {
+ value: true
+ } // defaultEvaluationContextsLogic
+ loadDefaultReleaseConditions: () => any // defaultReleaseConditionsLogic
+ deleteFlag: (id: number) => {
+ id: number
+ } // featureFlagsLogic
+ updateFlag: (flag: FeatureFlagType) => {
+ flag: FeatureFlagType
+ } // featureFlagsLogic
+ closeSidePanel: (tab?: SidePanelTab) => {
+ tab: SidePanelTab | undefined
+ } // sidePanelStateLogic
+ addProductIntent: (properties: ProductIntentProperties) => ProductIntentProperties // teamLogic
+ addVariant: () => {
+ value: true
+ }
+ applyTemplate: (templateId: string) => {
+ templateId: string
+ }
+ applyUrlIntent: () => {
+ value: true
+ }
+ applyUrlTemplate: (templateId: string) => {
+ templateId: string
+ }
+ copyFlag: () => any
+ copyFlagFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ copyFlagSuccess: (
+ featureFlagCopy: CopyFlagsResponseApi | undefined,
+ payload?: any
+ ) => {
+ featureFlagCopy: CopyFlagsResponseApi | undefined
+ payload?: any
+ }
+ createEarlyAccessFeature: () => any
+ createEarlyAccessFeatureFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ createEarlyAccessFeatureSuccess: (
+ newEarlyAccessFeature: EarlyAccessFeatureType,
+ payload?: any
+ ) => {
+ newEarlyAccessFeature: EarlyAccessFeatureType
+ payload?: any
+ }
+ createPairedSchedule: () => {
+ value: true
+ }
+ createScheduledChange: () => any
+ createScheduledChangeFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ createScheduledChangeSuccess: (
+ scheduledChange:
+ | {
+ scheduled_change: ScheduledChangeType
+ }
+ | undefined,
+ payload?: any
+ ) => {
+ scheduledChange:
+ | {
+ scheduled_change: ScheduledChangeType
+ }
+ | undefined
+ payload?: any
+ }
+ createStaticCohort: () => any
+ createStaticCohortFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ createStaticCohortSuccess: (
+ newCohort: CohortType | null,
+ payload?: any
+ ) => {
+ newCohort: CohortType | null
+ payload?: any
+ }
+ createSurvey: () => any
+ createSurveyFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ createSurveySuccess: (
+ newSurvey: Survey,
+ payload?: any
+ ) => {
+ newSurvey: Survey
+ payload?: any
+ }
+ deleteFeatureFlag: (featureFlag: Partial<FeatureFlagType>) => {
+ featureFlag: Partial<FeatureFlagType>
+ }
+ deleteScheduledChange: (scheduledChangeId: any) => any
+ deleteScheduledChangeFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deleteScheduledChangeSuccess: (
+ scheduledChange:
+ | {
+ scheduled_change: ScheduledChangeType
+ }
+ | undefined,
+ payload?: any
+ ) => {
+ scheduledChange:
+ | {
+ scheduled_change: ScheduledChangeType
+ }
+ | undefined
+ payload?: any
+ }
+ distributeVariantsEqually: () => {
+ value: true
+ }
+ duplicateVariant: (index: number) => {
+ index: number
+ }
+ editFeatureFlag: (
+ editing: boolean,
+ options?: {
+ expandAdvanced?: boolean
+ }
+ ) => {
+ editing: boolean
+ expandAdvanced: boolean
+ }
+ enrichUsageDashboard: () => {
+ value: true
+ }
+ generateUsageDashboard: () => {
+ value: true
+ }
+ loadCopyDependencyRequirements: () => {
+ value: true
+ }
+ loadCopyDependencyRequirementsFailure: (
+ error: string,
+ errorObject?: unknown
+ ) => {
+ error: string
+ errorObject: unknown
+ }
+ loadCopyDependencyRequirementsSuccess: (
+ copyDependencyRequirements: CopyFlagsDependencyRequirementsResponseApi | null
+ ) => {
+ copyDependencyRequirements: CopyFlagsDependencyRequirementsResponseApi | null
+ }
+ loadDependentFlags: () => any
+ loadDependentFlagsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadDependentFlagsSuccess: (
+ dependentFlags: DependentFlag[],
+ payload?: any
+ ) => {
+ dependentFlags: DependentFlag[]
+ payload?: any
+ }
+ loadExperiment: () => any
+ loadExperimentFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadExperimentSuccess: (
+ experiment: Experiment | null,
+ payload?: any
+ ) => {
+ experiment: Experiment | null
+ payload?: any
+ }
+ loadFeatureFlag: () => any
+ loadFeatureFlagFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadFeatureFlagStatus: () => any
+ loadFeatureFlagStatusFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadFeatureFlagStatusSuccess: (
+ flagStatus: Promise<FeatureFlagStatusResponse> | null,
+ payload?: any
+ ) => {
+ flagStatus: Promise<FeatureFlagStatusResponse> | null
+ payload?: any
+ }
+ loadFeatureFlagSuccess: (
+ featureFlag: FeatureFlagType,
+ payload?: any
+ ) => {
+ featureFlag: FeatureFlagType
+ payload?: any
+ }
+ loadProjectsWithCurrentFlag: () => any
+ loadProjectsWithCurrentFlagFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadProjectsWithCurrentFlagSuccess: (
+ projectsWithCurrentFlag: OrganizationFeatureFlag[],
+ payload?: any
+ ) => {
+ projectsWithCurrentFlag: OrganizationFeatureFlag[]
+ payload?: any
+ }
+ loadRelatedInsights: () => any
+ loadRelatedInsightsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRelatedInsightsSuccess: (
+ relatedInsights: QueryBasedInsightModel<Node<Record<string, any>>>[],
+ payload?: any
+ ) => {
+ relatedInsights: QueryBasedInsightModel<Node<Record<string, any>>>[]
+ payload?: any
+ }
+ loadScheduledChanges: () => any
+ loadScheduledChangesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadScheduledChangesSuccess: (
+ scheduledChanges: ScheduledChangeType[] | undefined,
+ payload?: any
+ ) => {
+ scheduledChanges: ScheduledChangeType[] | undefined
+ payload?: any
+ }
+ moveVariantDown: (index: number) => {
+ index: number
+ }
+ moveVariantUp: (index: number) => {
+ index: number
+ }
+ projectFlagActiveUpdateFailed: (
+ teamId: number,
+ flagId: number
+ ) => {
+ flagId: number
+ teamId: number
+ }
+ projectFlagActiveUpdated: (
+ teamId: number,
+ flagId: number,
+ active: boolean
+ ) => {
+ active: boolean
+ flagId: number
+ teamId: number
+ }
+ refreshFeatureFlag: () => any
+ refreshFeatureFlagFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ refreshFeatureFlagSuccess: (
+ featureFlagRefresh: FeatureFlagType | null,
+ payload?: any
+ ) => {
+ featureFlagRefresh: FeatureFlagType | null
+ payload?: any
+ }
+ removeVariant: (index: number) => {
+ index: number
+ }
+ reorderVariants: (
+ fromIndex: number,
+ toIndex: number
+ ) => {
+ fromIndex: number
+ toIndex: number
+ }
+ resetEncryptedPayload: () => {}
+ resetFeatureFlag: (values?: {
+ _create_in_folder?: string | null | undefined
+ _should_create_usage_dashboard?: boolean | undefined
+ active: boolean
+ archived: boolean
+ bucketing_identifier?: FeatureFlagBucketingIdentifier | null | undefined
+ can_edit: boolean
+ created_at: string | null
+ created_by: UserBasicType | null
+ deleted: boolean
+ ensure_experience_continuity: boolean
+ evaluation_contexts: string[]
+ evaluation_runtime: FeatureFlagEvaluationRuntime
+ experiment_set: number[] | null
+ experiment_set_metadata:
+ | {
+ id: number
+ is_running: boolean
+ name: string
+ }[]
+ | null
+ features: MinimalEarlyAccessFeatureType[] | null
+ filters: FeatureFlagFilters
+ has_encrypted_payloads: boolean
+ has_enriched_analytics?: boolean | undefined
+ id: number | null
+ is_remote_configuration: boolean
+ is_used_in_replay_settings?: boolean | undefined
+ key: string
+ last_called_at?: string | null | undefined
+ last_modified_by: UserBasicType | null
+ name: string
+ status: 'ACTIVE' | 'ARCHIVED' | 'DELETED' | 'STALE' | 'UNKNOWN'
+ surveys: Survey[] | null
+ tags: string[]
+ updated_at: string | null
+ usage_dashboard?: number | undefined
+ user_access_level: AccessControlLevel
+ version: number | null
+ }) => {
+ values?: {
+ _create_in_folder?: string | null | undefined
+ _should_create_usage_dashboard?: boolean | undefined
+ active: boolean
+ archived: boolean
+ bucketing_identifier?: FeatureFlagBucketingIdentifier | null | undefined
+ can_edit: boolean
+ created_at: string | null
+ created_by: UserBasicType | null
+ deleted: boolean
+ ensure_experience_continuity: boolean
+ evaluation_contexts: string[]
+ evaluation_runtime: FeatureFlagEvaluationRuntime
+ experiment_set: number[] | null
+ experiment_set_metadata:
+ | {
+ id: number
+ is_running: boolean
+ name: string
+ }[]
+ | null
+ features: MinimalEarlyAccessFeatureType[] | null
+ filters: FeatureFlagFilters
+ has_encrypted_payloads: boolean
+ has_enriched_analytics?: boolean | undefined
+ id: number | null
+ is_remote_configuration: boolean
+ is_used_in_replay_settings?: boolean | undefined
+ key: string
+ last_called_at?: string | null | undefined
+ last_modified_by: UserBasicType | null
+ name: string
+ status: 'ACTIVE' | 'ARCHIVED' | 'DELETED' | 'STALE' | 'UNKNOWN'
+ surveys: Survey[] | null
+ tags: string[]
+ updated_at: string | null
+ usage_dashboard?: number | undefined
+ user_access_level: AccessControlLevel
+ version: number | null
+ }
+ }
+ restoreFeatureFlag: (featureFlag: Partial<FeatureFlagType>) => {
+ featureFlag: Partial<FeatureFlagType>
+ }
+ resumeRecurringScheduledChange: (scheduledChangeId: number) => {
+ scheduledChangeId: number
+ }
+ saveDescriptionInline: (name: string) => {
+ name: string
+ }
+ saveFeatureFlag: (updatedFlag: Partial<FeatureFlagType>) => Partial<FeatureFlagType>
+ saveFeatureFlagFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ saveFeatureFlagSuccess: (
+ featureFlag: FeatureFlagType,
+ payload?: Partial<FeatureFlagType>
+ ) => {
+ featureFlag: FeatureFlagType
+ payload?: Partial<FeatureFlagType>
+ }
+ saveSidebarExperimentFeatureFlag: (updatedFlag: Partial<FeatureFlagType>) => Partial<FeatureFlagType>
+ saveSidebarExperimentFeatureFlagFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ saveSidebarExperimentFeatureFlagSuccess: (
+ featureFlag: FeatureFlagType,
+ payload?: Partial<FeatureFlagType>
+ ) => {
+ featureFlag: FeatureFlagType
+ payload?: Partial<FeatureFlagType>
+ }
+ saveTagsInline: (tags: string[]) => {
+ tags: string[]
+ }
+ setAccessDeniedToFeatureFlag: () => {
+ value: true
+ }
+ setActiveTab: (tab: FeatureFlagsTab) => {
+ tab: FeatureFlagsTab
+ }
+ setBucketingIdentifier: (bucketingIdentifier: FeatureFlagBucketingIdentifier | null) => {
+ bucketingIdentifier: FeatureFlagBucketingIdentifier | null
+ }
+ setCopyDependencies: (copyDependencies: boolean) => {
+ copyDependencies: boolean
+ }
+ setCopyDestinationProject: (id: number | null) => {
+ id: number | null
+ }
+ setCopySchedule: (copySchedule: boolean) => {
+ copySchedule: boolean
+ }
+ setCronExpression: (cronExpression: string | null) => {
+ cronExpression: string | null
+ }
+ setCustomPairCron: (
+ which: 'disable' | 'enable',
+ expression: string
+ ) => {
+ expression: string
+ which: 'disable' | 'enable'
+ }
+ setDisableCopiedFlag: (disableCopiedFlag: boolean) => {
+ disableCopiedFlag: boolean
+ }
+ setEndDate: (endDate: Dayjs | null) => {
+ endDate: Dayjs | null
+ }
+ setFeatureFlag: (featureFlag: FeatureFlagType) => {
+ featureFlag: FeatureFlagType
+ }
+ setFeatureFlagFilters: (
+ filters: FeatureFlagType['filters'],
+ errors: any
+ ) => {
+ errors: any
+ filters: FeatureFlagFilters
+ }
+ setFeatureFlagManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setFeatureFlagMissing: () => {
+ value: true
+ }
+ setFeatureFlagValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setFeatureFlagValues: (
+ values: DeepPartial<{
+ _create_in_folder?: string | null | undefined
+ _should_create_usage_dashboard?: boolean | undefined
+ active: boolean
+ archived: boolean
+ bucketing_identifier?: FeatureFlagBucketingIdentifier | null | undefined
+ can_edit: boolean
+ created_at: string | null
+ created_by: UserBasicType | null
+ deleted: boolean
+ ensure_experience_continuity: boolean
+ evaluation_contexts: string[]
+ evaluation_runtime: FeatureFlagEvaluationRuntime
+ experiment_set: number[] | null
+ experiment_set_metadata:
+ | {
+ id: number
+ is_running: boolean
+ name: string
+ }[]
+ | null
+ features: MinimalEarlyAccessFeatureType[] | null
+ filters: FeatureFlagFilters
+ has_encrypted_payloads: boolean
+ has_enriched_analytics?: boolean | undefined
+ id: number | null
+ is_remote_configuration: boolean
+ is_used_in_replay_settings?: boolean | undefined
+ key: string
+ last_called_at?: string | null | undefined
+ last_modified_by: UserBasicType | null
+ name: string
+ status: 'ACTIVE' | 'ARCHIVED' | 'DELETED' | 'STALE' | 'UNKNOWN'
+ surveys: Survey[] | null
+ tags: string[]
+ updated_at: string | null
+ usage_dashboard?: number | undefined
+ user_access_level: AccessControlLevel
+ version: number | null
+ }>
+ ) => {
+ values: DeepPartial<{
+ _create_in_folder?: string | null | undefined
+ _should_create_usage_dashboard?: boolean | undefined
+ active: boolean
+ archived: boolean
+ bucketing_identifier?: FeatureFlagBucketingIdentifier | null | undefined
+ can_edit: boolean
+ created_at: string | null
+ created_by: UserBasicType | null
+ deleted: boolean
+ ensure_experience_continuity: boolean
+ evaluation_contexts: string[]
+ evaluation_runtime: FeatureFlagEvaluationRuntime
+ experiment_set: number[] | null
+ experiment_set_metadata:
+ | {
+ id: number
+ is_running: boolean
+ name: string
+ }[]
+ | null
+ features: MinimalEarlyAccessFeatureType[] | null
+ filters: FeatureFlagFilters
+ has_encrypted_payloads: boolean
+ has_enriched_analytics?: boolean | undefined
+ id: number | null
+ is_remote_configuration: boolean
+ is_used_in_replay_settings?: boolean | undefined
+ key: string
+ last_called_at?: string | null | undefined
+ last_modified_by: UserBasicType | null
+ name: string
+ status: 'ACTIVE' | 'ARCHIVED' | 'DELETED' | 'STALE' | 'UNKNOWN'
+ surveys: Survey[] | null
+ tags: string[]
+ updated_at: string | null
+ usage_dashboard?: number | undefined
+ user_access_level: AccessControlLevel
+ version: number | null
+ }>
+ }
+ setFlagIntent: (intent: FlagIntent | null) => {
+ intent: FlagIntent | null
+ }
+ setIsRecurring: (isRecurring: boolean) => {
+ isRecurring: boolean
+ }
+ setMultivariateEnabled: (enabled: boolean) => {
+ enabled: boolean
+ }
+ setMultivariateOptions: (multivariateOptions: MultivariateFlagOptions | null) => {
+ multivariateOptions: MultivariateFlagOptions | null
+ }
+ setOpenVariants: (openVariants: string[]) => {
+ openVariants: string[]
+ }
+ setPayloadExpanded: (expanded: boolean) => {
+ expanded: boolean
+ }
+ setRecurrenceInterval: (interval: RecurrenceInterval | null) => {
+ interval: RecurrenceInterval | null
+ }
+ setRemoteConfigEnabled: (enabled: boolean) => {
+ enabled: boolean
+ }
+ setRepeatsValue: (value: RecurrenceInterval | 'cron' | 'none') => {
+ value: RecurrenceInterval | 'cron' | 'none'
+ }
+ setScheduleDateMarker: (dateMarker: any) => {
+ dateMarker: any
+ }
+ setSchedulePayload: (
+ filters: FeatureFlagType['filters'] | null,
+ active: FeatureFlagType['active'] | null,
+ errors?: any,
+ variants?: MultivariateFlagVariant[] | null,
+ payloads?: Record<string, any> | null
+ ) => {
+ active: boolean | null
+ errors: any
+ filters: FeatureFlagFilters | null
+ payloads: Record<string, any> | null | undefined
+ variants: MultivariateFlagVariant[] | null | undefined
+ }
+ setSchedulePreset: (preset: PairedPresetKey | null) => {
+ preset: PairedPresetKey | null
+ }
+ setScheduledChangeOperation: (changeType: ScheduledChangeOperationType) => {
+ changeType: ScheduledChangeOperationType
+ }
+ setShowImplementation: (show: boolean) => {
+ show: boolean
+ }
+ setTemplateExpanded: (expanded: boolean) => {
+ expanded: boolean
+ }
+ showDependentFlagsConfirmation: (payload: {
+ dependentFlags: DependentFlag[]
+ isBeingDisabled?: boolean
+ onConfirm: () => void
+ originalFlag: FeatureFlagType | null
+ requireStatusConfirmation?: boolean
+ updatedFlag: Partial<FeatureFlagType>
+ }) => {
+ dependentFlags: DependentFlag[]
+ isBeingDisabled?: boolean | undefined
+ onConfirm: () => void
+ originalFlag: FeatureFlagType | null
+ requireStatusConfirmation?: boolean | undefined
+ updatedFlag: Partial<FeatureFlagType>
+ }
+ stopRecurringScheduledChange: (scheduledChangeId: number) => {
+ scheduledChangeId: number
+ }
+ submitFeatureFlag: () => {
+ value: boolean
+ }
+ submitFeatureFlagFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitFeatureFlagRequest: (featureFlag: {
+ _create_in_folder?: string | null | undefined
+ _should_create_usage_dashboard?: boolean | undefined
+ active: boolean
+ archived: boolean
+ bucketing_identifier?: FeatureFlagBucketingIdentifier | null | undefined
+ can_edit: boolean
+ created_at: string | null
+ created_by: UserBasicType | null
+ deleted: boolean
+ ensure_experience_continuity: boolean
+ evaluation_contexts: string[]
+ evaluation_runtime: FeatureFlagEvaluationRuntime
+ experiment_set: number[] | null
+ experiment_set_metadata:
+ | {
+ id: number
+ is_running: boolean
+ name: string
+ }[]
+ | null
+ features: MinimalEarlyAccessFeatureType[] | null
+ filters: FeatureFlagFilters
+ has_encrypted_payloads: boolean
+ has_enriched_analytics?: boolean | undefined
+ id: number | null
+ is_remote_configuration: boolean
+ is_used_in_replay_settings?: boolean | undefined
+ key: string
+ last_called_at?: string | null | undefined
+ last_modified_by: UserBasicType | null
+ name: string
+ status: 'ACTIVE' | 'ARCHIVED' | 'DELETED' | 'STALE' | 'UNKNOWN'
+ surveys: Survey[] | null
+ tags: string[]
+ updated_at: string | null
+ usage_dashboard?: number | undefined
+ user_access_level: AccessControlLevel
+ version: number | null
+ }) => {
+ featureFlag: {
+ _create_in_folder?: string | null | undefined
+ _should_create_usage_dashboard?: boolean | undefined
+ active: boolean
+ archived: boolean
+ bucketing_identifier?: FeatureFlagBucketingIdentifier | null | undefined
+ can_edit: boolean
+ created_at: string | null
+ created_by: UserBasicType | null
+ deleted: boolean
+ ensure_experience_continuity: boolean
+ evaluation_contexts: string[]
+ evaluation_runtime: FeatureFlagEvaluationRuntime
+ experiment_set: number[] | null
+ experiment_set_metadata:
+ | {
+ id: number
+ is_running: boolean
+ name: string
+ }[]
+ | null
+ features: MinimalEarlyAccessFeatureType[] | null
+ filters: FeatureFlagFilters
+ has_encrypted_payloads: boolean
+ has_enriched_analytics?: boolean | undefined
+ id: number | null
+ is_remote_configuration: boolean
+ is_used_in_replay_settings?: boolean | undefined
+ key: string
+ last_called_at?: string | null | undefined
+ last_modified_by: UserBasicType | null
+ name: string
+ status: 'ACTIVE' | 'ARCHIVED' | 'DELETED' | 'STALE' | 'UNKNOWN'
+ surveys: Survey[] | null
+ tags: string[]
+ updated_at: string | null
+ usage_dashboard?: number | undefined
+ user_access_level: AccessControlLevel
+ version: number | null
+ }
+ }
+ submitFeatureFlagSuccess: (featureFlag: {
+ _create_in_folder?: string | null | undefined
+ _should_create_usage_dashboard?: boolean | undefined
+ active: boolean
+ archived: boolean
+ bucketing_identifier?: FeatureFlagBucketingIdentifier | null | undefined
+ can_edit: boolean
+ created_at: string | null
+ created_by: UserBasicType | null
+ deleted: boolean
+ ensure_experience_continuity: boolean
+ evaluation_contexts: string[]
+ evaluation_runtime: FeatureFlagEvaluationRuntime
+ experiment_set: number[] | null
+ experiment_set_metadata:
+ | {
+ id: number
+ is_running: boolean
+ name: string
+ }[]
+ | null
+ features: MinimalEarlyAccessFeatureType[] | null
+ filters: FeatureFlagFilters
+ has_encrypted_payloads: boolean
+ has_enriched_analytics?: boolean | undefined
+ id: number | null
+ is_remote_configuration: boolean
+ is_used_in_replay_settings?: boolean | undefined
+ key: string
+ last_called_at?: string | null | undefined
+ last_modified_by: UserBasicType | null
+ name: string
+ status: 'ACTIVE' | 'ARCHIVED' | 'DELETED' | 'STALE' | 'UNKNOWN'
+ surveys: Survey[] | null
+ tags: string[]
+ updated_at: string | null
+ usage_dashboard?: number | undefined
+ user_access_level: AccessControlLevel
+ version: number | null
+ }) => {
+ featureFlag: {
+ _create_in_folder?: string | null | undefined
+ _should_create_usage_dashboard?: boolean | undefined
+ active: boolean
+ archived: boolean
+ bucketing_identifier?: FeatureFlagBucketingIdentifier | null | undefined
+ can_edit: boolean
+ created_at: string | null
+ created_by: UserBasicType | null
+ deleted: boolean
+ ensure_experience_continuity: boolean
+ evaluation_contexts: string[]
+ evaluation_runtime: FeatureFlagEvaluationRuntime
+ experiment_set: number[] | null
+ experiment_set_metadata:
+ | {
+ id: number
+ is_running: boolean
+ name: string
+ }[]
+ | null
+ features: MinimalEarlyAccessFeatureType[] | null
+ filters: FeatureFlagFilters
+ has_encrypted_payloads: boolean
+ has_enriched_analytics?: boolean | undefined
+ id: number | null
+ is_remote_configuration: boolean
+ is_used_in_replay_settings?: boolean | undefined
+ key: string
+ last_called_at?: string | null | undefined
+ last_modified_by: UserBasicType | null
+ name: string
+ status: 'ACTIVE' | 'ARCHIVED' | 'DELETED' | 'STALE' | 'UNKNOWN'
+ surveys: Survey[] | null
+ tags: string[]
+ updated_at: string | null
+ usage_dashboard?: number | undefined
+ user_access_level: AccessControlLevel
+ version: number | null
+ }
+ }
+ submitFeatureFlagWithValidation: (featureFlag: Partial<FeatureFlagType>) => {
+ featureFlag: Partial<FeatureFlagType>
+ }
+ toggleFeatureFlagActive: (active: boolean) => {
+ active: boolean
+ }
+ toggleProjectFlagActive: (
+ teamId: number,
+ flagId: number,
+ active: boolean
+ ) => {
+ active: boolean
+ flagId: number
+ teamId: number
+ }
+ touchFeatureFlagField: (key: string) => {
+ key: string
+ }
+ updateFeatureFlagActive: (active: boolean) => boolean
+ updateFeatureFlagActiveFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateFeatureFlagActiveSuccess: (
+ featureFlagActiveUpdate: FeatureFlagType,
+ payload?: boolean
+ ) => {
+ featureFlagActiveUpdate: FeatureFlagType
+ payload?: boolean
+ }
+ updateFeatureFlagArchived: (archived: boolean) => boolean
+ updateFeatureFlagArchivedFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateFeatureFlagArchivedSuccess: (
+ featureFlagActiveUpdate: FeatureFlagType,
+ payload?: boolean
+ ) => {
+ featureFlagActiveUpdate: FeatureFlagType
+ payload?: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagLogicMeta {
+ key: number | 'link' | 'new'
+ sharedListeners: {
+ checkDependentFlagsAndConfirm: (
+ payload: {
+ onConfirm: () => void
+ originalFlag: FeatureFlagType | null
+ requireStatusConfirmation?: boolean | undefined
+ updatedFlag: Partial<FeatureFlagType>
+ },
+ breakpoint: BreakPointFunction,
+ action: {
+ type: string
+ payload: {
+ onConfirm: () => void
+ originalFlag: FeatureFlagType | null
+ requireStatusConfirmation?: boolean | undefined
+ updatedFlag: Partial<FeatureFlagType>
+ }
+ },
+ previousState: any
+ ) => void | Promise<void>
+ showDependentFlagsConfirmation: (
+ payload: {
+ dependentFlags: DependentFlag[]
+ isBeingDisabled?: boolean | undefined
+ onConfirm: () => void
+ originalFlag: FeatureFlagType | null
+ requireStatusConfirmation?: boolean | undefined
+ updatedFlag: Partial<FeatureFlagType>
+ },
+ breakpoint: BreakPointFunction,
+ action: {
+ type: string
+ payload: {
+ dependentFlags: DependentFlag[]
+ isBeingDisabled?: boolean | undefined
+ onConfirm: () => void
+ originalFlag: FeatureFlagType | null
+ requireStatusConfirmation?: boolean | undefined
+ updatedFlag: Partial<FeatureFlagType>
+ }
+ },
+ previousState: any
+ ) => void | Promise<void>
+ }
+ __keaTypeGenInternalSelectorTypes: {
+ props: (arg: any) => any
+ hasUnsavedChanges: (featureFlag: FeatureFlagType, originalFeatureFlag: FeatureFlagType | null) => boolean
+ isFormDirty: (
+ originalFeatureFlag: FeatureFlagType | null,
+ hasUnsavedChanges: boolean,
+ featureFlagChanged: boolean
+ ) => boolean
+ multivariateEnabled: (featureFlag: FeatureFlagType) => boolean
+ flagType: (featureFlag: FeatureFlagType) => 'boolean' | 'multivariate' | 'remote_config'
+ flagTypeString: (
+ featureFlag: FeatureFlagType
+ ) =>
+ | 'Multiple variants with rollout percentages (A/B/n test)'
+ | 'Release toggle (boolean)'
+ | 'Remote configuration (single payload)'
+ roleBasedAccessEnabled: (
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean
+ ) => boolean
+ variants: (featureFlag: FeatureFlagType) => MultivariateFlagVariant[]
+ nonEmptyVariants: (variants: MultivariateFlagVariant[]) => MultivariateFlagVariant[]
+ variantRolloutSum: (variants: MultivariateFlagVariant[]) => number
+ areVariantRolloutsValid: (variants: MultivariateFlagVariant[], variantRolloutSum: number) => boolean
+ aggregationTargetName: (
+ featureFlag: FeatureFlagType,
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun
+ ) => string
+ breadcrumbs: (featureFlag: FeatureFlagType) => Breadcrumb[]
+ projectTreeRef: (arg: number | 'link' | 'new') => ProjectTreeRef
+ sidePanelContext: (featureFlag: FeatureFlagType) => SidePanelSceneContext | null
+ recordingFilterForFlag: (featureFlag: FeatureFlagType) => Partial<RecordingUniversalFilters>
+ hasEarlyAccessFeatures: (featureFlag: FeatureFlagType) => boolean
+ earlyAccessFeaturesList: (featureFlag: FeatureFlagType) => MinimalEarlyAccessFeatureType[]
+ featureFlagKey: (featureFlag: FeatureFlagType) => string
+ canCreateEarlyAccessFeature: (featureFlag: FeatureFlagType, variants: MultivariateFlagVariant[]) => boolean
+ hasSurveys: (featureFlag: FeatureFlagType) => boolean | null
+ hasEncryptedPayloadBeenSaved: (featureFlag: FeatureFlagType, props: any) => boolean | undefined
+ hasExperiment: (featureFlag: FeatureFlagType) => boolean | null
+ isDraftExperiment: (experiment: any) => boolean
+ properties: (featureFlag: FeatureFlagType) => AnyPropertyFilter[]
+ variantErrors: (variants: MultivariateFlagVariant[]) => VariantError[]
+ repeatsValue: (
+ isRecurring: boolean,
+ cronExpression: string | null,
+ recurrenceInterval: RecurrenceInterval | null
+ ) => RecurrenceInterval | 'cron' | 'none'
+ cronPreview: (cronExpression: string | null) => string | null
+ customPairEnableCronPreview: (customPairEnableCron: string) => string | null
+ customPairDisableCronPreview: (customPairDisableCron: string) => string | null
+ canCreatePairedSchedule: (
+ schedulePreset: PairedPresetKey | null,
+ customPairEnableCron: string,
+ customPairDisableCron: string,
+ customPairEnableCronPreview: string | null,
+ customPairDisableCronPreview: string | null
+ ) => boolean
+ activeRecurringSchedules: (scheduledChanges: ScheduledChangeType[]) => ScheduledChangeType[]
+ pausedRecurringSchedules: (scheduledChanges: ScheduledChangeType[]) => ScheduledChangeType[]
+ upcomingOneTimeSchedules: (scheduledChanges: ScheduledChangeType[]) => ScheduledChangeType[]
+ completedSchedules: (scheduledChanges: ScheduledChangeType[]) => ScheduledChangeType[]
+ activeSchedules: (
+ activeRecurringSchedules: ScheduledChangeType[],
+ pausedRecurringSchedules: ScheduledChangeType[],
+ upcomingOneTimeSchedules: ScheduledChangeType[]
+ ) => ScheduledChangeType[]
+ emailDomain: (user: UserType | null) => string
+ templates: (emailDomain: string) => Array<{
+ description: string
+ getValues: (flag: FeatureFlagType) => Partial<FeatureFlagType>
+ id: string
+ name: string
+ }>
+ }
+}
+
+export type featureFlagLogicType = MakeLogicType<
+ featureFlagLogicValues,
+ featureFlagLogicActions,
+ FeatureFlagLogicProps,
+ featureFlagLogicMeta
+>
+
export const featureFlagLogic = kea<featureFlagLogicType>([
path(['scenes', 'feature-flags', 'featureFlagLogic']),
props({} as FeatureFlagLogicProps),
@@ -2702,7 +3955,7 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
props: [() => [(_, props) => props], (props) => props],
hasUnsavedChanges: [
(s) => [s.featureFlag, s.originalFeatureFlag],
- (featureFlag, originalFeatureFlag): boolean => {
+ (featureFlag: FeatureFlagType, originalFeatureFlag: FeatureFlagType | null): boolean => {
if (!originalFeatureFlag) {
// New flag — compare against form defaults via featureFlagChanged instead
return false
@@ -2713,15 +3966,22 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
],
isFormDirty: [
(s) => [s.originalFeatureFlag, s.hasUnsavedChanges, s.featureFlagChanged],
- (originalFeatureFlag, hasUnsavedChanges, featureFlagChanged): boolean =>
+ (
+ originalFeatureFlag: FeatureFlagType | null,
+ hasUnsavedChanges: boolean,
+ featureFlagChanged: boolean
+ ): boolean =>
// Existing flags compare against server state; new flags fall back to the
// form-defaults check from kea-forms (NEW_FLAG would otherwise always read dirty).
originalFeatureFlag ? hasUnsavedChanges : featureFlagChanged,
],
- multivariateEnabled: [(s) => [s.featureFlag], (featureFlag) => !!featureFlag?.filters.multivariate],
+ multivariateEnabled: [
+ (s) => [s.featureFlag],
+ (featureFlag: FeatureFlagType) => !!featureFlag?.filters.multivariate,
+ ],
flagType: [
(s) => [s.featureFlag],
- (featureFlag) =>
+ (featureFlag: FeatureFlagType) =>
featureFlag?.is_remote_configuration
? 'remote_config'
: featureFlag?.filters.multivariate
@@ -2730,7 +3990,7 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
],
flagTypeString: [
(s) => [s.featureFlag],
- (featureFlag) =>
+ (featureFlag: FeatureFlagType) =>
featureFlag?.is_remote_configuration
? 'Remote configuration (single payload)'
: featureFlag?.filters.multivariate
@@ -2739,23 +3999,37 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
],
roleBasedAccessEnabled: [
(s) => [s.hasAvailableFeature],
- (hasAvailableFeature) => hasAvailableFeature(AvailableFeature.ROLE_BASED_ACCESS),
+ (hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean) =>
+ hasAvailableFeature(AvailableFeature.ROLE_BASED_ACCESS),
+ ],
+ variants: [
+ (s) => [s.featureFlag],
+ (featureFlag: FeatureFlagType) => featureFlag?.filters.multivariate?.variants || [],
+ ],
+ nonEmptyVariants: [
+ (s) => [s.variants],
+ (variants: MultivariateFlagVariant[]) => variants.filter(({ key }) => !!key),
],
- variants: [(s) => [s.featureFlag], (featureFlag) => featureFlag?.filters.multivariate?.variants || []],
- nonEmptyVariants: [(s) => [s.variants], (variants) => variants.filter(({ key }) => !!key)],
variantRolloutSum: [
(s) => [s.variants],
- (variants) => variants.reduce((total: number, { rollout_percentage }) => total + rollout_percentage, 0),
+ (variants: MultivariateFlagVariant[]) =>
+ variants.reduce((total: number, { rollout_percentage }) => total + rollout_percentage, 0),
],
areVariantRolloutsValid: [
(s) => [s.variants, s.variantRolloutSum],
- (variants, variantRolloutSum) =>
+ (variants: MultivariateFlagVariant[], variantRolloutSum: number) =>
variants.every(({ rollout_percentage }) => rollout_percentage >= 0 && rollout_percentage <= 100) &&
variantRolloutSum === 100,
],
aggregationTargetName: [
(s) => [s.featureFlag, s.aggregationLabel],
- (featureFlag, aggregationLabel): string => {
+ (
+ featureFlag: FeatureFlagType,
+ aggregationLabel: (
+ groupTypeIndex: number | null | undefined,
+ deferToUserWording?: boolean
+ ) => import('~/models/groupsModel').Noun
+ ): string => {
if (featureFlag && featureFlag.filters.aggregation_group_type_index != null) {
return aggregationLabel(featureFlag.filters.aggregation_group_type_index).plural
}
@@ -2764,7 +4038,7 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
],
breadcrumbs: [
(s) => [s.featureFlag],
- (featureFlag): Breadcrumb[] => [
+ (featureFlag: FeatureFlagType): Breadcrumb[] => [
{
key: Scene.FeatureFlags,
name: 'Feature Flags',
@@ -2780,12 +4054,15 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
],
projectTreeRef: [
() => [(_, props: FeatureFlagLogicProps) => props.id],
- (id): ProjectTreeRef => ({ type: 'feature_flag', ref: id === 'link' || id === 'new' ? null : String(id) }),
+ (id: number | 'link' | 'new'): ProjectTreeRef => ({
+ type: 'feature_flag',
+ ref: id === 'link' || id === 'new' ? null : String(id),
+ }),
],
[SIDE_PANEL_CONTEXT_KEY]: [
(s) => [s.featureFlag],
- (featureFlag): SidePanelSceneContext | null => {
+ (featureFlag: FeatureFlagType): SidePanelSceneContext | null => {
return featureFlag?.id
? {
activity_scope: ActivityScope.FEATURE_FLAG,
@@ -2798,7 +4075,7 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
],
recordingFilterForFlag: [
(s) => [s.featureFlag],
- (featureFlag): Partial<RecordingUniversalFilters> => {
+ (featureFlag: FeatureFlagType): Partial<RecordingUniversalFilters> => {
const flagKey = featureFlag?.key
if (!flagKey) {
return {}
@@ -2809,37 +4086,37 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
],
hasEarlyAccessFeatures: [
(s) => [s.featureFlag],
- (featureFlag) => {
+ (featureFlag: FeatureFlagType) => {
return (featureFlag?.features?.length || 0) > 0
},
],
earlyAccessFeaturesList: [
(s) => [s.featureFlag],
- (featureFlag) => {
+ (featureFlag: FeatureFlagType) => {
return featureFlag?.features || []
},
],
featureFlagKey: [
(s) => [s.featureFlag],
- (featureFlag) => {
+ (featureFlag: FeatureFlagType) => {
return featureFlag.key
},
],
canCreateEarlyAccessFeature: [
(s) => [s.featureFlag, s.variants],
- (featureFlag, variants) => {
+ (featureFlag: FeatureFlagType, variants: MultivariateFlagVariant[]) => {
return featureFlag && featureFlag.filters.aggregation_group_type_index == null && variants.length === 0
},
],
hasSurveys: [
(s) => [s.featureFlag],
- (featureFlag) => {
+ (featureFlag: FeatureFlagType) => {
return featureFlag?.surveys && featureFlag.surveys.length > 0
},
],
hasEncryptedPayloadBeenSaved: [
(s) => [s.featureFlag, s.props],
- (featureFlag, props) => {
+ (featureFlag: FeatureFlagType, props) => {
if (!featureFlag.has_encrypted_payloads) {
return false
}
@@ -2851,7 +4128,7 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
],
hasExperiment: [
(s) => [s.featureFlag],
- (featureFlag) => {
+ (featureFlag: FeatureFlagType) => {
return featureFlag?.experiment_set && featureFlag.experiment_set.length > 0
},
],
@@ -2873,7 +4150,7 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
],
variantErrors: [
(s) => [s.variants],
- (variants) => {
+ (variants: MultivariateFlagVariant[]) => {
const errors: VariantError[] = variants.map(({ key: variantKey }: MultivariateFlagVariant) => ({
key: validateFeatureFlagKey(variantKey),
}))
@@ -2882,12 +4159,25 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
],
repeatsValue: [
(s) => [s.isRecurring, s.cronExpression, s.recurrenceInterval],
- (isRecurring, cronExpression, recurrenceInterval): RecurrenceInterval | 'none' | 'cron' =>
+ (
+ isRecurring: boolean,
+ cronExpression: string | null,
+ recurrenceInterval: RecurrenceInterval | null
+ ): RecurrenceInterval | 'none' | 'cron' =>
isRecurring ? (cronExpression !== null ? 'cron' : (recurrenceInterval ?? 'none')) : 'none',
],
- cronPreview: [(s) => [s.cronExpression], (cronExpression): string | null => describeCron(cronExpression)],
- customPairEnableCronPreview: [(s) => [s.customPairEnableCron], (cron): string | null => describeCron(cron)],
- customPairDisableCronPreview: [(s) => [s.customPairDisableCron], (cron): string | null => describeCron(cron)],
+ cronPreview: [
+ (s) => [s.cronExpression],
+ (cronExpression: string | null): string | null => describeCron(cronExpression),
+ ],
+ customPairEnableCronPreview: [
+ (s) => [s.customPairEnableCron],
+ (cron: string): string | null => describeCron(cron),
+ ],
+ customPairDisableCronPreview: [
+ (s) => [s.customPairDisableCron],
+ (cron: string): string | null => describeCron(cron),
+ ],
canCreatePairedSchedule: [
(s) => [
s.schedulePreset,
@@ -2896,7 +4186,13 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
s.customPairEnableCronPreview,
s.customPairDisableCronPreview,
],
- (preset, enableCron, disableCron, enablePreview, disablePreview): boolean => {
+ (
+ preset: PairedPresetKey | null,
+ enableCron: string,
+ disableCron: string,
+ enablePreview: string | null,
+ disablePreview: string | null
+ ): boolean => {
if (!preset) {
return false
}
@@ -2938,14 +4234,20 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
activeSchedules: [
(s) => [s.activeRecurringSchedules, s.pausedRecurringSchedules, s.upcomingOneTimeSchedules],
// Interleave all schedule types so the upcoming list reads soonest first.
- (activeRecurring, pausedRecurring, upcomingOneTime) =>
- [...activeRecurring, ...pausedRecurring, ...upcomingOneTime].sort(byScheduledAt),
+ (
+ activeRecurring: ScheduledChangeType[],
+ pausedRecurring: ScheduledChangeType[],
+ upcomingOneTime: ScheduledChangeType[]
+ ) => [...activeRecurring, ...pausedRecurring, ...upcomingOneTime].sort(byScheduledAt),
+ ],
+ emailDomain: [
+ (s) => [s.user],
+ (user: null | import('~/types').UserType) => user?.email?.split('@')[1] || 'example.com',
],
- emailDomain: [(s) => [s.user], (user) => user?.email?.split('@')[1] || 'example.com'],
templates: [
(s) => [s.emailDomain],
(
- emailDomain
+ emailDomain: string
): Array<{
id: string
name: string
diff --git a/frontend/src/scenes/feature-flags/featureFlagReleaseConditionsLogic.ts b/frontend/src/scenes/feature-flags/featureFlagReleaseConditionsLogic.ts
index 90e3568af786..5b2b920bdc52 100644
--- a/frontend/src/scenes/feature-flags/featureFlagReleaseConditionsLogic.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagReleaseConditionsLogic.ts
@@ -1,4 +1,5 @@
import {
+ MakeLogicType,
actions,
afterMount,
connect,
@@ -36,8 +37,10 @@ import {
UserBlastRadiusType,
} from '~/types'
+import type { SimpleOption } from '../../lib/components/TaxonomicFilter/types'
+import type { Noun } from '../../models/groupsModel'
+import type { GroupType } from '../../types'
import { resolveAggregationGroupTypeIndex } from './aggregation'
-import type { featureFlagReleaseConditionsLogicType } from './featureFlagReleaseConditionsLogicType'
// A property filter targets people by their raw distinct id.
export function isDistinctIdFilter(property: AnyPropertyFilter): boolean {
@@ -102,6 +105,222 @@ function ensureSortKeys(
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagReleaseConditionsLogicValues {
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun // groupsModel
+ groupTypes: Map<GroupTypeIndex, GroupType> // groupsModel
+ currentProjectId: number | null // projectLogic
+ affectedCounts: Record<string, number | undefined>
+ aggregationTargetName: (conditionGroupTypeIndex?: number | null | undefined) => string
+ blastRadiusErrors: Record<string, boolean>
+ computeBlastRadiusPercentage: (rolloutPercentage: any, sortKey: any) => any
+ distinctIdNameCache: Record<string, string>
+ distinctIds: string[]
+ draggedGroup: FeatureFlagGroupType | null
+ filterGroups: FeatureFlagGroupType[]
+ filters: FeatureFlagFilters & {
+ groups: FeatureFlagGroupTypeWithSortKey[]
+ }
+ filtersTaxonomicOptions: Partial<Record<TaxonomicFilterGroupType, SimpleOption[]>>
+ flagIds: string[]
+ flagKeyCache: Record<string, string>
+ flagKeyLoading: boolean
+ flagKeysLoading: boolean
+ getDistinctIdName: (distinctId: string) => string
+ getFlagKey: (flagId: string) => string
+ isAnyItemDragging: boolean
+ openConditions: string[]
+ properties: AnyPropertyFilter[]
+ propertySelectErrors: {
+ properties:
+ | {
+ value: string | undefined
+ }[]
+ | undefined
+ rollout_percentage: string | undefined
+ variant: null
+ }[]
+ taxonomicGroupTypes: TaxonomicFilterGroupType[]
+ taxonomicGroupTypesForCondition: (conditionGroupTypeIndex: number | null | undefined) => TaxonomicFilterGroupType[]
+ totalCounts: Record<string, number | undefined>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagReleaseConditionsLogicActions {
+ addConditionSet: (sortKey?: string) => {
+ sortKey: string | undefined
+ }
+ calculateBlastRadius: () => {
+ value: true
+ }
+ calculateBlastRadiusForCondition: (
+ sortKey: string,
+ properties: AnyPropertyFilter[] | undefined,
+ groupTypeIndex: number | null
+ ) => {
+ groupTypeIndex: number | null
+ properties: AnyPropertyFilter[] | undefined
+ sortKey: string
+ }
+ duplicateConditionSet: (index: number) => {
+ index: number
+ }
+ loadAllFlagKeys: (flagIds: string[]) => {
+ flagIds: string[]
+ }
+ loadDistinctIdNames: (distinctIds: string[]) => {
+ distinctIds: string[]
+ }
+ moveConditionSetDown: (index: number) => {
+ index: number
+ }
+ moveConditionSetUp: (index: number) => {
+ index: number
+ }
+ openCondition: (sortKey: string) => {
+ sortKey: string
+ }
+ removeConditionSet: (index: number) => {
+ index: number
+ }
+ reorderConditionSets: (
+ activeId: string,
+ overId: string
+ ) => {
+ activeId: string
+ overId: string
+ }
+ setAffectedCount: (
+ sortKey: string,
+ count?: number
+ ) => {
+ count: number | undefined
+ sortKey: string
+ }
+ setAggregationGroupTypeIndex: (value: number | null) => {
+ value: number | null
+ }
+ setBlastRadiusError: (sortKey: string) => {
+ sortKey: string
+ }
+ setConditionAggregation: (
+ index: number,
+ groupTypeIndex: number | null
+ ) => {
+ groupTypeIndex: number | null
+ index: number
+ }
+ setDistinctIdNames: (distinctIdNames: Record<string, string>) => {
+ distinctIdNames: Record<string, string>
+ }
+ setDraggedGroup: (draggedGroup: FeatureFlagGroupType | null) => {
+ draggedGroup: FeatureFlagGroupType | null
+ }
+ setEarlyExit: (earlyExit: boolean) => {
+ earlyExit: boolean
+ }
+ setFilters: (filters: FeatureFlagFilters) => {
+ filters: FeatureFlagFilters
+ }
+ setFlagKeys: (flagKeys: Record<string, string>) => {
+ flagKeys: Record<string, string>
+ }
+ setFlagKeysLoading: (isLoading: boolean) => {
+ isLoading: boolean
+ }
+ setIsAnyItemDragging: (isAnyItemDragging: boolean) => {
+ isAnyItemDragging: boolean
+ }
+ setOpenConditions: (openConditions: string[]) => {
+ openConditions: string[]
+ }
+ setTotalCount: (
+ sortKey: string,
+ count?: number
+ ) => {
+ count: number | undefined
+ sortKey: string
+ }
+ updateConditionSet: (
+ index: number,
+ newRolloutPercentage?: number,
+ newProperties?: AnyPropertyFilter[],
+ newVariant?: string | null,
+ newDescription?: string | null
+ ) => {
+ index: number
+ newDescription: string | null | undefined
+ newProperties: AnyPropertyFilter[] | undefined
+ newRolloutPercentage: number | undefined
+ newVariant: string | null | undefined
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagReleaseConditionsLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ filterGroups: (
+ filters: FeatureFlagFilters & {
+ groups: FeatureFlagGroupTypeWithSortKey[]
+ }
+ ) => FeatureFlagGroupType[]
+ taxonomicGroupTypes: (
+ filters: FeatureFlagFilters & {
+ groups: FeatureFlagGroupTypeWithSortKey[]
+ },
+ groupTypes: Map<GroupTypeIndex, GroupType>
+ ) => TaxonomicFilterGroupType[]
+ aggregationTargetName: (
+ filters: FeatureFlagFilters & {
+ groups: FeatureFlagGroupTypeWithSortKey[]
+ },
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun
+ ) => (conditionGroupTypeIndex?: number | null | undefined) => string
+ taxonomicGroupTypesForCondition: (
+ filters: FeatureFlagFilters & {
+ groups: FeatureFlagGroupTypeWithSortKey[]
+ },
+ groupTypes: Map<GroupTypeIndex, GroupType>
+ ) => (conditionGroupTypeIndex: number | null | undefined) => TaxonomicFilterGroupType[]
+ filtersTaxonomicOptions: (
+ filters: FeatureFlagFilters & {
+ groups: FeatureFlagGroupTypeWithSortKey[]
+ }
+ ) => Partial<Record<TaxonomicFilterGroupType, SimpleOption[]>>
+ propertySelectErrors: (
+ filters: FeatureFlagFilters & {
+ groups: FeatureFlagGroupTypeWithSortKey[]
+ }
+ ) => {
+ properties:
+ | {
+ value: string | undefined
+ }[]
+ | undefined
+ rollout_percentage: string | undefined
+ variant: null
+ }[]
+ computeBlastRadiusPercentage: (
+ affectedCounts: Record<string, number | undefined>,
+ totalCounts: Record<string, number | undefined>
+ ) => (rolloutPercentage: any, sortKey: any) => any
+ getFlagKey: (flagKeyCache: Record<string, string>) => (flagId: string) => string
+ flagKeysLoading: (flagKeyLoading: boolean) => boolean
+ flagIds: (filterGroups: FeatureFlagGroupType[]) => string[]
+ distinctIds: (filterGroups: FeatureFlagGroupType[]) => string[]
+ getDistinctIdName: (distinctIdNameCache: Record<string, string>) => (distinctId: string) => string
+ properties: (filterGroups: FeatureFlagGroupType[]) => AnyPropertyFilter[]
+ }
+}
+
+export type featureFlagReleaseConditionsLogicType = MakeLogicType<
+ featureFlagReleaseConditionsLogicValues,
+ featureFlagReleaseConditionsLogicActions,
+ FeatureFlagReleaseConditionsLogicProps,
+ featureFlagReleaseConditionsLogicMeta
+>
+
export const featureFlagReleaseConditionsLogic = kea<featureFlagReleaseConditionsLogicType>([
path(['scenes', 'feature-flags', 'featureFlagReleaseConditionsLogic']),
props({} as FeatureFlagReleaseConditionsLogicProps),
@@ -706,7 +925,12 @@ export const featureFlagReleaseConditionsLogic = kea<featureFlagReleaseCondition
filterGroups: [(s) => [s.filters], (filters: FeatureFlagFilters) => filters.groups || []],
taxonomicGroupTypes: [
(s) => [s.filters, s.groupTypes],
- (filters, groupTypes): TaxonomicFilterGroupType[] => {
+ (
+ filters: FeatureFlagFilters & {
+ groups: FeatureFlagGroupTypeWithSortKey[]
+ },
+ groupTypes: Map<GroupTypeIndex, import('~/types').GroupType>
+ ): TaxonomicFilterGroupType[] => {
const targetGroupTypes = []
const targetGroup =
filters?.aggregation_group_type_index != null
@@ -732,7 +956,15 @@ export const featureFlagReleaseConditionsLogic = kea<featureFlagReleaseCondition
],
aggregationTargetName: [
(s) => [s.filters, s.aggregationLabel],
- (filters, aggregationLabel) =>
+ (
+ filters: FeatureFlagFilters & {
+ groups: FeatureFlagGroupTypeWithSortKey[]
+ },
+ aggregationLabel: (
+ groupTypeIndex: number | null | undefined,
+ deferToUserWording?: boolean
+ ) => import('~/models/groupsModel').Noun
+ ) =>
(conditionGroupTypeIndex?: number | null): string => {
const effectiveIndex = resolveAggregationGroupTypeIndex(
conditionGroupTypeIndex,
@@ -746,7 +978,12 @@ export const featureFlagReleaseConditionsLogic = kea<featureFlagReleaseCondition
],
taxonomicGroupTypesForCondition: [
(s) => [s.filters, s.groupTypes],
- (filters, groupTypes) =>
+ (
+ filters: FeatureFlagFilters & {
+ groups: FeatureFlagGroupTypeWithSortKey[]
+ },
+ groupTypes: Map<GroupTypeIndex, import('~/types').GroupType>
+ ) =>
(conditionGroupTypeIndex: number | null | undefined): TaxonomicFilterGroupType[] => {
const effectiveIndex = resolveAggregationGroupTypeIndex(
conditionGroupTypeIndex,
@@ -779,7 +1016,11 @@ export const featureFlagReleaseConditionsLogic = kea<featureFlagReleaseCondition
],
filtersTaxonomicOptions: [
(s) => [s.filters],
- (filters) => {
+ (
+ filters: FeatureFlagFilters & {
+ groups: FeatureFlagGroupTypeWithSortKey[]
+ }
+ ) => {
if (filters && filters.aggregation_group_type_index != null) {
return {}
}
@@ -797,7 +1038,11 @@ export const featureFlagReleaseConditionsLogic = kea<featureFlagReleaseCondition
],
propertySelectErrors: [
(s) => [s.filters],
- (filters) => {
+ (
+ filters: FeatureFlagFilters & {
+ groups: FeatureFlagGroupTypeWithSortKey[]
+ }
+ ) => {
return filters?.groups?.map(({ properties, rollout_percentage }: FeatureFlagGroupType) => ({
properties: properties?.map((property: AnyPropertyFilter) => ({
value: getPropertyValueError(property),
@@ -816,38 +1061,41 @@ export const featureFlagReleaseConditionsLogic = kea<featureFlagReleaseCondition
],
computeBlastRadiusPercentage: [
(s) => [s.affectedCounts, s.totalCounts],
- (affectedCounts, totalCounts) => (rolloutPercentage, sortKey) => {
- let effectiveRolloutPercentage = rolloutPercentage
- if (
- rolloutPercentage === undefined ||
- rolloutPercentage === null ||
- (rolloutPercentage && rolloutPercentage > 100)
- ) {
- effectiveRolloutPercentage = 100
- }
+ (affectedCounts: Record<string, number | undefined>, totalCounts: Record<string, number | undefined>) =>
+ (rolloutPercentage, sortKey) => {
+ let effectiveRolloutPercentage = rolloutPercentage
+ if (
+ rolloutPercentage === undefined ||
+ rolloutPercentage === null ||
+ (rolloutPercentage && rolloutPercentage > 100)
+ ) {
+ effectiveRolloutPercentage = 100
+ }
- const affected = affectedCounts[sortKey]
- const total = totalCounts[sortKey]
+ const affected = affectedCounts[sortKey]
+ const total = totalCounts[sortKey]
- if (affected === -1 || total === -1 || !total || affected === undefined) {
- return effectiveRolloutPercentage
- }
+ if (affected === -1 || total === -1 || !total || affected === undefined) {
+ return effectiveRolloutPercentage
+ }
- let effectiveTotal = total
- if (effectiveTotal === 0) {
- effectiveTotal = 1
- }
+ let effectiveTotal = total
+ if (effectiveTotal === 0) {
+ effectiveTotal = 1
+ }
- return Math.round(effectiveRolloutPercentage * ((affected ?? 0) / effectiveTotal) * 1000000) / 1000000
- },
+ return (
+ Math.round(effectiveRolloutPercentage * ((affected ?? 0) / effectiveTotal) * 1000000) / 1000000
+ )
+ },
],
getFlagKey: [
(s) => [s.flagKeyCache],
- (flagKeyCache) => (flagId: string) => {
+ (flagKeyCache: Record<string, string>) => (flagId: string) => {
return flagKeyCache[flagId] || flagId
},
],
- flagKeysLoading: [(s) => [s.flagKeyLoading], (flagKeyLoading) => flagKeyLoading],
+ flagKeysLoading: [(s) => [s.flagKeyLoading], (flagKeyLoading: boolean) => flagKeyLoading],
flagIds: [
(s) => [s.filterGroups],
(filterGroups: FeatureFlagGroupType[]) =>
diff --git a/frontend/src/scenes/feature-flags/featureFlagScheduleEditLogic.ts b/frontend/src/scenes/feature-flags/featureFlagScheduleEditLogic.ts
index d0cb135a4d4a..bdadbc71a8eb 100644
--- a/frontend/src/scenes/feature-flags/featureFlagScheduleEditLogic.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagScheduleEditLogic.ts
@@ -1,5 +1,5 @@
import { CronExpressionParser } from 'cron-parser'
-import { actions, connect, key, kea, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, key, kea, listeners, path, props, reducers, selectors } from 'kea'
import api from 'lib/api'
import { Dayjs, dayjs } from 'lib/dayjs'
@@ -7,6 +7,7 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { RecurrenceInterval, ScheduledChangeOperationType, ScheduledChangeType } from '~/types'
+import type { TeamPublicType, TeamType } from '../../types'
import { teamLogic } from '../teamLogic'
import {
describeCron,
@@ -14,7 +15,6 @@ import {
scheduleDateFromStoredISO,
scheduleDateToProjectTzISO,
} from './featureFlagLogic'
-import type { featureFlagScheduleEditLogicType } from './featureFlagScheduleEditLogicType'
// Used from reducers, which don't receive `values` — we still need a synchronous read at
// action-dispatch time. Selectors and listeners use the reactive `projectTimezone` selector instead.
@@ -26,6 +26,106 @@ export interface FeatureFlagScheduleEditLogicProps {
id: number | 'new' | 'link'
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagScheduleEditLogicValues {
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ editCronExpression: string | null
+ editCronPreview: string | null
+ editEndDate: Dayjs | null
+ editIsRecurring: boolean
+ editOperationType: ScheduledChangeOperationType | null
+ editPayloadValue: boolean
+ editRecurrenceInterval: RecurrenceInterval | null
+ editRepeatsValue: RecurrenceInterval | 'cron' | 'none'
+ editSaving: boolean
+ editScheduledAt: Dayjs | null
+ editValidationErrors: Record<string, string>
+ editingSchedule: ScheduledChangeType | null
+ hasEditChanges: boolean
+ isEditOpen: boolean
+ projectTimezone: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagScheduleEditLogicActions {
+ closeEdit: () => {
+ value: true
+ }
+ openEdit: (schedule: ScheduledChangeType) => {
+ schedule: ScheduledChangeType
+ }
+ saveEdit: () => {
+ value: true
+ }
+ saveEditFailure: () => {
+ value: true
+ }
+ saveEditSuccess: () => {
+ value: true
+ }
+ setEditCronExpression: (cron: string | null) => {
+ cron: string | null
+ }
+ setEditEndDate: (date: Dayjs | null) => {
+ date: Dayjs | null
+ }
+ setEditIsRecurring: (isRecurring: boolean) => {
+ isRecurring: boolean
+ }
+ setEditPayloadValue: (value: boolean) => {
+ value: boolean
+ }
+ setEditRecurrenceInterval: (interval: RecurrenceInterval | null) => {
+ interval: RecurrenceInterval | null
+ }
+ setEditRepeatsValue: (value: RecurrenceInterval | 'cron' | 'none') => {
+ value: RecurrenceInterval | 'cron' | 'none'
+ }
+ setEditScheduledAt: (date: Dayjs | null) => {
+ date: Dayjs | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagScheduleEditLogicMeta {
+ key: number | 'link' | 'new'
+ __keaTypeGenInternalSelectorTypes: {
+ isEditOpen: (editingSchedule: ScheduledChangeType | null) => boolean
+ projectTimezone: (currentTeam: TeamPublicType | TeamType | null) => string
+ editRepeatsValue: (
+ editIsRecurring: boolean,
+ editCronExpression: string | null,
+ editRecurrenceInterval: RecurrenceInterval | null
+ ) => RecurrenceInterval | 'cron' | 'none'
+ editCronPreview: (editCronExpression: string | null) => string | null
+ editOperationType: (editingSchedule: ScheduledChangeType | null) => ScheduledChangeOperationType | null
+ hasEditChanges: (
+ editingSchedule: ScheduledChangeType | null,
+ editScheduledAt: Dayjs | null,
+ editCronExpression: string | null,
+ editRecurrenceInterval: RecurrenceInterval | null,
+ editEndDate: Dayjs | null,
+ editIsRecurring: boolean,
+ editPayloadValue: boolean,
+ projectTimezone: string
+ ) => boolean
+ editValidationErrors: (
+ editScheduledAt: Dayjs | null,
+ editCronExpression: string | null,
+ editEndDate: Dayjs | null,
+ editIsRecurring: boolean,
+ projectTimezone: string
+ ) => Record<string, string>
+ }
+}
+
+export type featureFlagScheduleEditLogicType = MakeLogicType<
+ featureFlagScheduleEditLogicValues,
+ featureFlagScheduleEditLogicActions,
+ FeatureFlagScheduleEditLogicProps,
+ featureFlagScheduleEditLogicMeta
+>
+
export const featureFlagScheduleEditLogic = kea<featureFlagScheduleEditLogicType>([
path((id) => ['scenes', 'feature-flags', 'featureFlagScheduleEditLogic', id]),
props({} as FeatureFlagScheduleEditLogicProps),
@@ -126,19 +226,28 @@ export const featureFlagScheduleEditLogic = kea<featureFlagScheduleEditLogicType
],
}),
selectors({
- isEditOpen: [(s) => [s.editingSchedule], (schedule): boolean => schedule !== null],
+ isEditOpen: [(s) => [s.editingSchedule], (schedule: ScheduledChangeType | null): boolean => schedule !== null],
// Reactive timezone input — selectors that depend on it recompute when the project
// timezone changes, which matters if the user switches projects while the edit dialog is open.
- projectTimezone: [(s) => [s.currentTeam], (currentTeam): string => currentTeam?.timezone || 'UTC'],
+ projectTimezone: [
+ (s) => [s.currentTeam],
+ (currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType): string =>
+ currentTeam?.timezone || 'UTC',
+ ],
editRepeatsValue: [
(s) => [s.editIsRecurring, s.editCronExpression, s.editRecurrenceInterval],
- (isRecurring, cron, interval): RecurrenceInterval | 'none' | 'cron' =>
+ (
+ isRecurring: boolean,
+ cron: string | null,
+ interval: RecurrenceInterval | null
+ ): RecurrenceInterval | 'none' | 'cron' =>
isRecurring ? (cron !== null ? 'cron' : (interval ?? 'none')) : 'none',
],
- editCronPreview: [(s) => [s.editCronExpression], (cron): string | null => describeCron(cron)],
+ editCronPreview: [(s) => [s.editCronExpression], (cron: string | null): string | null => describeCron(cron)],
editOperationType: [
(s) => [s.editingSchedule],
- (schedule): ScheduledChangeOperationType | null => schedule?.payload?.operation ?? null,
+ (schedule: ScheduledChangeType | null): ScheduledChangeOperationType | null =>
+ schedule?.payload?.operation ?? null,
],
hasEditChanges: [
(s) => [
@@ -151,7 +260,16 @@ export const featureFlagScheduleEditLogic = kea<featureFlagScheduleEditLogicType
s.editPayloadValue,
s.projectTimezone,
],
- (schedule, scheduledAt, cron, interval, endDate, isRecurring, payloadValue, tz): boolean => {
+ (
+ schedule: ScheduledChangeType | null,
+ scheduledAt: Dayjs | null,
+ cron: string | null,
+ interval: RecurrenceInterval | null,
+ endDate: Dayjs | null,
+ isRecurring: boolean,
+ payloadValue: boolean,
+ tz: string
+ ): boolean => {
if (!schedule) {
return false
}
@@ -188,7 +306,13 @@ export const featureFlagScheduleEditLogic = kea<featureFlagScheduleEditLogicType
],
editValidationErrors: [
(s) => [s.editScheduledAt, s.editCronExpression, s.editEndDate, s.editIsRecurring, s.projectTimezone],
- (scheduledAt, cron, endDate, isRecurring, tz): Record<string, string> => {
+ (
+ scheduledAt: Dayjs | null,
+ cron: string | null,
+ endDate: Dayjs | null,
+ isRecurring: boolean,
+ tz: string
+ ): Record<string, string> => {
const errors: Record<string, string> = {}
// editScheduledAt is a browser-local Dayjs whose wall clock mirrors the project
// timezone, so we reinterpret it in project tz before comparing to "now".
diff --git a/frontend/src/scenes/feature-flags/featureFlagTestingLogic.ts b/frontend/src/scenes/feature-flags/featureFlagTestingLogic.ts
index ad16b0812ee5..00135be1ae58 100644
--- a/frontend/src/scenes/feature-flags/featureFlagTestingLogic.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagTestingLogic.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 { loaders } from 'kea-loaders'
import api, { ApiError } from 'lib/api'
@@ -15,7 +15,7 @@ import type {
FeatureFlagTestEvaluationResponseApi,
} from 'products/feature_flags/frontend/generated/api.schemas'
-import type { featureFlagTestingLogicType } from './featureFlagTestingLogicType'
+import type { FeatureFlagConditionPropertyAnalysisApi } from '../../../../products/feature_flags/frontend/generated/api.schemas'
export type ConditionAnalysis = FeatureFlagConditionAnalysisApi
export type TestResult = FeatureFlagTestEvaluationResponseApi
@@ -121,6 +121,265 @@ export interface FeatureFlagTestingLogicProps {
flagId: number
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagTestingLogicValues {
+ currentProjectId: number | null // projectLogic
+ activeResult: TestResult | null
+ allEvaluations: PerDistinctIdEvaluation[] | null
+ allEvaluationsLoading: boolean
+ bucketingDistinctId: string | null
+ datePickerOpen: boolean
+ datePickerValue: Dayjs | null
+ enrichedConditions: {
+ display: {
+ label: string | null
+ tone: 'info' | 'muted' | 'success' | 'warning'
+ }
+ explanation: string
+ index: number
+ isWinningCondition: boolean
+ matched: boolean
+ matchedButNotWinner: boolean | undefined
+ properties: FeatureFlagConditionPropertyAnalysisApi[]
+ properties_matched?: boolean | undefined
+ rollout_excluded: boolean
+ rollout_percentage: number
+ variant: string | null
+ }[]
+ errorDisplay: {
+ helpText: string | null
+ message: string
+ } | null
+ hasMultipleDistinctIds: boolean
+ hasValidPerson: boolean
+ includeTime: boolean
+ personDistinctIds: string[]
+ resolvedPersonDistinctIds: string[] | null
+ resolvedPersonDistinctIdsLoading: boolean
+ resultsDiverge: boolean
+ selectedPerson: Partial<PersonType> | null
+ selectedResultDistinctId: string | null
+ testError: string | null
+ testEvaluation: TestResult | null
+ testEvaluationLoading: boolean
+ testFormData: TestFormData
+ testResult: TestResult | null
+ usedProperties: Set<string>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagTestingLogicActions {
+ clearBatchEvaluations: () => {
+ value: true
+ }
+ clearBatchEvaluationsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ clearBatchEvaluationsSuccess: (
+ allEvaluations: null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ allEvaluations: null
+ payload?: {
+ value: true
+ }
+ }
+ clearTestForm: () => {
+ value: true
+ }
+ clearTestFormFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ clearTestFormSuccess: (
+ resolvedPersonDistinctIds: null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ resolvedPersonDistinctIds: null
+ payload?: {
+ value: true
+ }
+ }
+ resolvePersonDistinctIds: (distinctId: string) => string
+ resolvePersonDistinctIdsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ resolvePersonDistinctIdsSuccess: (
+ resolvedPersonDistinctIds: string[],
+ payload?: string
+ ) => {
+ resolvedPersonDistinctIds: string[]
+ payload?: string
+ }
+ setDatePickerOpen: (open: boolean) => {
+ open: boolean
+ }
+ setDatePickerValue: (value: Dayjs | null) => {
+ value: Dayjs | null
+ }
+ setIncludeTime: (includeTime: boolean) => {
+ includeTime: boolean
+ }
+ setSelectedPerson: (
+ person: Partial<PersonType> | null,
+ distinctId?: string
+ ) => {
+ distinctId: string | undefined
+ person: Partial<PersonType> | null
+ }
+ setSelectedPersonFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ setSelectedPersonSuccess: (
+ resolvedPersonDistinctIds: null,
+ payload?: {
+ distinctId: string | undefined
+ person: Partial<PersonType> | null
+ }
+ ) => {
+ resolvedPersonDistinctIds: null
+ payload?: {
+ distinctId: string | undefined
+ person: Partial<PersonType> | null
+ }
+ }
+ setSelectedResultDistinctId: (distinctId: string | null) => {
+ distinctId: string | null
+ }
+ setTestError: (error: string | null) => {
+ error: string | null
+ }
+ setTestFormData: (formData: Partial<TestFormData>) => {
+ formData: Partial<TestFormData>
+ }
+ testAllDistinctIds: ({
+ flagId,
+ distinctIds,
+ formData,
+ }: {
+ distinctIds: string[]
+ flagId: number
+ formData: TestFormData
+ }) => {
+ flagId: number
+ distinctIds: string[]
+ formData: TestFormData
+ }
+ testAllDistinctIdsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ testAllDistinctIdsSuccess: (
+ allEvaluations: PerDistinctIdEvaluation[],
+ payload?: {
+ flagId: number
+ distinctIds: string[]
+ formData: TestFormData
+ }
+ ) => {
+ allEvaluations: PerDistinctIdEvaluation[]
+ payload?: {
+ flagId: number
+ distinctIds: string[]
+ formData: TestFormData
+ }
+ }
+ testFlagEvaluation: ({ flagId, formData }: { flagId: number; formData: TestFormData }) => {
+ flagId: number
+ formData: TestFormData
+ }
+ testFlagEvaluationFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ testFlagEvaluationSuccess: (
+ testEvaluation: FeatureFlagTestEvaluationResponseApi,
+ payload?: {
+ flagId: number
+ formData: TestFormData
+ }
+ ) => {
+ testEvaluation: FeatureFlagTestEvaluationResponseApi
+ payload?: {
+ flagId: number
+ formData: TestFormData
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagTestingLogicMeta {
+ key: number
+ __keaTypeGenInternalSelectorTypes: {
+ activeResult: (
+ testResult: FeatureFlagTestEvaluationResponseApi | null,
+ allEvaluations: PerDistinctIdEvaluation[] | null,
+ selectedResultDistinctId: string | null
+ ) => TestResult | null
+ resultsDiverge: (allEvaluations: PerDistinctIdEvaluation[] | null) => boolean
+ usedProperties: (activeResult: FeatureFlagTestEvaluationResponseApi | null) => Set<string>
+ enrichedConditions: (activeResult: FeatureFlagTestEvaluationResponseApi | null) => {
+ display: {
+ label: string | null
+ tone: 'info' | 'muted' | 'success' | 'warning'
+ }
+ explanation: string
+ index: number
+ isWinningCondition: boolean
+ matched: boolean
+ matchedButNotWinner: boolean | undefined
+ properties: FeatureFlagConditionPropertyAnalysisApi[]
+ properties_matched?: boolean | undefined
+ rollout_excluded: boolean
+ rollout_percentage: number
+ variant: string | null
+ }[]
+ hasValidPerson: (testFormData: TestFormData) => boolean
+ personDistinctIds: (
+ selectedPerson: Partial<PersonType> | null,
+ resolvedPersonDistinctIds: string[] | null
+ ) => string[]
+ hasMultipleDistinctIds: (personDistinctIds: string[]) => boolean
+ bucketingDistinctId: (activeResult: FeatureFlagTestEvaluationResponseApi | null) => string | null
+ errorDisplay: (testError: string | null) => {
+ helpText: string | null
+ message: string
+ } | null
+ }
+}
+
+export type featureFlagTestingLogicType = MakeLogicType<
+ featureFlagTestingLogicValues,
+ featureFlagTestingLogicActions,
+ FeatureFlagTestingLogicProps,
+ featureFlagTestingLogicMeta
+>
+
export const featureFlagTestingLogic = kea<featureFlagTestingLogicType>([
props({} as FeatureFlagTestingLogicProps),
key((props) => props.flagId),
diff --git a/frontend/src/scenes/feature-flags/featureFlagsLogic.ts b/frontend/src/scenes/feature-flags/featureFlagsLogic.ts
index 173ffc41439c..77e303d71cb0 100644
--- a/frontend/src/scenes/feature-flags/featureFlagsLogic.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagsLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, router, urlToAction } from 'kea-router'
@@ -16,8 +16,6 @@ import { urls } from 'scenes/urls'
import { SIDE_PANEL_CONTEXT_KEY, SidePanelSceneContext } from '~/layout/navigation-3000/sidepanel/types'
import { ActivityScope, Breadcrumb, FeatureFlagType } from '~/types'
-import type { featureFlagsLogicType } from './featureFlagsLogicType'
-
export const FLAGS_PER_PAGE = 100
export function flagMatchesSearch(flag: FeatureFlagType, search?: string): boolean {
@@ -158,6 +156,179 @@ export interface FlagLogicProps {
flagPrefix?: string // used to filter flags by prefix e.g. for the user interview flags
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagsLogicValues {
+ currentProjectId: number | null // projectLogic
+ activeTab: FeatureFlagsTab
+ breadcrumbs: Breadcrumb[]
+ count: number
+ displayedFlags: FeatureFlagType[]
+ enrichAnalyticsNoticeAcknowledged: boolean
+ featureFlags: FeatureFlagsResult
+ featureFlagsLoading: boolean
+ featureFlagsUpdating: Record<number, boolean>
+ filters: FeatureFlagsFilters
+ filtersChanged: boolean
+ localFlagsCache: FeatureFlagType[]
+ pagination: PaginationManual
+ paramsFromFilters: {
+ active?: string | undefined
+ archived?: string | undefined
+ created_by_id?: number[] | undefined
+ evaluation_runtime?: string | undefined
+ excluded_tags?: string[] | undefined
+ limit: number
+ offset: number
+ order?: string | undefined
+ page?: number | undefined
+ search?: string | undefined
+ tags?: string[] | undefined
+ type?: string | undefined
+ }
+ shouldShowEmptyState: boolean
+ sidePanelContext: SidePanelSceneContext
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagsLogicActions {
+ closeEnrichAnalyticsNotice: () => {
+ value: true
+ }
+ deleteFlag: (id: number) => {
+ id: number
+ }
+ loadFeatureFlags: () => any
+ loadFeatureFlagsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadFeatureFlagsSuccess: (
+ featureFlags: FeatureFlagsResult,
+ payload?: any
+ ) => {
+ featureFlags: FeatureFlagsResult
+ payload?: any
+ }
+ setActiveTab: (tabKey: FeatureFlagsTab) => {
+ tabKey: FeatureFlagsTab
+ }
+ setFeatureFlagUpdating: (
+ id: number,
+ updating: boolean
+ ) => {
+ id: number
+ updating: boolean
+ }
+ setFeatureFlagsFilters: (
+ filters: Partial<FeatureFlagsFilters>,
+ replace?: boolean
+ ) => {
+ filters: Partial<FeatureFlagsFilters>
+ replace: boolean | undefined
+ }
+ updateFeatureFlag: ({ id, payload }: { id: number; payload: Partial<FeatureFlagType> }) => {
+ id: number
+ payload: Partial<FeatureFlagType>
+ }
+ updateFeatureFlagFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateFeatureFlagSuccess: (
+ featureFlags: {
+ count: number
+ filters?: FeatureFlagsFilters | null | undefined
+ lastUpdatedFlagId: number
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: any[]
+ },
+ payload?: {
+ id: number
+ payload: Partial<FeatureFlagType>
+ }
+ ) => {
+ featureFlags: {
+ count: number
+ filters?: FeatureFlagsFilters | null | undefined
+ lastUpdatedFlagId: number
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: any[]
+ }
+ payload?: {
+ id: number
+ payload: Partial<FeatureFlagType>
+ }
+ }
+ updateFlag: (flag: FeatureFlagType) => {
+ flag: FeatureFlagType
+ }
+ updateFlagActive: (
+ id: number,
+ active: boolean
+ ) => {
+ active: boolean
+ id: number
+ }
+ updateFlagFromPartial: (
+ flag: Partial<FeatureFlagType> & {
+ id: number
+ }
+ ) => {
+ flag: Partial<FeatureFlagType> & {
+ id: number
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featureFlagsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ count: (featureFlags: FeatureFlagsResult) => number
+ filtersChanged: (filters: FeatureFlagsFilters, featureFlags: FeatureFlagsResult) => boolean
+ paramsFromFilters: (filters: FeatureFlagsFilters) => {
+ active?: string | undefined
+ archived?: string | undefined
+ created_by_id?: number[] | undefined
+ evaluation_runtime?: string | undefined
+ excluded_tags?: string[] | undefined
+ limit: number
+ offset: number
+ order?: string | undefined
+ page?: number | undefined
+ search?: string | undefined
+ tags?: string[] | undefined
+ type?: string | undefined
+ }
+ shouldShowEmptyState: (
+ featureFlagsLoading: boolean,
+ featureFlags: FeatureFlagsResult,
+ filters: FeatureFlagsFilters
+ ) => boolean
+ pagination: (
+ filters: FeatureFlagsFilters,
+ displayedFlags: FeatureFlagType[],
+ featureFlags: FeatureFlagsResult,
+ filtersChanged: boolean
+ ) => PaginationManual
+ displayedFlags: (localFlagsCache: FeatureFlagType[], filters: FeatureFlagsFilters) => FeatureFlagType[]
+ }
+}
+
+export type featureFlagsLogicType = MakeLogicType<
+ featureFlagsLogicValues,
+ featureFlagsLogicActions,
+ FlagLogicProps,
+ featureFlagsLogicMeta
+>
+
export const featureFlagsLogic = kea<featureFlagsLogicType>([
props({} as FlagLogicProps),
path(['scenes', 'feature-flags', 'featureFlagsLogic']),
@@ -294,10 +465,10 @@ export const featureFlagsLogic = kea<featureFlagsLogicType>([
],
}),
selectors({
- count: [(selectors) => [selectors.featureFlags], (featureFlags) => featureFlags.count],
+ count: [(selectors) => [selectors.featureFlags], (featureFlags: FeatureFlagsResult) => featureFlags.count],
filtersChanged: [
(s) => [s.filters, s.featureFlags],
- (filters, featureFlags): boolean => {
+ (filters: FeatureFlagsFilters, featureFlags: FeatureFlagsResult): boolean => {
if (!featureFlags.filters) {
return false
}
@@ -326,7 +497,7 @@ export const featureFlagsLogic = kea<featureFlagsLogicType>([
// Check to see if any non-default filters are being used
shouldShowEmptyState: [
(s) => [s.featureFlagsLoading, s.featureFlags, s.filters],
- (featureFlagsLoading, featureFlags, filters): boolean => {
+ (featureFlagsLoading: boolean, featureFlags: FeatureFlagsResult, filters: FeatureFlagsFilters): boolean => {
return (
!featureFlagsLoading && featureFlags.results.length <= 0 && objectsEqual(filters, DEFAULT_FILTERS)
)
@@ -334,7 +505,12 @@ export const featureFlagsLogic = kea<featureFlagsLogicType>([
],
pagination: [
(s) => [s.filters, s.displayedFlags, s.featureFlags, s.filtersChanged],
- (filters, displayedFlags, featureFlags, filtersChanged): PaginationManual => {
+ (
+ filters: FeatureFlagsFilters,
+ displayedFlags: FeatureFlagType[],
+ featureFlags: FeatureFlagsResult,
+ filtersChanged: boolean
+ ): PaginationManual => {
return {
controlled: true,
pageSize: FLAGS_PER_PAGE,
diff --git a/frontend/src/scenes/feature-flags/flagSelectionLogic.ts b/frontend/src/scenes/feature-flags/flagSelectionLogic.ts
index c51b2bf82c27..069d779a1a8d 100644
--- a/frontend/src/scenes/feature-flags/flagSelectionLogic.ts
+++ b/frontend/src/scenes/feature-flags/flagSelectionLogic.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 { beforeUnload } from 'kea-router'
@@ -13,8 +13,8 @@ import { projectLogic } from 'scenes/projectLogic'
import type { CopyFlagsResponseApi } from 'products/feature_flags/frontend/generated/api.schemas'
+import type { OrganizationType } from '../../types'
import { featureFlagsLogic } from './featureFlagsLogic'
-import type { flagSelectionLogicType } from './flagSelectionLogicType'
export type FlagRolloutState = 'fully_rolled_out' | 'not_rolled_out' | 'partial'
@@ -173,6 +173,160 @@ export function getBulkCopyDisabledReason(selectedCount: number, extraReason?: s
return undefined
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface flagSelectionLogicValues {
+ paramsFromFilters: {
+ active?: string | undefined
+ archived?: string | undefined
+ created_by_id?: number[] | undefined
+ evaluation_runtime?: string | undefined
+ excluded_tags?: string[] | undefined
+ limit: number
+ offset: number
+ order?: string | undefined
+ page?: number | undefined
+ search?: string | undefined
+ tags?: string[] | undefined
+ type?: string | undefined
+ } // featureFlagsLogic
+ currentOrganization: OrganizationType | null // organizationLogic
+ currentProjectId: number | null // projectLogic
+ bulkCopyDisableCopiedFlag: boolean
+ bulkCopyFlagCount: number
+ bulkCopyHardFailures: BulkCopyFailure[]
+ bulkCopyModalVisible: boolean
+ bulkCopyParams: BulkCopyParams | null
+ bulkCopyPendingApproval: BulkCopyFailure[]
+ bulkCopyProgress: {
+ done: number
+ total: number
+ } | null
+ bulkCopyResult: BulkCopyResult | null
+ bulkCopyRunning: boolean
+ bulkCopySchedule: boolean
+ bulkCopySourceProjectId: number | null
+ bulkCopySplitCopied: {
+ newCopies: {
+ key: string
+ projectIds: number[]
+ }[]
+ overwrites: {
+ key: string
+ projectIds: number[]
+ }[]
+ }
+ bulkCopySubmitDisabledReason: string | undefined
+ bulkCopyTargetProjectIds: number[]
+ bulkDeleteResponse: BulkDeleteResult | null
+ bulkDeleteResponseLoading: boolean
+ bulkDeleteResult: BulkDeleteResult | null
+ resultsModalVisible: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface flagSelectionLogicActions {
+ reportFeatureFlagBulkCopy: (
+ flagCount: number,
+ projectCount: number,
+ failedCount: number
+ ) => {
+ failedCount: number
+ flagCount: number
+ projectCount: number
+ } // eventUsageLogic
+ loadFeatureFlags: () => any // featureFlagsLogic
+ bulkCopyFlags: () => {
+ value: true
+ }
+ bulkCopyFlagsFinished: (result: BulkCopyResult | null) => {
+ result: BulkCopyResult | null
+ }
+ bulkDeleteFlags: ({ ids, allMatching }: { allMatching: boolean; ids: number[] }) => {
+ ids: number[]
+ allMatching: boolean
+ }
+ bulkDeleteFlagsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ bulkDeleteFlagsSuccess: (
+ bulkDeleteResponse: BulkDeleteResult,
+ payload?: {
+ ids: number[]
+ allMatching: boolean
+ }
+ ) => {
+ bulkDeleteResponse: BulkDeleteResult
+ payload?: {
+ ids: number[]
+ allMatching: boolean
+ }
+ }
+ closeBulkCopyModal: () => {
+ value: true
+ }
+ hideResultsModal: () => {
+ value: true
+ }
+ openBulkCopyModal: (params: BulkCopyParams) => {
+ params: BulkCopyParams
+ }
+ setBulkCopyDisableCopiedFlag: (disableCopiedFlag: boolean) => {
+ disableCopiedFlag: boolean
+ }
+ setBulkCopyProgress: (
+ done: number,
+ total: number
+ ) => {
+ done: number
+ total: number
+ }
+ setBulkCopySchedule: (copySchedule: boolean) => {
+ copySchedule: boolean
+ }
+ setBulkCopySourceProjectId: (projectId: number) => {
+ projectId: number
+ }
+ setBulkCopyTargetProjectIds: (projectIds: number[]) => {
+ projectIds: number[]
+ }
+ showResultsModal: (result: BulkDeleteResult) => {
+ result: BulkDeleteResult
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface flagSelectionLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ resultsModalVisible: (bulkDeleteResult: BulkDeleteResult | null) => boolean
+ bulkCopyModalVisible: (bulkCopyParams: BulkCopyParams | null) => boolean
+ bulkCopyFlagCount: (bulkCopyParams: BulkCopyParams | null) => number
+ bulkCopySplitCopied: (bulkCopyResult: BulkCopyResult | null) => {
+ newCopies: {
+ key: string
+ projectIds: number[]
+ }[]
+ overwrites: {
+ key: string
+ projectIds: number[]
+ }[]
+ }
+ bulkCopyPendingApproval: (bulkCopyResult: BulkCopyResult | null) => BulkCopyFailure[]
+ bulkCopyHardFailures: (bulkCopyResult: BulkCopyResult | null) => BulkCopyFailure[]
+ bulkCopySubmitDisabledReason: (bulkCopyTargetProjectIds: number[]) => string | undefined
+ }
+}
+
+export type flagSelectionLogicType = MakeLogicType<
+ flagSelectionLogicValues,
+ flagSelectionLogicActions,
+ Record<string, any>,
+ flagSelectionLogicMeta
+>
+
export const flagSelectionLogic = kea<flagSelectionLogicType>([
path(['scenes', 'feature-flags', 'flagSelectionLogic']),
diff --git a/frontend/src/scenes/feature-flags/projects-grid/projectsGridLogic.ts b/frontend/src/scenes/feature-flags/projects-grid/projectsGridLogic.ts
index dca8828f65c7..cab2889dfff9 100644
--- a/frontend/src/scenes/feature-flags/projects-grid/projectsGridLogic.ts
+++ b/frontend/src/scenes/feature-flags/projects-grid/projectsGridLogic.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 api from 'lib/api'
@@ -9,8 +9,8 @@ import { teamLogic } from 'scenes/teamLogic'
import { OrganizationFeatureFlag, OrganizationFeatureFlagRow, OrganizationType } from '~/types'
import { flagSelectionLogic } from '../flagSelectionLogic'
+import type { BulkCopyResult } from '../flagSelectionLogic'
import { flagToggleKey, updateFlagActiveInProject } from '../updateFlagActiveInProject'
-import type { projectsGridLogicType } from './projectsGridLogicType'
export const PAGE_SIZE = 25
@@ -23,6 +23,138 @@ export interface LoadFlagsResult {
const storageKey = (teamId: number): string => `ff-projects-grid.picked-teams.${teamId}`
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface projectsGridLogicValues {
+ currentOrganization: OrganizationType | null // organizationLogic
+ currentTeamId: number | null // teamLogic
+ accessibleTeamIds: Set<number>
+ flags: OrganizationFeatureFlagRow[]
+ flagsHasMore: boolean
+ flagsOffset: number
+ flagsPage: LoadFlagsResult | null
+ flagsPageLoading: boolean
+ pickedTeamIds: number[]
+ search: string
+ siblingQueue: string[]
+ siblingsByFlagKey: Record<string, OrganizationFeatureFlag[]>
+ siblingsLoadingKeys: string[]
+ togglingFlagIds: Record<string, boolean>
+ visibleColumns: number[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface projectsGridLogicActions {
+ bulkCopyFlagsFinished: (result: BulkCopyResult | null) => {
+ result: BulkCopyResult | null
+ } // flagSelectionLogic
+ enqueueSiblingFetches: (keys: string[]) => {
+ keys: string[]
+ }
+ flagActiveUpdateFailed: (
+ teamId: number,
+ flagId: number
+ ) => {
+ flagId: number
+ teamId: number
+ }
+ flagActiveUpdated: (
+ flagKey: string,
+ teamId: number,
+ flagId: number,
+ active: boolean
+ ) => {
+ active: boolean
+ flagId: number
+ flagKey: string
+ teamId: number
+ }
+ loadFlagsPage: ({ offset, search }: { offset: number; search: string }) => {
+ offset: number
+ search: string
+ }
+ loadFlagsPageFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadFlagsPageSuccess: (
+ flagsPage: {
+ next: string | null
+ offset: number
+ results: OrganizationFeatureFlagRow[]
+ search: string
+ },
+ payload?: {
+ offset: number
+ search: string
+ }
+ ) => {
+ flagsPage: {
+ next: string | null
+ offset: number
+ results: OrganizationFeatureFlagRow[]
+ search: string
+ }
+ payload?: {
+ offset: number
+ search: string
+ }
+ }
+ loadMoreFlags: () => {
+ value: true
+ }
+ resetPickedTeamIds: () => {
+ value: true
+ }
+ setPickedTeamIds: (teamIds: number[]) => {
+ teamIds: number[]
+ }
+ setSearch: (search: string) => {
+ search: string
+ }
+ siblingsFailed: (flagKey: string) => {
+ flagKey: string
+ }
+ siblingsLoaded: (
+ flagKey: string,
+ siblings: OrganizationFeatureFlag[]
+ ) => {
+ flagKey: string
+ siblings: OrganizationFeatureFlag[]
+ }
+ startSiblingFetch: (flagKey: string) => {
+ flagKey: string
+ }
+ toggleFlagActive: (
+ flagKey: string,
+ teamId: number,
+ flagId: number,
+ active: boolean
+ ) => {
+ active: boolean
+ flagId: number
+ flagKey: string
+ teamId: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface projectsGridLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ visibleColumns: (currentTeamId: number | null, pickedTeamIds: number[]) => number[]
+ accessibleTeamIds: (currentOrganization: OrganizationType | null) => Set<number>
+ }
+}
+
+export type projectsGridLogicType = MakeLogicType<
+ projectsGridLogicValues,
+ projectsGridLogicActions,
+ Record<string, any>,
+ projectsGridLogicMeta
+>
+
export const projectsGridLogic = kea<projectsGridLogicType>([
path(['scenes', 'feature-flags', 'projects-grid', 'projectsGridLogic']),
connect(() => ({
@@ -174,7 +306,7 @@ export const projectsGridLogic = kea<projectsGridLogicType>([
selectors({
visibleColumns: [
(s) => [s.currentTeamId, s.pickedTeamIds],
- (currentTeamId, pickedTeamIds): number[] =>
+ (currentTeamId: number | null, pickedTeamIds: number[]): number[] =>
currentTeamId ? [currentTeamId, ...pickedTeamIds.filter((id) => id !== currentTeamId)] : pickedTeamIds,
],
accessibleTeamIds: [
diff --git a/frontend/src/scenes/health/categoryDetail/healthCategoryDetailLogic.ts b/frontend/src/scenes/health/categoryDetail/healthCategoryDetailLogic.ts
index 55398eb3eae8..5d9338e02b81 100644
--- a/frontend/src/scenes/health/categoryDetail/healthCategoryDetailLogic.ts
+++ b/frontend/src/scenes/health/categoryDetail/healthCategoryDetailLogic.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 { router } from 'kea-router'
@@ -13,11 +13,12 @@ import { Breadcrumb } from '~/types'
import { HEALTH_CATEGORY_CONFIG, kindsForCategory } from '../healthCategories'
import type { HealthIssueCategory } from '../healthCategories'
+import type { CategoryConfig } from '../healthCategories'
import type { HealthIssuesResponse } from '../healthSceneLogic'
import { kindToLabel, worstSeverity as computeWorstSeverity } from '../healthUtils'
import type { HealthIssue, HealthIssueSeverity } from '../types'
import { CATEGORY_DETAIL_CONFIG } from './categoryDetailConfig'
-import type { healthCategoryDetailLogicType } from './healthCategoryDetailLogicType'
+import type { CategoryDetailConfig } from './categoryDetailConfig'
export interface HealthCategoryDetailLogicProps {
category: string
@@ -30,6 +31,83 @@ export interface KindGroup {
worstSeverity: HealthIssueSeverity
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface healthCategoryDetailLogicValues {
+ currentTeamIdStrict: number | string // teamLogic
+ breadcrumbs: Breadcrumb[]
+ category: string
+ categoryConfig: CategoryConfig
+ categoryIssues: HealthIssue[]
+ detailConfig: CategoryDetailConfig | undefined
+ healthIssues: HealthIssuesResponse | null
+ healthIssuesLoading: boolean
+ isValidCategory: boolean
+ issuesByKind: KindGroup[]
+ showDismissed: boolean
+ statusSummary: {
+ count: number
+ isHealthy: boolean
+ worstSeverity: HealthIssueSeverity | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface healthCategoryDetailLogicActions {
+ dismissIssue: (id: string) => {
+ id: string
+ }
+ loadHealthIssues: () => any
+ loadHealthIssuesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadHealthIssuesSuccess: (
+ healthIssues: HealthIssuesResponse | null,
+ payload?: any
+ ) => {
+ healthIssues: HealthIssuesResponse | null
+ payload?: any
+ }
+ refreshHealthData: () => {
+ value: true
+ }
+ setShowDismissed: (show: boolean) => {
+ show: boolean
+ }
+ undismissIssue: (id: string) => {
+ id: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface healthCategoryDetailLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ category: (arg: any) => string
+ isValidCategory: (category: string) => boolean
+ categoryConfig: (category: string) => CategoryConfig
+ detailConfig: (category: string) => CategoryDetailConfig | undefined
+ categoryIssues: (healthIssues: HealthIssuesResponse | null, category: string) => HealthIssue[]
+ issuesByKind: (categoryIssues: HealthIssue[]) => KindGroup[]
+ statusSummary: (categoryIssues: HealthIssue[]) => {
+ count: number
+ isHealthy: boolean
+ worstSeverity: HealthIssueSeverity | null
+ }
+ breadcrumbs: (categoryConfig: CategoryConfig) => Breadcrumb[]
+ }
+}
+
+export type healthCategoryDetailLogicType = MakeLogicType<
+ healthCategoryDetailLogicValues,
+ healthCategoryDetailLogicActions,
+ HealthCategoryDetailLogicProps,
+ healthCategoryDetailLogicMeta
+>
+
export const healthCategoryDetailLogic = kea<healthCategoryDetailLogicType>([
path((key) => ['scenes', 'health', 'categoryDetail', 'healthCategoryDetailLogic', key]),
props({} as HealthCategoryDetailLogicProps),
diff --git a/frontend/src/scenes/health/healthSceneLogic.tsx b/frontend/src/scenes/health/healthSceneLogic.tsx
index e7086e79fc41..ffac2ade89b1 100644
--- a/frontend/src/scenes/health/healthSceneLogic.tsx
+++ b/frontend/src/scenes/health/healthSceneLogic.tsx
@@ -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 api, { ApiError } from 'lib/api'
@@ -11,7 +11,6 @@ import { teamLogic } from 'scenes/teamLogic'
import { Breadcrumb } from '~/types'
import { CATEGORY_ORDER, HEALTH_CATEGORY_CONFIG, categoryForKind } from './healthCategories'
-import type { healthSceneLogicType } from './healthSceneLogicType'
import type { CategoryHealthSummary, HealthIssue, HealthIssueSeverity } from './types'
import { REFRESH_COOLDOWN_MS, REFRESH_POLL_COUNT, REFRESH_POLL_INTERVAL_MS, SEVERITY_ORDER } from './types'
@@ -22,6 +21,77 @@ export interface HealthIssuesResponse {
previous?: string | null
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface healthSceneLogicValues {
+ currentTeamIdStrict: number | string // teamLogic
+ breadcrumbs: Breadcrumb[]
+ categorySummaries: CategoryHealthSummary[]
+ healthIssues: HealthIssuesResponse | null
+ healthIssuesLoading: boolean
+ isManualRefresh: boolean
+ isRefreshInFlight: boolean
+ issues: HealthIssue[]
+ nextRefreshAvailableAt: number | null
+ showDismissed: boolean
+ totalCount: number
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface healthSceneLogicActions {
+ clearRefreshInFlight: () => {
+ value: true
+ }
+ dismissIssue: (id: string) => {
+ id: string
+ }
+ loadHealthIssues: () => any
+ loadHealthIssuesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadHealthIssuesSuccess: (
+ healthIssues: HealthIssuesResponse | null,
+ payload?: any
+ ) => {
+ healthIssues: HealthIssuesResponse | null
+ payload?: any
+ }
+ refreshHealthData: (isManual?: boolean) => {
+ isManual: boolean
+ }
+ resetManualRefresh: () => {
+ value: true
+ }
+ setNextRefreshAvailableAt: (timestamp: number | null) => {
+ timestamp: number | null
+ }
+ setShowDismissed: (show: boolean) => {
+ show: boolean
+ }
+ undismissIssue: (id: string) => {
+ id: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface healthSceneLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ issues: (healthIssues: HealthIssuesResponse | null) => HealthIssue[]
+ totalCount: (healthIssues: HealthIssuesResponse | null) => number
+ categorySummaries: (issues: HealthIssue[]) => CategoryHealthSummary[]
+ }
+}
+
+export type healthSceneLogicType = MakeLogicType<
+ healthSceneLogicValues,
+ healthSceneLogicActions,
+ Record<string, any>,
+ healthSceneLogicMeta
+>
+
export const healthSceneLogic = kea<healthSceneLogicType>([
path(['scenes', 'health', 'healthSceneLogic']),
connect({
diff --git a/frontend/src/scenes/health/pipelineStatus/pipelineHealthLogic.ts b/frontend/src/scenes/health/pipelineStatus/pipelineHealthLogic.ts
index 5d02b05ca42d..f5d3201cbb0c 100644
--- a/frontend/src/scenes/health/pipelineStatus/pipelineHealthLogic.ts
+++ b/frontend/src/scenes/health/pipelineStatus/pipelineHealthLogic.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 api from 'lib/api'
@@ -6,7 +6,7 @@ import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { teamLogic } from 'scenes/teamLogic'
-import type { pipelineHealthLogicType } from './pipelineHealthLogicType'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
export type HealthStatus = 'danger' | 'warning' | 'success'
@@ -28,6 +28,58 @@ export interface DataHealthIssuesResponse {
export const REFRESH_INTERVAL = 60 * 1000 * 5 // 5 minutes
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface pipelineHealthLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ currentTeamIdStrict: number | string // teamLogic
+ hasErrors: boolean
+ hasIssues: boolean
+ healthIssues: DataHealthIssuesResponse | null
+ healthIssuesLoading: boolean
+ healthStatus: HealthStatus
+ issueCount: number
+ issues: DataHealthIssue[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface pipelineHealthLogicActions {
+ loadHealthIssues: () => any
+ loadHealthIssuesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadHealthIssuesSuccess: (
+ healthIssues: DataHealthIssuesResponse | null,
+ payload?: any
+ ) => {
+ healthIssues: DataHealthIssuesResponse | null
+ payload?: any
+ }
+ setPageVisibility: (visible: boolean) => {
+ visible: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface pipelineHealthLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ hasIssues: (issueCount: number) => boolean
+ healthStatus: (issueCount: number) => HealthStatus
+ issues: (healthIssues: DataHealthIssuesResponse | null) => DataHealthIssue[]
+ hasErrors: (healthIssues: DataHealthIssuesResponse | null, healthIssuesLoading: boolean) => boolean
+ }
+}
+
+export type pipelineHealthLogicType = MakeLogicType<
+ pipelineHealthLogicValues,
+ pipelineHealthLogicActions,
+ Record<string, any>,
+ pipelineHealthLogicMeta
+>
+
export const pipelineHealthLogic = kea<pipelineHealthLogicType>([
path(['scenes', 'health', 'pipelineStatus', 'pipelineHealthLogic']),
connect({
diff --git a/frontend/src/scenes/health/pipelineStatus/pipelineStatusSceneLogic.tsx b/frontend/src/scenes/health/pipelineStatus/pipelineStatusSceneLogic.tsx
index ccb68513dcb9..0ad94293f1bc 100644
--- a/frontend/src/scenes/health/pipelineStatus/pipelineStatusSceneLogic.tsx
+++ b/frontend/src/scenes/health/pipelineStatus/pipelineStatusSceneLogic.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 { router } from 'kea-router'
import { FEATURE_FLAGS } from 'lib/constants'
@@ -9,14 +9,75 @@ import { urls } from 'scenes/urls'
import { Breadcrumb } from '~/types'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
import { pipelineHealthLogic } from './pipelineHealthLogic'
import type { DataHealthIssue } from './pipelineHealthLogic'
-import type { pipelineStatusSceneLogicType } from './pipelineStatusSceneLogicType'
export type IssueTypeFilter = 'all' | DataHealthIssue['type']
const THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1000
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface pipelineStatusSceneLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ issues: DataHealthIssue[] // pipelineHealthLogic
+ activeDismissedIds: Set<string>
+ breadcrumbs: Breadcrumb[]
+ dismissedCount: number
+ dismissedIssues: Record<string, number>
+ filteredIssueCount: number
+ filteredIssues: DataHealthIssue[]
+ isIssueDismissed: (issueId: string) => boolean
+ searchTerm: string
+ showDismissed: boolean
+ typeFilter: IssueTypeFilter
+ typeSummary: Record<DataHealthIssue['type'], number>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface pipelineStatusSceneLogicActions {
+ dismissIssue: (issueId: string) => {
+ issueId: string
+ }
+ setSearchTerm: (term: string) => {
+ term: string
+ }
+ setShowDismissed: (show: boolean) => {
+ show: boolean
+ }
+ setTypeFilter: (filter: IssueTypeFilter) => {
+ filter: IssueTypeFilter
+ }
+ undismissIssue: (issueId: string) => {
+ issueId: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface pipelineStatusSceneLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ activeDismissedIds: (dismissedIssues: Record<string, number>) => Set<string>
+ typeSummary: (issues: DataHealthIssue[]) => Record<DataHealthIssue['type'], number>
+ filteredIssues: (
+ issues: DataHealthIssue[],
+ typeFilter: IssueTypeFilter,
+ searchTerm: string,
+ activeDismissedIds: Set<string>,
+ showDismissed: boolean
+ ) => DataHealthIssue[]
+ filteredIssueCount: (filteredIssues: DataHealthIssue[]) => number
+ dismissedCount: (issues: DataHealthIssue[], activeDismissedIds: Set<string>) => number
+ isIssueDismissed: (activeDismissedIds: Set<string>) => (issueId: string) => boolean
+ }
+}
+
+export type pipelineStatusSceneLogicType = MakeLogicType<
+ pipelineStatusSceneLogicValues,
+ pipelineStatusSceneLogicActions,
+ Record<string, any>,
+ pipelineStatusSceneLogicMeta
+>
+
export const pipelineStatusSceneLogic = kea<pipelineStatusSceneLogicType>([
path(['scenes', 'health', 'pipelineStatus', 'pipelineStatusSceneLogic']),
connect({
diff --git a/frontend/src/scenes/insights/insightDataLogic.tsx b/frontend/src/scenes/insights/insightDataLogic.tsx
index e3b76e0a9d2f..edd2c5f13be2 100644
--- a/frontend/src/scenes/insights/insightDataLogic.tsx
+++ b/frontend/src/scenes/insights/insightDataLogic.tsx
@@ -52,7 +52,6 @@ import { DATAWAREHOUSE_EDITOR_ITEM_ID } from 'products/data_warehouse/frontend/u
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,
@@ -144,9 +143,9 @@ export interface insightDataLogicValues {
// 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>>
+ refresh?: RefreshType | undefined,
+ alreadyRunningQueryId?: string | undefined,
+ overrideQuery?: DataNode<Record<string, any>> | undefined
) => {
overrideQuery: DataNode<Record<string, any>> | undefined
pollOnly: boolean
@@ -177,12 +176,14 @@ export interface insightDataLogicActions {
| 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
+ }
+ | undefined
) => {
payload?: {
overrideQuery: DataNode<Record<string, any>> | undefined
@@ -208,7 +209,23 @@ export interface insightDataLogicActions {
| undefined
} // dataNodeLogic
setInsightData: (
- response: Exclude<AnyResponseType, undefined>
+ response:
+ | ErrorTrackingQueryResponse
+ | EventsQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogsQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | TraceSpansTreeQueryResponse
) =>
| ErrorTrackingQueryResponse
| EventsQueryResponse
@@ -333,7 +350,7 @@ export interface insightDataLogicActions {
Pick<QueryBasedInsightModel<Node<Record<string, any>>>, 'description' | 'favorited' | 'name' | 'tags'>
>
} // insightLogic
- renameInsightSuccess: (item: QueryBasedInsightModel) => {
+ renameInsightSuccess: (item: QueryBasedInsightModel<Node<Record<string, any>>>) => {
item: QueryBasedInsightModel<Node<Record<string, any>>>
} // insightsModel
cancelChanges: () => {
diff --git a/frontend/src/scenes/insights/insightDataTimingLogic.ts b/frontend/src/scenes/insights/insightDataTimingLogic.ts
index a731c94fca74..a585f6d606ce 100644
--- a/frontend/src/scenes/insights/insightDataTimingLogic.ts
+++ b/frontend/src/scenes/insights/insightDataTimingLogic.ts
@@ -50,9 +50,9 @@ export interface insightDataTimingLogicValues {
// 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>>
+ refresh?: RefreshType | undefined,
+ alreadyRunningQueryId?: string | undefined,
+ overrideQuery?: DataNode<Record<string, any>> | undefined
) => {
overrideQuery: DataNode<Record<string, any>> | undefined
pollOnly: boolean
@@ -86,12 +86,14 @@ export interface insightDataTimingLogicActions {
| 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
+ }
+ | undefined
) => {
payload?: {
overrideQuery: DataNode<Record<string, any>> | undefined
diff --git a/frontend/src/scenes/insights/insightLogic.tsx b/frontend/src/scenes/insights/insightLogic.tsx
index 019a0f0647fb..533ca2d3cce2 100644
--- a/frontend/src/scenes/insights/insightLogic.tsx
+++ b/frontend/src/scenes/insights/insightLogic.tsx
@@ -480,7 +480,7 @@ export interface insightLogicMeta {
isInViewMode: (location: { hash: string; pathname: string; search: string }) => boolean
derivedName: (
query: Node<Record<string, any>> | null,
- aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun,
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun, // groupsModel
cohortsById: Partial<Record<number | string, CohortType>>,
mathDefinitions: Partial<Record<string, MathDefinition>>
) => string
@@ -508,14 +508,6 @@ export interface insightLogicMeta {
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<
@@ -777,7 +769,10 @@ export const insightLogic: LogicWrapper<insightLogicType> = kea<insightLogicType
}
return state
},
- [insightsModel.actionTypes.renameInsightSuccess]: (state, { item }) => {
+ [insightsModel.actionTypes.renameInsightSuccess]: (
+ state: Partial<QueryBasedInsightModel>,
+ { item }: { item: QueryBasedInsightModel }
+ ) => {
if (item.id === state.id) {
// Also sync query (display-option saves); preserve result — bare PATCHes return result: null.
return {
@@ -837,7 +832,10 @@ export const insightLogic: LogicWrapper<insightLogicType> = kea<insightLogicType
tags: insight.tags,
favorited: insight.favorited,
}),
- [insightsModel.actionTypes.renameInsightSuccess]: (state, { item }) =>
+ [insightsModel.actionTypes.renameInsightSuccess]: (
+ state: Partial<QueryBasedInsightModel>,
+ { item }: { item: QueryBasedInsightModel }
+ ) =>
item.id === state.id
? { ...state, name: item.name, description: item.description, query: item.query ?? state.query }
: state,
diff --git a/frontend/src/scenes/insights/summarizeInsight.ts b/frontend/src/scenes/insights/summarizeInsight.ts
index 4e641449587c..1c838b04dd99 100644
--- a/frontend/src/scenes/insights/summarizeInsight.ts
+++ b/frontend/src/scenes/insights/summarizeInsight.ts
@@ -13,9 +13,9 @@ import { MathCategory, apiValueToMathType, mathsLogic } from 'scenes/trends/math
import type { mathsLogicType } from 'scenes/trends/mathsLogic'
import { cohortsModel } from '~/models/cohortsModel'
-import { cohortsModelType } from '~/models/cohortsModelType'
+import type { cohortsModelType } from '~/models/cohortsModel'
import { groupsModel } from '~/models/groupsModel'
-import { groupsModelType } from '~/models/groupsModelType'
+import type { groupsModelType } from '~/models/groupsModel'
import { extractDisplayLabel } from '~/queries/nodes/DataTable/utils'
import {
Breakdown,
diff --git a/frontend/src/scenes/notebooks/Nodes/NotebookNodePlaylist.tsx b/frontend/src/scenes/notebooks/Nodes/NotebookNodePlaylist.tsx
index 9ff4dda7dfbd..20ca397f2136 100644
--- a/frontend/src/scenes/notebooks/Nodes/NotebookNodePlaylist.tsx
+++ b/frontend/src/scenes/notebooks/Nodes/NotebookNodePlaylist.tsx
@@ -8,7 +8,7 @@ import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
import { createPostHogWidgetNode } from 'scenes/notebooks/Nodes/NodeWrapper'
import { RecordingsUniversalFiltersEmbed } from 'scenes/session-recordings/filters/RecordingsUniversalFiltersEmbed'
import { sessionRecordingPlayerLogic } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'
-import { sessionRecordingPlayerLogicType } from 'scenes/session-recordings/player/sessionRecordingPlayerLogicType'
+import type { sessionRecordingPlayerLogicType } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'
import { SessionRecordingsPlaylist } from 'scenes/session-recordings/playlist/SessionRecordingsPlaylist'
import {
DEFAULT_RECORDING_FILTERS,
diff --git a/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts b/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts
index dd03ea605373..2041d7d33844 100644
--- a/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts
+++ b/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts
@@ -353,7 +353,7 @@ export interface notebookLogicActions {
} // commentsLogic
setItemContext: (
context: Record<string, any> | null,
- callback?: (event: { sent: boolean }) => void
+ callback?: ((event: { sent: boolean }) => void) | undefined
) => {
callback: ((event: { sent: boolean }) => void) | undefined
context: Record<string, any> | null
diff --git a/frontend/src/scenes/notebooks/NotebooksTable/notebooksTableLogic.ts b/frontend/src/scenes/notebooks/NotebooksTable/notebooksTableLogic.ts
index 8fbdeb249f10..0e13cf846977 100644
--- a/frontend/src/scenes/notebooks/NotebooksTable/notebooksTableLogic.ts
+++ b/frontend/src/scenes/notebooks/NotebooksTable/notebooksTableLogic.ts
@@ -49,10 +49,12 @@ export interface notebooksTableLogicValues {
export interface notebooksTableLogicActions {
deleteNotebookSuccess: (
notebooks: NotebookListItemType[],
- payload?: {
- shortId: string
- title: string | undefined
- }
+ payload?:
+ | {
+ shortId: string
+ title: string | undefined
+ }
+ | undefined
) => {
notebooks: NotebookListItemType[]
payload?: {
diff --git a/frontend/src/scenes/notebooks/notebookSceneLogic.ts b/frontend/src/scenes/notebooks/notebookSceneLogic.ts
index 167aec3f670f..a739a9ff4d53 100644
--- a/frontend/src/scenes/notebooks/notebookSceneLogic.ts
+++ b/frontend/src/scenes/notebooks/notebookSceneLogic.ts
@@ -37,10 +37,10 @@ export interface notebookSceneLogicActions {
} // notebookLogic
createNotebook: (
location: NotebookTarget,
- title?: string,
- content?: JSONContent[],
- onCreate?: (notebook: BuiltLogic<notebookLogicType>) => void,
- shortId?: string
+ title?: string | undefined,
+ content?: JSONContent[] | undefined,
+ onCreate?: ((notebook: BuiltLogic<notebookLogicType>) => void) | undefined,
+ shortId?: string | undefined
) => {
content: JSONContent[] | undefined
location: NotebookTarget
diff --git a/frontend/src/scenes/projectLogic.ts b/frontend/src/scenes/projectLogic.ts
index 0655e5206461..974196c7d2ca 100644
--- a/frontend/src/scenes/projectLogic.ts
+++ b/frontend/src/scenes/projectLogic.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 { router } from 'kea-router'
@@ -11,11 +11,156 @@ import { identifierToHuman } from 'lib/utils/strings'
import { ProjectType } from '~/types'
+import type { OrganizationBasicType } from '../types'
import { organizationLogic } from './organizationLogic'
-import type { projectLogicType } from './projectLogicType'
import { urls } from './urls'
import { userLogic } from './userLogic'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface projectLogicValues {
+ otherOrganizations: OrganizationBasicType[] // userLogic
+ currentProject: ProjectType | null
+ currentProjectId: number | null
+ currentProjectLoading: boolean
+ moveProjectDisabledReason: "You can't move the project because you aren't a member of another organization" | null
+ projectBeingDeleted: ProjectType | null
+ projectBeingMoved: ProjectType | null
+ projectBeingMovedLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface projectLogicActions {
+ loadCurrentOrganization: () => any // organizationLogic
+ loadUser: (resetOnFailure?: boolean) => {
+ resetOnFailure: boolean | undefined
+ } // userLogic
+ switchTeam: (
+ teamId: number | string,
+ destination?: string
+ ) => {
+ destination: string | undefined
+ teamId: number | string
+ } // userLogic
+ updateCurrentOrganization: (
+ organizationId: string,
+ destination?: string
+ ) => {
+ destination: string | undefined
+ organizationId: string
+ } // userLogic
+ createProject: ({ name }: { name: string }) => {
+ name: string
+ }
+ createProjectFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ createProjectSuccess: (
+ currentProject: ProjectType | null,
+ payload?: {
+ name: string
+ }
+ ) => {
+ currentProject: ProjectType | null
+ payload?: {
+ name: string
+ }
+ }
+ deleteProject: (project: ProjectType) => {
+ project: ProjectType
+ }
+ deleteProjectFailure: () => {
+ value: true
+ }
+ deleteProjectSuccess: () => {
+ value: true
+ }
+ guardPendingDeletion: (
+ pathname: string,
+ isPendingDeletion: boolean | null | undefined
+ ) => {
+ isPendingDeletion: boolean | null | undefined
+ pathname: string
+ }
+ loadCurrentProject: () => any
+ loadCurrentProjectFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadCurrentProjectSuccess: (
+ currentProject: ProjectType | null,
+ payload?: any
+ ) => {
+ currentProject: ProjectType | null
+ payload?: any
+ }
+ moveProject: (
+ project: ProjectType,
+ organizationId: string
+ ) => {
+ organizationId: string
+ project: ProjectType
+ }
+ moveProjectFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ moveProjectSuccess: (
+ projectBeingMoved: ProjectType,
+ payload?: {
+ organizationId: string
+ project: ProjectType
+ }
+ ) => {
+ projectBeingMoved: ProjectType
+ payload?: {
+ organizationId: string
+ project: ProjectType
+ }
+ }
+ updateCurrentProject: (payload: Partial<ProjectType>) => Partial<ProjectType>
+ updateCurrentProjectFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateCurrentProjectSuccess: (
+ currentProject: ProjectType,
+ payload?: Partial<ProjectType>
+ ) => {
+ currentProject: ProjectType
+ payload?: Partial<ProjectType>
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface projectLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ currentProjectId: (currentProject: ProjectType | null) => number | null
+ moveProjectDisabledReason: (
+ otherOrganizations: OrganizationBasicType[]
+ ) => "You can't move the project because you aren't a member of another organization" | null
+ }
+}
+
+export type projectLogicType = MakeLogicType<
+ projectLogicValues,
+ projectLogicActions,
+ Record<string, any>,
+ projectLogicMeta
+>
+
export const projectLogic = kea<projectLogicType>([
path(['scenes', 'projectLogic']),
actions({
@@ -117,10 +262,13 @@ export const projectLogic = kea<projectLogicType>([
],
})),
selectors({
- currentProjectId: [(s) => [s.currentProject], (currentProject) => currentProject?.id || null],
+ currentProjectId: [
+ (s) => [s.currentProject],
+ (currentProject: ProjectType | null) => currentProject?.id || null,
+ ],
moveProjectDisabledReason: [
(s) => [s.otherOrganizations],
- (otherOrganizations) =>
+ (otherOrganizations: import('~/types').OrganizationBasicType[]) =>
otherOrganizations.length === 0
? "You can't move the project because you aren't a member of another organization"
: null,
diff --git a/frontend/src/scenes/saved-insights/savedInsightsLogic.ts b/frontend/src/scenes/saved-insights/savedInsightsLogic.ts
index 456649154a1b..bde6ebe1241b 100644
--- a/frontend/src/scenes/saved-insights/savedInsightsLogic.ts
+++ b/frontend/src/scenes/saved-insights/savedInsightsLogic.ts
@@ -648,10 +648,16 @@ export const savedInsightsLogic = kea<savedInsightsLogicType>([
setDates: () => {
actions.loadInsights()
},
- [insightsModel.actionTypes.renameInsightSuccess]: ({ item }) => {
+ [insightsModel.actionTypes.renameInsightSuccess]: ({ item }: { item: QueryBasedInsightModel }) => {
actions.updateInsight(item)
},
- [dashboardsModel.actionTypes.updateDashboardInsight]: ({ insight, sourceDashboardId }) => {
+ [dashboardsModel.actionTypes.updateDashboardInsight]: ({
+ insight,
+ sourceDashboardId,
+ }: {
+ insight: QueryBasedInsightModel
+ sourceDashboardId?: number
+ }) => {
if (sourceDashboardId != null) {
// That payload is only valid on the dashboard that refreshed it (date range, etc. are baked into
// `query`). The saved list should show the saved insight definition, not the merged view.
diff --git a/frontend/src/scenes/session-recordings/apm/networkViewLogic.ts b/frontend/src/scenes/session-recordings/apm/networkViewLogic.ts
index 6e259d8e5198..11fe88de74c0 100644
--- a/frontend/src/scenes/session-recordings/apm/networkViewLogic.ts
+++ b/frontend/src/scenes/session-recordings/apm/networkViewLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, key, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, key, path, props, reducers, selectors } from 'kea'
import { Dayjs, dayjs } from 'lib/dayjs'
import { humanFriendlyMilliseconds } from 'lib/utils/durations'
@@ -11,10 +11,133 @@ import {
import { PerformanceEvent } from '~/types'
-import type { networkViewLogicType } from './networkViewLogicType'
+import type { SessionPlayerData, SessionRecordingType } from '../../../types'
+import type { AssetSizeInfo } from './performanceEventDataLogic'
export interface NetworkViewLogicProps extends SessionRecordingDataCoordinatorLogicProps {}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface networkViewLogicValues {
+ allPerformanceEvents: PerformanceEvent[] // performanceEventDataLogic
+ sizeBreakdown: Record<string, AssetSizeInfo> // performanceEventDataLogic
+ sessionPlayerData: SessionPlayerData // sessionRecordingDataCoordinatorLogic
+ sessionPlayerMetaData: SessionRecordingType | null // sessionRecordingDataCoordinatorLogic
+ sessionPlayerMetaDataLoading: boolean // sessionRecordingDataCoordinatorLogic
+ snapshotsLoading: boolean // sessionRecordingDataCoordinatorLogic
+ start: Dayjs | null // sessionRecordingDataCoordinatorLogic
+ currentPage: (PerformanceEvent & {
+ timeInRecording: number
+ })[]
+ finalItem:
+ | (PerformanceEvent & {
+ timeInRecording: number
+ })
+ | null
+ formattedDurationFor: (item: PerformanceEvent) => string | undefined
+ hasPageViews: boolean
+ isLoading: boolean
+ navigationItem:
+ | (PerformanceEvent & {
+ timeInRecording: number
+ })
+ | null
+ page: number
+ pageCount: number
+ pageViews: (PerformanceEvent & {
+ timeInRecording: number
+ })[][]
+ positionPercentagesFor: (item: PerformanceEvent) =>
+ | {
+ startPercentage: string
+ widthPercentage: string
+ }
+ | null
+ | undefined
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface networkViewLogicActions {
+ loadSnapshots: () => {
+ value: true
+ } // sessionRecordingDataCoordinatorLogic
+ maybeLoadRecordingMeta: () => {
+ value: true
+ } // sessionRecordingDataCoordinatorLogic
+ nextPage: () => boolean
+ prevPage: () => boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface networkViewLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ isLoading: (snapshotsLoading: boolean, sessionPlayerMetaDataLoading: boolean) => boolean
+ pageViews: (
+ allPerformanceEvents: PerformanceEvent[],
+ start: Dayjs | null
+ ) => (PerformanceEvent & {
+ timeInRecording: number
+ })[][]
+ pageCount: (
+ pageViews: (PerformanceEvent & {
+ timeInRecording: number
+ })[][]
+ ) => number
+ currentPage: (
+ pageViews: (PerformanceEvent & {
+ timeInRecording: number
+ })[][],
+ page: number
+ ) => (PerformanceEvent & {
+ timeInRecording: number
+ })[]
+ navigationItem: (
+ currentPage: (PerformanceEvent & {
+ timeInRecording: number
+ })[]
+ ) =>
+ | (PerformanceEvent & {
+ timeInRecording: number
+ })
+ | null
+ finalItem: (
+ currentPage: (PerformanceEvent & {
+ timeInRecording: number
+ })[]
+ ) =>
+ | (PerformanceEvent & {
+ timeInRecording: number
+ })
+ | null
+ positionPercentagesFor: (
+ navigationItem:
+ | (PerformanceEvent & {
+ timeInRecording: number
+ })
+ | null,
+ finalItem:
+ | (PerformanceEvent & {
+ timeInRecording: number
+ })
+ | null
+ ) => (item: PerformanceEvent) =>
+ | {
+ startPercentage: string
+ widthPercentage: string
+ }
+ | null
+ | undefined
+ hasPageViews: (pageCount: number) => boolean
+ }
+}
+
+export type networkViewLogicType = MakeLogicType<
+ networkViewLogicValues,
+ networkViewLogicActions,
+ NetworkViewLogicProps,
+ networkViewLogicMeta
+>
+
export const networkViewLogic = kea<networkViewLogicType>([
path(['scenes', 'session-recordings', 'apm', 'networkViewLogic']),
key((props) => `network-view-${props.sessionRecordingId}`),
@@ -48,7 +171,8 @@ export const networkViewLogic = kea<networkViewLogicType>([
selectors({
isLoading: [
(s) => [s.snapshotsLoading, s.sessionPlayerMetaDataLoading],
- (snapshotsLoading, sessionPlayerMetaDataLoading) => snapshotsLoading || sessionPlayerMetaDataLoading,
+ (snapshotsLoading: boolean, sessionPlayerMetaDataLoading: boolean) =>
+ snapshotsLoading || sessionPlayerMetaDataLoading,
],
pageViews: [
(s) => [s.allPerformanceEvents, s.start],
@@ -81,16 +205,32 @@ export const networkViewLogic = kea<networkViewLogicType>([
return pages
},
],
- pageCount: [(s) => [s.pageViews], (pageViews) => pageViews.length],
+ pageCount: [
+ (s) => [s.pageViews],
+ (
+ pageViews: (PerformanceEvent & {
+ timeInRecording: number
+ })[][]
+ ) => pageViews.length,
+ ],
currentPage: [
(s) => [s.pageViews, s.page],
- (pageViews, page) => {
+ (
+ pageViews: (PerformanceEvent & {
+ timeInRecording: number
+ })[][],
+ page: number
+ ) => {
return pageViews[page] || []
},
],
navigationItem: [
(s) => [s.currentPage],
- (currentPage) => {
+ (
+ currentPage: (PerformanceEvent & {
+ timeInRecording: number
+ })[]
+ ) => {
if (currentPage.length) {
return currentPage[0]
}
@@ -99,7 +239,11 @@ export const networkViewLogic = kea<networkViewLogicType>([
],
finalItem: [
(s) => [s.currentPage],
- (currentPage) => {
+ (
+ currentPage: (PerformanceEvent & {
+ timeInRecording: number
+ })[]
+ ) => {
if (currentPage.length) {
return currentPage[currentPage.length - 1]
}
@@ -126,7 +270,18 @@ export const networkViewLogic = kea<networkViewLogicType>([
],
positionPercentagesFor: [
(s) => [s.navigationItem, s.finalItem],
- (navigationItem, finalItem) => {
+ (
+ navigationItem:
+ | (PerformanceEvent & {
+ timeInRecording: number
+ })
+ | null,
+ finalItem:
+ | (PerformanceEvent & {
+ timeInRecording: number
+ })
+ | null
+ ) => {
return (item: PerformanceEvent) => {
if (!navigationItem || !finalItem) {
return
@@ -159,6 +314,6 @@ export const networkViewLogic = kea<networkViewLogicType>([
}
},
],
- hasPageViews: [(s) => [s.pageCount], (pageCount) => pageCount > 0],
+ hasPageViews: [(s) => [s.pageCount], (pageCount: number) => pageCount > 0],
}),
])
diff --git a/frontend/src/scenes/session-recordings/apm/performanceEventDataLogic.ts b/frontend/src/scenes/session-recordings/apm/performanceEventDataLogic.ts
index 486e9731d485..515c718fee57 100644
--- a/frontend/src/scenes/session-recordings/apm/performanceEventDataLogic.ts
+++ b/frontend/src/scenes/session-recordings/apm/performanceEventDataLogic.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 {
getPerformanceEvents,
@@ -13,7 +13,7 @@ import {
import { PerformanceEvent, RecordingEventType } from '~/types'
-import type { performanceEventDataLogicType } from './performanceEventDataLogicType'
+import type { SessionPlayerData } from '../../../types'
export type InspectorListItemPerformance = InspectorListItemBase & {
type: 'network'
@@ -99,6 +99,33 @@ function matchWebVitalsEvents(
return performanceEvents
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface performanceEventDataLogicValues {
+ sessionPlayerData: SessionPlayerData // sessionRecordingDataCoordinatorLogic
+ webVitalsEvents: RecordingEventType[] // sessionRecordingDataCoordinatorLogic
+ allPerformanceEvents: PerformanceEvent[]
+ sizeBreakdown: Record<string, AssetSizeInfo>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface performanceEventDataLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ allPerformanceEvents: (
+ sessionPlayerData: SessionPlayerData,
+ webVitalsEvents: RecordingEventType[]
+ ) => PerformanceEvent[]
+ sizeBreakdown: (allPerformanceEvents: PerformanceEvent[]) => Record<string, AssetSizeInfo>
+ }
+}
+
+export type performanceEventDataLogicType = MakeLogicType<
+ performanceEventDataLogicValues,
+ {},
+ PerformanceEventDataLogicProps,
+ performanceEventDataLogicMeta
+>
+
export const performanceEventDataLogic = kea<performanceEventDataLogicType>([
path(['scenes', 'session-recordings', 'apm', 'performanceEventDataLogic']),
props({} as PerformanceEventDataLogicProps),
@@ -110,7 +137,10 @@ export const performanceEventDataLogic = kea<performanceEventDataLogicType>([
selectors(() => ({
allPerformanceEvents: [
(s) => [s.sessionPlayerData, s.webVitalsEvents],
- (sessionPlayerData, webVitalsEvents): PerformanceEvent[] => {
+ (
+ sessionPlayerData: import('~/types').SessionPlayerData,
+ webVitalsEvents: RecordingEventType[]
+ ): PerformanceEvent[] => {
// TRICKY: we listen to webVitalsEventsLoading to trigger a recompute once all the data is present
// performanceEvents used to come from the API,
@@ -127,7 +157,7 @@ export const performanceEventDataLogic = kea<performanceEventDataLogicType>([
],
sizeBreakdown: [
(s) => [s.allPerformanceEvents],
- (allPerformanceEvents) => {
+ (allPerformanceEvents: PerformanceEvent[]) => {
const breakdown: Record<string, AssetSizeInfo> = {}
allPerformanceEvents.forEach((event) => {
const label = initiatorToAssetTypeMapping[event.initiator_type || 'unknown'] || 'unknown'
diff --git a/frontend/src/scenes/session-recordings/collections/sessionRecordingCollectionsLogic.ts b/frontend/src/scenes/session-recordings/collections/sessionRecordingCollectionsLogic.ts
index 5d2232d00bf9..bcabad0ea26c 100644
--- a/frontend/src/scenes/session-recordings/collections/sessionRecordingCollectionsLogic.ts
+++ b/frontend/src/scenes/session-recordings/collections/sessionRecordingCollectionsLogic.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 { actionToUrl, router, urlToAction } from 'kea-router'
@@ -21,7 +21,6 @@ import {
} from '~/types'
import { createPlaylist, deletePlaylist } from '../playlist/playlistUtils'
-import type { sessionRecordingCollectionsLogicType } from './sessionRecordingCollectionsLogicType'
export const PLAYLISTS_PER_PAGE = 30
@@ -33,6 +32,158 @@ export const DEFAULT_PLAYLIST_FILTERS = {
collectionType: null,
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingCollectionsLogicValues {
+ filters: Record<string, any> | SavedSessionRecordingPlaylistsFilters
+ loadPlaylistsFailed: boolean
+ pagination: PaginationManual
+ playlists: SavedSessionRecordingPlaylistsResult
+ playlistsLoading: boolean
+ sorting: Sorting | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingCollectionsLogicActions {
+ reportRecordingPlaylistCreated: (source: 'duplicate' | 'filters' | 'new' | 'pin') => {
+ source: 'duplicate' | 'filters' | 'new' | 'pin'
+ } // sessionRecordingEventUsageLogic
+ deletePlaylist: (playlist: SessionRecordingPlaylistType) => {
+ playlist: SessionRecordingPlaylistType
+ }
+ deletePlaylistFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deletePlaylistSuccess: (
+ playlists: {
+ count: number
+ filters?: SavedSessionRecordingPlaylistsFilters | null | undefined
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: SessionRecordingPlaylistType[]
+ },
+ payload?: {
+ playlist: SessionRecordingPlaylistType
+ }
+ ) => {
+ playlists: {
+ count: number
+ filters?: SavedSessionRecordingPlaylistsFilters | null | undefined
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: SessionRecordingPlaylistType[]
+ }
+ payload?: {
+ playlist: SessionRecordingPlaylistType
+ }
+ }
+ duplicatePlaylist: (playlist: SessionRecordingPlaylistType) => {
+ playlist: SessionRecordingPlaylistType
+ }
+ duplicatePlaylistFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ duplicatePlaylistSuccess: (
+ playlists: SavedSessionRecordingPlaylistsResult,
+ payload?: {
+ playlist: SessionRecordingPlaylistType
+ }
+ ) => {
+ playlists: SavedSessionRecordingPlaylistsResult
+ payload?: {
+ playlist: SessionRecordingPlaylistType
+ }
+ }
+ loadPlaylists: () => {
+ value: true
+ }
+ loadPlaylistsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPlaylistsSuccess: (
+ playlists: SavedSessionRecordingPlaylistsResult,
+ payload?: {
+ value: true
+ }
+ ) => {
+ playlists: SavedSessionRecordingPlaylistsResult
+ payload?: {
+ value: true
+ }
+ }
+ setSavedPlaylistsFilters: (filters: Partial<SavedSessionRecordingPlaylistsFilters>) => {
+ filters: Partial<SavedSessionRecordingPlaylistsFilters>
+ }
+ updatePlaylist: (
+ shortId: SessionRecordingPlaylistType['short_id'],
+ properties: Partial<SessionRecordingPlaylistType>
+ ) => {
+ properties: Partial<SessionRecordingPlaylistType>
+ shortId: string
+ }
+ updatePlaylistFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updatePlaylistSuccess: (
+ playlists: {
+ count: number
+ filters?: SavedSessionRecordingPlaylistsFilters | null | undefined
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: SessionRecordingPlaylistType[]
+ },
+ payload?: {
+ properties: Partial<SessionRecordingPlaylistType>
+ shortId: string
+ }
+ ) => {
+ playlists: {
+ count: number
+ filters?: SavedSessionRecordingPlaylistsFilters | null | undefined
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: SessionRecordingPlaylistType[]
+ }
+ payload?: {
+ properties: Partial<SessionRecordingPlaylistType>
+ shortId: string
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingCollectionsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ sorting: (filters: Record<string, any> | SavedSessionRecordingPlaylistsFilters) => Sorting | null
+ pagination: (
+ filters: Record<string, any> | SavedSessionRecordingPlaylistsFilters,
+ playlists: SavedSessionRecordingPlaylistsResult
+ ) => PaginationManual
+ }
+}
+
+export type sessionRecordingCollectionsLogicType = MakeLogicType<
+ sessionRecordingCollectionsLogicValues,
+ sessionRecordingCollectionsLogicActions,
+ Record<string, any>,
+ sessionRecordingCollectionsLogicMeta
+>
+
export const sessionRecordingCollectionsLogic = kea<sessionRecordingCollectionsLogicType>([
path(() => ['scenes', 'session-recordings', 'collections', 'sessionRecordingCollectionsLogic']),
connect(() => ({
@@ -161,7 +312,7 @@ export const sessionRecordingCollectionsLogic = kea<sessionRecordingCollectionsL
selectors(({ actions }) => ({
sorting: [
(s) => [s.filters],
- (filters): Sorting | null => {
+ (filters: Record<string, any> | SavedSessionRecordingPlaylistsFilters): Sorting | null => {
if (!filters.order) {
return {
columnKey: 'last_modified_at',
@@ -181,7 +332,10 @@ export const sessionRecordingCollectionsLogic = kea<sessionRecordingCollectionsL
],
pagination: [
(s) => [s.filters, s.playlists],
- (filters, playlists): PaginationManual => {
+ (
+ filters: Record<string, any> | SavedSessionRecordingPlaylistsFilters,
+ playlists: SavedSessionRecordingPlaylistsResult
+ ): PaginationManual => {
return {
controlled: true,
pageSize: PLAYLISTS_PER_PAGE,
diff --git a/frontend/src/scenes/session-recordings/components/AiRegexHelper/aiRegexHelperLogic.ts b/frontend/src/scenes/session-recordings/components/AiRegexHelper/aiRegexHelperLogic.ts
index beb10a4a44c0..384613f57589 100644
--- a/frontend/src/scenes/session-recordings/components/AiRegexHelper/aiRegexHelperLogic.ts
+++ b/frontend/src/scenes/session-recordings/components/AiRegexHelper/aiRegexHelperLogic.ts
@@ -1,14 +1,51 @@
-import { actions, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, listeners, path, reducers } from 'kea'
import posthog from 'posthog-js'
import api, { ApiError } from 'lib/api'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { copyToClipboard } from 'lib/utils/copyToClipboard'
-import type { aiRegexHelperLogicType } from './aiRegexHelperLogicType'
-
const GENERIC_ERROR = 'Failed to generate regex. Try again?'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface aiRegexHelperLogicValues {
+ error: string
+ generatedRegex: string
+ input: string
+ isLoading: boolean
+ isOpen: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface aiRegexHelperLogicActions {
+ handleCopyToClipboard: () => {
+ value: true
+ }
+ handleGenerateRegex: () => {
+ value: true
+ }
+ onClose: () => {
+ value: true
+ }
+ setError: (error: string) => {
+ error: string
+ }
+ setGeneratedRegex: (generatedRegex: string) => {
+ generatedRegex: string
+ }
+ setInput: (input: string) => {
+ input: string
+ }
+ setIsLoading: (isLoading: boolean) => {
+ isLoading: boolean
+ }
+ setIsOpen: (isOpen: boolean) => {
+ isOpen: boolean
+ }
+}
+
+export type aiRegexHelperLogicType = MakeLogicType<aiRegexHelperLogicValues, aiRegexHelperLogicActions>
+
export const aiRegexHelperLogic = kea<aiRegexHelperLogicType>([
path(['lib', 'components', 'AiRegexHelper', 'aiRegexHelperLogic']),
actions({
diff --git a/frontend/src/scenes/session-recordings/components/InternalSurvey/internalMultipleChoiceSurveyLogic.ts b/frontend/src/scenes/session-recordings/components/InternalSurvey/internalMultipleChoiceSurveyLogic.ts
index 9c756539ebb7..03127559e9dc 100644
--- a/frontend/src/scenes/session-recordings/components/InternalSurvey/internalMultipleChoiceSurveyLogic.ts
+++ b/frontend/src/scenes/session-recordings/components/InternalSurvey/internalMultipleChoiceSurveyLogic.ts
@@ -1,14 +1,61 @@
-import { actions, afterMount, kea, key, listeners, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, afterMount, kea, key, listeners, path, props, reducers } from 'kea'
import posthog from 'posthog-js'
import { Survey } from '~/types'
-import type { internalMultipleChoiceSurveyLogicType } from './internalMultipleChoiceSurveyLogicType'
-
export interface InternalSurveyLogicProps {
surveyId: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface internalMultipleChoiceSurveyLogicValues {
+ openChoice: string | null
+ showThankYouMessage: boolean
+ survey: Survey | null
+ surveyResponse: string[]
+ thankYouMessage: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface internalMultipleChoiceSurveyLogicActions {
+ getSurveys: () => {}
+ handleChoiceChange: (
+ choice: string,
+ isAdded: boolean
+ ) => {
+ choice: string
+ isAdded: boolean
+ }
+ handleSurveyResponse: () => {}
+ handleSurveys: (surveys: Survey[]) => {
+ surveys: Survey[]
+ }
+ setOpenChoice: (openChoice: string) => {
+ openChoice: string
+ }
+ setShowThankYouMessage: (showThankYouMessage: boolean) => {
+ showThankYouMessage: boolean
+ }
+ setSurvey: (survey: Survey) => {
+ survey: Survey
+ }
+ setThankYouMessage: (thankYouMessage: string) => {
+ thankYouMessage: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface internalMultipleChoiceSurveyLogicMeta {
+ key: string
+}
+
+export type internalMultipleChoiceSurveyLogicType = MakeLogicType<
+ internalMultipleChoiceSurveyLogicValues,
+ internalMultipleChoiceSurveyLogicActions,
+ InternalSurveyLogicProps,
+ internalMultipleChoiceSurveyLogicMeta
+>
+
export const internalMultipleChoiceSurveyLogic = kea<internalMultipleChoiceSurveyLogicType>([
path(['lib', 'components', 'InternalSurvey', 'internalMultipleChoiceSurveyLogicType']),
props({} as InternalSurveyLogicProps),
diff --git a/frontend/src/scenes/session-recordings/components/replayCaptureDiagnosticsPanelLogic.ts b/frontend/src/scenes/session-recordings/components/replayCaptureDiagnosticsPanelLogic.ts
index 015d83488707..085111f6b0af 100644
--- a/frontend/src/scenes/session-recordings/components/replayCaptureDiagnosticsPanelLogic.ts
+++ b/frontend/src/scenes/session-recordings/components/replayCaptureDiagnosticsPanelLogic.ts
@@ -1,14 +1,49 @@
-import { defaults, kea, key, path, props } from 'kea'
+import { MakeLogicType, defaults, kea, key, path, props } from 'kea'
import { lazyLoaders } from 'kea-loaders'
import api from 'lib/api'
-import type { replayCaptureDiagnosticsPanelLogicType } from './replayCaptureDiagnosticsPanelLogicType'
-
export interface ReplayCaptureDiagnosticsPanelLogicProps {
sessionId: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface replayCaptureDiagnosticsPanelLogicValues {
+ sessionEventProperties: Record<string, any> | null
+ sessionEventPropertiesLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface replayCaptureDiagnosticsPanelLogicActions {
+ loadSessionEventProperties: (_: any) => any
+ loadSessionEventPropertiesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSessionEventPropertiesSuccess: (
+ sessionEventProperties: Record<string, any> | null,
+ payload?: any
+ ) => {
+ sessionEventProperties: Record<string, any> | null
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface replayCaptureDiagnosticsPanelLogicMeta {
+ key: string
+}
+
+export type replayCaptureDiagnosticsPanelLogicType = MakeLogicType<
+ replayCaptureDiagnosticsPanelLogicValues,
+ replayCaptureDiagnosticsPanelLogicActions,
+ ReplayCaptureDiagnosticsPanelLogicProps,
+ replayCaptureDiagnosticsPanelLogicMeta
+>
+
export const replayCaptureDiagnosticsPanelLogic = kea<replayCaptureDiagnosticsPanelLogicType>([
path(['scenes', 'session-recordings', 'components', 'replayCaptureDiagnosticsPanelLogic']),
props({} as ReplayCaptureDiagnosticsPanelLogicProps),
diff --git a/frontend/src/scenes/session-recordings/deletedRecordingsLogic.ts b/frontend/src/scenes/session-recordings/deletedRecordingsLogic.ts
index ad86d27714f1..83ea6bb3acef 100644
--- a/frontend/src/scenes/session-recordings/deletedRecordingsLogic.ts
+++ b/frontend/src/scenes/session-recordings/deletedRecordingsLogic.ts
@@ -1,6 +1,18 @@
-import { actions, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
-import type { deletedRecordingsLogicType } from './deletedRecordingsLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface deletedRecordingsLogicValues {
+ deletedRecordingIds: Set<string>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface deletedRecordingsLogicActions {
+ addDeletedRecordings: (ids: string[]) => {
+ ids: string[]
+ }
+}
+
+export type deletedRecordingsLogicType = MakeLogicType<deletedRecordingsLogicValues, deletedRecordingsLogicActions>
export const deletedRecordingsLogic = kea<deletedRecordingsLogicType>([
path(['scenes', 'session-recordings', 'deletedRecordingsLogic']),
diff --git a/frontend/src/scenes/session-recordings/detail/sessionRecordingDetailLogic.ts b/frontend/src/scenes/session-recordings/detail/sessionRecordingDetailLogic.ts
index 3b721e8afd23..6a6439d9b143 100644
--- a/frontend/src/scenes/session-recordings/detail/sessionRecordingDetailLogic.ts
+++ b/frontend/src/scenes/session-recordings/detail/sessionRecordingDetailLogic.ts
@@ -1,23 +1,40 @@
-import { kea, path, props, selectors } from 'kea'
+import { MakeLogicType, kea, path, props, selectors } from 'kea'
import { Scene } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
import { Breadcrumb, SessionRecordingType } from '~/types'
-import type { sessionRecordingDetailLogicType } from './sessionRecordingDetailLogicType'
-
export interface SessionRecordingDetailLogicProps {
id?: SessionRecordingType['id']
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingDetailLogicValues {
+ breadcrumbs: Breadcrumb[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingDetailLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ breadcrumbs: (arg: SessionRecordingType['id']) => Breadcrumb[]
+ }
+}
+
+export type sessionRecordingDetailLogicType = MakeLogicType<
+ sessionRecordingDetailLogicValues,
+ {},
+ SessionRecordingDetailLogicProps,
+ sessionRecordingDetailLogicMeta
+>
+
export const sessionRecordingDetailLogic = kea<sessionRecordingDetailLogicType>([
path(['scenes', 'session-recordings', 'detail', 'sessionRecordingDetailLogic']),
props({} as SessionRecordingDetailLogicProps),
selectors({
breadcrumbs: [
() => [(_, props) => props.id as SessionRecordingType['id']],
- (sessionRecordingId): Breadcrumb[] => [
+ (sessionRecordingId: SessionRecordingType['id']): Breadcrumb[] => [
{
key: Scene.Replay,
name: `Replay`,
diff --git a/frontend/src/scenes/session-recordings/file-playback/sessionRecordingFilePlaybackSceneLogic.ts b/frontend/src/scenes/session-recordings/file-playback/sessionRecordingFilePlaybackSceneLogic.ts
index fbcbcaedc2e6..93659619a06e 100644
--- a/frontend/src/scenes/session-recordings/file-playback/sessionRecordingFilePlaybackSceneLogic.ts
+++ b/frontend/src/scenes/session-recordings/file-playback/sessionRecordingFilePlaybackSceneLogic.ts
@@ -1,4 +1,4 @@
-import { BuiltLogic, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, BuiltLogic, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { beforeUnload } from 'kea-router'
@@ -12,11 +12,15 @@ import { urls } from 'scenes/urls'
import { Breadcrumb } from '~/types'
-import { sessionRecordingDataCoordinatorLogic } from '../player/sessionRecordingDataCoordinatorLogic'
-import type { sessionRecordingDataCoordinatorLogicType } from '../player/sessionRecordingDataCoordinatorLogicType'
+import type { RecordingSnapshot } from '../../../../../common/replay-shared/src/types'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { PersonType } from '../../../types'
+import {
+ sessionRecordingDataCoordinatorLogic,
+ type sessionRecordingDataCoordinatorLogicType,
+} from '../player/sessionRecordingDataCoordinatorLogic'
import { SessionRecordingPlayerProps } from '../player/SessionRecordingPlayer'
import { sessionRecordingEventUsageLogic } from '../sessionRecordingEventUsageLogic'
-import type { sessionRecordingFilePlaybackSceneLogicType } from './sessionRecordingFilePlaybackSceneLogicType'
import { ExportedSessionRecordingFileV1, ExportedSessionRecordingFileV2 } from './types'
export const parseExportedSessionRecording = (fileData: string): ExportedSessionRecordingFileV2 => {
@@ -84,6 +88,76 @@ const waitForDataLogic = async (
throw new Error('Timeout reached: dataLogic is still null after 2 seconds')
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingFilePlaybackSceneLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ breadcrumbs: Breadcrumb[]
+ fileId: string
+ playerProps: SessionRecordingPlayerProps
+ sessionRecording: ExportedSessionRecordingFileV2['data'] | null
+ sessionRecordingLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingFilePlaybackSceneLogicActions {
+ reportRecordingLoadedFromFile: (data: { error?: string; success: boolean }) => {
+ error?: string | undefined
+ success: boolean
+ } // sessionRecordingEventUsageLogic
+ loadFromFile: (file: File) => File
+ loadFromFileFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadFromFileSuccess: (
+ sessionRecording: {
+ id: string
+ person: PersonType | undefined
+ snapshots: RecordingSnapshot[]
+ } | null,
+ payload?: File
+ ) => {
+ sessionRecording: {
+ id: string
+ person: PersonType | undefined
+ snapshots: RecordingSnapshot[]
+ } | null
+ payload?: File
+ }
+ resetSessionRecording: () => any
+ resetSessionRecordingFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ resetSessionRecordingSuccess: (
+ sessionRecording: null,
+ payload?: any
+ ) => {
+ sessionRecording: null
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingFilePlaybackSceneLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ playerProps: (fileId: string) => SessionRecordingPlayerProps
+ }
+}
+
+export type sessionRecordingFilePlaybackSceneLogicType = MakeLogicType<
+ sessionRecordingFilePlaybackSceneLogicValues,
+ sessionRecordingFilePlaybackSceneLogicActions,
+ Record<string, any>,
+ sessionRecordingFilePlaybackSceneLogicMeta
+>
+
export const sessionRecordingFilePlaybackSceneLogic = kea<sessionRecordingFilePlaybackSceneLogicType>([
path(['scenes', 'session-recordings', 'detail', 'sessionRecordingFilePlaybackSceneLogic']),
connect(() => ({
diff --git a/frontend/src/scenes/session-recordings/filters/sessionRecordingSavedFiltersLogic.ts b/frontend/src/scenes/session-recordings/filters/sessionRecordingSavedFiltersLogic.ts
index 0c7cc52e2a92..ce7782976cfe 100644
--- a/frontend/src/scenes/session-recordings/filters/sessionRecordingSavedFiltersLogic.ts
+++ b/frontend/src/scenes/session-recordings/filters/sessionRecordingSavedFiltersLogic.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 { router } from 'kea-router'
@@ -17,7 +17,6 @@ import {
} from '~/types'
import { deletePlaylist, stripSessionIds } from '../playlist/playlistUtils'
-import type { sessionRecordingSavedFiltersLogicType } from './sessionRecordingSavedFiltersLogicType'
export const PLAYLISTS_PER_PAGE = 30
@@ -27,6 +26,139 @@ export const DEFAULT_PLAYLIST_FILTERS = {
dateFrom: 'all',
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingSavedFiltersLogicValues {
+ appliedSavedFilter: SessionRecordingPlaylistType | null
+ filters: Record<string, any> | SavedSessionRecordingPlaylistsFilters
+ loadSavedFiltersFailed: boolean
+ paginationSavedFilters: PaginationManual
+ pendingFilterApplication: SessionRecordingPlaylistType | null
+ playlists: SavedSessionRecordingPlaylistsResult
+ playlistsLoading: boolean
+ savedFilters: SavedSessionRecordingPlaylistsResult
+ savedFiltersLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingSavedFiltersLogicActions {
+ reportRecordingPlaylistCreated: (source: 'duplicate' | 'filters' | 'new' | 'pin') => {
+ source: 'duplicate' | 'filters' | 'new' | 'pin'
+ } // sessionRecordingEventUsageLogic
+ checkForSavedFilterRedirect: () => {
+ value: true
+ }
+ clearPendingFilterApplication: () => {
+ value: true
+ }
+ deletePlaylist: (playlist: SessionRecordingPlaylistType) => {
+ playlist: SessionRecordingPlaylistType
+ }
+ deletePlaylistFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deletePlaylistSuccess: (
+ playlists: SavedSessionRecordingPlaylistsResult,
+ payload?: {
+ playlist: SessionRecordingPlaylistType
+ }
+ ) => {
+ playlists: SavedSessionRecordingPlaylistsResult
+ payload?: {
+ playlist: SessionRecordingPlaylistType
+ }
+ }
+ loadSavedFilters: () => {
+ value: true
+ }
+ loadSavedFiltersFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSavedFiltersSuccess: (
+ savedFilters: SavedSessionRecordingPlaylistsResult,
+ payload?: {
+ value: true
+ }
+ ) => {
+ savedFilters: SavedSessionRecordingPlaylistsResult
+ payload?: {
+ value: true
+ }
+ }
+ requestApplySavedFilter: (filter: SessionRecordingPlaylistType) => {
+ filter: SessionRecordingPlaylistType
+ }
+ setAppliedSavedFilter: (appliedSavedFilter: SessionRecordingPlaylistType | null) => {
+ appliedSavedFilter: SessionRecordingPlaylistType | null
+ }
+ setSavedPlaylistsFilters: (filters: Partial<SavedSessionRecordingPlaylistsFilters>) => {
+ filters: Partial<SavedSessionRecordingPlaylistsFilters>
+ }
+ updatePlaylist: (
+ shortId: SessionRecordingPlaylistType['short_id'],
+ properties: Partial<SessionRecordingPlaylistType>
+ ) => {
+ properties: Partial<SessionRecordingPlaylistType>
+ shortId: string
+ }
+ updatePlaylistFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updatePlaylistSuccess: (
+ playlists: {
+ count: number
+ filters?: SavedSessionRecordingPlaylistsFilters | null | undefined
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: SessionRecordingPlaylistType[]
+ },
+ payload?: {
+ properties: Partial<SessionRecordingPlaylistType>
+ shortId: string
+ }
+ ) => {
+ playlists: {
+ count: number
+ filters?: SavedSessionRecordingPlaylistsFilters | null | undefined
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: SessionRecordingPlaylistType[]
+ }
+ payload?: {
+ properties: Partial<SessionRecordingPlaylistType>
+ shortId: string
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingSavedFiltersLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ paginationSavedFilters: (
+ filters: Record<string, any> | SavedSessionRecordingPlaylistsFilters,
+ savedFilters: SavedSessionRecordingPlaylistsResult
+ ) => PaginationManual
+ }
+}
+
+export type sessionRecordingSavedFiltersLogicType = MakeLogicType<
+ sessionRecordingSavedFiltersLogicValues,
+ sessionRecordingSavedFiltersLogicActions,
+ Record<string, any>,
+ sessionRecordingSavedFiltersLogicMeta
+>
+
export const sessionRecordingSavedFiltersLogic = kea<sessionRecordingSavedFiltersLogicType>([
path(() => ['scenes', 'session-recordings', 'filters', 'sessionRecordingSavedFiltersLogic']),
connect(() => ({
@@ -147,7 +279,10 @@ export const sessionRecordingSavedFiltersLogic = kea<sessionRecordingSavedFilter
selectors(({ actions }) => ({
paginationSavedFilters: [
(s) => [s.filters, s.savedFilters],
- (filters, savedFilters): PaginationManual => {
+ (
+ filters: Record<string, any> | SavedSessionRecordingPlaylistsFilters,
+ savedFilters: SavedSessionRecordingPlaylistsResult
+ ): PaginationManual => {
return {
controlled: true,
pageSize: PLAYLISTS_PER_PAGE,
diff --git a/frontend/src/scenes/session-recordings/kiosk/sessionRecordingsKioskLogic.ts b/frontend/src/scenes/session-recordings/kiosk/sessionRecordingsKioskLogic.ts
index 1b746ceaaf61..8c39d82dd04a 100644
--- a/frontend/src/scenes/session-recordings/kiosk/sessionRecordingsKioskLogic.ts
+++ b/frontend/src/scenes/session-recordings/kiosk/sessionRecordingsKioskLogic.ts
@@ -1,4 +1,4 @@
-import { actions, beforeUnmount, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, beforeUnmount, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, urlToAction } from 'kea-router'
@@ -8,8 +8,6 @@ import { urls } from 'scenes/urls'
import { NodeKind, RecordingsQuery } from '~/queries/schema/schema-general'
import { PropertyFilterType, PropertyOperator, SessionRecordingType } from '~/types'
-import type { sessionRecordingsKioskLogicType } from './sessionRecordingsKioskLogicType'
-
const KIOSK_PLAYED_IDS_KEY = 'kiosk_played_ids'
const SOFT_REFRESH_AFTER_RECORDINGS = 10
const HARD_REFRESH_AFTER_RECORDINGS = 50
@@ -63,6 +61,87 @@ const DEFAULT_FILTERS: KioskFilters = {
featureFlagValue: null,
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingsKioskLogicValues {
+ currentRecording: SessionRecordingType | null
+ currentRecordingId: string | null
+ filters: KioskFilters
+ hasRecordings: boolean
+ isConfigured: boolean
+ nextRecording: SessionRecordingType | null
+ playedCountSinceRefresh: number
+ playedRecordingIds: string[]
+ recordings: SessionRecordingType[]
+ recordingsLoading: boolean
+ started: boolean
+ totalPlayedCount: number
+ unplayedRecordings: SessionRecordingType[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingsKioskLogicActions {
+ advanceToNextRecording: () => {
+ value: true
+ }
+ loadRecordings: () => any
+ loadRecordingsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRecordingsSuccess: (
+ recordings: SessionRecordingType[],
+ payload?: any
+ ) => {
+ recordings: SessionRecordingType[]
+ payload?: any
+ }
+ markRecordingPlayed: (id: string) => {
+ id: string
+ }
+ resetPlayback: () => {
+ value: true
+ }
+ resetPlayedRecordings: () => {
+ value: true
+ }
+ setCurrentRecordingId: (id: string | null) => {
+ id: string | null
+ }
+ setFilters: (filters: Partial<KioskFilters>) => {
+ filters: Partial<KioskFilters>
+ }
+ startPlayback: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingsKioskLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ isConfigured: (started: boolean) => boolean
+ unplayedRecordings: (recordings: SessionRecordingType[], playedRecordingIds: string[]) => SessionRecordingType[]
+ currentRecording: (
+ recordings: SessionRecordingType[],
+ currentRecordingId: string | null
+ ) => SessionRecordingType | null
+ nextRecording: (
+ unplayedRecordings: SessionRecordingType[],
+ currentRecordingId: string | null
+ ) => SessionRecordingType | null
+ hasRecordings: (recordings: SessionRecordingType[]) => boolean
+ }
+}
+
+export type sessionRecordingsKioskLogicType = MakeLogicType<
+ sessionRecordingsKioskLogicValues,
+ sessionRecordingsKioskLogicActions,
+ Record<string, any>,
+ sessionRecordingsKioskLogicMeta
+>
+
export const sessionRecordingsKioskLogic = kea<sessionRecordingsKioskLogicType>([
path(['scenes', 'session-recordings', 'kiosk', 'sessionRecordingsKioskLogic']),
actions({
@@ -175,20 +254,23 @@ export const sessionRecordingsKioskLogic = kea<sessionRecordingsKioskLogicType>(
],
})),
selectors({
- isConfigured: [(s) => [s.started], (started): boolean => started],
+ isConfigured: [(s) => [s.started], (started: boolean): boolean => started],
unplayedRecordings: [
(s) => [s.recordings, s.playedRecordingIds],
- (recordings, playedRecordingIds): SessionRecordingType[] =>
+ (recordings: SessionRecordingType[], playedRecordingIds: string[]): SessionRecordingType[] =>
recordings.filter((r) => !playedRecordingIds.includes(r.id)),
],
currentRecording: [
(s) => [s.recordings, s.currentRecordingId],
- (recordings, currentRecordingId): SessionRecordingType | null =>
+ (recordings: SessionRecordingType[], currentRecordingId: string | null): SessionRecordingType | null =>
recordings.find((r) => r.id === currentRecordingId) ?? null,
],
nextRecording: [
(s) => [s.unplayedRecordings, s.currentRecordingId],
- (unplayedRecordings, currentRecordingId): SessionRecordingType | null => {
+ (
+ unplayedRecordings: SessionRecordingType[],
+ currentRecordingId: string | null
+ ): SessionRecordingType | null => {
if (!currentRecordingId) {
return unplayedRecordings[0] ?? null
}
@@ -196,7 +278,7 @@ export const sessionRecordingsKioskLogic = kea<sessionRecordingsKioskLogicType>(
return unplayedRecordings[currentIndex + 1] ?? unplayedRecordings[0] ?? null
},
],
- hasRecordings: [(s) => [s.recordings], (recordings): boolean => recordings.length > 0],
+ hasRecordings: [(s) => [s.recordings], (recordings: SessionRecordingType[]): boolean => recordings.length > 0],
}),
listeners(({ actions, values }) => ({
markRecordingPlayed: () => {
diff --git a/frontend/src/scenes/session-recordings/player/commenting/playerCommentModel.ts b/frontend/src/scenes/session-recordings/player/commenting/playerCommentModel.ts
index 6fc7939f9883..2cfc27855e59 100644
--- a/frontend/src/scenes/session-recordings/player/commenting/playerCommentModel.ts
+++ b/frontend/src/scenes/session-recordings/player/commenting/playerCommentModel.ts
@@ -1,8 +1,18 @@
-import { actions, kea, path } from 'kea'
+import { MakeLogicType, actions, kea, path } from 'kea'
import { RecordingCommentForm } from 'scenes/session-recordings/player/commenting/playerFrameCommentOverlayLogic'
-import type { playerCommentModelType } from './playerCommentModelType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerCommentModelActions {
+ commentEdited: (recordingId: string) => {
+ recordingId: string
+ }
+ startCommenting: (comment: RecordingCommentForm | null) => {
+ comment: RecordingCommentForm | null
+ }
+}
+
+export type playerCommentModelType = MakeLogicType<{}, playerCommentModelActions>
/**
* used as a message bus for decoupled components to signal that a recording should be commented on
diff --git a/frontend/src/scenes/session-recordings/player/commenting/playerFrameCommentOverlayLogic.ts b/frontend/src/scenes/session-recordings/player/commenting/playerFrameCommentOverlayLogic.ts
index 7f7519fac6d4..e66b18688b63 100644
--- a/frontend/src/scenes/session-recordings/player/commenting/playerFrameCommentOverlayLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/commenting/playerFrameCommentOverlayLogic.ts
@@ -1,5 +1,6 @@
-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 { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { subscriptions } from 'kea-subscriptions'
import api from 'lib/api'
@@ -13,8 +14,8 @@ import { isSingleEmoji } from 'scenes/session-recordings/utils'
import { CommentType } from '~/types'
+import type { SessionPlayerData } from '../../../../types'
import { SessionRecordingPlayerLogicProps, sessionRecordingPlayerLogic } from '../sessionRecordingPlayerLogic'
-import type { playerCommentOverlayLogicType } from './playerFrameCommentOverlayLogicType'
export interface RecordingCommentForm {
// formatted time in recording, e.g. 00:00:00, 00:00:01, 00:00:02, etc.
@@ -34,6 +35,113 @@ export interface PlayerCommentOverlayLogicProps extends SessionRecordingPlayerLo
recordingId: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerCommentOverlayLogicValues {
+ currentPlayerTime: number // sessionRecordingPlayerLogic
+ currentTimestamp: number | undefined // sessionRecordingPlayerLogic
+ sessionPlayerData: SessionPlayerData // sessionRecordingPlayerLogic
+ asTask: boolean
+ formattedTimestamp: string
+ isEmpty: boolean
+ isLoading: boolean
+ isRecordingCommentSubmitting: boolean
+ isRecordingCommentValid: boolean
+ recordingComment: RecordingCommentForm
+ recordingCommentAllErrors: Record<string, any>
+ recordingCommentChanged: boolean
+ recordingCommentErrors: DeepPartialMap<RecordingCommentForm, ValidationErrorType>
+ recordingCommentHasErrors: boolean
+ recordingCommentManualErrors: Record<string, any>
+ recordingCommentTouched: boolean
+ recordingCommentTouches: Record<string, boolean>
+ recordingCommentValidationErrors: DeepPartialMap<RecordingCommentForm, ValidationErrorType>
+ richContentEditor: RichContentEditorType | null
+ showRecordingCommentErrors: boolean
+ timestampUnits: 2 | 3
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerCommentOverlayLogicActions {
+ ensureAllMembersLoaded: () => {
+ value: true
+ } // membersLogic
+ setIsCommenting: (isCommenting: boolean) => {
+ isCommenting: boolean
+ } // sessionRecordingPlayerLogic
+ addEmojiComment: (emoji: string) => {
+ emoji: string
+ }
+ editComment: (comment: RecordingCommentForm) => {
+ comment: RecordingCommentForm
+ }
+ onRichContentEditorUpdate: (isEmpty: boolean) => {
+ isEmpty: boolean
+ }
+ resetRecordingComment: (values?: RecordingCommentForm) => {
+ values?: RecordingCommentForm
+ }
+ setAsTask: (asTask: boolean) => {
+ asTask: boolean
+ }
+ setLoading: (isLoading: boolean) => {
+ isLoading: boolean
+ }
+ setRecordingCommentManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setRecordingCommentValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setRecordingCommentValues: (values: DeepPartial<RecordingCommentForm>) => {
+ values: DeepPartial<RecordingCommentForm>
+ }
+ setRichContent: (richContent: JSONContent | null) => {
+ richContent: JSONContent | null
+ }
+ setRichContentEditor: (editor: RichContentEditorType) => {
+ editor: RichContentEditorType
+ }
+ submitRecordingComment: () => {
+ value: boolean
+ }
+ submitRecordingCommentFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitRecordingCommentRequest: (recordingComment: RecordingCommentForm) => {
+ recordingComment: RecordingCommentForm
+ }
+ submitRecordingCommentSuccess: (recordingComment: RecordingCommentForm) => {
+ recordingComment: RecordingCommentForm
+ }
+ touchRecordingCommentField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerCommentOverlayLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ timestampUnits: (sessionPlayerData: SessionPlayerData) => 2 | 3
+ formattedTimestamp: (currentPlayerTime: number, timestampUnits: 2 | 3) => string
+ }
+}
+
+export type playerCommentOverlayLogicType = MakeLogicType<
+ playerCommentOverlayLogicValues,
+ playerCommentOverlayLogicActions,
+ PlayerCommentOverlayLogicProps,
+ playerCommentOverlayLogicMeta
+>
+
export const playerCommentOverlayLogic = kea<playerCommentOverlayLogicType>([
path(['scenes', 'session-recordings', 'player', 'PlayerFrameAnnotationOverlay']),
key((props) => props.recordingId ?? 'unknown'),
@@ -83,14 +191,14 @@ export const playerCommentOverlayLogic = kea<playerCommentOverlayLogicType>([
selectors({
timestampUnits: [
(s) => [s.sessionPlayerData],
- (sessionPlayerData) => {
+ (sessionPlayerData: import('~/types').SessionPlayerData) => {
const endTimeSeconds = Math.floor(sessionPlayerData.durationMs / 1000)
return endTimeSeconds > 3600 ? 3 : 2
},
],
formattedTimestamp: [
(s) => [s.currentPlayerTime, s.timestampUnits],
- (currentPlayerTime, timestampUnits) => {
+ (currentPlayerTime: number, timestampUnits: 2 | 3) => {
return colonDelimitedDuration(currentPlayerTime / 1000, timestampUnits)
},
],
diff --git a/frontend/src/scenes/session-recordings/player/controller/seekbarLogic.ts b/frontend/src/scenes/session-recordings/player/controller/seekbarLogic.ts
index 3a2286ab999a..4412f4307f2e 100644
--- a/frontend/src/scenes/session-recordings/player/controller/seekbarLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/controller/seekbarLogic.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 { MutableRefObject } from 'react'
import { clamp } from 'lib/utils/numbers'
@@ -7,8 +7,105 @@ import {
sessionRecordingPlayerLogic,
} from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'
+import type { SessionPlayerData } from '../../../../types'
import { InteractEvent, ReactInteractEvent, THUMB_OFFSET, getXPos } from '../utils/playerUtils'
-import type { seekbarLogicType } from './seekbarLogicType'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface seekbarLogicValues {
+ currentPlayerTime: number // sessionRecordingPlayerLogic
+ sessionPlayerData: SessionPlayerData // sessionRecordingPlayerLogic
+ cursorDiff: number
+ endTimeMs: number
+ isScrubbing: boolean
+ isSeeking: boolean
+ scrubbingTime: number
+ scrubbingTimeSeconds: number
+ slider: HTMLDivElement | null
+ thumb: HTMLDivElement | null
+ thumbLeftPos: number
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface seekbarLogicActions {
+ endScrub: () => {
+ value: true
+ } // sessionRecordingPlayerLogic
+ seekToTime: (
+ timeInMilliseconds: number,
+ forcePlay?: boolean | undefined
+ ) => {
+ forcePlay: boolean
+ timeInMilliseconds: number
+ } // sessionRecordingPlayerLogic
+ setCurrentTimestamp: (timestamp: number) => {
+ timestamp: number
+ } // sessionRecordingPlayerLogic
+ startScrub: () => {
+ value: true
+ } // sessionRecordingPlayerLogic
+ debouncedSetTime: (time: number) => {
+ time: number
+ }
+ endSeeking: () => {
+ value: true
+ }
+ handleClick: (event: ReactInteractEvent) => {
+ event: ReactInteractEvent
+ }
+ handleDown: (event: ReactInteractEvent) => {
+ event: ReactInteractEvent
+ }
+ handleMove: (event: InteractEvent) => {
+ event: InteractEvent
+ }
+ handleSeek: (
+ newX: number,
+ shouldSeek?: boolean
+ ) => {
+ newX: number
+ shouldSeek: boolean
+ }
+ handleUp: (event: InteractEvent) => {
+ event: InteractEvent
+ }
+ setCursorDiff: (cursorDiff: number) => {
+ cursorDiff: number
+ }
+ setSlider: (ref: MutableRefObject<HTMLDivElement | null>) => {
+ ref: MutableRefObject<HTMLDivElement | null>
+ }
+ setThumb: (ref: MutableRefObject<HTMLDivElement | null>) => {
+ ref: MutableRefObject<HTMLDivElement | null>
+ }
+ setThumbLeftPos: (
+ thumbLeftPos: number,
+ shouldSeek: boolean
+ ) => {
+ shouldSeek: boolean
+ thumbLeftPos: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface seekbarLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ endTimeMs: (sessionPlayerData: SessionPlayerData) => number
+ scrubbingTime: (
+ thumbLeftPos: number,
+ slider: HTMLDivElement | null,
+ sessionPlayerData: SessionPlayerData
+ ) => number
+ scrubbingTimeSeconds: (scrubbingTime: number) => number
+ }
+}
+
+export type seekbarLogicType = MakeLogicType<
+ seekbarLogicValues,
+ seekbarLogicActions,
+ SessionRecordingPlayerLogicProps,
+ seekbarLogicMeta
+>
export const seekbarLogic = kea<seekbarLogicType>([
path((key) => ['scenes', 'session-recordings', 'player', 'seekbarLogic', key]),
@@ -79,14 +176,18 @@ export const seekbarLogic = kea<seekbarLogicType>([
selectors({
endTimeMs: [
(selectors) => [selectors.sessionPlayerData],
- (sessionPlayerData) => {
+ (sessionPlayerData: import('../../../../types').SessionPlayerData) => {
return sessionPlayerData?.durationMs ?? 0
},
],
scrubbingTime: [
(selectors) => [selectors.thumbLeftPos, selectors.slider, selectors.sessionPlayerData],
- (thumbLeftPos, slider, sessionPlayerData) => {
+ (
+ thumbLeftPos: number,
+ slider: HTMLDivElement | null,
+ sessionPlayerData: import('../../../../types').SessionPlayerData
+ ) => {
if (thumbLeftPos && slider && sessionPlayerData?.durationMs) {
return ((thumbLeftPos + THUMB_OFFSET) / slider.offsetWidth) * sessionPlayerData.durationMs
}
@@ -95,7 +196,7 @@ export const seekbarLogic = kea<seekbarLogicType>([
],
scrubbingTimeSeconds: [
(selectors) => [selectors.scrubbingTime],
- (scrubbingTime) => Math.floor(scrubbingTime / 1000),
+ (scrubbingTime: number) => Math.floor(scrubbingTime / 1000),
],
}),
listeners(({ values, actions, cache }) => ({
diff --git a/frontend/src/scenes/session-recordings/player/inspector/miniFiltersLogic.ts b/frontend/src/scenes/session-recordings/player/inspector/miniFiltersLogic.ts
index 3dbb0ed9b277..3dad22370441 100644
--- a/frontend/src/scenes/session-recordings/player/inspector/miniFiltersLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/inspector/miniFiltersLogic.ts
@@ -1,10 +1,10 @@
import { deepEqual as equal } from 'fast-equals'
-import { actions, connect, events, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, events, kea, listeners, path, reducers, selectors } from 'kea'
import { sessionRecordingEventUsageLogic } from 'scenes/session-recordings/sessionRecordingEventUsageLogic'
import { teamLogic } from 'scenes/teamLogic'
-import type { miniFiltersLogicType } from './miniFiltersLogicType'
+import type { TeamPublicType, TeamType } from '../../../../types'
import { FilterableInspectorListItemTypes } from './playerInspectorLogic'
export type SharedListMiniFilter = {
@@ -152,6 +152,93 @@ const defaultMinifilters = [
'logs-error',
]
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface miniFiltersLogicValues {
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ groupRepeatedItems: boolean
+ hasEventsFiltersSelected: boolean
+ miniFilters: SharedListMiniFilter[]
+ miniFiltersByKey: {
+ [key: string]: SharedListMiniFilter
+ }
+ miniFiltersForType: (tab: FilterableInspectorListItemTypes) => SharedListMiniFilter[]
+ miniFiltersForTypeByKey: (tab: FilterableInspectorListItemTypes) => {
+ [key: string]: SharedListMiniFilter
+ }
+ searchQuery: string
+ selectedMiniFilters: string[]
+ showLineTooltips: boolean
+ showOnlyMatching: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface miniFiltersLogicActions {
+ reportRecordingInspectorMiniFilterViewed: (
+ minifilterKey: string,
+ enabled: boolean
+ ) => {
+ enabled: boolean
+ minifilterKey: string
+ } // sessionRecordingEventUsageLogic
+ resetMiniFilters: () => {
+ value: true
+ }
+ setGroupRepeatedItems: (groupRepeatedItems: boolean) => {
+ groupRepeatedItems: boolean
+ }
+ setMiniFilter: (
+ key: MiniFilterKey,
+ enabled: boolean
+ ) => {
+ enabled: boolean
+ key: string
+ }
+ setMiniFilters: (
+ keys: MiniFilterKey[],
+ enabled: boolean
+ ) => {
+ enabled: boolean
+ keys: string[]
+ }
+ setSearchQuery: (search: string) => {
+ search: string
+ }
+ setShowLineTooltips: (showLineTooltips: boolean) => {
+ showLineTooltips: boolean
+ }
+ setShowOnlyMatching: (showOnlyMatching: boolean) => {
+ showOnlyMatching: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface miniFiltersLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ miniFiltersForType: (
+ selectedMiniFilters: string[]
+ ) => (tab: FilterableInspectorListItemTypes) => SharedListMiniFilter[]
+ hasEventsFiltersSelected: (
+ miniFiltersForType: (tab: FilterableInspectorListItemTypes) => SharedListMiniFilter[]
+ ) => boolean
+ miniFilters: (selectedMiniFilters: string[]) => SharedListMiniFilter[]
+ miniFiltersByKey: (miniFilters: SharedListMiniFilter[]) => {
+ [key: string]: SharedListMiniFilter
+ }
+ miniFiltersForTypeByKey: (
+ miniFiltersForType: (tab: FilterableInspectorListItemTypes) => SharedListMiniFilter[]
+ ) => (tab: FilterableInspectorListItemTypes) => {
+ [key: string]: SharedListMiniFilter
+ }
+ }
+}
+
+export type miniFiltersLogicType = MakeLogicType<
+ miniFiltersLogicValues,
+ miniFiltersLogicActions,
+ Record<string, any>,
+ miniFiltersLogicMeta
+>
+
export const miniFiltersLogic = kea<miniFiltersLogicType>([
path(['scenes', 'session-recordings', 'player', 'miniFiltersLogic']),
actions({
@@ -228,7 +315,7 @@ export const miniFiltersLogic = kea<miniFiltersLogicType>([
selectors({
miniFiltersForType: [
(s) => [s.selectedMiniFilters],
- (selectedMiniFilters): ((tab: FilterableInspectorListItemTypes) => SharedListMiniFilter[]) => {
+ (selectedMiniFilters: string[]): ((tab: FilterableInspectorListItemTypes) => SharedListMiniFilter[]) => {
return (tab: FilterableInspectorListItemTypes) => {
return MiniFilters.filter((filter) => filter.type === tab).map((x) => ({
...x,
@@ -240,12 +327,13 @@ export const miniFiltersLogic = kea<miniFiltersLogicType>([
hasEventsFiltersSelected: [
(s) => [s.miniFiltersForType],
- (miniFiltersForType) => miniFiltersForType('events').some((x) => x.enabled),
+ (miniFiltersForType: (tab: FilterableInspectorListItemTypes) => SharedListMiniFilter[]) =>
+ miniFiltersForType('events').some((x) => x.enabled),
],
miniFilters: [
(s) => [s.selectedMiniFilters],
- (selectedMiniFilters): SharedListMiniFilter[] => {
+ (selectedMiniFilters: string[]): SharedListMiniFilter[] => {
return MiniFilters.map((x) => ({
...x,
enabled: selectedMiniFilters.includes(x.key),
@@ -256,7 +344,7 @@ export const miniFiltersLogic = kea<miniFiltersLogicType>([
miniFiltersByKey: [
(s) => [s.miniFilters],
- (miniFilters): { [key: string]: SharedListMiniFilter } => {
+ (miniFilters: SharedListMiniFilter[]): { [key: string]: SharedListMiniFilter } => {
return miniFilters.reduce<Record<string, SharedListMiniFilter>>((acc, filter) => {
acc[filter.key] = filter
return acc
@@ -268,7 +356,7 @@ export const miniFiltersLogic = kea<miniFiltersLogicType>([
miniFiltersForTypeByKey: [
(s) => [s.miniFiltersForType],
(
- miniFiltersForType
+ miniFiltersForType: (tab: FilterableInspectorListItemTypes) => SharedListMiniFilter[]
): ((tab: FilterableInspectorListItemTypes) => { [key: string]: SharedListMiniFilter }) => {
return (tab) => {
return miniFiltersForType(tab).reduce<Record<string, SharedListMiniFilter>>((acc, filter) => {
diff --git a/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogic.ts b/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogic.ts
index 7fe3fd059d47..f861db78bcc4 100644
--- a/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogic.ts
@@ -1,6 +1,19 @@
import { deepEqual as equal } from 'fast-equals'
import FuseClass from 'fuse.js'
-import { actions, connect, events, kea, key, listeners, path, props, propsChanged, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ connect,
+ events,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ propsChanged,
+ reducers,
+ selectors,
+} from 'kea'
import { loaders } from 'kea-loaders'
import {
EventType as RRWebEventType,
@@ -47,6 +60,9 @@ import {
RecordingEventType,
} from '~/types'
+import type { ExperimentSessionContextItemApi } from '../../../../../../products/experiments/frontend/generated/api.schemas'
+import type { FeatureFlagsSet } from '../../../../lib/logic/featureFlagLogic'
+import type { RecordingSegment, SessionPlayerData, SessionRecordingType } from '../../../../types'
import { sessionRecordingExperimentContextLogic } from '../player-meta/sessionRecordingExperimentContextLogic'
import { sessionRecordingDataCoordinatorLogic } from '../sessionRecordingDataCoordinatorLogic'
import {
@@ -54,7 +70,7 @@ import {
SessionRecordingPlayerLogicProps,
sessionRecordingPlayerLogic,
} from '../sessionRecordingPlayerLogic'
-import type { playerInspectorLogicType } from './playerInspectorLogicType'
+import type { SharedListMiniFilter } from './miniFiltersLogic'
import { playerInspectorLogsLogic } from './playerInspectorLogsLogic'
const CONSOLE_LOG_PLUGIN_NAME = 'rrweb/console@1'
@@ -358,6 +374,394 @@ function commentTimestamp(
return { timestamp: commentTime, timeInRecording: commentTime.valueOf() - (start?.valueOf() ?? 0) }
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerInspectorLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ groupRepeatedItems: boolean // miniFiltersLogic
+ miniFilters: SharedListMiniFilter[] // miniFiltersLogic
+ miniFiltersByKey: {
+ [key: string]: SharedListMiniFilter
+ } // miniFiltersLogic
+ miniFiltersForTypeByKey: (tab: FilterableInspectorListItemTypes) => {
+ [key: string]: SharedListMiniFilter
+ } // miniFiltersLogic
+ searchQuery: string // miniFiltersLogic
+ showOnlyMatching: boolean // miniFiltersLogic
+ allPerformanceEvents: PerformanceEvent[] // performanceEventDataLogic
+ logs: LogMessage[] // playerInspectorLogsLogic
+ logsHasMore: boolean // playerInspectorLogsLogic
+ logsInitialLoadRequested: boolean // playerInspectorLogsLogic
+ logsLoadError: boolean // playerInspectorLogsLogic
+ logsLoading: boolean // playerInspectorLogsLogic
+ logsNextCursor: string | undefined // playerInspectorLogsLogic
+ readyToLoadLogs: boolean // playerInspectorLogsLogic
+ durationMs: number // sessionRecordingDataCoordinatorLogic
+ end: Dayjs | null // sessionRecordingDataCoordinatorLogic
+ segments: RecordingSegment[] // sessionRecordingDataCoordinatorLogic
+ sessionComments: CommentType[] // sessionRecordingDataCoordinatorLogic
+ sessionCommentsLoading: boolean // sessionRecordingDataCoordinatorLogic
+ sessionEventsData: RecordingEventType[] | null // sessionRecordingDataCoordinatorLogic
+ sessionEventsDataLoading: boolean // sessionRecordingDataCoordinatorLogic
+ sessionNotebookComments: any // sessionRecordingDataCoordinatorLogic
+ sessionPlayerData: SessionPlayerData // sessionRecordingDataCoordinatorLogic
+ sessionPlayerMetaData: SessionRecordingType | null // sessionRecordingDataCoordinatorLogic
+ sessionPlayerMetaDataLoading: boolean // sessionRecordingDataCoordinatorLogic
+ snapshotsLoading: boolean // sessionRecordingDataCoordinatorLogic
+ start: Dayjs | null // sessionRecordingDataCoordinatorLogic
+ trackedWindow: number | null // sessionRecordingDataCoordinatorLogic
+ uuidToIndex: Record<string, number> // sessionRecordingDataCoordinatorLogic
+ windowIdForTimestamp: (timestamp: number) => number | undefined // sessionRecordingDataCoordinatorLogic
+ windowIds: number[] // sessionRecordingDataCoordinatorLogic
+ experimentItems: ExperimentSessionContextItemApi[] // sessionRecordingExperimentContextLogic
+ currentPlayerTime: number // sessionRecordingPlayerLogic
+ doctorDiagnostics: DoctorDiagnostics | null // sessionRecordingPlayerLogic
+ skipToFirstMatchingEvent: boolean // sessionRecordingPlayerLogic
+ allContextItems: InspectorListItem[]
+ allItems: {
+ items: InspectorListItem[]
+ itemsByMiniFilterKey: Record<MiniFilterKey, InspectorListItem[]>
+ itemsByType: Record<FilterableInspectorListItemTypes | 'context', InspectorListItem[]>
+ }
+ allItemsByItemType: Record<FilterableInspectorListItemTypes | 'context', InspectorListItem[]>
+ allItemsByMiniFilterKey: Record<MiniFilterKey, InspectorListItem[]>
+ allItemsList: InspectorListItem[]
+ allowMatchingEventsFilter: boolean
+ collapseInspectorItems: boolean
+ commentItems: InspectorListItemComment[]
+ displayGroups: DisplayGroup[]
+ expandedItems: number[]
+ experimentVariantItems: InspectorListItemExperimentVariant[]
+ filteredItems: InspectorListItem[]
+ fuse: Fuse
+ hasEventsToDisplay: boolean
+ inspectorDataState: Record<FilterableInspectorListItemTypes, 'empty' | 'loading' | 'ready'>
+ isLoading: boolean
+ isReady: boolean
+ items: InspectorListItem[]
+ matchingEvents: MatchedRecordingEvent[] | null
+ matchingEventsLoading: boolean
+ notebookCommentItems: InspectorListItemNotebookComment[]
+ playbackIndicatorIndex: number
+ playbackIndicatorIndexStop: number
+ processedSnapshotData: {
+ appStateItems: InspectorListItemAppState[]
+ browserVisibilityChanges: InspectorListBrowserVisibility[]
+ consoleItems: InspectorListItemConsole[]
+ contextItems: InspectorListItem[]
+ doctorEvents: InspectorListItemDoctor[]
+ offlineStatusChanges: InspectorListOfflineStatusChange[]
+ rawConsoleLogs: RecordingConsoleLogV2[]
+ }
+ runtimeDoctorEvents: InspectorListItemDoctor[]
+ seekbarItems: (InspectorListItemComment | InspectorListItemEvent | InspectorListItemExperimentVariant)[]
+ syncScrollPaused: boolean
+ windowNumberForID: (windowId: number | undefined) => number | '?' | undefined
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerInspectorLogicActions {
+ setMiniFilter: (
+ key: string,
+ enabled: boolean
+ ) => {
+ enabled: boolean
+ key: string
+ } // miniFiltersLogic
+ setSearchQuery: (search: string) => {
+ search: string
+ } // miniFiltersLogic
+ loadLogs: () => any // playerInspectorLogsLogic
+ loadMoreLogs: () => any // playerInspectorLogsLogic
+ markLogsInitialLoadRequested: () => {
+ value: true
+ } // playerInspectorLogsLogic
+ loadEventsSuccess: (
+ sessionEventsData: RecordingEventType[] | null,
+ payload?:
+ | {
+ value: true
+ }
+ | undefined
+ ) => {
+ payload?: {
+ value: true
+ }
+ sessionEventsData: RecordingEventType[] | null
+ } // sessionRecordingDataCoordinatorLogic
+ loadFullEventData: (event: RecordingEventType | RecordingEventType[]) => {
+ event: RecordingEventType | RecordingEventType[]
+ } // sessionRecordingDataCoordinatorLogic
+ registerWindowId: (uuid: string) => {
+ uuid: string
+ } // sessionRecordingDataCoordinatorLogic
+ setTrackedWindow: (windowId: number | null) => {
+ windowId: number | null
+ } // sessionRecordingDataCoordinatorLogic
+ reportRecordingInspectorItemExpanded: (
+ tab:
+ | 'app-state'
+ | 'browser-visibility'
+ | 'comment'
+ | 'console'
+ | 'doctor'
+ | 'events'
+ | 'experiment-variant'
+ | 'inactivity'
+ | 'inspector-summary'
+ | 'logs'
+ | 'network'
+ | 'offline-status'
+ | 'performance'
+ | 'session-change',
+ index: number
+ ) => {
+ index: number
+ tab:
+ | 'app-state'
+ | 'browser-visibility'
+ | 'comment'
+ | 'console'
+ | 'doctor'
+ | 'events'
+ | 'experiment-variant'
+ | 'inactivity'
+ | 'inspector-summary'
+ | 'logs'
+ | 'network'
+ | 'offline-status'
+ | 'performance'
+ | 'session-change'
+ } // sessionRecordingEventUsageLogic
+ seekToTime: (
+ timeInMilliseconds: number,
+ forcePlay?: boolean | undefined
+ ) => {
+ forcePlay: boolean
+ timeInMilliseconds: number
+ } // sessionRecordingPlayerLogic
+ setSkippingToMatchingEvent: (isSkippingToMatchingEvent: boolean) => {
+ isSkippingToMatchingEvent: boolean
+ } // sessionRecordingPlayerLogic
+ loadMatchingEvents: () => any
+ loadMatchingEventsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadMatchingEventsSuccess: (
+ matchingEvents: MatchedRecordingEvent[] | null,
+ payload?: any
+ ) => {
+ matchingEvents: MatchedRecordingEvent[] | null
+ payload?: any
+ }
+ setItemExpanded: (
+ index: number,
+ expanded: boolean
+ ) => {
+ expanded: boolean
+ index: number
+ }
+ setSyncScrollPaused: (paused: boolean) => {
+ paused: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerInspectorLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ allowMatchingEventsFilter: (miniFilters: SharedListMiniFilter[]) => boolean
+ windowNumberForID: (windowIds: number[]) => (windowId: number | undefined) => number | '?' | undefined
+ collapseInspectorItems: (featureFlags: FeatureFlagsSet) => boolean
+ processedSnapshotData: (
+ start: Dayjs | null,
+ sessionPlayerData: SessionPlayerData,
+ windowNumberForID: (windowId: number | undefined) => number | '?' | undefined,
+ collapseInspectorItems: boolean
+ ) => {
+ appStateItems: InspectorListItemAppState[]
+ browserVisibilityChanges: InspectorListBrowserVisibility[]
+ consoleItems: InspectorListItemConsole[]
+ contextItems: InspectorListItem[]
+ doctorEvents: InspectorListItemDoctor[]
+ offlineStatusChanges: InspectorListOfflineStatusChange[]
+ rawConsoleLogs: RecordingConsoleLogV2[]
+ }
+ notebookCommentItems: (
+ sessionNotebookComments: any,
+ windowIdForTimestamp: (timestamp: number) => number | undefined,
+ windowNumberForID: (windowId: number | undefined) => number | '?' | undefined,
+ start: Dayjs | null
+ ) => InspectorListItemNotebookComment[]
+ commentItems: (
+ sessionComments: CommentType[],
+ windowIdForTimestamp: (timestamp: number) => number | undefined,
+ windowNumberForID: (windowId: number | undefined) => number | '?' | undefined,
+ start: Dayjs | null
+ ) => InspectorListItemComment[]
+ experimentVariantItems: (
+ experimentItems: ExperimentSessionContextItemApi[],
+ windowIdForTimestamp: (timestamp: number) => number | undefined,
+ windowNumberForID: (windowId: number | undefined) => number | '?' | undefined,
+ start: Dayjs | null
+ ) => InspectorListItemExperimentVariant[]
+ runtimeDoctorEvents: (
+ start: Dayjs | null,
+ doctorDiagnostics: DoctorDiagnostics | null
+ ) => InspectorListItemDoctor[]
+ allContextItems: (
+ start: Dayjs | null,
+ processedSnapshotData: {
+ appStateItems: InspectorListItemAppState[]
+ browserVisibilityChanges: InspectorListBrowserVisibility[]
+ consoleItems: InspectorListItemConsole[]
+ contextItems: InspectorListItem[]
+ doctorEvents: InspectorListItemDoctor[]
+ offlineStatusChanges: InspectorListOfflineStatusChange[]
+ rawConsoleLogs: RecordingConsoleLogV2[]
+ },
+ windowNumberForID: (windowId: number | undefined) => number | '?' | undefined,
+ sessionPlayerMetaData: SessionRecordingType | null,
+ segments: import('@common/replay-shared/src').RecordingSegment[],
+ runtimeDoctorEvents: InspectorListItemDoctor[],
+ experimentVariantItems: InspectorListItemExperimentVariant[]
+ ) => InspectorListItem[]
+ allItems: (
+ start: Dayjs | null,
+ allPerformanceEvents: PerformanceEvent[],
+ processedSnapshotData: {
+ appStateItems: InspectorListItemAppState[]
+ browserVisibilityChanges: InspectorListBrowserVisibility[]
+ consoleItems: InspectorListItemConsole[]
+ contextItems: InspectorListItem[]
+ doctorEvents: InspectorListItemDoctor[]
+ offlineStatusChanges: InspectorListOfflineStatusChange[]
+ rawConsoleLogs: RecordingConsoleLogV2[]
+ },
+ sessionEventsData: RecordingEventType[] | null,
+ matchingEvents: MatchedRecordingEvent[] | null,
+ windowNumberForID: (windowId: number | undefined) => number | '?' | undefined,
+ allContextItems: InspectorListItem[],
+ commentItems: InspectorListItemComment[],
+ notebookCommentItems: InspectorListItemNotebookComment[],
+ sessionPlayerData: SessionPlayerData,
+ miniFiltersByKey: {
+ [key: string]: SharedListMiniFilter
+ },
+ uuidToIndex: Record<string, number>,
+ logs: LogMessage[]
+ ) => {
+ items: InspectorListItem[]
+ itemsByMiniFilterKey: Record<MiniFilterKey, InspectorListItem[]>
+ itemsByType: Record<FilterableInspectorListItemTypes | 'context', InspectorListItem[]>
+ }
+ filteredItems: (
+ allItems: {
+ items: InspectorListItem[]
+ itemsByMiniFilterKey: Record<MiniFilterKey, InspectorListItem[]>
+ itemsByType: Record<FilterableInspectorListItemTypes | 'context', InspectorListItem[]>
+ },
+ miniFiltersByKey: {
+ [key: string]: SharedListMiniFilter
+ },
+ showOnlyMatching: boolean,
+ allowMatchingEventsFilter: boolean,
+ trackedWindow: number | null,
+ hasEventsToDisplay: boolean
+ ) => InspectorListItem[]
+ seekbarItems: (
+ allItems: {
+ items: InspectorListItem[]
+ itemsByMiniFilterKey: Record<MiniFilterKey, InspectorListItem[]>
+ itemsByType: Record<FilterableInspectorListItemTypes | 'context', InspectorListItem[]>
+ },
+ miniFiltersByKey: {
+ [key: string]: SharedListMiniFilter
+ },
+ showOnlyMatching: boolean,
+ allowMatchingEventsFilter: boolean,
+ trackedWindow: number | null,
+ hasEventsToDisplay: boolean
+ ) => (InspectorListItemComment | InspectorListItemEvent | InspectorListItemExperimentVariant)[]
+ inspectorDataState: (
+ sessionEventsDataLoading: boolean,
+ sessionPlayerMetaDataLoading: boolean,
+ snapshotsLoading: boolean,
+ sessionEventsData: RecordingEventType[] | null,
+ processedSnapshotData: {
+ appStateItems: InspectorListItemAppState[]
+ browserVisibilityChanges: InspectorListBrowserVisibility[]
+ consoleItems: InspectorListItemConsole[]
+ contextItems: InspectorListItem[]
+ doctorEvents: InspectorListItemDoctor[]
+ offlineStatusChanges: InspectorListOfflineStatusChange[]
+ rawConsoleLogs: RecordingConsoleLogV2[]
+ },
+ allPerformanceEvents: PerformanceEvent[],
+ sessionComments: CommentType[],
+ sessionCommentsLoading: boolean,
+ logsLoading: boolean,
+ logs: LogMessage[]
+ ) => Record<FilterableInspectorListItemTypes, 'empty' | 'loading' | 'ready'>
+ isLoading: (
+ inspectorDataState: Record<
+ 'comment' | 'console' | 'doctor' | 'events' | 'logs' | 'network',
+ 'empty' | 'loading' | 'ready'
+ >
+ ) => boolean
+ isReady: (
+ inspectorDataState: Record<
+ 'comment' | 'console' | 'doctor' | 'events' | 'logs' | 'network',
+ 'empty' | 'loading' | 'ready'
+ >
+ ) => boolean
+ playbackIndicatorIndex: (
+ currentPlayerTime: number,
+ items: InspectorListItem[],
+ displayGroups: DisplayGroup[]
+ ) => number
+ playbackIndicatorIndexStop: (playbackIndicatorIndex: number, displayGroups: DisplayGroup[]) => number
+ fuse: (filteredItems: InspectorListItem[]) => Fuse
+ items: (filteredItems: InspectorListItem[], fuse: Fuse, searchQuery: string) => InspectorListItem[]
+ displayGroups: (
+ items: InspectorListItem[],
+ groupRepeatedItems: boolean,
+ collapseInspectorItems: boolean
+ ) => DisplayGroup[]
+ allItemsList: (allItems: {
+ items: InspectorListItem[]
+ itemsByMiniFilterKey: Record<MiniFilterKey, InspectorListItem[]>
+ itemsByType: Record<FilterableInspectorListItemTypes | 'context', InspectorListItem[]>
+ }) => InspectorListItem[]
+ allItemsByMiniFilterKey: (allItems: {
+ items: InspectorListItem[]
+ itemsByMiniFilterKey: Record<MiniFilterKey, InspectorListItem[]>
+ itemsByType: Record<FilterableInspectorListItemTypes | 'context', InspectorListItem[]>
+ }) => Record<MiniFilterKey, InspectorListItem[]>
+ allItemsByItemType: (allItems: {
+ items: InspectorListItem[]
+ itemsByMiniFilterKey: Record<MiniFilterKey, InspectorListItem[]>
+ itemsByType: Record<FilterableInspectorListItemTypes | 'context', InspectorListItem[]>
+ }) => Record<FilterableInspectorListItemTypes | 'context', InspectorListItem[]>
+ hasEventsToDisplay: (
+ allItemsByItemType: Record<
+ 'comment' | 'console' | 'context' | 'doctor' | 'events' | 'logs' | 'network',
+ InspectorListItem[]
+ >
+ ) => boolean
+ }
+}
+
+export type playerInspectorLogicType = MakeLogicType<
+ playerInspectorLogicValues,
+ playerInspectorLogicActions,
+ PlayerInspectorLogicProps,
+ playerInspectorLogicMeta
+>
+
export const playerInspectorLogic = kea<playerInspectorLogicType>([
path((key) => ['scenes', 'session-recordings', 'player', 'playerInspectorLogic', key]),
props({} as PlayerInspectorLogicProps),
@@ -509,7 +913,9 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([
selectors(({ props }) => ({
allowMatchingEventsFilter: [
(s) => [s.miniFilters],
- (miniFilters): boolean => {
+ (
+ miniFilters: import('scenes/session-recordings/player/inspector/miniFiltersLogic').SharedListMiniFilter[]
+ ): boolean => {
return (
miniFilters.some((mf) => mf.type === 'events' && mf.enabled) &&
props.matchingEventsMatchType?.matchType !== 'none'
@@ -519,7 +925,7 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([
windowNumberForID: [
(s) => [s.windowIds],
- (windowIds) => {
+ (windowIds: number[]) => {
// windowId is already 1-indexed from the registry
return (windowId: number | undefined): number | '?' | undefined => {
if (windowIds.length <= 1) {
@@ -535,16 +941,17 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([
collapseInspectorItems: [
(s) => [s.featureFlags],
- (featureFlags): boolean => !!featureFlags[FEATURE_FLAGS.REPLAY_COLLAPSE_INSPECTOR_ITEMS],
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet): boolean =>
+ !!featureFlags[FEATURE_FLAGS.REPLAY_COLLAPSE_INSPECTOR_ITEMS],
],
processedSnapshotData: [
(s) => [s.start, s.sessionPlayerData, s.windowNumberForID, s.collapseInspectorItems],
(
- start,
- sessionPlayerData,
- windowNumberForID,
- collapseInspectorItems
+ start: Dayjs | null,
+ sessionPlayerData: import('~/types').SessionPlayerData,
+ windowNumberForID: (windowId: number | undefined) => number | '?' | undefined,
+ collapseInspectorItems: boolean
): {
offlineStatusChanges: InspectorListOfflineStatusChange[]
browserVisibilityChanges: InspectorListBrowserVisibility[]
@@ -784,9 +1191,9 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([
(s) => [s.sessionNotebookComments, s.windowIdForTimestamp, s.windowNumberForID, s.start],
(
sessionNotebookComments,
- windowIdForTimestamp,
- windowNumberForID,
- start
+ windowIdForTimestamp: (timestamp: number) => number | undefined,
+ windowNumberForID: (windowId: number | undefined) => number | '?' | undefined,
+ start: Dayjs | null
): InspectorListItemNotebookComment[] => {
const items: InspectorListItemNotebookComment[] = []
for (const comment of sessionNotebookComments || []) {
@@ -815,7 +1222,12 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([
commentItems: [
(s) => [s.sessionComments, s.windowIdForTimestamp, s.windowNumberForID, s.start],
- (sessionComments, windowIdForTimestamp, windowNumberForID, start): InspectorListItemComment[] => {
+ (
+ sessionComments: CommentType[],
+ windowIdForTimestamp: (timestamp: number) => number | undefined,
+ windowNumberForID: (windowId: number | undefined) => number | '?' | undefined,
+ start: Dayjs | null
+ ): InspectorListItemComment[] => {
const items: InspectorListItemComment[] = []
for (const comment of sessionComments || []) {
if (!comment.item_context?.time_in_recording) {
@@ -849,7 +1261,12 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([
experimentVariantItems: [
(s) => [s.experimentItems, s.windowIdForTimestamp, s.windowNumberForID, s.start],
- (experimentItems, windowIdForTimestamp, windowNumberForID, start): InspectorListItemExperimentVariant[] => {
+ (
+ experimentItems: import('products/experiments/frontend/generated/api.schemas').ExperimentSessionContextItemApi[],
+ windowIdForTimestamp: (timestamp: number) => number | undefined,
+ windowNumberForID: (windowId: number | undefined) => number | '?' | undefined,
+ start: Dayjs | null
+ ): InspectorListItemExperimentVariant[] => {
const items: InspectorListItemExperimentVariant[] = []
for (const item of experimentItems || []) {
// Without a $feature_flag_called event there is no in-session moment to mark —
@@ -938,13 +1355,21 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([
s.experimentVariantItems,
],
(
- start,
- processedSnapshotData,
- windowNumberForID,
- sessionPlayerMetaData,
- segments,
- runtimeDoctorEvents,
- experimentVariantItems
+ start: Dayjs | null,
+ processedSnapshotData: {
+ appStateItems: InspectorListItemAppState[]
+ browserVisibilityChanges: InspectorListBrowserVisibility[]
+ consoleItems: InspectorListItemConsole[]
+ contextItems: InspectorListItem[]
+ doctorEvents: InspectorListItemDoctor[]
+ offlineStatusChanges: InspectorListOfflineStatusChange[]
+ rawConsoleLogs: RecordingConsoleLogV2[]
+ },
+ windowNumberForID: (windowId: number | undefined) => number | '?' | undefined,
+ sessionPlayerMetaData: null | import('~/types').SessionRecordingType,
+ segments: import('~/types').RecordingSegment[],
+ runtimeDoctorEvents: InspectorListItemDoctor[],
+ experimentVariantItems: InspectorListItemExperimentVariant[]
) => {
const items: InspectorListItem[] = []
@@ -1026,19 +1451,29 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([
s.logs,
],
(
- start,
- performanceEvents,
- processedSnapshotData,
- eventsData,
- matchingEvents,
- windowNumberForID,
- allContextItems,
- commentItems,
- notebookCommentItems,
- sessionPlayerData,
- miniFiltersByKey,
- uuidToIndex,
- logs
+ start: Dayjs | null,
+ performanceEvents: PerformanceEvent[],
+ processedSnapshotData: {
+ appStateItems: InspectorListItemAppState[]
+ browserVisibilityChanges: InspectorListBrowserVisibility[]
+ consoleItems: InspectorListItemConsole[]
+ contextItems: InspectorListItem[]
+ doctorEvents: InspectorListItemDoctor[]
+ offlineStatusChanges: InspectorListOfflineStatusChange[]
+ rawConsoleLogs: RecordingConsoleLogV2[]
+ },
+ eventsData: RecordingEventType[] | null,
+ matchingEvents: MatchedRecordingEvent[] | null,
+ windowNumberForID: (windowId: number | undefined) => number | '?' | undefined,
+ allContextItems: InspectorListItem[],
+ commentItems: InspectorListItemComment[],
+ notebookCommentItems: InspectorListItemNotebookComment[],
+ sessionPlayerData: import('~/types').SessionPlayerData,
+ miniFiltersByKey: {
+ [key: string]: import('scenes/session-recordings/player/inspector/miniFiltersLogic').SharedListMiniFilter
+ },
+ uuidToIndex: Record<string, number>,
+ logs: LogMessage[]
): {
items: InspectorListItem[]
itemsByMiniFilterKey: Record<MiniFilterKey, InspectorListItem[]>
@@ -1260,12 +1695,18 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([
s.hasEventsToDisplay,
],
(
- allItemsData,
- miniFiltersByKey,
- showOnlyMatching,
- allowMatchingEventsFilter,
- trackedWindow,
- hasEventsToDisplay
+ allItemsData: {
+ items: InspectorListItem[]
+ itemsByMiniFilterKey: Record<MiniFilterKey, InspectorListItem[]>
+ itemsByType: Record<FilterableInspectorListItemTypes | 'context', InspectorListItem[]>
+ },
+ miniFiltersByKey: {
+ [key: string]: import('scenes/session-recordings/player/inspector/miniFiltersLogic').SharedListMiniFilter
+ },
+ showOnlyMatching: boolean,
+ allowMatchingEventsFilter: boolean,
+ trackedWindow: number | null,
+ hasEventsToDisplay: boolean
): InspectorListItem[] => {
const filteredItems = filterInspectorListItems({
allItems: allItemsData.items,
@@ -1291,12 +1732,18 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([
s.hasEventsToDisplay,
],
(
- allItemsData,
- miniFiltersByKey,
- showOnlyMatching,
- allowMatchingEventsFilter,
- trackedWindow,
- hasEventsToDisplay
+ allItemsData: {
+ items: InspectorListItem[]
+ itemsByMiniFilterKey: Record<MiniFilterKey, InspectorListItem[]>
+ itemsByType: Record<FilterableInspectorListItemTypes | 'context', InspectorListItem[]>
+ },
+ miniFiltersByKey: {
+ [key: string]: import('scenes/session-recordings/player/inspector/miniFiltersLogic').SharedListMiniFilter
+ },
+ showOnlyMatching: boolean,
+ allowMatchingEventsFilter: boolean,
+ trackedWindow: number | null,
+ hasEventsToDisplay: boolean
): (InspectorListItemEvent | InspectorListItemComment | InspectorListItemExperimentVariant)[] => {
// Pre-filter to only events, comments and experiment variant markers, avoiding the full filterInspectorListItems call
const eventAndCommentItems: (
@@ -1449,17 +1896,19 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([
isLoading: [
(s) => [s.inspectorDataState],
- (inspectorDataState): boolean => Object.values(inspectorDataState).some((state) => state === 'loading'),
+ (inspectorDataState: Record<FilterableInspectorListItemTypes, 'empty' | 'loading' | 'ready'>): boolean =>
+ Object.values(inspectorDataState).some((state) => state === 'loading'),
],
isReady: [
(s) => [s.inspectorDataState],
- (inspectorDataState): boolean => Object.values(inspectorDataState).every((state) => state === 'ready'),
+ (inspectorDataState: Record<FilterableInspectorListItemTypes, 'empty' | 'loading' | 'ready'>): boolean =>
+ Object.values(inspectorDataState).every((state) => state === 'ready'),
],
playbackIndicatorIndex: [
(s) => [s.currentPlayerTime, s.items, s.displayGroups],
- (playerTime, items, displayGroups): number => {
+ (playerTime: number, items: InspectorListItem[], displayGroups: DisplayGroup[]): number => {
if (!playerTime) {
return 0
}
@@ -1472,13 +1921,13 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([
playbackIndicatorIndexStop: [
(s) => [s.playbackIndicatorIndex, s.displayGroups],
- (playbackIndicatorIndex, displayGroups): number =>
+ (playbackIndicatorIndex: number, displayGroups: DisplayGroup[]): number =>
(displayGroups.length + playbackIndicatorIndex) % displayGroups.length,
],
fuse: [
(s) => [s.filteredItems],
- (filteredItems): Fuse =>
+ (filteredItems: InspectorListItem[]): Fuse =>
createFuse<InspectorListItem>(filteredItems, {
keys: ['search'],
findAllMatches: true,
@@ -1490,7 +1939,7 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([
items: [
(s) => [s.filteredItems, s.fuse, s.searchQuery],
- (filteredItems, fuse, searchQuery): InspectorListItem[] => {
+ (filteredItems: InspectorListItem[], fuse: Fuse, searchQuery: string): InspectorListItem[] => {
if (searchQuery === '') {
return filteredItems
}
@@ -1501,7 +1950,11 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([
displayGroups: [
(s) => [s.items, s.groupRepeatedItems, s.collapseInspectorItems],
- (items, groupRepeatedItems, collapseInspectorItems): DisplayGroup[] => {
+ (
+ items: InspectorListItem[],
+ groupRepeatedItems: boolean,
+ collapseInspectorItems: boolean
+ ): DisplayGroup[] => {
if (!collapseInspectorItems) {
return items.map((_, i) => ({ indices: [i] }))
}
@@ -1510,14 +1963,25 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([
{ resultEqualityCheck: equal },
],
- allItemsList: [(s) => [s.allItems], (allItemsData): InspectorListItem[] => allItemsData.items],
+ allItemsList: [
+ (s) => [s.allItems],
+ (allItemsData: {
+ items: InspectorListItem[]
+ itemsByMiniFilterKey: Record<MiniFilterKey, InspectorListItem[]>
+ itemsByType: Record<FilterableInspectorListItemTypes | 'context', InspectorListItem[]>
+ }): InspectorListItem[] => allItemsData.items,
+ ],
/**
* All items by mini-filter key, not filtered items, so that we can count the unfiltered sets
*/
allItemsByMiniFilterKey: [
(s) => [s.allItems],
- (allItemsData): Record<MiniFilterKey, InspectorListItem[]> => allItemsData.itemsByMiniFilterKey,
+ (allItemsData: {
+ items: InspectorListItem[]
+ itemsByMiniFilterKey: Record<MiniFilterKey, InspectorListItem[]>
+ itemsByType: Record<FilterableInspectorListItemTypes | 'context', InspectorListItem[]>
+ }): Record<MiniFilterKey, InspectorListItem[]> => allItemsData.itemsByMiniFilterKey,
],
/**
@@ -1525,13 +1989,17 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([
*/
allItemsByItemType: [
(s) => [s.allItems],
- (allItemsData): Record<FilterableInspectorListItemTypes | 'context', InspectorListItem[]> =>
- allItemsData.itemsByType,
+ (allItemsData: {
+ items: InspectorListItem[]
+ itemsByMiniFilterKey: Record<MiniFilterKey, InspectorListItem[]>
+ itemsByType: Record<FilterableInspectorListItemTypes | 'context', InspectorListItem[]>
+ }): Record<FilterableInspectorListItemTypes | 'context', InspectorListItem[]> => allItemsData.itemsByType,
],
hasEventsToDisplay: [
(s) => [s.allItemsByItemType],
- (allItemsByItemType): boolean => allItemsByItemType['events']?.length > 0,
+ (allItemsByItemType: Record<FilterableInspectorListItemTypes | 'context', InspectorListItem[]>): boolean =>
+ allItemsByItemType['events']?.length > 0,
],
})),
listeners(({ values, actions }) => ({
diff --git a/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogsLogic.ts b/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogsLogic.ts
index a2526e6e36bd..1a00476a2aaa 100644
--- a/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogsLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogsLogic.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 { loaders } from 'kea-loaders'
import api from 'lib/api'
@@ -9,9 +9,9 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { LogMessage, LogsQuery } from '~/queries/schema/schema-general'
import { FilterLogicalOperator, PropertyFilterType, PropertyOperator } from '~/types'
+import type { FeatureFlagsSet } from '../../../../lib/logic/featureFlagLogic'
import { sessionRecordingDataCoordinatorLogic } from '../sessionRecordingDataCoordinatorLogic'
import { SessionRecordingPlayerLogicProps } from '../sessionRecordingPlayerLogic'
-import type { playerInspectorLogsLogicType } from './playerInspectorLogsLogicType'
export const MAX_LOG_ENTRIES = 5000
@@ -50,6 +50,78 @@ export function buildSessionLogsQuery(
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerInspectorLogsLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ end: Dayjs | null // sessionRecordingDataCoordinatorLogic
+ start: Dayjs | null // sessionRecordingDataCoordinatorLogic
+ logs: LogMessage[]
+ logsHasMore: boolean
+ logsInitialLoadRequested: boolean
+ logsLoadError: boolean
+ logsLoading: boolean
+ logsNextCursor: string | undefined
+ readyToLoadLogs: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerInspectorLogsLogicActions {
+ loadLogs: () => any
+ loadLogsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadLogsSuccess: (
+ logs: LogMessage[],
+ payload?: any
+ ) => {
+ logs: LogMessage[]
+ payload?: any
+ }
+ loadMoreLogs: () => any
+ loadMoreLogsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadMoreLogsSuccess: (
+ logs: LogMessage[],
+ payload?: any
+ ) => {
+ logs: LogMessage[]
+ payload?: any
+ }
+ markLogsInitialLoadRequested: () => {
+ value: true
+ }
+ setLogsHasMore: (hasMore: boolean) => {
+ hasMore: boolean
+ }
+ setLogsNextCursor: (cursor: string | undefined) => {
+ cursor: string | undefined
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerInspectorLogsLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ readyToLoadLogs: (featureFlags: FeatureFlagsSet, start: Dayjs | null, end: Dayjs | null, arg: any) => boolean
+ }
+}
+
+export type playerInspectorLogsLogicType = MakeLogicType<
+ playerInspectorLogsLogicValues,
+ playerInspectorLogsLogicActions,
+ SessionRecordingPlayerLogicProps,
+ playerInspectorLogsLogicMeta
+>
+
export const playerInspectorLogsLogic = kea<playerInspectorLogsLogicType>([
path((key) => ['scenes', 'session-recordings', 'player', 'inspector', 'playerInspectorLogsLogic', key]),
props({} as SessionRecordingPlayerLogicProps),
@@ -149,7 +221,12 @@ export const playerInspectorLogsLogic = kea<playerInspectorLogsLogicType>([
selectors(() => ({
readyToLoadLogs: [
(s) => [s.featureFlags, s.start, s.end, (_, props) => props.sessionRecordingId],
- (featureFlags, start, end, sessionRecordingId): boolean =>
+ (
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet,
+ start: Dayjs | null,
+ end: Dayjs | null,
+ sessionRecordingId
+ ): boolean =>
!!featureFlags[FEATURE_FLAGS.SESSION_REPLAY_BACKEND_LOGS] && !!start && !!end && !!sessionRecordingId,
],
})),
diff --git a/frontend/src/scenes/session-recordings/player/modal/sessionPlayerModalLogic.ts b/frontend/src/scenes/session-recordings/player/modal/sessionPlayerModalLogic.ts
index e33ca776b397..d493ec962a7d 100644
--- a/frontend/src/scenes/session-recordings/player/modal/sessionPlayerModalLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/modal/sessionPlayerModalLogic.ts
@@ -1,10 +1,8 @@
-import { actions, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
import { actionToUrl, router, urlToAction } from 'kea-router'
import { SessionRecordingId, SessionRecordingType } from '~/types'
-import type { sessionPlayerModalLogicType } from './sessionPlayerModalLogicType'
-
interface HashParams {
sessionRecordingId?: SessionRecordingId
}
@@ -13,6 +11,28 @@ interface QueryParams {
timestamp?: number
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionPlayerModalLogicValues {
+ activeSessionRecording: Pick<SessionRecordingType, 'id' | 'matching_events'> | null
+ initialTimestamp: number | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionPlayerModalLogicActions {
+ closeSessionPlayer: () => {
+ value: true
+ }
+ openSessionPlayer: (
+ sessionRecording: Pick<SessionRecordingType, 'id' | 'matching_events'>,
+ initialTimestamp?: number | null
+ ) => {
+ initialTimestamp: number | null
+ sessionRecording: Pick<SessionRecordingType, 'id' | 'matching_events'>
+ }
+}
+
+export type sessionPlayerModalLogicType = MakeLogicType<sessionPlayerModalLogicValues, sessionPlayerModalLogicActions>
+
export const sessionPlayerModalLogic = kea<sessionPlayerModalLogicType>([
path(['scenes', 'session-recordings', 'sessionPlayerModalLogic']),
actions({
diff --git a/frontend/src/scenes/session-recordings/player/player-meta/playerMetaLogic.tsx b/frontend/src/scenes/session-recordings/player/player-meta/playerMetaLogic.tsx
index 8a4842c22c97..82e2ad37de55 100644
--- a/frontend/src/scenes/session-recordings/player/player-meta/playerMetaLogic.tsx
+++ b/frontend/src/scenes/session-recordings/player/player-meta/playerMetaLogic.tsx
@@ -1,6 +1,6 @@
import { aiSummaryMock } from './ai-summary.mock'
-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 React from 'react'
@@ -25,11 +25,18 @@ import {
import { getCoreFilterDefinition, getFirstFilterTypeFor } from '~/taxonomy/helpers'
import { PersonType, PropertyFilterType, SessionRecordingType } from '~/types'
+import type {
+ RecordingEventType,
+ RecordingSegment,
+ SessionPlayerData,
+ SessionRecordingPropertiesType,
+} from '../../../../types'
import { sessionRecordingsListPropertiesLogic } from '../../playlist/sessionRecordingsListPropertiesLogic'
import { SeekbarSegmentRange } from '../controller/SeekbarSegments'
+import type { MiniFilterKey } from '../inspector/miniFiltersLogic'
import { playerInspectorLogic } from '../inspector/playerInspectorLogic'
import type { InspectorListItemEvent } from '../inspector/playerInspectorLogic'
-import type { playerMetaLogicType } from './playerMetaLogicType'
+import type { InspectorListItem } from '../inspector/playerInspectorLogic'
import { sessionRecordingPinnedPropertiesLogic } from './sessionRecordingPinnedPropertiesLogic'
import { HARDCODED_DISPLAY_LABELS } from './sessionRecordingPinnedPropertiesLogic'
import { sessionSummaryProgressLogic } from './sessionSummaryProgressLogic'
@@ -141,6 +148,199 @@ export function getPropertyDisplayInfo(
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerMetaLogicValues {
+ allItemsByMiniFilterKey: Record<MiniFilterKey, InspectorListItem[]> // playerInspectorLogic
+ sessionEventsData: RecordingEventType[] | null // sessionRecordingDataCoordinatorLogic
+ sessionPlayerData: SessionPlayerData // sessionRecordingDataCoordinatorLogic
+ sessionPlayerMetaData: SessionRecordingType | null // sessionRecordingDataCoordinatorLogic
+ trackedWindow: number | null // sessionRecordingDataCoordinatorLogic
+ urls: {
+ timestamp: number
+ url: string
+ }[] // sessionRecordingDataCoordinatorLogic
+ windowIds: number[] // sessionRecordingDataCoordinatorLogic
+ pinnedProperties: string[] // sessionRecordingPinnedPropertiesLogic
+ currentPlayerTime: number // sessionRecordingPlayerLogic
+ currentSegment: RecordingSegment | null // sessionRecordingPlayerLogic
+ currentTimestamp: number | undefined // sessionRecordingPlayerLogic
+ currentURL: string | undefined // sessionRecordingPlayerLogic
+ resolution: {
+ height: number
+ width: number
+ } | null // sessionRecordingPlayerLogic
+ scale: number // sessionRecordingPlayerLogic
+ recordingPropertiesById: Record<string, SessionRecordingPropertiesType[]> // sessionRecordingsListPropertiesLogic
+ recordingPropertiesLoading: boolean // sessionRecordingsListPropertiesLogic
+ errorBySessionId: Record<string, string | null> // sessionSummaryProgressLogic
+ feedbackBySessionId: Record<string, boolean> // sessionSummaryProgressLogic
+ loadingBySessionId: Record<string, boolean> // sessionSummaryProgressLogic
+ progressBySessionId: Record<string, SummarizationProgress | null> // sessionSummaryProgressLogic
+ retryStateBySessionId: Record<
+ string,
+ {
+ hasRetried: boolean
+ maxStep: number
+ }
+ > // sessionSummaryProgressLogic
+ summaryBySessionId: Record<string, SessionSummaryContent | null> // sessionSummaryProgressLogic
+ summaryIdBySessionId: Record<string, string | null> // sessionSummaryProgressLogic
+ allOverviewItems: OverviewItem[]
+ currentWindowIndex: number
+ displayOverviewItems: OverviewItem[]
+ endTime: Dayjs | null
+ isPropertyPopoverOpen: boolean
+ lastPageviewEvent: RecordingEventType | null | undefined
+ loading: boolean
+ resolutionDisplay: string
+ scaleDisplay: string
+ sessionPerson: PersonType | null
+ sessionSummary: SessionSummaryContent | null
+ sessionSummaryError: string | null
+ sessionSummaryHasRetried: boolean
+ sessionSummaryId: string | null
+ sessionSummaryLoading: boolean
+ sessionSummarySegmentRanges: SeekbarSegmentRange[] | null
+ showFeedbackSurvey: boolean
+ snapshotAt: any
+ startTime: Dayjs | null
+ summarizationProgress: SummarizationProgress | null
+ summaryDisabledReason: string | undefined
+ summaryHasHadFeedback: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerMetaLogicActions {
+ loadRecordingMetaSuccess: (
+ sessionPlayerMetaData: SessionRecordingType | null,
+ payload?:
+ | {
+ value: true
+ }
+ | undefined
+ ) => {
+ payload?: {
+ value: true
+ }
+ sessionPlayerMetaData: SessionRecordingType | null
+ } // sessionRecordingDataCoordinatorLogic
+ setTrackedWindow: (windowId: number | null) => {
+ windowId: number | null
+ } // sessionRecordingDataCoordinatorLogic
+ setPinnedProperties: (properties: string[]) => {
+ properties: string[]
+ } // sessionRecordingPinnedPropertiesLogic
+ togglePropertyPin: (propertyKey: string) => {
+ propertyKey: string
+ } // sessionRecordingPinnedPropertiesLogic
+ loadPropertiesForSessionsSuccess: (
+ recordingProperties: SessionRecordingPropertiesType[],
+ payload?:
+ | {
+ sessions: SessionRecordingType[]
+ }
+ | undefined
+ ) => {
+ payload?: {
+ sessions: SessionRecordingType[]
+ }
+ recordingProperties: SessionRecordingPropertiesType[]
+ } // sessionRecordingsListPropertiesLogic
+ maybeLoadPropertiesForSessions: (sessions: SessionRecordingType[]) => {
+ sessions: SessionRecordingType[]
+ } // sessionRecordingsListPropertiesLogic
+ markFeedbackGiven: (sessionId: string) => {
+ sessionId: string
+ } // sessionSummaryProgressLogic
+ setSummary: (
+ sessionId: string,
+ summary: SessionSummaryContent | null,
+ summaryId?: string | null | undefined
+ ) => {
+ sessionId: string
+ summary: SessionSummaryContent | null
+ summaryId: string | null
+ } // sessionSummaryProgressLogic
+ startSummarization: (sessionId: string) => {
+ sessionId: string
+ } // sessionSummaryProgressLogic
+ sessionSummaryFeedback: (feedback: 'bad' | 'good') => {
+ feedback: 'bad' | 'good'
+ }
+ setIsPropertyPopoverOpen: (isOpen: boolean) => {
+ isOpen: boolean
+ }
+ setShowFeedbackSurvey: (show: boolean) => {
+ show: boolean
+ }
+ summarizeSession: () => {}
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerMetaLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ sessionSummary: (
+ summaryBySessionId: Record<string, SessionSummaryContent | null>
+ ) => SessionSummaryContent | null
+ sessionSummaryId: (summaryIdBySessionId: Record<string, string | null>) => string | null
+ sessionSummaryLoading: (loadingBySessionId: Record<string, boolean>) => boolean
+ summarizationProgress: (
+ progressBySessionId: Record<string, SummarizationProgress | null>
+ ) => SummarizationProgress | null
+ sessionSummaryError: (errorBySessionId: Record<string, string | null>) => string | null
+ sessionSummaryHasRetried: (
+ retryStateBySessionId: Record<
+ string,
+ {
+ hasRetried: boolean
+ maxStep: number
+ }
+ >
+ ) => boolean
+ summaryHasHadFeedback: (feedbackBySessionId: Record<string, boolean>) => boolean
+ summaryDisabledReason: (
+ allItemsByMiniFilterKey: Record<string, InspectorListItem[]>,
+ sessionPlayerData: SessionPlayerData
+ ) => string | undefined
+ loading: (
+ sessionPlayerMetaData: SessionRecordingType | null,
+ recordingPropertiesById: Record<string, SessionRecordingPropertiesType[]>
+ ) => boolean
+ sessionPerson: (sessionPlayerData: SessionPlayerData) => PersonType | null
+ resolutionDisplay: (
+ resolution: {
+ height: number
+ width: number
+ } | null
+ ) => string
+ scaleDisplay: (scale: number) => string
+ startTime: (sessionPlayerData: SessionPlayerData) => Dayjs | null
+ endTime: (sessionPlayerData: SessionPlayerData) => Dayjs | null
+ snapshotAt: (startTime: Dayjs | null) => any
+ currentWindowIndex: (currentSegment: null | import('@common/replay-shared/src').RecordingSegment) => number
+ lastPageviewEvent: (
+ sessionEventsData: RecordingEventType[] | null,
+ currentPlayerTime: number
+ ) => RecordingEventType | null | undefined
+ allOverviewItems: (
+ sessionPlayerMetaData: SessionRecordingType | null,
+ startTime: Dayjs | null,
+ recordingPropertiesById: Record<string, SessionRecordingPropertiesType[]>,
+ pinnedProperties: string[]
+ ) => OverviewItem[]
+ displayOverviewItems: (allOverviewItems: OverviewItem[], pinnedProperties: string[]) => OverviewItem[]
+ sessionSummarySegmentRanges: (sessionSummary: SessionSummaryContent | null) => SeekbarSegmentRange[] | null
+ }
+}
+
+export type playerMetaLogicType = MakeLogicType<
+ playerMetaLogicValues,
+ playerMetaLogicActions,
+ SessionRecordingPlayerLogicProps,
+ playerMetaLogicMeta
+>
+
export const playerMetaLogic = kea<playerMetaLogicType>([
path((key) => ['scenes', 'session-recordings', 'player', 'playerMetaLogic', key]),
props({} as SessionRecordingPlayerLogicProps),
@@ -202,36 +402,53 @@ export const playerMetaLogic = kea<playerMetaLogicType>([
selectors(({ props }) => ({
sessionSummary: [
(s) => [s.summaryBySessionId],
- (summaryBySessionId): SessionSummaryContent | null => summaryBySessionId[props.sessionRecordingId] ?? null,
+ (summaryBySessionId: Record<string, SessionSummaryContent | null>): SessionSummaryContent | null =>
+ summaryBySessionId[props.sessionRecordingId] ?? null,
],
sessionSummaryId: [
(s) => [s.summaryIdBySessionId],
- (summaryIdBySessionId): string | null => summaryIdBySessionId[props.sessionRecordingId] ?? null,
+ (summaryIdBySessionId: Record<string, string | null>): string | null =>
+ summaryIdBySessionId[props.sessionRecordingId] ?? null,
],
sessionSummaryLoading: [
(s) => [s.loadingBySessionId],
- (loadingBySessionId): boolean => !!loadingBySessionId[props.sessionRecordingId],
+ (loadingBySessionId: Record<string, boolean>): boolean => !!loadingBySessionId[props.sessionRecordingId],
],
summarizationProgress: [
(s) => [s.progressBySessionId],
- (progressBySessionId): SummarizationProgress | null =>
+ (progressBySessionId: Record<string, SummarizationProgress | null>): SummarizationProgress | null =>
progressBySessionId[props.sessionRecordingId] ?? null,
],
sessionSummaryError: [
(s) => [s.errorBySessionId],
- (errorBySessionId): string | null => errorBySessionId[props.sessionRecordingId] ?? null,
+ (errorBySessionId: Record<string, string | null>): string | null =>
+ errorBySessionId[props.sessionRecordingId] ?? null,
],
sessionSummaryHasRetried: [
(s) => [s.retryStateBySessionId],
- (retryStateBySessionId): boolean => !!retryStateBySessionId[props.sessionRecordingId]?.hasRetried,
+ (
+ retryStateBySessionId: Record<
+ string,
+ {
+ hasRetried: boolean
+ maxStep: number
+ }
+ >
+ ): boolean => !!retryStateBySessionId[props.sessionRecordingId]?.hasRetried,
],
summaryHasHadFeedback: [
(s) => [s.feedbackBySessionId],
- (feedbackBySessionId): boolean => !!feedbackBySessionId[props.sessionRecordingId],
+ (feedbackBySessionId: Record<string, boolean>): boolean => !!feedbackBySessionId[props.sessionRecordingId],
],
summaryDisabledReason: [
(s) => [s.allItemsByMiniFilterKey, s.sessionPlayerData],
- (allItemsByMiniFilterKey, sessionPlayerData): string | undefined => {
+ (
+ allItemsByMiniFilterKey: Record<
+ import('../inspector/miniFiltersLogic').MiniFilterKey,
+ import('../inspector/playerInspectorLogic').InspectorListItem[]
+ >,
+ sessionPlayerData: import('~/types').SessionPlayerData
+ ): string | undefined => {
const eventItems = SUMMARY_EVENT_MINI_FILTER_KEYS.flatMap(
(key) => allItemsByMiniFilterKey[key] ?? []
).filter((item): item is InspectorListItemEvent => item.type === 'events')
@@ -245,7 +462,10 @@ export const playerMetaLogic = kea<playerMetaLogicType>([
],
loading: [
(s) => [s.sessionPlayerMetaData, s.recordingPropertiesById],
- (sessionPlayerMetaData, recordingPropertiesById) => {
+ (
+ sessionPlayerMetaData: SessionRecordingType | null,
+ recordingPropertiesById: Record<string, import('~/types').SessionRecordingPropertiesType[]>
+ ) => {
const hasSessionPlayerMetadata = !!sessionPlayerMetaData && !isEmptyObject(sessionPlayerMetaData)
const hasRecordingProperties = !!recordingPropertiesById && !isEmptyObject(recordingPropertiesById)
return !hasSessionPlayerMetadata || !hasRecordingProperties
@@ -253,37 +473,42 @@ export const playerMetaLogic = kea<playerMetaLogicType>([
],
sessionPerson: [
(s) => [s.sessionPlayerData],
- (playerData): PersonType | null => {
+ (playerData: import('~/types').SessionPlayerData): PersonType | null => {
return playerData?.person ?? null
},
],
resolutionDisplay: [
(s) => [s.resolution],
- (resolution) => {
+ (
+ resolution: {
+ height: number
+ width: number
+ } | null
+ ) => {
return `${resolution?.width || '--'} x ${resolution?.height || '--'}`
},
],
scaleDisplay: [
(s) => [s.scale],
- (scale) => {
+ (scale: number) => {
return `${percentage(scale, 1, true)}`
},
],
startTime: [
(s) => [s.sessionPlayerData],
- (sessionPlayerData) => {
+ (sessionPlayerData: import('~/types').SessionPlayerData) => {
return sessionPlayerData.start ?? null
},
],
endTime: [
(s) => [s.sessionPlayerData],
- (sessionPlayerData) => {
+ (sessionPlayerData: import('~/types').SessionPlayerData) => {
return sessionPlayerData.end ?? null
},
],
snapshotAt: [
(s) => [s.startTime],
- (startTime) => {
+ (startTime: Dayjs | null) => {
return startTime
? ((startTime as any).toISOString?.() ??
(typeof startTime === 'string' ? startTime : String(startTime)))
@@ -292,14 +517,14 @@ export const playerMetaLogic = kea<playerMetaLogicType>([
],
currentWindowIndex: [
(s) => [s.currentSegment],
- (currentSegment) => {
+ (currentSegment: null | import('~/types').RecordingSegment) => {
// windowId is already 1-indexed from the registry
return currentSegment?.windowId ?? 1
},
],
lastPageviewEvent: [
(s) => [s.sessionEventsData, s.currentPlayerTime],
- (sessionEventsData, currentPlayerTime) => {
+ (sessionEventsData: import('~/types').RecordingEventType[] | null, currentPlayerTime: number) => {
const playerTimeClosestSecond = ceilMsToClosestSecond(currentPlayerTime ?? 0)
if (!sessionEventsData?.length) {
@@ -446,7 +671,7 @@ export const playerMetaLogic = kea<playerMetaLogicType>([
],
displayOverviewItems: [
(s) => [s.allOverviewItems, s.pinnedProperties],
- (allOverviewItems, pinnedProperties) => {
+ (allOverviewItems: OverviewItem[], pinnedProperties: string[]) => {
// Filter to show only pinned properties and sort by pinned order
const pinnedItems = allOverviewItems.filter((item) => {
const key = item.type === 'property' ? item.property : item.label
diff --git a/frontend/src/scenes/session-recordings/player/player-meta/sessionRecordingExperimentContextLogic.ts b/frontend/src/scenes/session-recordings/player/player-meta/sessionRecordingExperimentContextLogic.ts
index 177b9cc4457f..c39cac6cdeba 100644
--- a/frontend/src/scenes/session-recordings/player/player-meta/sessionRecordingExperimentContextLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/player-meta/sessionRecordingExperimentContextLogic.ts
@@ -1,4 +1,4 @@
-import { afterMount, connect, kea, key, path, props, selectors } from 'kea'
+import { MakeLogicType, afterMount, connect, kea, key, path, props, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { subscriptions } from 'kea-subscriptions'
@@ -12,7 +12,7 @@ import type {
ExperimentSessionContextResponseApi,
} from 'products/experiments/frontend/generated/api.schemas'
-import type { sessionRecordingExperimentContextLogicType } from './sessionRecordingExperimentContextLogicType'
+import type { FeatureFlagsSet } from '../../../../lib/logic/featureFlagLogic'
export interface SessionRecordingExperimentContextLogicProps {
sessionRecordingId: string
@@ -30,6 +30,65 @@ export function experimentSignalRank(item: ExperimentSessionContextItemApi): num
return isControlVariant(item) ? 2 : 1
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingExperimentContextLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ currentProjectId: number | string // teamLogic
+ enrolledCount: number
+ enrolledItems: ExperimentSessionContextItemApi[]
+ experimentContext: ExperimentSessionContextResponseApi | null
+ experimentContextEnabled: boolean
+ experimentContextLoading: boolean
+ experimentItems: ExperimentSessionContextItemApi[]
+ hasExperimentContext: boolean
+ hasMultipleVariantWarning: boolean
+ seenCount: number
+ seenItems: ExperimentSessionContextItemApi[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingExperimentContextLogicActions {
+ loadExperimentContext: () => any
+ loadExperimentContextFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadExperimentContextSuccess: (
+ experimentContext: ExperimentSessionContextResponseApi | null,
+ payload?: any
+ ) => {
+ experimentContext: ExperimentSessionContextResponseApi | null
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingExperimentContextLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ experimentContextEnabled: (featureFlags: FeatureFlagsSet, arg: any) => boolean
+ experimentItems: (
+ experimentContext: ExperimentSessionContextResponseApi | null
+ ) => ExperimentSessionContextItemApi[]
+ seenItems: (experimentItems: ExperimentSessionContextItemApi[]) => ExperimentSessionContextItemApi[]
+ enrolledItems: (experimentItems: ExperimentSessionContextItemApi[]) => ExperimentSessionContextItemApi[]
+ seenCount: (seenItems: ExperimentSessionContextItemApi[]) => number
+ enrolledCount: (enrolledItems: ExperimentSessionContextItemApi[]) => number
+ hasExperimentContext: (experimentItems: ExperimentSessionContextItemApi[]) => boolean
+ hasMultipleVariantWarning: (seenItems: ExperimentSessionContextItemApi[]) => boolean
+ }
+}
+
+export type sessionRecordingExperimentContextLogicType = MakeLogicType<
+ sessionRecordingExperimentContextLogicValues,
+ sessionRecordingExperimentContextLogicActions,
+ SessionRecordingExperimentContextLogicProps,
+ sessionRecordingExperimentContextLogicMeta
+>
+
export const sessionRecordingExperimentContextLogic = kea<sessionRecordingExperimentContextLogicType>([
path((key) => [
'scenes',
@@ -67,12 +126,13 @@ export const sessionRecordingExperimentContextLogic = kea<sessionRecordingExperi
selectors({
experimentContextEnabled: [
(s) => [s.featureFlags, (_, props) => props.sessionRecordingId],
- (featureFlags, sessionRecordingId): boolean =>
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet, sessionRecordingId): boolean =>
!!featureFlags[FEATURE_FLAGS.REPLAY_EXPERIMENT_CONTEXT] && !!sessionRecordingId,
],
experimentItems: [
(s) => [s.experimentContext],
- (experimentContext): ExperimentSessionContextItemApi[] => experimentContext?.results ?? [],
+ (experimentContext: ExperimentSessionContextResponseApi | null): ExperimentSessionContextItemApi[] =>
+ experimentContext?.results ?? [],
],
// Experiments whose flag was evaluated during this recording — these have a moment on the timeline to jump to.
seenItems: [
diff --git a/frontend/src/scenes/session-recordings/player/player-meta/sessionRecordingPinnedPropertiesLogic.ts b/frontend/src/scenes/session-recordings/player/player-meta/sessionRecordingPinnedPropertiesLogic.ts
index 27bc37b3aa14..724af795f7c5 100644
--- a/frontend/src/scenes/session-recordings/player/player-meta/sessionRecordingPinnedPropertiesLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/player-meta/sessionRecordingPinnedPropertiesLogic.ts
@@ -1,9 +1,27 @@
-import { actions, kea, listeners, path, reducers } from 'kea'
-
-import type { sessionRecordingPinnedPropertiesLogicType } from './sessionRecordingPinnedPropertiesLogicType'
+import { MakeLogicType, actions, kea, listeners, path, reducers } from 'kea'
export const HARDCODED_DISPLAY_LABELS = ['Start', 'Duration', 'TTL', 'Clicks', 'Errors', 'Key presses'] as const
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingPinnedPropertiesLogicValues {
+ pinnedProperties: string[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingPinnedPropertiesLogicActions {
+ setPinnedProperties: (properties: string[]) => {
+ properties: string[]
+ }
+ togglePropertyPin: (propertyKey: string) => {
+ propertyKey: string
+ }
+}
+
+export type sessionRecordingPinnedPropertiesLogicType = MakeLogicType<
+ sessionRecordingPinnedPropertiesLogicValues,
+ sessionRecordingPinnedPropertiesLogicActions
+>
+
export const sessionRecordingPinnedPropertiesLogic = kea<sessionRecordingPinnedPropertiesLogicType>([
path(['scenes', 'session-recordings', 'player', 'playerMetaLogic', 'sessionRecordingPinnedPropertiesLogic']),
actions({
diff --git a/frontend/src/scenes/session-recordings/player/player-meta/sessionSummaryProgressLogic.ts b/frontend/src/scenes/session-recordings/player/player-meta/sessionSummaryProgressLogic.ts
index a369cdf31f59..c919c548c46a 100644
--- a/frontend/src/scenes/session-recordings/player/player-meta/sessionSummaryProgressLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/player-meta/sessionSummaryProgressLogic.ts
@@ -1,5 +1,5 @@
import { createParser } from 'eventsource-parser'
-import { actions, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, listeners, path, reducers } from 'kea'
import posthog from 'posthog-js'
import api, { ApiError } from 'lib/api'
@@ -7,7 +7,6 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { SessionRecordingType } from '~/types'
-import type { sessionSummaryProgressLogicType } from './sessionSummaryProgressLogicType'
import { SessionSummaryContent, SummarizationProgress } from './types'
// Give up waiting after 10 minutes. The workflow may still complete later; if
@@ -31,6 +30,80 @@ const abortControllersBySessionId = new Map<string, AbortController>()
// cancel falls back to the default attach-to-existing behavior.
const cancelledSessionIds = new Set<string>()
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionSummaryProgressLogicValues {
+ autoExpandSummary: boolean
+ errorBySessionId: Record<string, string | null>
+ feedbackBySessionId: Record<string, boolean>
+ loadingBySessionId: Record<string, boolean>
+ openBySessionId: Record<string, boolean>
+ progressBySessionId: Record<string, SummarizationProgress | null>
+ retryStateBySessionId: Record<
+ string,
+ {
+ hasRetried: boolean
+ maxStep: number
+ }
+ >
+ summaryBySessionId: Record<string, SessionSummaryContent | null>
+ summaryIdBySessionId: Record<string, string | null>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionSummaryProgressLogicActions {
+ cancelSummarization: (sessionId: SessionRecordingType['id']) => {
+ sessionId: string
+ }
+ markFeedbackGiven: (sessionId: string) => {
+ sessionId: string
+ }
+ setError: (
+ sessionId: string,
+ error: string | null
+ ) => {
+ error: string | null
+ sessionId: string
+ }
+ setLoading: (
+ sessionId: string,
+ loading: boolean
+ ) => {
+ loading: boolean
+ sessionId: string
+ }
+ setProgress: (
+ sessionId: string,
+ progress: SummarizationProgress | null
+ ) => {
+ progress: SummarizationProgress | null
+ sessionId: string
+ }
+ setSummary: (
+ sessionId: string,
+ summary: SessionSummaryContent | null,
+ summaryId?: string | null
+ ) => {
+ sessionId: string
+ summary: SessionSummaryContent | null
+ summaryId: string | null
+ }
+ setSummaryOpen: (
+ sessionId: string,
+ open: boolean
+ ) => {
+ open: boolean
+ sessionId: string
+ }
+ startSummarization: (sessionId: SessionRecordingType['id']) => {
+ sessionId: string
+ }
+}
+
+export type sessionSummaryProgressLogicType = MakeLogicType<
+ sessionSummaryProgressLogicValues,
+ sessionSummaryProgressLogicActions
+>
+
/**
* Singleton store for in-flight session summarization state, keyed by session id.
*
diff --git a/frontend/src/scenes/session-recordings/player/playerSettingsLogic.ts b/frontend/src/scenes/session-recordings/player/playerSettingsLogic.ts
index 726826d83adc..0782746c7ee1 100644
--- a/frontend/src/scenes/session-recordings/player/playerSettingsLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/playerSettingsLogic.ts
@@ -1,12 +1,10 @@
-import { actions, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, listeners, path, reducers, selectors } from 'kea'
import { actionToUrl, router, urlToAction } from 'kea-router'
import { subscriptions } from 'kea-subscriptions'
import posthog from 'posthog-js'
import { AutoplayDirection, SessionRecordingSidebarStacking } from '~/types'
-import type { playerSettingsLogicType } from './playerSettingsLogicType'
-
export enum TimestampFormat {
Relative = 'relative',
UTC = 'utc',
@@ -15,6 +13,90 @@ export enum TimestampFormat {
export type HideViewedRecordingsOptions = 'current-user' | 'any-user' | false
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerSettingsLogicValues {
+ autoplayDirection: AutoplayDirection
+ hideRecordingsMenuLabelFor: (
+ option: HideViewedRecordingsOptions
+ ) => 'Hide all viewed recordings' | 'Hide my viewed recordings' | 'Viewed and unviewed recordings'
+ hideViewedRecordings: HideViewedRecordingsOptions
+ isPlaylistCollapsed: boolean
+ isVerticallyStacked: boolean
+ playerControlsOverlay: boolean
+ playlistOpen: boolean
+ playlistTimestampFormat: TimestampFormat
+ preferredSidebarStacking: SessionRecordingSidebarStacking
+ showFilters: boolean
+ showMetadataFooter: boolean
+ sidebarOpen: boolean
+ skipInactivitySetting: boolean
+ speed: number
+ timestampFormat: TimestampFormat
+ urlOverrideSidebarOpen: boolean | null
+ userPreferenceSidebarOpen: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerSettingsLogicActions {
+ setAutoplayDirection: (autoplayDirection: AutoplayDirection) => {
+ autoplayDirection: AutoplayDirection
+ }
+ setHideViewedRecordings: (hideViewedRecordings: HideViewedRecordingsOptions) => {
+ hideViewedRecordings: HideViewedRecordingsOptions
+ }
+ setPlayerControlsOverlay: (playerControlsOverlay: boolean) => {
+ playerControlsOverlay: boolean
+ }
+ setPlaylistCollapsed: (collapsed: boolean) => {
+ collapsed: boolean
+ }
+ setPlaylistOpen: (open: boolean) => {
+ open: boolean
+ }
+ setPlaylistTimestampFormat: (format: TimestampFormat) => {
+ format: TimestampFormat
+ }
+ setPreferredSidebarStacking: (stacking: SessionRecordingSidebarStacking) => {
+ stacking: SessionRecordingSidebarStacking
+ }
+ setShowFilters: (showFilters: boolean) => {
+ showFilters: boolean
+ }
+ setShowMetadataFooter: (showMetadataFooter: boolean) => {
+ showMetadataFooter: boolean
+ }
+ setSidebarOpen: (open: boolean) => {
+ open: boolean
+ }
+ setSkipInactivitySetting: (skipInactivitySetting: boolean) => {
+ skipInactivitySetting: boolean
+ }
+ setSpeed: (speed: number) => {
+ speed: number
+ }
+ setTimestampFormat: (format: TimestampFormat) => {
+ format: TimestampFormat
+ }
+ setURLOverrideSidebarOpen: (open: boolean) => {
+ open: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerSettingsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ sidebarOpen: (userPreferenceSidebarOpen: boolean, urlOverrideSidebarOpen: boolean | null) => boolean
+ isVerticallyStacked: (preferredSidebarStacking: SessionRecordingSidebarStacking) => boolean
+ }
+}
+
+export type playerSettingsLogicType = MakeLogicType<
+ playerSettingsLogicValues,
+ playerSettingsLogicActions,
+ Record<string, any>,
+ playerSettingsLogicMeta
+>
+
// This logic contains player settings that should persist across players
// If key is not specified, it is global so it does not reset when recordings change in the main recordings page
export const playerSettingsLogic = kea<playerSettingsLogicType>([
@@ -122,7 +204,7 @@ export const playerSettingsLogic = kea<playerSettingsLogicType>([
selectors({
sidebarOpen: [
(s) => [s.userPreferenceSidebarOpen, s.urlOverrideSidebarOpen],
- (userPreferenceSidebarOpen, urlOverrideSidebarOpen): boolean => {
+ (userPreferenceSidebarOpen: boolean, urlOverrideSidebarOpen: boolean | null): boolean => {
if (urlOverrideSidebarOpen !== null) {
return urlOverrideSidebarOpen
}
@@ -131,7 +213,8 @@ export const playerSettingsLogic = kea<playerSettingsLogicType>([
],
isVerticallyStacked: [
(s) => [s.preferredSidebarStacking],
- (preferredSidebarStacking) => preferredSidebarStacking === SessionRecordingSidebarStacking.Vertical,
+ (preferredSidebarStacking: SessionRecordingSidebarStacking) =>
+ preferredSidebarStacking === SessionRecordingSidebarStacking.Vertical,
],
hideRecordingsMenuLabelFor: [
() => [],
diff --git a/frontend/src/scenes/session-recordings/player/playlist-popover/playlistPopoverLogic.ts b/frontend/src/scenes/session-recordings/player/playlist-popover/playlistPopoverLogic.ts
index 1568beace829..8379ba3689f5 100644
--- a/frontend/src/scenes/session-recordings/player/playlist-popover/playlistPopoverLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/playlist-popover/playlistPopoverLogic.ts
@@ -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 { lazyLoaders, loaders } from 'kea-loaders'
import api from 'lib/api'
@@ -14,7 +15,222 @@ import { sessionRecordingEventUsageLogic } from 'scenes/session-recordings/sessi
import { SessionRecordingPlaylistType } from '~/types'
-import type { playlistPopoverLogicType } from './playlistPopoverLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playlistPopoverLogicValues {
+ allPlaylists: {
+ playlist: SessionRecordingPlaylistType
+ selected: boolean
+ }[]
+ currentPlaylists: SessionRecordingPlaylistType[]
+ currentPlaylistsLoading: boolean
+ isNewPlaylistSubmitting: boolean
+ isNewPlaylistValid: boolean
+ modifyingPlaylist: SessionRecordingPlaylistType | null
+ newFormShowing: boolean
+ newPlaylist: {
+ name: string
+ }
+ newPlaylistAllErrors: Record<string, any>
+ newPlaylistChanged: boolean
+ newPlaylistErrors: DeepPartialMap<
+ {
+ name: string
+ },
+ ValidationErrorType
+ >
+ newPlaylistHasErrors: boolean
+ newPlaylistManualErrors: Record<string, any>
+ newPlaylistTouched: boolean
+ newPlaylistTouches: Record<string, boolean>
+ newPlaylistValidationErrors: DeepPartialMap<
+ {
+ name: string
+ },
+ ValidationErrorType
+ >
+ pinnedCount: number
+ playlists: SessionRecordingPlaylistType[]
+ playlistsLoading: boolean
+ searchQuery: string
+ showNewPlaylistErrors: boolean
+ showPlaylistPopover: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playlistPopoverLogicActions {
+ reportRecordingPinnedToList: (pinned: boolean) => {
+ pinned: boolean
+ } // sessionRecordingEventUsageLogic
+ reportRecordingPlaylistCreated: (source: 'duplicate' | 'filters' | 'new' | 'pin') => {
+ source: 'duplicate' | 'filters' | 'new' | 'pin'
+ } // sessionRecordingEventUsageLogic
+ setPause: () => {
+ value: true
+ } // sessionRecordingPlayerLogic
+ addToPlaylist: (playlist: SessionRecordingPlaylistType) => {
+ playlist: SessionRecordingPlaylistType
+ }
+ addToPlaylistFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ addToPlaylistSuccess: (
+ currentPlaylists: SessionRecordingPlaylistType[],
+ payload?: {
+ playlist: SessionRecordingPlaylistType
+ }
+ ) => {
+ currentPlaylists: SessionRecordingPlaylistType[]
+ payload?: {
+ playlist: SessionRecordingPlaylistType
+ }
+ }
+ loadPlaylists: () => {
+ value: true
+ }
+ loadPlaylistsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPlaylistsForRecording: () => {
+ value: true
+ }
+ loadPlaylistsForRecordingFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPlaylistsForRecordingSuccess: (
+ currentPlaylists: SessionRecordingPlaylistType[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ currentPlaylists: SessionRecordingPlaylistType[]
+ payload?: {
+ value: true
+ }
+ }
+ loadPlaylistsSuccess: (
+ playlists: SessionRecordingPlaylistType[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ playlists: SessionRecordingPlaylistType[]
+ payload?: {
+ value: true
+ }
+ }
+ removeFromPlaylist: (playlist: SessionRecordingPlaylistType) => {
+ playlist: SessionRecordingPlaylistType
+ }
+ removeFromPlaylistFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ removeFromPlaylistSuccess: (
+ currentPlaylists: SessionRecordingPlaylistType[],
+ payload?: {
+ playlist: SessionRecordingPlaylistType
+ }
+ ) => {
+ currentPlaylists: SessionRecordingPlaylistType[]
+ payload?: {
+ playlist: SessionRecordingPlaylistType
+ }
+ }
+ resetNewPlaylist: (values?: { name: string }) => {
+ values?: {
+ name: string
+ }
+ }
+ setNewFormShowing: (show: boolean) => {
+ show: boolean
+ }
+ setNewPlaylistManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setNewPlaylistValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setNewPlaylistValues: (
+ values: DeepPartial<{
+ name: string
+ }>
+ ) => {
+ values: DeepPartial<{
+ name: string
+ }>
+ }
+ setSearchQuery: (query: string) => {
+ query: string
+ }
+ setShowPlaylistPopover: (show: boolean) => {
+ show: boolean
+ }
+ submitNewPlaylist: () => {
+ value: boolean
+ }
+ submitNewPlaylistFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitNewPlaylistRequest: (newPlaylist: { name: string }) => {
+ newPlaylist: {
+ name: string
+ }
+ }
+ submitNewPlaylistSuccess: (newPlaylist: { name: string }) => {
+ newPlaylist: {
+ name: string
+ }
+ }
+ touchNewPlaylistField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playlistPopoverLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ allPlaylists: (
+ playlists: SessionRecordingPlaylistType[],
+ currentPlaylists: SessionRecordingPlaylistType[],
+ searchQuery: string
+ ) => {
+ playlist: SessionRecordingPlaylistType
+ selected: boolean
+ }[]
+ pinnedCount: (currentPlaylists: SessionRecordingPlaylistType[]) => number
+ }
+}
+
+export type playlistPopoverLogicType = MakeLogicType<
+ playlistPopoverLogicValues,
+ playlistPopoverLogicActions,
+ SessionRecordingPlayerLogicProps,
+ playlistPopoverLogicMeta
+>
export const playlistPopoverLogic = kea<playlistPopoverLogicType>([
path((key) => ['scenes', 'session-recordings', 'player', 'playlist-popover', 'playlistPopoverLogic', key]),
@@ -148,7 +364,11 @@ export const playlistPopoverLogic = kea<playlistPopoverLogicType>([
selectors(() => ({
allPlaylists: [
(s) => [s.playlists, s.currentPlaylists, s.searchQuery],
- (playlists, currentPlaylists, searchQuery) => {
+ (
+ playlists: SessionRecordingPlaylistType[],
+ currentPlaylists: SessionRecordingPlaylistType[],
+ searchQuery: string
+ ) => {
const nonSyntheticPlaylists = playlists.filter((x) => !x.is_synthetic)
const nonSyntheticCurrentPlaylists = currentPlaylists.filter((x) => !x.is_synthetic)
@@ -179,7 +399,8 @@ export const playlistPopoverLogic = kea<playlistPopoverLogicType>([
],
pinnedCount: [
(s) => [s.currentPlaylists],
- (currentPlaylists) => currentPlaylists.filter((x) => !x.is_synthetic).length,
+ (currentPlaylists: SessionRecordingPlaylistType[]) =>
+ currentPlaylists.filter((x) => !x.is_synthetic).length,
],
})),
diff --git a/frontend/src/scenes/session-recordings/player/sessionEventsDataLogic.ts b/frontend/src/scenes/session-recordings/player/sessionEventsDataLogic.ts
index 49ea838cfa5f..62ecb162cd11 100644
--- a/frontend/src/scenes/session-recordings/player/sessionEventsDataLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/sessionEventsDataLogic.ts
@@ -1,5 +1,17 @@
import { deepEqual as equal } from 'fast-equals'
-import { actions, beforeUnmount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ beforeUnmount,
+ connect,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ reducers,
+ selectors,
+} from 'kea'
import { loaders } from 'kea-loaders'
import { subscriptions } from 'kea-subscriptions'
import posthog from 'posthog-js'
@@ -16,12 +28,129 @@ import { primaryEventPropertiesModel } from '~/models/primaryEventPropertiesMode
import { HogQLQueryString, hogql } from '~/queries/utils'
import { RecordingEventType } from '~/types'
-import type { sessionEventsDataLogicType } from './sessionEventsDataLogicType'
+import type { SessionRecordingType } from '../../../types'
import { SessionRecordingMetaLogicProps, sessionRecordingMetaLogic } from './sessionRecordingMetaLogic'
const TWENTY_FOUR_HOURS_IN_MS = 24 * 60 * 60 * 1000 // +- before and after start and end of a recording to query for session linked events.
const FIVE_MINUTES_IN_MS = 5 * 60 * 1000 // +- before and after start and end of a recording to query for events related by person.
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionEventsDataLogicValues {
+ sessionPlayerMetaData: SessionRecordingType | null // metaLogic
+ primaryProperties: Record<string, string> // primaryEventPropertiesModel
+ AIEvents: RecordingEventType[]
+ eventViewportsItems: TimeTree<{
+ payload: ViewportResolution
+ timestamp: Dayjs
+ }>
+ eventsWithPrimaryProperty: RecordingEventType[]
+ exceptionEvents: RecordingEventType[]
+ preloadableEvents: RecordingEventType[]
+ sessionEventsData: RecordingEventType[] | null
+ sessionEventsDataLoading: boolean
+ viewportForTimestamp: (timestamp: number) => ViewportResolution | undefined
+ webVitalsEvents: RecordingEventType[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionEventsDataLogicActions {
+ loadRecordingMetaSuccess: (
+ sessionPlayerMetaData: SessionRecordingType | null,
+ payload?:
+ | {
+ value: true
+ }
+ | undefined
+ ) => {
+ payload?: {
+ value: true
+ }
+ sessionPlayerMetaData: SessionRecordingType | null
+ } // metaLogic
+ ensureLoadedForEvents: (eventNames: string[]) => {
+ eventNames: string[]
+ } // primaryEventPropertiesModel
+ loadEvents: () => {
+ value: true
+ }
+ loadEventsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadEventsSuccess: (
+ sessionEventsData: RecordingEventType[] | null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ sessionEventsData: RecordingEventType[] | null
+ payload?: {
+ value: true
+ }
+ }
+ loadFullEventData: (event: RecordingEventType | RecordingEventType[]) => {
+ event: RecordingEventType | RecordingEventType[]
+ }
+ loadFullEventDataFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadFullEventDataSuccess: (
+ sessionEventsData: RecordingEventType[] | null,
+ payload?: {
+ event: RecordingEventType | RecordingEventType[]
+ }
+ ) => {
+ sessionEventsData: RecordingEventType[] | null
+ payload?: {
+ event: RecordingEventType | RecordingEventType[]
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionEventsDataLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ webVitalsEvents: (sessionEventsData: RecordingEventType[] | null) => RecordingEventType[]
+ AIEvents: (sessionEventsData: RecordingEventType[] | null) => RecordingEventType[]
+ exceptionEvents: (sessionEventsData: RecordingEventType[] | null) => RecordingEventType[]
+ eventsWithPrimaryProperty: (
+ sessionEventsData: RecordingEventType[] | null,
+ primaryProperties: Record<string, string>
+ ) => RecordingEventType[]
+ preloadableEvents: (
+ webVitalsEvents: RecordingEventType[],
+ AIEvents: RecordingEventType[],
+ exceptionEvents: RecordingEventType[],
+ eventsWithPrimaryProperty: RecordingEventType[]
+ ) => RecordingEventType[]
+ eventViewportsItems: (sessionEventsData: RecordingEventType[] | null) => TimeTree<{
+ payload: ViewportResolution
+ timestamp: Dayjs
+ }>
+ viewportForTimestamp: (
+ eventViewportsItems: TimeTree<{
+ payload: ViewportResolution
+ timestamp: Dayjs
+ }>
+ ) => (timestamp: number) => ViewportResolution | undefined
+ }
+}
+
+export type sessionEventsDataLogicType = MakeLogicType<
+ sessionEventsDataLogicValues,
+ sessionEventsDataLogicActions,
+ SessionRecordingMetaLogicProps,
+ sessionEventsDataLogicMeta
+>
+
export const sessionEventsDataLogic = kea<sessionEventsDataLogicType>([
path((key) => ['scenes', 'session-recordings', 'sessionEventsDataLogic', key]),
props({} as SessionRecordingMetaLogicProps),
@@ -234,28 +363,35 @@ AND properties.$lib != 'web'`
selectors(() => ({
webVitalsEvents: [
(s) => [s.sessionEventsData],
- (sessionEventsData): RecordingEventType[] =>
+ (sessionEventsData: RecordingEventType[] | null): RecordingEventType[] =>
(sessionEventsData || []).filter((e) => e.event === '$web_vitals'),
],
AIEvents: [
(s) => [s.sessionEventsData],
- (sessionEventsData): RecordingEventType[] =>
+ (sessionEventsData: RecordingEventType[] | null): RecordingEventType[] =>
// see if event start with $ai_
(sessionEventsData || []).filter((e) => e.event.startsWith('$ai_')),
],
exceptionEvents: [
(s) => [s.sessionEventsData],
- (sessionEventsData): RecordingEventType[] =>
+ (sessionEventsData: RecordingEventType[] | null): RecordingEventType[] =>
(sessionEventsData || []).filter((e) => e.event === '$exception'),
],
eventsWithPrimaryProperty: [
(s) => [s.sessionEventsData, s.primaryProperties],
- (sessionEventsData, primaryProperties): RecordingEventType[] =>
- getEventsWithPrimaryProperty(sessionEventsData || [], primaryProperties),
+ (
+ sessionEventsData: RecordingEventType[] | null,
+ primaryProperties: Record<string, string>
+ ): RecordingEventType[] => getEventsWithPrimaryProperty(sessionEventsData || [], primaryProperties),
],
preloadableEvents: [
(s) => [s.webVitalsEvents, s.AIEvents, s.exceptionEvents, s.eventsWithPrimaryProperty],
- (webVitalsEvents, AIEvents, exceptionEvents, eventsWithPrimaryProperty): RecordingEventType[] => {
+ (
+ webVitalsEvents: RecordingEventType[],
+ AIEvents: RecordingEventType[],
+ exceptionEvents: RecordingEventType[],
+ eventsWithPrimaryProperty: RecordingEventType[]
+ ): RecordingEventType[] => {
const seen = new Set<string>()
const merged: RecordingEventType[] = []
for (const e of [...webVitalsEvents, ...AIEvents, ...exceptionEvents, ...eventsWithPrimaryProperty]) {
@@ -271,7 +407,7 @@ AND properties.$lib != 'web'`
eventViewportsItems: [
(s) => [s.sessionEventsData],
(
- sessionEventsData
+ sessionEventsData: RecordingEventType[] | null
): TimeTree<{
timestamp: Dayjs
payload: ViewportResolution
@@ -298,7 +434,12 @@ AND properties.$lib != 'web'`
],
viewportForTimestamp: [
(s) => [s.eventViewportsItems],
- (eventViewportsItems) => {
+ (
+ eventViewportsItems: TimeTree<{
+ payload: ViewportResolution
+ timestamp: Dayjs
+ }>
+ ) => {
return (timestamp: number) => {
const closestItem =
eventViewportsItems.next(dayjs(timestamp)) || eventViewportsItems.previous(dayjs(timestamp))
diff --git a/frontend/src/scenes/session-recordings/player/sessionRecordingCommentsLogic.ts b/frontend/src/scenes/session-recordings/player/sessionRecordingCommentsLogic.ts
index a5071cb87859..1f5403313cfd 100644
--- a/frontend/src/scenes/session-recordings/player/sessionRecordingCommentsLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/sessionRecordingCommentsLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, key, listeners, path, props } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props } from 'kea'
import { loaders } from 'kea-loaders'
import posthog from 'posthog-js'
@@ -9,13 +9,107 @@ import { RecordingComment } from 'scenes/session-recordings/player/inspector/pla
import { CommentType, SessionRecordingId } from '~/types'
-import type { sessionRecordingCommentsLogicType } from './sessionRecordingCommentsLogicType'
+import type { SessionRecordingType } from '../../../types'
import { SessionRecordingMetaLogicProps, sessionRecordingMetaLogic } from './sessionRecordingMetaLogic'
export interface SessionRecordingCommentsLogicProps {
sessionRecordingId: SessionRecordingId
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingCommentsLogicValues {
+ sessionComments: CommentType[]
+ sessionCommentsLoading: boolean
+ sessionNotebookComments: any
+ sessionNotebookCommentsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingCommentsLogicActions {
+ loadRecordingMetaSuccess: (
+ sessionPlayerMetaData: SessionRecordingType | null,
+ payload?:
+ | {
+ value: true
+ }
+ | undefined
+ ) => {
+ payload?: {
+ value: true
+ }
+ sessionPlayerMetaData: SessionRecordingType | null
+ } // metaLogic
+ deleteComment: (id: any) => any
+ deleteCommentFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deleteCommentSuccess: (
+ sessionComments: CommentType[],
+ payload?: any
+ ) => {
+ sessionComments: CommentType[]
+ payload?: any
+ }
+ loadRecordingComments: () => {
+ value: true
+ }
+ loadRecordingCommentsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRecordingCommentsSuccess: (
+ sessionComments: CommentType[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ sessionComments: CommentType[]
+ payload?: {
+ value: true
+ }
+ }
+ loadRecordingNotebookComments: () => {
+ value: true
+ }
+ loadRecordingNotebookCommentsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRecordingNotebookCommentsSuccess: (
+ sessionNotebookComments: RecordingComment[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ sessionNotebookComments: RecordingComment[]
+ payload?: {
+ value: true
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingCommentsLogicMeta {
+ key: string
+}
+
+export type sessionRecordingCommentsLogicType = MakeLogicType<
+ sessionRecordingCommentsLogicValues,
+ sessionRecordingCommentsLogicActions,
+ SessionRecordingCommentsLogicProps,
+ sessionRecordingCommentsLogicMeta
+>
+
export const sessionRecordingCommentsLogic = kea<sessionRecordingCommentsLogicType>([
path((key) => ['scenes', 'session-recordings', 'sessionRecordingCommentsLogic', key]),
props({} as SessionRecordingCommentsLogicProps),
diff --git a/frontend/src/scenes/session-recordings/player/sessionRecordingDataCoordinatorLogic.ts b/frontend/src/scenes/session-recordings/player/sessionRecordingDataCoordinatorLogic.ts
index 7cd5f53c8b77..ac5d78c65279 100644
--- a/frontend/src/scenes/session-recordings/player/sessionRecordingDataCoordinatorLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/sessionRecordingDataCoordinatorLogic.ts
@@ -1,5 +1,17 @@
import { deepEqual as equal } from 'fast-equals'
-import { actions, beforeUnmount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ beforeUnmount,
+ connect,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ reducers,
+ selectors,
+} from 'kea'
import { subscriptions } from 'kea-subscriptions'
import posthog from 'posthog-js'
import { EventType, customEvent, eventWithTime } from 'posthog-js/rrweb-types'
@@ -26,11 +38,19 @@ import {
TeamType,
} from '~/types'
+import type { ViewportResolution } from '../../../../../common/replay-shared/src/index'
+import type {
+ AnnotationType,
+ CommentType,
+ PersonType,
+ RecordingEventType,
+ SessionRecordingSnapshotSource,
+} from '../../../types'
import { ExportedSessionRecordingFileV2 } from '../file-playback/types'
import { sessionRecordingEventUsageLogic } from '../sessionRecordingEventUsageLogic'
+import type { RecordingComment } from './inspector/playerInspectorLogic'
import { sessionEventsDataLogic } from './sessionEventsDataLogic'
import { sessionRecordingCommentsLogic } from './sessionRecordingCommentsLogic'
-import type { sessionRecordingDataCoordinatorLogicType } from './sessionRecordingDataCoordinatorLogicType'
import { sessionRecordingMetaLogic } from './sessionRecordingMetaLogic'
import { posthogTelemetry } from './snapshot-processing/process-all-snapshots'
import { snapshotDataLogic } from './snapshotDataLogic'
@@ -56,6 +76,329 @@ export function isWithinIngestionGracePeriod(start: Dayjs | null): boolean {
return start != null && now().diff(start, 'minute') <= INGESTION_GRACE_PERIOD_MINUTES
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingDataCoordinatorLogicValues {
+ sessionComments: CommentType[] // commentsLogic
+ sessionCommentsLoading: boolean // commentsLogic
+ sessionNotebookComments: any // commentsLogic
+ sessionNotebookCommentsLoading: boolean // commentsLogic
+ AIEvents: RecordingEventType[] // eventsLogic
+ sessionEventsData: RecordingEventType[] | null // eventsLogic
+ sessionEventsDataLoading: boolean // eventsLogic
+ viewportForTimestamp: (timestamp: number) => ViewportResolution | undefined // eventsLogic
+ webVitalsEvents: RecordingEventType[] // eventsLogic
+ annotations: AnnotationType[] // metaLogic
+ annotationsLoading: boolean // metaLogic
+ currentTeam: TeamPublicType | TeamType | null // metaLogic
+ getWindowId: (uuid: string | undefined) => number | undefined // metaLogic
+ isLoadingSnapshots: boolean // metaLogic
+ isNotFound: boolean // metaLogic
+ isRecordingDeleted: boolean // metaLogic
+ loadMetaError: boolean // metaLogic
+ recordingDeletedAt: number | null // metaLogic
+ recordingDeletedBy: string | null // metaLogic
+ sessionPlayerMetaData: SessionRecordingType | null // metaLogic
+ sessionPlayerMetaDataLoading: boolean // metaLogic
+ snapshotSources: SessionRecordingSnapshotSource[] | null // metaLogic
+ snapshotsLoaded: boolean // metaLogic
+ snapshotsLoading: boolean // metaLogic
+ trackedWindow: number | null // metaLogic
+ uuidToIndex: Record<string, number> // metaLogic
+ snapshotStore: SnapshotStore // snapLogic
+ sourceLoadingStates: SourceLoadingState[] // snapLogic
+ storeVersion: number // snapLogic
+ bufferedToTime: number | null
+ createExportJSON: () => ExportedSessionRecordingFileV2
+ customRRWebEvents: customEvent[]
+ durationMs: number
+ effectiveSourceLoadingStates: SourceLoadingState[]
+ end: Dayjs | null
+ fullyLoaded: boolean
+ isOldAndInvalid: boolean
+ isRecentAndInvalid: boolean
+ processedSnapshots: RecordingSnapshot[]
+ reportedLoaded: boolean
+ segments: RecordingSegment[]
+ sessionPlayerData: SessionPlayerData
+ snapshots: RecordingSnapshot[]
+ snapshotsByWindowId: Record<number, eventWithTime[]>
+ snapshotsInvalid: boolean
+ start: Dayjs | null
+ urls: {
+ timestamp: number
+ url: string
+ }[]
+ windowIdForTimestamp: (timestamp: number) => number | undefined
+ windowIds: number[]
+ windowsHaveFullSnapshot: Record<string, boolean>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingDataCoordinatorLogicActions {
+ loadRecordingComments: () => {
+ value: true
+ } // commentsLogic
+ loadRecordingCommentsSuccess: (
+ sessionComments: CommentType[],
+ payload?:
+ | {
+ value: true
+ }
+ | undefined
+ ) => {
+ payload?: {
+ value: true
+ }
+ sessionComments: CommentType[]
+ } // commentsLogic
+ loadRecordingNotebookComments: () => {
+ value: true
+ } // commentsLogic
+ loadRecordingNotebookCommentsSuccess: (
+ sessionNotebookComments: RecordingComment[],
+ payload?:
+ | {
+ value: true
+ }
+ | undefined
+ ) => {
+ payload?: {
+ value: true
+ }
+ sessionNotebookComments: RecordingComment[]
+ } // commentsLogic
+ loadEvents: () => {
+ value: true
+ } // eventsLogic
+ loadEventsSuccess: (
+ sessionEventsData: RecordingEventType[] | null,
+ payload?:
+ | {
+ value: true
+ }
+ | undefined
+ ) => {
+ payload?: {
+ value: true
+ }
+ sessionEventsData: RecordingEventType[] | null
+ } // eventsLogic
+ loadFullEventData: (event: RecordingEventType | RecordingEventType[]) => {
+ event: RecordingEventType | RecordingEventType[]
+ } // eventsLogic
+ loadFullEventDataSuccess: (
+ sessionEventsData: RecordingEventType[] | null,
+ payload?:
+ | {
+ event: RecordingEventType | RecordingEventType[]
+ }
+ | undefined
+ ) => {
+ payload?: {
+ event: RecordingEventType | RecordingEventType[]
+ }
+ sessionEventsData: RecordingEventType[] | null
+ } // eventsLogic
+ loadRecordingFromFile: (recording: {
+ id: SessionRecordingType['id']
+ person: SessionRecordingType['person']
+ snapshots: RecordingSnapshot[]
+ }) => {
+ recording: {
+ id: string
+ person: PersonType | undefined
+ snapshots: RecordingSnapshot[]
+ }
+ } // metaLogic
+ loadRecordingMeta: () => {
+ value: true
+ } // metaLogic
+ loadRecordingMetaFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ } // metaLogic
+ loadRecordingMetaSuccess: (
+ sessionPlayerMetaData: SessionRecordingType | null,
+ payload?:
+ | {
+ value: true
+ }
+ | undefined
+ ) => {
+ payload?: {
+ value: true
+ }
+ sessionPlayerMetaData: SessionRecordingType | null
+ } // metaLogic
+ loadSnapshotSources: (breakpointLength?: number | undefined) => {
+ breakpointLength: number | undefined
+ } // metaLogic
+ loadSnapshots: () => {
+ value: true
+ } // metaLogic
+ loadSnapshotsForSourceSuccess: (
+ snapshotsForSource:
+ | {
+ source: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>
+ sources?: undefined
+ }
+ | {
+ source?: undefined
+ sources: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>[]
+ },
+ payload?:
+ | {
+ sources: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>[]
+ }
+ | undefined
+ ) => {
+ payload?: {
+ sources: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>[]
+ }
+ snapshotsForSource:
+ | {
+ source: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>
+ sources?: undefined
+ }
+ | {
+ source?: undefined
+ sources: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>[]
+ }
+ } // metaLogic
+ maybeLoadRecordingMeta: () => {
+ value: true
+ } // metaLogic
+ registerWindowId: (uuid: string) => {
+ uuid: string
+ } // metaLogic
+ setSnapshots: (snapshots: import('@posthog/replay-shared').RecordingSnapshot[]) => {
+ snapshots: RecordingSnapshot[]
+ } // metaLogic
+ setTrackedWindow: (windowId: number | null) => {
+ windowId: number | null
+ } // metaLogic
+ reportRecordingLoaded: (
+ playerData: SessionPlayerData,
+ metadata: SessionRecordingType | null
+ ) => {
+ metadata: SessionRecordingType | null
+ playerData: SessionPlayerData
+ } // sessionRecordingEventUsageLogic
+ storeUpdated: () => {
+ value: true
+ } // snapLogic
+ loadRecordingData: () => {
+ value: true
+ }
+ processSnapshotsAsync: () => {
+ value: true
+ }
+ reportUsageIfFullyLoaded: () => {
+ value: true
+ }
+ setProcessedSnapshots: (snapshots: RecordingSnapshot[]) => {
+ snapshots: RecordingSnapshot[]
+ }
+ setRecordingReportedLoaded: () => {
+ value: true
+ }
+ snapshotProcessingFailed: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingDataCoordinatorLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ snapshots: (processedSnapshots: import('@posthog/replay-shared').RecordingSnapshot[]) => RecordingSnapshot[]
+ start: (
+ snapshots: import('@posthog/replay-shared').RecordingSnapshot[],
+ sessionPlayerMetaData: SessionRecordingType | null
+ ) => Dayjs | null
+ end: (
+ snapshots: import('@posthog/replay-shared').RecordingSnapshot[],
+ sessionPlayerMetaData: SessionRecordingType | null
+ ) => Dayjs | null
+ durationMs: (
+ start: Dayjs | null,
+ end: Dayjs | null,
+ sessionPlayerMetaData: SessionRecordingType | null,
+ fullyLoaded: boolean
+ ) => number
+ segments: (
+ snapshots: import('@posthog/replay-shared').RecordingSnapshot[],
+ start: Dayjs | null,
+ end: Dayjs | null,
+ trackedWindow: number | null,
+ snapshotsByWindowId: Record<number, eventWithTime[]>,
+ snapshotStore: SnapshotStore,
+ storeVersion: number
+ ) => RecordingSegment[]
+ snapshotsByWindowId: (
+ snapshots: import('@posthog/replay-shared').RecordingSnapshot[]
+ ) => Record<number, eventWithTime[]>
+ bufferedToTime: (segments: import('@posthog/replay-shared').RecordingSegment[]) => number | null
+ windowIdForTimestamp: (
+ segments: import('@posthog/replay-shared').RecordingSegment[]
+ ) => (timestamp: number) => number | undefined
+ urls: (snapshots: import('@posthog/replay-shared').RecordingSnapshot[]) => {
+ timestamp: number
+ url: string
+ }[]
+ windowsHaveFullSnapshot: (snapshotsByWindowId: Record<number, eventWithTime[]>) => Record<string, boolean>
+ snapshotsInvalid: (
+ windowsHaveFullSnapshot: Record<string, boolean>,
+ fullyLoaded: boolean,
+ start: Dayjs | null,
+ sessionRecordingId: string,
+ currentTeam: TeamPublicType | TeamType | null
+ ) => boolean
+ isRecentAndInvalid: (start: Dayjs | null, snapshotsInvalid: boolean) => boolean
+ isOldAndInvalid: (snapshotsInvalid: boolean, isRecentAndInvalid: boolean) => boolean
+ windowIds: (snapshotsByWindowId: Record<number, eventWithTime[]>) => number[]
+ createExportJSON: (
+ sessionPlayerMetaData: SessionRecordingType | null,
+ snapshots: import('@posthog/replay-shared').RecordingSnapshot[]
+ ) => () => ExportedSessionRecordingFileV2
+ customRRWebEvents: (snapshots: import('@posthog/replay-shared').RecordingSnapshot[]) => customEvent[]
+ effectiveSourceLoadingStates: (
+ sourceLoadingStates: SourceLoadingState[],
+ segments: import('@posthog/replay-shared').RecordingSegment[]
+ ) => SourceLoadingState[]
+ fullyLoaded: (
+ snapshots: import('@posthog/replay-shared').RecordingSnapshot[],
+ segments: import('@posthog/replay-shared').RecordingSegment[],
+ sessionPlayerMetaDataLoading: boolean,
+ snapshotsLoading: boolean,
+ sessionEventsDataLoading: boolean,
+ sessionCommentsLoading: boolean,
+ sessionNotebookCommentsLoading: boolean
+ ) => boolean
+ sessionPlayerData: (
+ sessionPlayerMetaData: SessionRecordingType | null,
+ snapshotsByWindowId: Record<number, eventWithTime[]>,
+ segments: import('@posthog/replay-shared').RecordingSegment[],
+ bufferedToTime: number | null,
+ start: Dayjs | null,
+ end: Dayjs | null,
+ durationMs: number,
+ fullyLoaded: boolean,
+ sessionRecordingId: string
+ ) => SessionPlayerData
+ }
+}
+
+export type sessionRecordingDataCoordinatorLogicType = MakeLogicType<
+ sessionRecordingDataCoordinatorLogicValues,
+ sessionRecordingDataCoordinatorLogicActions,
+ SessionRecordingDataCoordinatorLogicProps,
+ sessionRecordingDataCoordinatorLogicMeta
+>
+
export const sessionRecordingDataCoordinatorLogic = kea<sessionRecordingDataCoordinatorLogicType>([
path((key) => ['scenes', 'session-recordings', 'sessionRecordingDataCoordinatorLogic', key]),
props({} as SessionRecordingDataCoordinatorLogicProps),
@@ -325,7 +668,7 @@ export const sessionRecordingDataCoordinatorLogic = kea<sessionRecordingDataCoor
start: [
(s) => [s.snapshots, s.sessionPlayerMetaData],
- (snapshots, meta): Dayjs | null => {
+ (snapshots: RecordingSnapshot[], meta: SessionRecordingType | null): Dayjs | null => {
const firstSnapshot = snapshots[0] || null
const eventStart = meta?.start_time ? dayjs(meta.start_time) : null
const snapshotStart = firstSnapshot ? dayjs(firstSnapshot.timestamp) : null
@@ -339,7 +682,7 @@ export const sessionRecordingDataCoordinatorLogic = kea<sessionRecordingDataCoor
end: [
(s) => [s.snapshots, s.sessionPlayerMetaData],
- (snapshots, meta): Dayjs | null => {
+ (snapshots: RecordingSnapshot[], meta: SessionRecordingType | null): Dayjs | null => {
const lastSnapshot = snapshots[snapshots.length - 1] || null
const eventEnd = meta?.end_time ? dayjs(meta.end_time) : null
const snapshotEnd = lastSnapshot ? dayjs(lastSnapshot.timestamp) : null
@@ -353,7 +696,12 @@ export const sessionRecordingDataCoordinatorLogic = kea<sessionRecordingDataCoor
durationMs: [
(s) => [s.start, s.end, s.sessionPlayerMetaData, s.fullyLoaded],
- (start, end, meta: SessionRecordingType | null, fullyLoaded: boolean): number => {
+ (
+ start: Dayjs | null,
+ end: Dayjs | null,
+ meta: SessionRecordingType | null,
+ fullyLoaded: boolean
+ ): number => {
if (!start || !end) {
return 0
}
@@ -398,7 +746,7 @@ export const sessionRecordingDataCoordinatorLogic = kea<sessionRecordingDataCoor
bufferedToTime: [
(s) => [s.segments],
- (segments): number | null => {
+ (segments: RecordingSegment[]): number | null => {
if (!segments.length) {
return null
}
@@ -416,7 +764,7 @@ export const sessionRecordingDataCoordinatorLogic = kea<sessionRecordingDataCoor
windowIdForTimestamp: [
(s) => [s.segments],
- (segments) => {
+ (segments: RecordingSegment[]) => {
// memoized per segments recompute — segments reshape as data loads, so a logic-lifetime cache would pin stale window attributions
const memo: Record<number, number | undefined> = {}
return (timestamp: number): number | undefined => {
@@ -435,7 +783,7 @@ export const sessionRecordingDataCoordinatorLogic = kea<sessionRecordingDataCoor
urls: [
(s) => [s.snapshots],
- (snapshots): { url: string; timestamp: number }[] => {
+ (snapshots: RecordingSnapshot[]): { url: string; timestamp: number }[] => {
return (
snapshots
.filter((snapshot) => getHrefFromSnapshot(snapshot))
@@ -508,7 +856,7 @@ export const sessionRecordingDataCoordinatorLogic = kea<sessionRecordingDataCoor
isRecentAndInvalid: [
(s) => [s.start, s.snapshotsInvalid],
- (start, snapshotsInvalid) => {
+ (start: Dayjs | null, snapshotsInvalid: boolean) => {
return snapshotsInvalid && isWithinIngestionGracePeriod(start)
},
],
@@ -517,7 +865,7 @@ export const sessionRecordingDataCoordinatorLogic = kea<sessionRecordingDataCoor
// e.g. the browser closed or went offline before the recording finished uploading
isOldAndInvalid: [
(s) => [s.snapshotsInvalid, s.isRecentAndInvalid],
- (snapshotsInvalid, isRecentAndInvalid) => snapshotsInvalid && !isRecentAndInvalid,
+ (snapshotsInvalid: boolean, isRecentAndInvalid: boolean) => snapshotsInvalid && !isRecentAndInvalid,
],
windowIds: [
@@ -529,7 +877,10 @@ export const sessionRecordingDataCoordinatorLogic = kea<sessionRecordingDataCoor
createExportJSON: [
(s) => [s.sessionPlayerMetaData, s.snapshots],
- (sessionPlayerMetaData, snapshots): (() => ExportedSessionRecordingFileV2) => {
+ (
+ sessionPlayerMetaData: SessionRecordingType | null,
+ snapshots: RecordingSnapshot[]
+ ): (() => ExportedSessionRecordingFileV2) => {
return (): ExportedSessionRecordingFileV2 => {
return {
version: '2023-04-28',
@@ -545,7 +896,7 @@ export const sessionRecordingDataCoordinatorLogic = kea<sessionRecordingDataCoor
customRRWebEvents: [
(s) => [s.snapshots],
- (snapshots): customEvent[] => {
+ (snapshots: RecordingSnapshot[]): customEvent[] => {
return snapshots.filter((snapshot) => snapshot.type === EventType.Custom).map((x) => x as customEvent)
},
],
@@ -578,13 +929,13 @@ export const sessionRecordingDataCoordinatorLogic = kea<sessionRecordingDataCoor
s.sessionNotebookCommentsLoading,
],
(
- snapshots,
- segments,
- sessionPlayerMetaDataLoading,
- snapshotsLoading,
- sessionEventsDataLoading,
- sessionCommentsLoading,
- sessionNotebookCommentsLoading
+ snapshots: RecordingSnapshot[],
+ segments: RecordingSegment[],
+ sessionPlayerMetaDataLoading: boolean,
+ snapshotsLoading: boolean,
+ sessionEventsDataLoading: boolean,
+ sessionCommentsLoading: boolean,
+ sessionNotebookCommentsLoading: boolean
): boolean => {
// Check if there's a buffer segment (unloaded data)
const hasBufferSegment = segments.some((segment) => segment.kind === 'buffer')
diff --git a/frontend/src/scenes/session-recordings/player/sessionRecordingMetaLogic.ts b/frontend/src/scenes/session-recordings/player/sessionRecordingMetaLogic.ts
index 19cd07284a13..b4b2e6e1efe6 100644
--- a/frontend/src/scenes/session-recordings/player/sessionRecordingMetaLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/sessionRecordingMetaLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, defaults, kea, key, listeners, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, connect, defaults, kea, key, listeners, path, props, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import api, { ApiError } from 'lib/api'
@@ -10,8 +10,15 @@ import { teamLogic } from 'scenes/teamLogic'
import { annotationsModel } from '~/models/annotationsModel'
import { SessionRecordingId, SessionRecordingType } from '~/types'
+import type {
+ AnnotationType,
+ PersonType,
+ RecordingSnapshot,
+ SessionRecordingSnapshotSource,
+ TeamPublicType,
+ TeamType,
+} from '../../../types'
import { ExportedSessionRecordingFileV2 } from '../file-playback/types'
-import type { sessionRecordingMetaLogicType } from './sessionRecordingMetaLogicType'
export interface SessionRecordingMetaLogicProps {
sessionRecordingId: SessionRecordingId
@@ -20,6 +27,118 @@ export interface SessionRecordingMetaLogicProps {
accessToken?: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingMetaLogicValues {
+ annotations: AnnotationType[] // annotationsModel
+ annotationsLoading: boolean // annotationsModel
+ getWindowId: (uuid: string | undefined) => number | undefined // registryLogic
+ uuidToIndex: Record<string, number> // registryLogic
+ isLoadingSnapshots: boolean // snapshotLogic
+ isRecordingDeleted: boolean // snapshotLogic
+ recordingDeletedAt: number | null // snapshotLogic
+ recordingDeletedBy: string | null // snapshotLogic
+ snapshotSources: SessionRecordingSnapshotSource[] | null // snapshotLogic
+ snapshotsLoaded: boolean // snapshotLogic
+ snapshotsLoading: boolean // snapshotLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ isNotFound: boolean
+ loadMetaError: boolean
+ sessionPlayerMetaData: SessionRecordingType | null
+ sessionPlayerMetaDataLoading: boolean
+ trackedWindow: number | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingMetaLogicActions {
+ registerWindowId: (uuid: string) => {
+ uuid: string
+ } // registryLogic
+ loadSnapshotSources: (breakpointLength?: number | undefined) => {
+ breakpointLength: number | undefined
+ } // snapshotLogic
+ loadSnapshots: () => {
+ value: true
+ } // snapshotLogic
+ loadSnapshotsForSourceSuccess: (
+ snapshotsForSource:
+ | {
+ source: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>
+ sources?: undefined
+ }
+ | {
+ source?: undefined
+ sources: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>[]
+ },
+ payload?:
+ | {
+ sources: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>[]
+ }
+ | undefined
+ ) => {
+ payload?: {
+ sources: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>[]
+ }
+ snapshotsForSource:
+ | {
+ source: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>
+ sources?: undefined
+ }
+ | {
+ source?: undefined
+ sources: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>[]
+ }
+ } // snapshotLogic
+ setSnapshots: (snapshots: import('@common/replay-shared/src').RecordingSnapshot[]) => {
+ snapshots: RecordingSnapshot[]
+ } // snapshotLogic
+ loadRecordingFromFile: (recording: ExportedSessionRecordingFileV2['data']) => {
+ recording: {
+ id: string
+ person: PersonType | undefined
+ snapshots: RecordingSnapshot[]
+ }
+ }
+ loadRecordingMeta: () => {
+ value: true
+ }
+ loadRecordingMetaFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRecordingMetaSuccess: (
+ sessionPlayerMetaData: SessionRecordingType | null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ sessionPlayerMetaData: SessionRecordingType | null
+ payload?: {
+ value: true
+ }
+ }
+ maybeLoadRecordingMeta: () => {
+ value: true
+ }
+ setTrackedWindow: (windowId: number | null) => {
+ windowId: number | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingMetaLogicMeta {
+ key: string
+}
+
+export type sessionRecordingMetaLogicType = MakeLogicType<
+ sessionRecordingMetaLogicValues,
+ sessionRecordingMetaLogicActions,
+ SessionRecordingMetaLogicProps,
+ sessionRecordingMetaLogicMeta
+>
+
export const sessionRecordingMetaLogic = kea<sessionRecordingMetaLogicType>([
path((key) => ['scenes', 'session-recordings', 'sessionRecordingMetaLogic', key]),
props({} as SessionRecordingMetaLogicProps),
diff --git a/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts b/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts
index c40e1f4fed17..9602e3ea2755 100644
--- a/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts
@@ -1,4 +1,5 @@
import {
+ MakeLogicType,
BuiltLogic,
actions,
afterMount,
@@ -18,6 +19,7 @@ import { delay } from 'kea-test-utils'
import posthog from 'posthog-js'
import { ReplayPlugin, Replayer, playerConfig } from 'posthog-js/rrweb'
import { EventType, IncrementalSource, eventWithTime } from 'posthog-js/rrweb-types'
+import type { customEvent } from 'posthog-js/rrweb-types'
import { RefObject } from 'react'
import { lemonToast } from '@posthog/lemon-ui'
@@ -54,13 +56,16 @@ import { userLogic } from 'scenes/userLogic'
import { AvailableFeature, ExporterFormat, RecordingSegment, SessionPlayerData, SessionPlayerState } from '~/types'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { PreflightStatus, SessionRecordingSnapshotSource, SessionRecordingType, UserType } from '../../../types'
import { deletedRecordingsLogic } from '../deletedRecordingsLogic'
import { ExportedSessionRecordingFileV2 } from '../file-playback/types'
import { sessionRecordingEventUsageLogic } from '../sessionRecordingEventUsageLogic'
-import { playerCommentOverlayLogic } from './commenting/playerFrameCommentOverlayLogic'
-import { playerCommentOverlayLogicType } from './commenting/playerFrameCommentOverlayLogicType'
+import {
+ playerCommentOverlayLogic,
+ type playerCommentOverlayLogicType,
+} from './commenting/playerFrameCommentOverlayLogic'
import { playerSettingsLogic } from './playerSettingsLogic'
-import type { sessionRecordingPlayerLogicType } from './sessionRecordingPlayerLogicType'
import { snapshotDataLogic } from './snapshotDataLogic'
import {
addAssetError,
@@ -510,6 +515,603 @@ function scheduleDiagnosticsFlush(
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingPlayerLogicValues {
+ hasReachedExportFullVideoLimit: boolean // exportsLogic
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ playerControlsOverlay: boolean // playerSettingsLogic
+ showMetadataFooter: boolean // playerSettingsLogic
+ skipInactivitySetting: boolean // playerSettingsLogic
+ speed: number // playerSettingsLogic
+ preflight: PreflightStatus | null // preflightLogic
+ createExportJSON: () => ExportedSessionRecordingFileV2 // sessionRecordingDataCoordinatorLogic
+ customRRWebEvents: customEvent[] // sessionRecordingDataCoordinatorLogic
+ fullyLoaded: boolean // sessionRecordingDataCoordinatorLogic
+ sessionPlayerData: SessionPlayerData // sessionRecordingDataCoordinatorLogic
+ sessionPlayerMetaData: SessionRecordingType | null // sessionRecordingDataCoordinatorLogic
+ sessionPlayerMetaDataLoading: boolean // sessionRecordingDataCoordinatorLogic
+ trackedWindow: number | null // sessionRecordingDataCoordinatorLogic
+ urls: {
+ timestamp: number
+ url: string
+ }[] // sessionRecordingDataCoordinatorLogic
+ allSourcesLoaded: boolean // snapshotDataLogic
+ snapshotSources: SessionRecordingSnapshotSource[] | null // snapshotDataLogic
+ snapshotStore: SnapshotStore // snapshotDataLogic
+ snapshotsLoaded: boolean // snapshotDataLogic
+ snapshotsLoading: boolean // snapshotDataLogic
+ storeVersion: number // snapshotDataLogic
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean // userLogic
+ user: UserType | null // userLogic
+ activityPerSecond: {
+ durationSeconds: number
+ maxY: number
+ smoothedPoints: Record<
+ number,
+ {
+ y: number
+ }
+ >
+ }
+ clickCount: number
+ currentPlayerState:
+ | SessionPlayerState.READY
+ | SessionPlayerState.BUFFER
+ | SessionPlayerState.PLAY
+ | SessionPlayerState.PAUSE
+ | SessionPlayerState.SKIP
+ | SessionPlayerState.SKIP_TO_MATCHING_EVENT
+ | SessionPlayerState.ERROR
+ currentPlayerTime: number
+ currentPlayerTimeSeconds: number
+ currentSegment: RecordingSegment | null
+ currentTimestamp: number | undefined
+ currentURL: string | undefined
+ dataBufferedUntilTimestamp: number | null
+ debugSettings: {
+ incrementalSources: IncrementalSource[]
+ types: EventType[]
+ }
+ debugSnapshots: eventWithTime[]
+ doctorDiagnostics: DoctorDiagnostics | null
+ endReached: boolean
+ errorCount: number
+ explorerMode: SessionRecordingPlayerExplorerProps | null
+ forceShowPlayerChrome: boolean
+ fromRRWebPlayerTime: (time?: number | undefined) => number | undefined
+ hasLateFullSnapshot: boolean
+ hasSnapshots: boolean
+ hoverModeIsEnabled: boolean
+ isBuffering: boolean
+ isCommenting: boolean
+ isFullScreen: boolean
+ isHovering: boolean
+ isKioskMode: boolean
+ isMuted: boolean
+ isScrubbing: boolean
+ isSkippingInactivity: boolean
+ isSkippingToMatchingEvent: boolean
+ isWaitingForIngestion: boolean
+ jumpTimeMs: number
+ leadingUnplayableMs: number
+ logicProps: SessionRecordingPlayerLogicProps
+ maskingWindow: boolean
+ pauseForced: boolean
+ playNextAnimationInterrupted: boolean
+ playNextRecording: ((automatic: boolean) => void) | undefined
+ player: Player | null
+ playerError: string | null
+ playerSpeed: number
+ playingState: SessionPlayerState.PLAY | SessionPlayerState.PAUSE
+ playingTimeTracking: PlayerTimeTracking
+ quickEmojiIsOpen: boolean
+ reportedReplayerErrors: Set<string>
+ resolution: {
+ height: number
+ width: number
+ } | null
+ rootFrame: HTMLDivElement | null
+ roughAnimationFPS: number
+ scale: number
+ seekIndicator: {
+ direction: 'backward' | 'forward'
+ seconds: number
+ } | null
+ seekRenderability: (timestamp: number) => SeekRenderability
+ segmentForTimestamp: (timestamp?: number | undefined) => RecordingSegment | null
+ sessionRecordingId: string
+ showPlayerChrome: boolean
+ showingClipParams: boolean
+ skipToFirstMatchingEvent: boolean
+ timestampChangeTracking: {
+ timestamp: number | null
+ timestampMatchesPrevious: number
+ }
+ toRRWebPlayerTime: (timestamp: number) => number | undefined
+ wasMarkedViewed: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingPlayerLogicActions {
+ addDeletedRecordings: (ids: string[]) => {
+ ids: string[]
+ } // deletedRecordingsLogic
+ startReplayExport: (
+ sessionRecordingId: string,
+ format?: ExporterFormat,
+ timestamp?: number,
+ duration?: number,
+ mode?: SessionRecordingPlayerMode,
+ options?: {
+ css_selector?: string
+ filename?: string
+ height?: number
+ skip_inactivity?: boolean
+ width?: number
+ }
+ ) => {
+ duration: number | undefined
+ format: ExporterFormat | undefined
+ mode: SessionRecordingPlayerMode | undefined
+ options:
+ | {
+ css_selector?: string | undefined
+ filename?: string | undefined
+ height?: number | undefined
+ skip_inactivity?: boolean | undefined
+ width?: number | undefined
+ }
+ | undefined
+ sessionRecordingId: string
+ timestamp: number | undefined
+ } // exportsLogic
+ setPlayerControlsOverlay: (playerControlsOverlay: boolean) => {
+ playerControlsOverlay: boolean
+ } // playerSettingsLogic
+ setSkipInactivitySetting: (skipInactivitySetting: boolean) => {
+ skipInactivitySetting: boolean
+ } // playerSettingsLogic
+ setSpeed: (speed: number) => {
+ speed: number
+ } // playerSettingsLogic
+ loadRecordingData: () => {
+ value: true
+ } // sessionRecordingDataCoordinatorLogic
+ loadRecordingMetaSuccess: (
+ sessionPlayerMetaData: SessionRecordingType | null,
+ payload?:
+ | {
+ value: true
+ }
+ | undefined
+ ) => {
+ payload?: {
+ value: true
+ }
+ sessionPlayerMetaData: SessionRecordingType | null
+ } // sessionRecordingDataCoordinatorLogic
+ snapshotProcessingFailed: () => {
+ value: true
+ } // sessionRecordingDataCoordinatorLogic
+ reportNextRecordingTriggered: (automatic: boolean) => {
+ automatic: boolean
+ } // sessionRecordingEventUsageLogic
+ reportRecordingExportedToFile: () => {
+ value: true
+ } // sessionRecordingEventUsageLogic
+ loadAllSources: () => {
+ value: true
+ } // snapshotDataLogic
+ loadNextSnapshotSource: () => {
+ value: true
+ } // snapshotDataLogic
+ loadSnapshotSourcesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ } // snapshotDataLogic
+ loadSnapshots: () => {
+ value: true
+ } // snapshotDataLogic
+ loadSnapshotsForSourceFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ } // snapshotDataLogic
+ setPlayerActive: (active: boolean) => {
+ active: boolean
+ } // snapshotDataLogic
+ setTargetTimestamp: (
+ timestamp: number | null,
+ windowId?: number | undefined
+ ) => {
+ timestamp: number | null
+ windowId: number | undefined
+ } // snapshotDataLogic
+ snapshotSourceLoadExhausted: () => {
+ value: true
+ } // snapshotDataLogic
+ updatePlaybackPosition: (
+ timestamp: number,
+ windowId?: number | undefined
+ ) => {
+ timestamp: number
+ windowId: number | undefined
+ } // snapshotDataLogic
+ allowPlayerChromeToHide: () => {
+ value: true
+ }
+ caughtAssetErrorFromIframe: (errorDetails: ResourceErrorDetails) => {
+ errorDetails: ResourceErrorDetails
+ }
+ clearPlayerError: () => {
+ value: true
+ }
+ closeExplorer: () => {
+ value: true
+ }
+ createExternalReference: (
+ integrationId: number,
+ config: Record<string, any>
+ ) => {
+ config: Record<string, any>
+ integrationId: number
+ }
+ deleteRecording: () => {
+ value: true
+ }
+ endBuffer: () => {
+ value: true
+ }
+ endScrub: () => {
+ value: true
+ }
+ exportRecording: (
+ format: ExporterFormat,
+ timestamp?: number,
+ mode?: SessionRecordingPlayerMode,
+ duration?: number,
+ filename?: string
+ ) => {
+ duration: number
+ filename: string | undefined
+ format: ExporterFormat
+ mode: SessionRecordingPlayerMode
+ timestamp: number
+ }
+ exportRecordingToFile: () => {
+ value: true
+ }
+ exportRecordingToVideoFile: () => {
+ value: true
+ }
+ fingerprintReported: (fingerprint: string) => {
+ fingerprint: string
+ }
+ flushDoctorDiagnostics: (diagnostics: DoctorDiagnostics) => {
+ diagnostics: DoctorDiagnostics
+ }
+ forcePause: () => {
+ value: true
+ }
+ getClip: (
+ format: ExporterFormat,
+ duration?: number,
+ filename?: string
+ ) => {
+ duration: number
+ filename: string | undefined
+ format: ExporterFormat
+ }
+ hideSeekIndicator: () => {
+ value: true
+ }
+ incrementClickCount: () => {
+ value: true
+ }
+ incrementErrorCount: () => {
+ value: true
+ }
+ initializePlayerFromStart: () => {
+ value: true
+ }
+ markViewed: (delay?: number) => {
+ delay: number | undefined
+ }
+ openExplorer: () => {
+ value: true
+ }
+ openHeatmap: () => {
+ value: true
+ }
+ pauseIframePlayback: () => {
+ value: true
+ }
+ playerErrorSeen: (error: any) => {
+ error: any
+ }
+ restartIframePlayback: () => {
+ value: true
+ }
+ schedulePlayerTimeTracking: () => {
+ value: true
+ }
+ seekBackward: (amount?: number) => {
+ amount: number | undefined
+ }
+ seekForward: (amount?: number) => {
+ amount: number | undefined
+ }
+ seekToStart: () => {
+ value: true
+ }
+ seekToTime: (
+ timeInMilliseconds: number,
+ forcePlay?: boolean
+ ) => {
+ forcePlay: boolean
+ timeInMilliseconds: number
+ }
+ seekToTimestamp: (
+ timestamp: number,
+ forcePlay?: boolean
+ ) => {
+ forcePlay: boolean
+ timestamp: number
+ }
+ setCurrentSegment: (segment: RecordingSegment) => {
+ segment: RecordingSegment
+ }
+ setCurrentTimestamp: (timestamp: number) => {
+ timestamp: number
+ }
+ setDebugSnapshotIncrementalSources: (incrementalSources: IncrementalSource[]) => {
+ incrementalSources: IncrementalSource[]
+ }
+ setDebugSnapshotTypes: (types: EventType[]) => {
+ types: EventType[]
+ }
+ setEndReached: (reached?: boolean) => {
+ reached: boolean
+ }
+ setExplorerProps: (props: SessionRecordingPlayerExplorerProps | null) => {
+ props: SessionRecordingPlayerExplorerProps | null
+ }
+ setIsCommenting: (isCommenting: boolean) => {
+ isCommenting: boolean
+ }
+ setIsFullScreen: (isFullScreen: boolean) => {
+ isFullScreen: boolean
+ }
+ setIsHovering: (isHovering: boolean) => {
+ isHovering: boolean
+ }
+ setMaskWindow: (shouldMaskWindow: boolean) => {
+ shouldMaskWindow: boolean
+ }
+ setMuted: (muted: boolean) => {
+ muted: boolean
+ }
+ setPause: () => {
+ value: true
+ }
+ setPlay: () => {
+ value: true
+ }
+ setPlayNextAnimationInterrupted: (interrupted: boolean) => {
+ interrupted: boolean
+ }
+ setPlayer: (player: Player | null) => {
+ player: Player | null
+ }
+ setPlayerError: (reason: string) => {
+ reason: string
+ }
+ setPlayerTimeTrackingState: (tracking: PlayerTimeTracking) => {
+ tracking: PlayerTimeTracking
+ }
+ setQuickEmojiIsOpen: (quickEmojiIsOpen: boolean) => {
+ quickEmojiIsOpen: boolean
+ }
+ setRootFrame: (frame: HTMLDivElement | null) => {
+ frame: HTMLDivElement | null
+ }
+ setScale: (scale: number) => {
+ scale: number
+ }
+ setShowingClipParams: (showingClipParams: boolean) => {
+ showingClipParams: boolean
+ }
+ setSkipToFirstMatchingEvent: (skipToFirstMatchingEvent: boolean) => {
+ skipToFirstMatchingEvent: boolean
+ }
+ setSkippingInactivity: (isSkippingInactivity: boolean) => {
+ isSkippingInactivity: boolean
+ }
+ setSkippingToMatchingEvent: (isSkippingToMatchingEvent: boolean) => {
+ isSkippingToMatchingEvent: boolean
+ }
+ setWasMarkedViewed: (wasMarkedViewed: boolean) => {
+ wasMarkedViewed: boolean
+ }
+ showSeekIndicator: (
+ direction: 'backward' | 'forward',
+ seconds: number
+ ) => {
+ direction: 'backward' | 'forward'
+ seconds: number
+ }
+ skipPlayerForward: (
+ rrWebPlayerTime: number,
+ skip: number
+ ) => {
+ rrWebPlayerTime: number
+ skip: number
+ }
+ startBuffer: () => {
+ value: true
+ }
+ startScrub: () => {
+ value: true
+ }
+ stopAnimation: () => {
+ value: true
+ }
+ syncPlayerSpeed: () => {
+ value: true
+ }
+ syncPlayerState: (
+ forcePlay?: boolean,
+ reposition?: boolean
+ ) => {
+ forcePlay: boolean
+ reposition: boolean
+ }
+ syncSnapshotsWithPlayer: () => {
+ value: true
+ }
+ takeScreenshot: () => {
+ value: true
+ }
+ togglePlayPause: () => {
+ value: true
+ }
+ tryInitReplayer: () => boolean
+ updateAnimation: () => {
+ value: true
+ }
+ updatePlayerTimeTracking: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingPlayerLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ sessionRecordingId: (sessionRecordingId: string) => string
+ logicProps: (arg: any) => SessionRecordingPlayerLogicProps
+ playNextRecording: (arg: any) => ((automatic: boolean) => void) | undefined
+ hasSnapshots: (sessionPlayerData: SessionPlayerData) => boolean
+ activityPerSecond: (
+ sessionPlayerData: SessionPlayerData,
+ hasSnapshots: boolean
+ ) => {
+ durationSeconds: number
+ maxY: number
+ smoothedPoints: Record<
+ number,
+ {
+ y: number
+ }
+ >
+ }
+ roughAnimationFPS: (playerSpeed: number) => number
+ currentPlayerState: (
+ playingState: SessionPlayerState.PLAY | SessionPlayerState.PAUSE,
+ isBuffering: boolean,
+ playerError: string | null,
+ isScrubbing: boolean,
+ isSkippingInactivity: boolean,
+ isSkippingToMatchingEvent: boolean,
+ snapshotsLoaded: boolean,
+ snapshotsLoading: boolean
+ ) =>
+ | SessionPlayerState.READY
+ | SessionPlayerState.BUFFER
+ | SessionPlayerState.PLAY
+ | SessionPlayerState.PAUSE
+ | SessionPlayerState.SKIP
+ | SessionPlayerState.SKIP_TO_MATCHING_EVENT
+ | SessionPlayerState.ERROR
+ dataBufferedUntilTimestamp: (sessionPlayerData: SessionPlayerData) => number | null
+ currentPlayerTime: (currentTimestamp: number | undefined, sessionPlayerData: SessionPlayerData) => number
+ currentPlayerTimeSeconds: (currentPlayerTime: number) => number
+ toRRWebPlayerTime: (
+ sessionPlayerData: SessionPlayerData,
+ currentSegment: null | import('@posthog/replay-shared').RecordingSegment
+ ) => (timestamp: number) => number | undefined
+ fromRRWebPlayerTime: (
+ sessionPlayerData: SessionPlayerData,
+ currentSegment: null | import('@posthog/replay-shared').RecordingSegment
+ ) => (time?: number | undefined) => number | undefined
+ jumpTimeMs: (speed: number) => number
+ playerSpeed: (
+ speed: number,
+ isSkippingInactivity: boolean,
+ currentSegment: null | import('@posthog/replay-shared').RecordingSegment,
+ currentTimestamp: number | undefined,
+ arg: any
+ ) => number
+ segmentForTimestamp: (
+ sessionPlayerData: SessionPlayerData
+ ) => (timestamp?: number | undefined) => RecordingSegment | null
+ seekRenderability: (
+ segmentForTimestamp: (timestamp?: number | undefined) => RecordingSegment | null,
+ snapshotStore: SnapshotStore,
+ allSourcesLoaded: boolean,
+ sessionPlayerData: SessionPlayerData,
+ storeVersion: number
+ ) => (timestamp: number) => SeekRenderability
+ leadingUnplayableMs: (
+ sessionPlayerData: SessionPlayerData,
+ seekRenderability: (timestamp: number) => SeekRenderability
+ ) => number
+ hasLateFullSnapshot: (leadingUnplayableMs: number) => boolean
+ isWaitingForIngestion: (
+ seekRenderability: (timestamp: number) => SeekRenderability,
+ currentTimestamp: number | undefined
+ ) => boolean
+ debugSnapshots: (
+ sessionPlayerData: SessionPlayerData,
+ debugSettings: {
+ incrementalSources: IncrementalSource[]
+ types: EventType[]
+ }
+ ) => eventWithTime[]
+ currentURL: (
+ urls: {
+ timestamp: number
+ url: string
+ }[],
+ sessionPlayerMetaData: SessionRecordingType | null,
+ currentTimestamp: number | undefined
+ ) => string | undefined
+ resolution: (
+ sessionPlayerData: SessionPlayerData,
+ currentTimestamp: number | undefined,
+ currentSegment: null | import('@posthog/replay-shared').RecordingSegment
+ ) => {
+ height: number
+ width: number
+ } | null
+ isKioskMode: (logicProps: SessionRecordingPlayerLogicProps) => boolean
+ hoverModeIsEnabled: (
+ logicProps: SessionRecordingPlayerLogicProps,
+ isCommenting: boolean,
+ showingClipParams: boolean,
+ playerControlsOverlay: boolean
+ ) => boolean
+ showPlayerChrome: (
+ isKioskMode: boolean,
+ hoverModeIsEnabled: boolean,
+ isHovering: boolean,
+ forceShowPlayerChrome: boolean
+ ) => boolean
+ }
+}
+
+export type sessionRecordingPlayerLogicType = MakeLogicType<
+ sessionRecordingPlayerLogicValues,
+ sessionRecordingPlayerLogicActions,
+ SessionRecordingPlayerLogicProps,
+ sessionRecordingPlayerLogicMeta
+>
+
export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>([
path((key) => ['scenes', 'session-recordings', 'player', 'sessionRecordingPlayerLogic', key]),
props({} as SessionRecordingPlayerLogicProps),
@@ -890,7 +1492,7 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(
})),
selectors({
// Prop references for use by other logics
- sessionRecordingId: [(_, p) => [p.sessionRecordingId], (sessionRecordingId) => sessionRecordingId],
+ sessionRecordingId: [(_, p) => [p.sessionRecordingId], (sessionRecordingId: string) => sessionRecordingId],
logicProps: [() => [(_, props) => props], (props): SessionRecordingPlayerLogicProps => props],
playNextRecording: [
() => [(_, props) => props.playNextRecording],
@@ -977,7 +1579,7 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(
},
],
- roughAnimationFPS: [(s) => [s.playerSpeed], (playerSpeed) => playerSpeed * (1000 / 60)],
+ roughAnimationFPS: [(s) => [s.playerSpeed], (playerSpeed: number) => playerSpeed * (1000 / 60)],
currentPlayerState: [
(s) => [
s.playingState,
@@ -990,14 +1592,14 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(
s.snapshotsLoading,
],
(
- playingState,
- isBuffering,
- playerError,
- isScrubbing,
- isSkippingInactivity,
- isSkippingToMatchingEvent,
- snapshotsLoaded,
- snapshotsLoading
+ playingState: SessionPlayerState.PLAY | SessionPlayerState.PAUSE,
+ isBuffering: boolean,
+ playerError: string | null,
+ isScrubbing: boolean,
+ isSkippingInactivity: boolean,
+ isSkippingToMatchingEvent: boolean,
+ snapshotsLoaded: boolean,
+ snapshotsLoading: boolean
) => {
switch (true) {
case isScrubbing:
@@ -1035,7 +1637,7 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(
// Useful for the relative time in the context of the whole recording
currentPlayerTime: [
(s) => [s.currentTimestamp, s.sessionPlayerData],
- (currentTimestamp, sessionPlayerData) => {
+ (currentTimestamp: number | undefined, sessionPlayerData: SessionPlayerData) => {
if (!currentTimestamp || !sessionPlayerData?.start) {
return 0
}
@@ -1046,13 +1648,13 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(
currentPlayerTimeSeconds: [
(s) => [s.currentPlayerTime],
- (currentPlayerTime) => Math.floor(currentPlayerTime / 1000),
+ (currentPlayerTime: number) => Math.floor(currentPlayerTime / 1000),
],
// The relative time for the player, i.e. the offset between the current timestamp, and the window start for the current segment
toRRWebPlayerTime: [
(s) => [s.sessionPlayerData, s.currentSegment],
- (sessionPlayerData, currentSegment) => {
+ (sessionPlayerData: SessionPlayerData, currentSegment: RecordingSegment | null) => {
return (timestamp: number): number | undefined => {
if (!currentSegment || !currentSegment.windowId) {
return
@@ -1071,7 +1673,7 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(
// The relative time for the player, i.e. the offset between the current timestamp, and the window start for the current segment
fromRRWebPlayerTime: [
(s) => [s.sessionPlayerData, s.currentSegment],
- (sessionPlayerData, currentSegment) => {
+ (sessionPlayerData: SessionPlayerData, currentSegment: RecordingSegment | null) => {
return (time?: number): number | undefined => {
if (time === undefined || !currentSegment?.windowId) {
return
@@ -1085,11 +1687,17 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(
},
],
- jumpTimeMs: [(selectors) => [selectors.speed], (speed) => 10 * 1000 * speed],
+ jumpTimeMs: [(selectors) => [selectors.speed], (speed: number) => 10 * 1000 * speed],
playerSpeed: [
(s) => [s.speed, s.isSkippingInactivity, s.currentSegment, s.currentTimestamp, (_, props) => props.mode],
- (speed, isSkippingInactivity, currentSegment, currentTimestamp, mode) => {
+ (
+ speed: number,
+ isSkippingInactivity: boolean,
+ currentSegment: RecordingSegment | null,
+ currentTimestamp: number | undefined,
+ mode
+ ) => {
if (mode === SessionRecordingPlayerMode.Preview) {
// default max speed in rrweb https://github.com/rrweb-io/rrweb/blob/58c9104eddc8b7994a067a97daae5684e42f892f/packages/rrweb/src/replay/index.ts#L178
return 360
@@ -1257,7 +1865,13 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(
debugSnapshots: [
(s) => [s.sessionPlayerData, s.debugSettings],
- (sessionPlayerData: SessionPlayerData, debugSettings): eventWithTime[] => {
+ (
+ sessionPlayerData: SessionPlayerData,
+ debugSettings: {
+ incrementalSources: import('node_modules/posthog-js/dist/rrweb').IncrementalSource[]
+ types: import('node_modules/posthog-js/dist/rrweb').EventType[]
+ }
+ ): eventWithTime[] => {
const allSnapshots = Object.values(sessionPlayerData.snapshotsByWindowId).flat()
const visualSnapshots = allSnapshots.filter(
(s) =>
@@ -1271,7 +1885,14 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(
currentURL: [
(s) => [s.urls, s.sessionPlayerMetaData, s.currentTimestamp],
- (urls, sessionPlayerMetaData, currentTimestamp): string | undefined => {
+ (
+ urls: {
+ timestamp: number
+ url: string
+ }[],
+ sessionPlayerMetaData: null | import('~/types').SessionRecordingType,
+ currentTimestamp: number | undefined
+ ): string | undefined => {
if (!urls.length || !currentTimestamp) {
return sessionPlayerMetaData?.start_url ?? undefined
}
@@ -1287,7 +1908,11 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(
],
resolution: [
(s) => [s.sessionPlayerData, s.currentTimestamp, s.currentSegment],
- (sessionPlayerData, currentTimestamp, currentSegment): { width: number; height: number } | null => {
+ (
+ sessionPlayerData: SessionPlayerData,
+ currentTimestamp: number | undefined,
+ currentSegment: RecordingSegment | null
+ ): { width: number; height: number } | null => {
// Find snapshot to pull resolution from
if (!currentTimestamp) {
return null
@@ -1330,11 +1955,17 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(
],
isKioskMode: [
(s) => [s.logicProps],
- (logicProps): boolean => logicProps.mode === SessionRecordingPlayerMode.Kiosk,
+ (logicProps: SessionRecordingPlayerLogicProps): boolean =>
+ logicProps.mode === SessionRecordingPlayerMode.Kiosk,
],
hoverModeIsEnabled: [
(s) => [s.logicProps, s.isCommenting, s.showingClipParams, s.playerControlsOverlay],
- (logicProps, isCommenting, showingClipParams, playerControlsOverlay): boolean => {
+ (
+ logicProps: SessionRecordingPlayerLogicProps,
+ isCommenting: boolean,
+ showingClipParams: boolean,
+ playerControlsOverlay: boolean
+ ): boolean => {
return (
!!logicProps.mode &&
ModesWithInteractions.includes(logicProps.mode) &&
@@ -1346,7 +1977,12 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(
],
showPlayerChrome: [
(s) => [s.isKioskMode, s.hoverModeIsEnabled, s.isHovering, s.forceShowPlayerChrome],
- (isKioskMode, hoverModeIsEnabled, isHovering, forceShowPlayerChrome): boolean => {
+ (
+ isKioskMode: boolean,
+ hoverModeIsEnabled: boolean,
+ isHovering: boolean,
+ forceShowPlayerChrome: boolean
+ ): boolean => {
// Kiosk mode never shows player controls
if (isKioskMode) {
return false
diff --git a/frontend/src/scenes/session-recordings/player/sessionSummariesConfigLogic.ts b/frontend/src/scenes/session-recordings/player/sessionSummariesConfigLogic.ts
index 09445597d8c7..9bd0f54d934d 100644
--- a/frontend/src/scenes/session-recordings/player/sessionSummariesConfigLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/sessionSummariesConfigLogic.ts
@@ -1,5 +1,6 @@
-import { actions, afterMount, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, afterMount, 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 api from 'lib/api'
@@ -7,8 +8,6 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import type { SessionSummariesConfig } from 'products/session_summaries/frontend/types'
-import type { sessionSummariesConfigLogicType } from './sessionSummariesConfigLogicType'
-
export const CUSTOM_TAGS_MAX_COUNT = 15
export const CUSTOM_TAG_NAME_MAX_LENGTH = 60
export const CUSTOM_TAG_DESCRIPTION_MAX_LENGTH = 200
@@ -42,6 +41,103 @@ const customTagsToDict = (tags: CustomTagFormEntry[]): Record<string, string> =>
return dict
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionSummariesConfigLogicValues {
+ config: SessionSummariesConfig | null
+ configForm: SessionSummariesConfigForm
+ configFormAllErrors: Record<string, any>
+ configFormChanged: boolean
+ configFormErrors: DeepPartialMap<SessionSummariesConfigForm, ValidationErrorType>
+ configFormHasErrors: boolean
+ configFormManualErrors: Record<string, any>
+ configFormTouched: boolean
+ configFormTouches: Record<string, boolean>
+ configFormValidationErrors: DeepPartialMap<SessionSummariesConfigForm, ValidationErrorType>
+ configLoading: boolean
+ isConfigFormSubmitting: boolean
+ isConfigFormValid: boolean
+ isLoading: boolean
+ isUpdating: boolean
+ showConfigFormErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionSummariesConfigLogicActions {
+ loadConfig: () => any
+ loadConfigFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadConfigSuccess: (
+ config: SessionSummariesConfig,
+ payload?: any
+ ) => {
+ config: SessionSummariesConfig
+ payload?: any
+ }
+ resetConfigForm: (values?: SessionSummariesConfigForm) => {
+ values?: SessionSummariesConfigForm
+ }
+ revertConfigForm: () => {
+ value: true
+ }
+ setConfigFormManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setConfigFormValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setConfigFormValues: (values: DeepPartial<SessionSummariesConfigForm>) => {
+ values: DeepPartial<SessionSummariesConfigForm>
+ }
+ submitConfigForm: () => {
+ value: boolean
+ }
+ submitConfigFormFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitConfigFormRequest: (configForm: SessionSummariesConfigForm) => {
+ configForm: SessionSummariesConfigForm
+ }
+ submitConfigFormSuccess: (configForm: SessionSummariesConfigForm) => {
+ configForm: SessionSummariesConfigForm
+ }
+ touchConfigFormField: (key: string) => {
+ key: string
+ }
+ updateConfig: (data: SessionSummariesConfigForm) => SessionSummariesConfigForm
+ updateConfigFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateConfigSuccess: (
+ config: SessionSummariesConfig,
+ payload?: SessionSummariesConfigForm
+ ) => {
+ config: SessionSummariesConfig
+ payload?: SessionSummariesConfigForm
+ }
+}
+
+export type sessionSummariesConfigLogicType = MakeLogicType<
+ sessionSummariesConfigLogicValues,
+ sessionSummariesConfigLogicActions
+>
+
export const sessionSummariesConfigLogic = kea<sessionSummariesConfigLogicType>([
path(['scenes', 'session-recordings', 'player', 'sessionSummariesConfigLogic']),
diff --git a/frontend/src/scenes/session-recordings/player/share/playerShareLogic.ts b/frontend/src/scenes/session-recordings/player/share/playerShareLogic.ts
index 5523d50ada6b..5ec32171ded6 100644
--- a/frontend/src/scenes/session-recordings/player/share/playerShareLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/share/playerShareLogic.ts
@@ -1,12 +1,11 @@
-import { kea, key, path, props, selectors } from 'kea'
+import { MakeLogicType, kea, key, path, props, selectors } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { combineUrl } from 'kea-router'
import { colonDelimitedDuration, reverseColonDelimitedDuration } from 'lib/utils/durations'
import { urls } from 'scenes/urls'
-import type { playerShareLogicType } from './playerShareLogicType'
-
export interface FormWithTime {
includeTime: boolean
time: string | null
@@ -31,6 +30,79 @@ export type PlayerShareLogicProps = {
shareType?: 'private' | 'public'
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerShareLogicValues {
+ isPrivateLinkFormSubmitting: boolean
+ isPrivateLinkFormValid: boolean
+ privateLinkForm: FormWithTime
+ privateLinkFormAllErrors: Record<string, any>
+ privateLinkFormChanged: boolean
+ privateLinkFormErrors: DeepPartialMap<FormWithTime, ValidationErrorType>
+ privateLinkFormHasErrors: boolean
+ privateLinkFormManualErrors: Record<string, any>
+ privateLinkFormTouched: boolean
+ privateLinkFormTouches: Record<string, boolean>
+ privateLinkFormValidationErrors: DeepPartialMap<FormWithTime, ValidationErrorType>
+ privateLinkUrl: string
+ privateLinkUrlQueryParams: Record<string, string | undefined>
+ showPrivateLinkFormErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerShareLogicActions {
+ resetPrivateLinkForm: (values?: FormWithTime) => {
+ values?: FormWithTime
+ }
+ setPrivateLinkFormManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setPrivateLinkFormValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setPrivateLinkFormValues: (values: DeepPartial<FormWithTime>) => {
+ values: DeepPartial<FormWithTime>
+ }
+ submitPrivateLinkForm: () => {
+ value: boolean
+ }
+ submitPrivateLinkFormFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitPrivateLinkFormRequest: (privateLinkForm: FormWithTime) => {
+ privateLinkForm: FormWithTime
+ }
+ submitPrivateLinkFormSuccess: (privateLinkForm: FormWithTime) => {
+ privateLinkForm: FormWithTime
+ }
+ touchPrivateLinkFormField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerShareLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ privateLinkUrlQueryParams: (privateLinkForm: FormWithTime) => Record<string, string | undefined>
+ privateLinkUrl: (privateLinkForm: FormWithTime) => string
+ }
+}
+
+export type playerShareLogicType = MakeLogicType<
+ playerShareLogicValues,
+ playerShareLogicActions,
+ PlayerShareLogicProps,
+ playerShareLogicMeta
+>
+
export const playerShareLogic = kea<playerShareLogicType>([
path(() => ['scenes', 'session-recordings', 'player', 'playerShareLogic']),
props({} as PlayerShareLogicProps),
@@ -58,13 +130,13 @@ export const playerShareLogic = kea<playerShareLogicType>([
selectors(({ props }) => ({
privateLinkUrlQueryParams: [
(s) => [s.privateLinkForm],
- (privateLinkForm) => {
+ (privateLinkForm: FormWithTime) => {
return makePrivateLinkQueryParams(privateLinkForm)
},
],
privateLinkUrl: [
(s) => [s.privateLinkForm],
- (privateLinkForm) => {
+ (privateLinkForm: FormWithTime) => {
return makePrivateLink(props.id, privateLinkForm)
},
],
diff --git a/frontend/src/scenes/session-recordings/player/sidebar/playerSidebarLogic.ts b/frontend/src/scenes/session-recordings/player/sidebar/playerSidebarLogic.ts
index cbd5fd3b5897..4a8125a409d8 100644
--- a/frontend/src/scenes/session-recordings/player/sidebar/playerSidebarLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/sidebar/playerSidebarLogic.ts
@@ -1,9 +1,21 @@
-import { actions, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
import { actionToUrl, router, urlToAction } from 'kea-router'
import { SessionRecordingSidebarTab } from '~/types'
-import type { playerSidebarLogicType } from './playerSidebarLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerSidebarLogicValues {
+ activeTab: SessionRecordingSidebarTab
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playerSidebarLogicActions {
+ setTab: (tab: SessionRecordingSidebarTab) => {
+ tab: SessionRecordingSidebarTab
+ }
+}
+
+export type playerSidebarLogicType = MakeLogicType<playerSidebarLogicValues, playerSidebarLogicActions>
export const playerSidebarLogic = kea<playerSidebarLogicType>([
path(() => ['scenes', 'session-recordings', 'player', 'playerSidebarLogic']),
diff --git a/frontend/src/scenes/session-recordings/player/snapshotDataLogic.tsx b/frontend/src/scenes/session-recordings/player/snapshotDataLogic.tsx
index a0257a951fe5..1ef512ef2720 100644
--- a/frontend/src/scenes/session-recordings/player/snapshotDataLogic.tsx
+++ b/frontend/src/scenes/session-recordings/player/snapshotDataLogic.tsx
@@ -1,6 +1,19 @@
import '~/queries/utils'
-import { actions, afterMount, beforeUnmount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ beforeUnmount,
+ connect,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ reducers,
+ selectors,
+} from 'kea'
import { loaders } from 'kea-loaders'
import posthog from 'posthog-js'
@@ -21,7 +34,6 @@ import {
} from '~/types'
import { SeekTarget, planNextBatch } from './snapshot-store/planNextBatch'
-import type { snapshotDataLogicType } from './snapshotDataLogicType'
const DEFAULT_V2_POLLING_INTERVAL_MS: number = 10000
const MAX_V2_POLLING_INTERVAL_MS = 60000
@@ -34,6 +46,189 @@ export interface SnapshotLogicProps {
accessToken?: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface snapshotDataLogicValues {
+ getWindowId: (uuid: string | undefined) => number | undefined // windowIdRegistryLogic
+ uuidToIndex: Record<string, number> // windowIdRegistryLogic
+ allSourcesLoaded: boolean
+ isLoadingSnapshots: boolean
+ isPolling: boolean
+ isRecordingDeleted: boolean
+ loadAllMode: boolean
+ loadingSources: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'end_timestamp' | 'source' | 'start_timestamp'>[]
+ pollingInterval: number
+ recordingDeletedAt: number | null
+ recordingDeletedBy: string | null
+ seekTarget: SeekTarget | null
+ snapshotLoadError: Error | null
+ snapshotSources: SessionRecordingSnapshotSource[] | null
+ snapshotSourcesLoading: boolean
+ snapshotStore: SnapshotStore
+ snapshotsForSource: SessionRecordingSnapshotSourceResponse | null
+ snapshotsForSourceLoading: boolean
+ snapshotsLoaded: boolean
+ snapshotsLoading: boolean
+ sourceLoadingStates: SourceLoadingState[]
+ storeUpdateCount: number
+ storeVersion: number
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface snapshotDataLogicActions {
+ registerWindowId: (uuid: string) => {
+ uuid: string
+ } // windowIdRegistryLogic
+ loadAllSources: () => {
+ value: true
+ }
+ loadNextSnapshotSource: () => {
+ value: true
+ }
+ loadSnapshotSources: (breakpointLength?: number) => {
+ breakpointLength: number | undefined
+ }
+ loadSnapshotSourcesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSnapshotSourcesSuccess: (
+ snapshotSources: SessionRecordingSnapshotSource[],
+ payload?: {
+ breakpointLength: number | undefined
+ }
+ ) => {
+ snapshotSources: SessionRecordingSnapshotSource[]
+ payload?: {
+ breakpointLength: number | undefined
+ }
+ }
+ loadSnapshots: () => {
+ value: true
+ }
+ loadSnapshotsForSource: (sources: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>[]) => {
+ sources: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>[]
+ }
+ loadSnapshotsForSourceFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSnapshotsForSourceSuccess: (
+ snapshotsForSource:
+ | {
+ source: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>
+ sources?: undefined
+ }
+ | {
+ source?: undefined
+ sources: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>[]
+ },
+ payload?: {
+ sources: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>[]
+ }
+ ) => {
+ snapshotsForSource:
+ | {
+ source: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>
+ sources?: undefined
+ }
+ | {
+ source?: undefined
+ sources: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>[]
+ }
+ payload?: {
+ sources: Pick<SessionRecordingSnapshotSource, 'blob_key' | 'source'>[]
+ }
+ }
+ maybeStartPolling: () => {
+ value: true
+ }
+ resetPollingInterval: () => {
+ value: true
+ }
+ setPlayerActive: (active: boolean) => {
+ active: boolean
+ }
+ setPollingInterval: (intervalMs: number) => {
+ intervalMs: number
+ }
+ setSnapshots: (snapshots: RecordingSnapshot[]) => {
+ snapshots: RecordingSnapshot[]
+ }
+ setTargetTimestamp: (
+ timestamp: number | null,
+ windowId?: number
+ ) => {
+ timestamp: number | null
+ windowId: number | undefined
+ }
+ snapshotSourceLoadExhausted: () => {
+ value: true
+ }
+ startPolling: () => {
+ value: true
+ }
+ stopPolling: () => {
+ value: true
+ }
+ storeUpdated: () => {
+ value: true
+ }
+ updatePlaybackPosition: (
+ timestamp: number,
+ windowId?: number
+ ) => {
+ timestamp: number
+ windowId: number | undefined
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface snapshotDataLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ snapshotsLoading: (
+ snapshotSourcesLoading: boolean,
+ snapshotsForSourceLoading: boolean,
+ storeVersion: number
+ ) => boolean
+ snapshotsLoaded: (
+ snapshotSources: import('@posthog/replay-shared').SessionRecordingSnapshotSource[] | null
+ ) => boolean
+ isLoadingSnapshots: (
+ loadingSources: Pick<
+ import('@posthog/replay-shared').SessionRecordingSnapshotSource,
+ 'blob_key' | 'end_timestamp' | 'source' | 'start_timestamp'
+ >[]
+ ) => boolean
+ allSourcesLoaded: (
+ snapshotSources: import('@posthog/replay-shared').SessionRecordingSnapshotSource[] | null,
+ storeVersion: number
+ ) => boolean
+ storeVersion: (
+ storeUpdateCount: number,
+ snapshotSources: import('@posthog/replay-shared').SessionRecordingSnapshotSource[] | null
+ ) => number
+ snapshotStore: (storeVersion: number) => SnapshotStore
+ sourceLoadingStates: (storeVersion: number) => SourceLoadingState[]
+ isRecordingDeleted: (snapshotLoadError: Error | null) => boolean
+ recordingDeletedAt: (snapshotLoadError: Error | null) => number | null
+ recordingDeletedBy: (snapshotLoadError: Error | null) => string | null
+ }
+}
+
+export type snapshotDataLogicType = MakeLogicType<
+ snapshotDataLogicValues,
+ snapshotDataLogicActions,
+ SnapshotLogicProps,
+ snapshotDataLogicMeta
+>
+
// Reactivity note (#53893): `cache.store` (SnapshotStore) lives outside Kea, so any listener that mutates it (markFetched, setSources) MUST dispatch `storeUpdated()` afterwards, and any selector reading it MUST depend on `storeVersion`.
export const snapshotDataLogic = kea<snapshotDataLogicType>([
path((key) => ['scenes', 'session-recordings', 'snapshotLogic', key]),
@@ -457,18 +652,26 @@ export const snapshotDataLogic = kea<snapshotDataLogicType>([
},
],
- snapshotsLoaded: [(s) => [s.snapshotSources], (snapshotSources): boolean => !!snapshotSources],
+ snapshotsLoaded: [
+ (s) => [s.snapshotSources],
+ (snapshotSources: SessionRecordingSnapshotSource[] | null): boolean => !!snapshotSources,
+ ],
isLoadingSnapshots: [
(s) => [s.loadingSources],
- (loadingSources): boolean => {
+ (
+ loadingSources: Pick<
+ SessionRecordingSnapshotSource,
+ 'blob_key' | 'end_timestamp' | 'source' | 'start_timestamp'
+ >[]
+ ): boolean => {
return loadingSources.length > 0
},
],
allSourcesLoaded: [
(s) => [s.snapshotSources, s.storeVersion],
- (snapshotSources, _storeVersion: number): boolean => {
+ (snapshotSources: SessionRecordingSnapshotSource[] | null, _storeVersion: number): boolean => {
if (!snapshotSources || snapshotSources.length === 0) {
return false
}
@@ -501,14 +704,14 @@ export const snapshotDataLogic = kea<snapshotDataLogicType>([
isRecordingDeleted: [
(s) => [s.snapshotLoadError],
- (snapshotLoadError): boolean => {
+ (snapshotLoadError: Error | null): boolean => {
return snapshotLoadError instanceof RecordingDeletedError
},
],
recordingDeletedAt: [
(s) => [s.snapshotLoadError],
- (snapshotLoadError): number | null => {
+ (snapshotLoadError: Error | null): number | null => {
if (snapshotLoadError instanceof RecordingDeletedError) {
return snapshotLoadError.deletedAt
}
@@ -518,7 +721,7 @@ export const snapshotDataLogic = kea<snapshotDataLogicType>([
recordingDeletedBy: [
(s) => [s.snapshotLoadError],
- (snapshotLoadError): string | null => {
+ (snapshotLoadError: Error | null): string | null => {
if (snapshotLoadError instanceof RecordingDeletedError) {
return snapshotLoadError.deletedBy
}
diff --git a/frontend/src/scenes/session-recordings/player/windowIdRegistryLogic.ts b/frontend/src/scenes/session-recordings/player/windowIdRegistryLogic.ts
index b8a52d1e6b3d..399471203729 100644
--- a/frontend/src/scenes/session-recordings/player/windowIdRegistryLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/windowIdRegistryLogic.ts
@@ -1,13 +1,41 @@
-import { actions, kea, key, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, key, path, props, reducers, selectors } from 'kea'
import { SessionRecordingId } from '~/types'
-import type { windowIdRegistryLogicType } from './windowIdRegistryLogicType'
-
export interface WindowIdRegistryLogicProps {
sessionRecordingId: SessionRecordingId
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface windowIdRegistryLogicValues {
+ getWindowId: (uuid: string | undefined) => number | undefined
+ uuidToIndex: Record<string, number>
+ windowIds: number[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface windowIdRegistryLogicActions {
+ registerWindowId: (uuid: string) => {
+ uuid: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface windowIdRegistryLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ getWindowId: (uuidToIndex: Record<string, number>) => (uuid: string | undefined) => number | undefined
+ windowIds: (uuidToIndex: Record<string, number>) => number[]
+ }
+}
+
+export type windowIdRegistryLogicType = MakeLogicType<
+ windowIdRegistryLogicValues,
+ windowIdRegistryLogicActions,
+ WindowIdRegistryLogicProps,
+ windowIdRegistryLogicMeta
+>
+
export const windowIdRegistryLogic = kea<windowIdRegistryLogicType>([
path((key) => ['scenes', 'session-recordings', 'windowIdRegistryLogic', key]),
props({} as WindowIdRegistryLogicProps),
@@ -31,7 +59,7 @@ export const windowIdRegistryLogic = kea<windowIdRegistryLogicType>([
selectors({
getWindowId: [
(s) => [s.uuidToIndex],
- (uuidToIndex) =>
+ (uuidToIndex: Record<string, number>) =>
(uuid: string | undefined): number | undefined => {
if (!uuid) {
return undefined
@@ -41,7 +69,7 @@ export const windowIdRegistryLogic = kea<windowIdRegistryLogicType>([
],
windowIds: [
(s) => [s.uuidToIndex],
- (uuidToIndex): number[] => Object.values(uuidToIndex).sort((a, b) => a - b),
+ (uuidToIndex: Record<string, number>): number[] => Object.values(uuidToIndex).sort((a, b) => a - b),
],
}),
])
diff --git a/frontend/src/scenes/session-recordings/playlist/playlistFiltersLogic.ts b/frontend/src/scenes/session-recordings/playlist/playlistFiltersLogic.ts
index 00c09b24e9de..3f1078498733 100644
--- a/frontend/src/scenes/session-recordings/playlist/playlistFiltersLogic.ts
+++ b/frontend/src/scenes/session-recordings/playlist/playlistFiltersLogic.ts
@@ -1,11 +1,35 @@
-import { actions, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
import { actionToUrl, router, urlToAction } from 'kea-router'
import { urls } from 'scenes/urls'
import { ReplayTabs } from '~/types'
-import type { playlistFiltersLogicType } from './playlistFiltersLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playlistFiltersLogicValues {
+ activeCategory: string
+ activeFilterTab: string
+ isExpanded: boolean
+ isFiltersExpanded: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface playlistFiltersLogicActions {
+ setActiveCategory: (categoryId: string) => {
+ categoryId: string
+ }
+ setActiveFilterTab: (activeFilterTab: string) => {
+ activeFilterTab: string
+ }
+ setIsExpanded: (isExpanded: boolean) => {
+ isExpanded: boolean
+ }
+ setIsFiltersExpanded: (isFiltersExpanded: boolean) => {
+ isFiltersExpanded: boolean
+ }
+}
+
+export type playlistFiltersLogicType = MakeLogicType<playlistFiltersLogicValues, playlistFiltersLogicActions>
export const playlistFiltersLogic = kea<playlistFiltersLogicType>([
path(['scenes', 'session-recordings', 'playlist', 'playlistFiltersLogic']),
diff --git a/frontend/src/scenes/session-recordings/playlist/playlistUtils.ts b/frontend/src/scenes/session-recordings/playlist/playlistUtils.ts
index 1ea463352424..2dd5e7e761bf 100644
--- a/frontend/src/scenes/session-recordings/playlist/playlistUtils.ts
+++ b/frontend/src/scenes/session-recordings/playlist/playlistUtils.ts
@@ -15,7 +15,7 @@ import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
import { deleteFromTree, refreshTreeItem } from '~/layout/panel-layout/ProjectTree/projectTreeLogic'
-import { cohortsModelType } from '~/models/cohortsModelType'
+import type { cohortsModelType } from '~/models/cohortsModel'
import { getCoreFilterDefinition } from '~/taxonomy/helpers'
import {
PropertyOperator,
diff --git a/frontend/src/scenes/session-recordings/playlist/sessionRecordingsListPropertiesLogic.ts b/frontend/src/scenes/session-recordings/playlist/sessionRecordingsListPropertiesLogic.ts
index dfc209c6dab5..c4d5a2ab703b 100644
--- a/frontend/src/scenes/session-recordings/playlist/sessionRecordingsListPropertiesLogic.ts
+++ b/frontend/src/scenes/session-recordings/playlist/sessionRecordingsListPropertiesLogic.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 api, { ApiError } from 'lib/api'
@@ -11,7 +11,6 @@ import { CORE_FILTER_DEFINITIONS_BY_GROUP } from '~/taxonomy/taxonomy'
import { SessionRecordingPropertiesType, SessionRecordingType } from '~/types'
import { sessionRecordingPinnedPropertiesLogic } from '../player/player-meta/sessionRecordingPinnedPropertiesLogic'
-import type { sessionRecordingsListPropertiesLogicType } from './sessionRecordingsListPropertiesLogicType'
const QUERY_TAGS: QueryLogTags = { scene: 'Replay', productKey: 'session_replay' }
@@ -66,6 +65,64 @@ function buildPropertiesQuery(
GROUP BY session_id`
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingsListPropertiesLogicValues {
+ pinnedProperties: string[] // sessionRecordingPinnedPropertiesLogic
+ extraSessionProperties: string[]
+ recordingProperties: SessionRecordingPropertiesType[]
+ recordingPropertiesById: Record<string, SessionRecordingPropertiesType['properties']>
+ recordingPropertiesLoading: boolean
+ unqueryableExtraProperties: string[] | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingsListPropertiesLogicActions {
+ reportRecordingsListPropertiesFetched: (loadTime: number) => {
+ loadTime: number
+ } // sessionRecordingEventUsageLogic
+ loadPropertiesForSessions: (sessions: SessionRecordingType[]) => {
+ sessions: SessionRecordingType[]
+ }
+ loadPropertiesForSessionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPropertiesForSessionsSuccess: (
+ recordingProperties: SessionRecordingPropertiesType[],
+ payload?: {
+ sessions: SessionRecordingType[]
+ }
+ ) => {
+ recordingProperties: SessionRecordingPropertiesType[]
+ payload?: {
+ sessions: SessionRecordingType[]
+ }
+ }
+ markExtraPropertiesUnqueryable: (properties: string[]) => {
+ properties: string[]
+ }
+ maybeLoadPropertiesForSessions: (sessions: SessionRecordingType[]) => {
+ sessions: SessionRecordingType[]
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingsListPropertiesLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ extraSessionProperties: (pinnedProperties: string[], unqueryableExtraProperties: string[] | null) => string[]
+ }
+}
+
+export type sessionRecordingsListPropertiesLogicType = MakeLogicType<
+ sessionRecordingsListPropertiesLogicValues,
+ sessionRecordingsListPropertiesLogicActions,
+ Record<string, any>,
+ sessionRecordingsListPropertiesLogicMeta
+>
+
// This logic is used to fetch properties for a list of recordings
// It is used in a global way as the cached values can be re-used
export const sessionRecordingsListPropertiesLogic = kea<sessionRecordingsListPropertiesLogicType>([
@@ -173,7 +230,7 @@ export const sessionRecordingsListPropertiesLogic = kea<sessionRecordingsListPro
selectors({
extraSessionProperties: [
(s) => [s.pinnedProperties, s.unqueryableExtraProperties],
- (pinnedProperties, unqueryableExtraProperties): string[] => {
+ (pinnedProperties: string[], unqueryableExtraProperties: string[] | null): string[] => {
const extras = pinnedSessionProperties(pinnedProperties)
// while the pin set that failed to query is unchanged, don't retry it
if (
diff --git a/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic.ts b/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic.ts
index 92877aebdbe8..3b49987906ed 100644
--- a/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic.ts
+++ b/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic.ts
@@ -1,5 +1,18 @@
import { deepEqual as equal } from 'fast-equals'
-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 { lazyLoaders, loaders } from 'kea-loaders'
import { actionToUrl, router, urlToAction } from 'kea-router'
import posthog from 'posthog-js'
@@ -58,8 +71,12 @@ import { playlistFiltersLogic } from './playlistFiltersLogic'
// Re-exported for back-compat with existing import sites; the implementations now live in the leaf
// `recordingsQueryConversions` module so they can be imported without pulling in this logic file.
export { DEFAULT_RECORDING_FILTERS_ORDER_BY, convertUniversalFiltersToRecordingsQuery }
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { RecordingOrderDirection } from '../../../queries/schema/schema-general'
+import type { AutoplayDirection } from '../../../types'
+import type { HideViewedRecordingsOptions } from '../player/playerSettingsLogic'
+import type { SessionRecordingFilterType } from '../sessionRecordingEventUsageLogic'
import { sessionRecordingsListPropertiesLogic } from './sessionRecordingsListPropertiesLogic'
-import type { sessionRecordingsPlaylistLogicType } from './sessionRecordingsPlaylistLogicType'
import { sessionRecordingsPlaylistSceneLogic } from './sessionRecordingsPlaylistSceneLogic'
export type PersonUUID = string
@@ -414,6 +431,356 @@ export interface SessionRecordingPlaylistLogicProps {
const isRelativeDate = (x: RecordingUniversalFilters['date_from']): boolean => !!x && x.startsWith('-')
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingsPlaylistLogicValues {
+ deletedRecordingIds: Set<string> // deletedRecordingsLogic
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ autoplayDirection: AutoplayDirection // playerSettingsLogic
+ hideViewedRecordings: HideViewedRecordingsOptions // playerSettingsLogic
+ activeSessionRecording: SessionRecordingType | undefined
+ activeSessionRecordingId: SessionRecordingId | undefined
+ addToCollectionSearch: string
+ allowEventPropertyExpansion: boolean
+ allowHogQLFilters: boolean
+ collectionsForBulkAdd: SavedSessionRecordingPlaylistsResult
+ collectionsForBulkAddLoading: boolean
+ deleteConfirmationText: string
+ eventsHaveSessionId: Record<string, boolean>
+ eventsHaveSessionIdLoading: boolean
+ filters: RecordingUniversalFilters
+ hasNext: boolean
+ hiddenRecordings: SessionRecordingType[]
+ hiddenRecordingsCount: number
+ isAddToCollectionModalOpen: boolean
+ isCreatingNewCollectionInModal: boolean
+ isDeleteSelectedRecordingsDialogOpen: boolean
+ logicProps: SessionRecordingPlaylistLogicProps
+ matchingEventsMatchType: MatchingEventsMatchType
+ newCollectionName: string
+ nextSessionRecording: Partial<SessionRecordingType> | undefined
+ otherRecordings: SessionRecordingType[]
+ pinnedFilters: UniversalFiltersGroup | undefined
+ pinnedRecordings: SessionRecordingType[]
+ pinnedRecordingsLoading: boolean
+ recordings: SessionRecordingType[]
+ recordingsCount: number
+ selectedRecordingId: SessionRecordingType['id'] | null
+ selectedRecordingOutsideFilters: boolean
+ selectedRecordingsIds: string[]
+ sessionRecordings: SessionRecordingType[]
+ sessionRecordingsAPIErrored: boolean
+ sessionRecordingsResponse: RecordingsQueryResponse & {
+ order: RecordingsQuery['order']
+ order_direction: RecordingsQuery['order_direction']
+ }
+ sessionRecordingsResponseLoading: boolean
+ showFilters: boolean
+ showSettings: boolean
+ totalFiltersCount: number
+ unusableEventsInFilter: string[]
+ visiblePinnedRecordings: SessionRecordingType[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingsPlaylistLogicActions {
+ addDeletedRecordings: (ids: string[]) => {
+ ids: string[]
+ } // deletedRecordingsLogic
+ setHideViewedRecordings: (hideViewedRecordings: HideViewedRecordingsOptions) => {
+ hideViewedRecordings: HideViewedRecordingsOptions
+ } // playerSettingsLogic
+ setIsFiltersExpanded: (isFiltersExpanded: boolean) => {
+ isFiltersExpanded: boolean
+ } // playlistFiltersLogic
+ reportRecordingsListFetched: (
+ loadTime: number,
+ filters: RecordingUniversalFilters,
+ defaultDurationFilter: RecordingDurationFilter
+ ) => {
+ defaultDurationFilter: RecordingDurationFilter
+ filters: RecordingUniversalFilters
+ loadTime: number
+ } // sessionRecordingEventUsageLogic
+ reportRecordingsListFilterAdded: (filterType: SessionRecordingFilterType) => {
+ filterType: SessionRecordingFilterType
+ } // sessionRecordingEventUsageLogic
+ maybeLoadPropertiesForSessions: (sessions: SessionRecordingType[]) => {
+ sessions: SessionRecordingType[]
+ } // sessionRecordingsListPropertiesLogic
+ applyPropertyFilter: (
+ propertyKey: string,
+ propertyValue: string | undefined
+ ) => {
+ propertyKey: string
+ propertyValue: string | undefined
+ }
+ handleBulkAddToPlaylist: (short_id: string) => {
+ short_id: string
+ }
+ handleBulkDeleteFromPlaylist: (short_id: string) => {
+ short_id: string
+ }
+ handleBulkMarkAsNotViewed: (shortId?: string) => {
+ shortId: string | undefined
+ }
+ handleBulkMarkAsViewed: (shortId?: string) => {
+ shortId: string | undefined
+ }
+ handleCreateNewCollectionBulkAdd: (onSuccess: () => void) => {
+ onSuccess: () => void
+ }
+ handleDeleteSelectedRecordings: (shortId?: string) => {
+ shortId: string | undefined
+ }
+ handleSelectUnselectAll: (
+ checked: boolean,
+ type: 'collection' | 'filters'
+ ) => {
+ checked: boolean
+ type: 'collection' | 'filters'
+ }
+ loadAllRecordings: () => {
+ value: true
+ }
+ loadCollectionsForBulkAdd: (_: any) => any
+ loadCollectionsForBulkAddFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadCollectionsForBulkAddSuccess: (
+ collectionsForBulkAdd: SavedSessionRecordingPlaylistsResult,
+ payload?: any
+ ) => {
+ collectionsForBulkAdd: SavedSessionRecordingPlaylistsResult
+ payload?: any
+ }
+ loadEventsHaveSessionId: () => any
+ loadEventsHaveSessionIdFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadEventsHaveSessionIdSuccess: (
+ eventsHaveSessionId: Record<string, boolean>,
+ payload?: any
+ ) => {
+ eventsHaveSessionId: Record<string, boolean>
+ payload?: any
+ }
+ loadNext: () => {
+ value: true
+ }
+ loadPinnedRecordings: () => {
+ value: true
+ }
+ loadPinnedRecordingsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPinnedRecordingsSuccess: (
+ pinnedRecordings: SessionRecordingType[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ pinnedRecordings: SessionRecordingType[]
+ payload?: {
+ value: true
+ }
+ }
+ loadPrev: () => {
+ value: true
+ }
+ loadSessionRecordings: (
+ direction?: 'newer' | 'older',
+ userModifiedFilters?: Record<string, any>
+ ) => {
+ direction: 'newer' | 'older' | undefined
+ userModifiedFilters: Record<string, any> | undefined
+ }
+ loadSessionRecordingsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSessionRecordingsSuccess: (
+ sessionRecordingsResponse: {
+ has_next: boolean
+ next_cursor: string | undefined
+ order:
+ | 'active_seconds'
+ | 'activity_score'
+ | 'click_count'
+ | 'console_error_count'
+ | 'duration'
+ | 'inactive_seconds'
+ | 'keypress_count'
+ | 'mouse_activity_count'
+ | 'recording_duration'
+ | 'recording_ttl'
+ | 'start_time'
+ | 'surfacing_score'
+ | undefined
+ order_direction: RecordingOrderDirection | undefined
+ results: SessionRecordingType[]
+ },
+ payload?: {
+ direction: 'newer' | 'older' | undefined
+ userModifiedFilters: Record<string, any> | undefined
+ }
+ ) => {
+ sessionRecordingsResponse: {
+ has_next: boolean
+ next_cursor: string | undefined
+ order:
+ | 'active_seconds'
+ | 'activity_score'
+ | 'click_count'
+ | 'console_error_count'
+ | 'duration'
+ | 'inactive_seconds'
+ | 'keypress_count'
+ | 'mouse_activity_count'
+ | 'recording_duration'
+ | 'recording_ttl'
+ | 'start_time'
+ | 'surfacing_score'
+ | undefined
+ order_direction: RecordingOrderDirection | undefined
+ results: SessionRecordingType[]
+ }
+ payload?: {
+ direction: 'newer' | 'older' | undefined
+ userModifiedFilters: Record<string, any> | undefined
+ }
+ }
+ maybeLoadSessionRecordings: (direction?: 'newer' | 'older') => {
+ direction: 'newer' | 'older' | undefined
+ }
+ resetFilters: () => {
+ value: true
+ }
+ setAddToCollectionSearch: (addToCollectionSearch: string) => {
+ addToCollectionSearch: string
+ }
+ setDeleteConfirmationText: (deleteConfirmationText: string) => {
+ deleteConfirmationText: string
+ }
+ setFilters: (filters: Partial<RecordingUniversalFilters>) => {
+ filters: Partial<RecordingUniversalFilters>
+ }
+ setIsAddToCollectionModalOpen: (isAddToCollectionModalOpen: boolean) => {
+ isAddToCollectionModalOpen: boolean
+ }
+ setIsCreatingNewCollectionInModal: (isCreatingNewCollectionInModal: boolean) => {
+ isCreatingNewCollectionInModal: boolean
+ }
+ setIsDeleteSelectedRecordingsDialogOpen: (isDeleteSelectedRecordingsDialogOpen: boolean) => {
+ isDeleteSelectedRecordingsDialogOpen: boolean
+ }
+ setNewCollectionName: (newCollectionName: string) => {
+ newCollectionName: string
+ }
+ setSelectedRecordingId: (id: SessionRecordingType['id'] | null) => {
+ id: string | null
+ }
+ setSelectedRecordingsIds: (recordingsIds: string[]) => {
+ recordingsIds: string[]
+ }
+ setShowFilters: (showFilters: boolean) => {
+ showFilters: boolean
+ }
+ setShowSettings: (showSettings: boolean) => {
+ showSettings: boolean
+ }
+ togglePropertyFilter: (
+ propertyKey: string,
+ propertyValue: string | undefined
+ ) => {
+ propertyKey: string
+ propertyValue: string | undefined
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingsPlaylistLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ logicProps: (arg: any) => SessionRecordingPlaylistLogicProps
+ allowEventPropertyExpansion: (featureFlags: FeatureFlagsSet) => boolean
+ matchingEventsMatchType: (filters: RecordingUniversalFilters) => MatchingEventsMatchType
+ activeSessionRecordingId: (
+ selectedRecordingId: string | null,
+ recordings: SessionRecordingType[],
+ arg: any
+ ) => SessionRecordingId | undefined
+ activeSessionRecording: (
+ activeSessionRecordingId: string | undefined,
+ recordings: SessionRecordingType[]
+ ) => SessionRecordingType | undefined
+ selectedRecordingOutsideFilters: (
+ selectedRecordingId: string | null,
+ recordings: SessionRecordingType[]
+ ) => boolean
+ nextSessionRecording: (
+ activeSessionRecording: SessionRecordingType | undefined,
+ recordings: SessionRecordingType[],
+ autoplayDirection: AutoplayDirection
+ ) => Partial<SessionRecordingType> | undefined
+ hasNext: (
+ sessionRecordingsResponse: RecordingsQueryResponse & {
+ order: RecordingsQuery['order']
+ order_direction: RecordingsQuery['order_direction']
+ }
+ ) => boolean
+ pinnedFilters: (arg: any) => UniversalFiltersGroup | undefined
+ totalFiltersCount: (filters: RecordingUniversalFilters, arg: any, arg2: any) => number
+ hiddenRecordings: (
+ sessionRecordings: SessionRecordingType[],
+ hideViewedRecordings: HideViewedRecordingsOptions,
+ selectedRecordingId: string | null,
+ deletedRecordingIds: Set<string>
+ ) => SessionRecordingType[]
+ otherRecordings: (
+ sessionRecordings: SessionRecordingType[],
+ hideViewedRecordings: HideViewedRecordingsOptions,
+ pinnedRecordings: SessionRecordingType[],
+ deletedRecordingIds: Set<string>,
+ selectedRecordingId: string | null,
+ filters: RecordingUniversalFilters
+ ) => SessionRecordingType[]
+ visiblePinnedRecordings: (
+ pinnedRecordings: SessionRecordingType[],
+ deletedRecordingIds: Set<string>
+ ) => SessionRecordingType[]
+ recordings: (
+ visiblePinnedRecordings: SessionRecordingType[],
+ otherRecordings: SessionRecordingType[],
+ arg: any
+ ) => SessionRecordingType[]
+ recordingsCount: (recordings: SessionRecordingType[]) => number
+ hiddenRecordingsCount: (hiddenRecordings: SessionRecordingType[]) => number
+ allowHogQLFilters: (featureFlags: FeatureFlagsSet) => boolean
+ }
+}
+
+export type sessionRecordingsPlaylistLogicType = MakeLogicType<
+ sessionRecordingsPlaylistLogicValues,
+ sessionRecordingsPlaylistLogicActions,
+ SessionRecordingPlaylistLogicProps,
+ sessionRecordingsPlaylistLogicMeta
+>
+
export const sessionRecordingsPlaylistLogic = kea<sessionRecordingsPlaylistLogicType>([
path((key) => ['scenes', 'session-recordings', 'playlist', 'sessionRecordingsPlaylistLogic', key]),
props({} as SessionRecordingPlaylistLogicProps),
@@ -1226,14 +1593,14 @@ export const sessionRecordingsPlaylistLogic = kea<sessionRecordingsPlaylistLogic
allowEventPropertyExpansion: [
(s) => [s.featureFlags],
- (featureFlags): boolean => {
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet): boolean => {
return !!featureFlags[FEATURE_FLAGS.RECORDINGS_PLAYER_EVENT_PROPERTY_EXPANSION]
},
],
matchingEventsMatchType: [
(s) => [s.filters],
- (filters): MatchingEventsMatchType => {
+ (filters: RecordingUniversalFilters): MatchingEventsMatchType => {
if (!filters) {
return { matchType: 'none' }
}
@@ -1280,21 +1647,28 @@ export const sessionRecordingsPlaylistLogic = kea<sessionRecordingsPlaylistLogic
activeSessionRecordingId: [
(s) => [s.selectedRecordingId, s.recordings, (_, props) => props.autoPlay],
- (selectedRecordingId, recordings, autoPlay): SessionRecordingId | undefined => {
+ (
+ selectedRecordingId: SessionRecordingType['id'] | null,
+ recordings: SessionRecordingType[],
+ autoPlay
+ ): SessionRecordingId | undefined => {
return selectedRecordingId ? selectedRecordingId : autoPlay ? recordings[0]?.id : undefined
},
],
activeSessionRecording: [
(s) => [s.activeSessionRecordingId, s.recordings],
- (activeSessionRecordingId, recordings): SessionRecordingType | undefined => {
+ (
+ activeSessionRecordingId: SessionRecordingId | undefined,
+ recordings: SessionRecordingType[]
+ ): SessionRecordingType | undefined => {
return recordings.find((rec) => rec.id === activeSessionRecordingId)
},
],
selectedRecordingOutsideFilters: [
(s) => [s.selectedRecordingId, s.recordings],
- (selectedRecordingId, recordings): boolean => {
+ (selectedRecordingId: SessionRecordingType['id'] | null, recordings: SessionRecordingType[]): boolean => {
if (!selectedRecordingId) {
return false
}
@@ -1304,7 +1678,11 @@ export const sessionRecordingsPlaylistLogic = kea<sessionRecordingsPlaylistLogic
nextSessionRecording: [
(s) => [s.activeSessionRecording, s.recordings, s.autoplayDirection],
- (activeSessionRecording, recordings, autoplayDirection): Partial<SessionRecordingType> | undefined => {
+ (
+ activeSessionRecording: SessionRecordingType | undefined,
+ recordings: SessionRecordingType[],
+ autoplayDirection: import('~/types').AutoplayDirection
+ ): Partial<SessionRecordingType> | undefined => {
if (!activeSessionRecording || !autoplayDirection) {
return
}
@@ -1317,7 +1695,12 @@ export const sessionRecordingsPlaylistLogic = kea<sessionRecordingsPlaylistLogic
hasNext: [
(s) => [s.sessionRecordingsResponse],
- (sessionRecordingsResponse) => sessionRecordingsResponse.has_next,
+ (
+ sessionRecordingsResponse: RecordingsQueryResponse & {
+ order: RecordingsQuery['order']
+ order_direction: RecordingsQuery['order_direction']
+ }
+ ) => sessionRecordingsResponse.has_next,
],
pinnedFilters: [
@@ -1327,7 +1710,7 @@ export const sessionRecordingsPlaylistLogic = kea<sessionRecordingsPlaylistLogic
totalFiltersCount: [
(s) => [s.filters, (_, props) => props.personUUID, (_, props) => props.pinnedFilters],
- (filters, personUUID, pinnedFilters) => {
+ (filters: RecordingUniversalFilters, personUUID, pinnedFilters) => {
const defaultFilters = getDefaultFilters(personUUID, pinnedFilters)
const groupFilters = filtersFromUniversalFilterGroups(filters)
const pinnedValues: UniversalFilterValue[] = pinnedFilters?.values ?? []
@@ -1346,10 +1729,10 @@ export const sessionRecordingsPlaylistLogic = kea<sessionRecordingsPlaylistLogic
hiddenRecordings: [
(s) => [s.sessionRecordings, s.hideViewedRecordings, s.selectedRecordingId, s.deletedRecordingIds],
(
- sessionRecordings,
- hideViewedRecordings,
- selectedRecordingId,
- deletedRecordingIds
+ sessionRecordings: SessionRecordingType[],
+ hideViewedRecordings: import('../player/playerSettingsLogic').HideViewedRecordingsOptions,
+ selectedRecordingId: SessionRecordingType['id'] | null,
+ deletedRecordingIds: Set<string>
): SessionRecordingType[] => {
return sessionRecordings.filter((rec) => {
if (deletedRecordingIds.has(rec.id)) {
@@ -1383,12 +1766,12 @@ export const sessionRecordingsPlaylistLogic = kea<sessionRecordingsPlaylistLogic
s.filters,
],
(
- sessionRecordings,
- hideViewedRecordings,
- pinnedRecordings,
- deletedRecordingIds,
- selectedRecordingId,
- filters
+ sessionRecordings: SessionRecordingType[],
+ hideViewedRecordings: import('../player/playerSettingsLogic').HideViewedRecordingsOptions,
+ pinnedRecordings: SessionRecordingType[],
+ deletedRecordingIds: Set<string>,
+ selectedRecordingId: SessionRecordingType['id'] | null,
+ filters: RecordingUniversalFilters
): SessionRecordingType[] => {
const filteredRecordings = sessionRecordings.filter((rec) => {
if (deletedRecordingIds.has(rec.id)) {
@@ -1425,7 +1808,7 @@ export const sessionRecordingsPlaylistLogic = kea<sessionRecordingsPlaylistLogic
// pinnedRecordings is a lazyLoader so we can't add filtering there directly
visiblePinnedRecordings: [
(s) => [s.pinnedRecordings, s.deletedRecordingIds],
- (pinnedRecordings, deletedRecordingIds): SessionRecordingType[] => {
+ (pinnedRecordings: SessionRecordingType[], deletedRecordingIds: Set<string>): SessionRecordingType[] => {
if (deletedRecordingIds.size === 0) {
return pinnedRecordings
}
@@ -1435,28 +1818,33 @@ export const sessionRecordingsPlaylistLogic = kea<sessionRecordingsPlaylistLogic
recordings: [
(s) => [s.visiblePinnedRecordings, s.otherRecordings, (_, props) => props.onlyPinned],
- (visiblePinnedRecordings, otherRecordings, onlyPinned): SessionRecordingType[] => {
+ (
+ visiblePinnedRecordings: SessionRecordingType[],
+ otherRecordings: SessionRecordingType[],
+ onlyPinned
+ ): SessionRecordingType[] => {
return onlyPinned ? [...visiblePinnedRecordings] : [...visiblePinnedRecordings, ...otherRecordings]
},
],
recordingsCount: [
(s) => [s.recordings],
- (recordings): number => {
+ (recordings: SessionRecordingType[]): number => {
return recordings.length
},
],
hiddenRecordingsCount: [
(s) => [s.hiddenRecordings],
- (hiddenRecordings): number => {
+ (hiddenRecordings: SessionRecordingType[]): number => {
return hiddenRecordings?.length ?? 0
},
],
allowHogQLFilters: [
(s) => [s.featureFlags],
- (featureFlags): boolean => !!featureFlags[FEATURE_FLAGS.REPLAY_HOGQL_FILTERS],
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet): boolean =>
+ !!featureFlags[FEATURE_FLAGS.REPLAY_HOGQL_FILTERS],
],
}),
diff --git a/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistSceneLogic.ts b/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistSceneLogic.ts
index 71d71d59bbbf..b472642e6858 100644
--- a/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistSceneLogic.ts
+++ b/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistSceneLogic.ts
@@ -1,5 +1,5 @@
import { deepEqual as equal } from 'fast-equals'
-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 { beforeUnload, combineUrl, router, urlToAction } from 'kea-router'
@@ -31,15 +31,189 @@ import {
SessionRecordingType,
} from '~/types'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { CohortType } from '../../../types'
import { addRecordingToPlaylist, removeRecordingFromPlaylist } from '../player/utils/playerUtils'
import { filtersFromUniversalFilterGroups, isUniversalFilters } from '../utils'
import { PINNED_RECORDINGS_LIMIT, convertLegacyFiltersToUniversalFilters } from './sessionRecordingsPlaylistLogic'
-import type { sessionRecordingsPlaylistSceneLogicType } from './sessionRecordingsPlaylistSceneLogicType'
export interface SessionRecordingsPlaylistLogicProps {
shortId: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingsPlaylistSceneLogicValues {
+ cohortsById: Partial<Record<number | string, CohortType>> // cohortsModel
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ activeSceneId: string | null // sceneLogic
+ breadcrumbs: Breadcrumb[]
+ derivedName: string
+ filters: LegacyRecordingFilters | RecordingUniversalFilters | null
+ hasChanges: boolean
+ pinnedRecordings: SessionRecordingType[] | null
+ pinnedRecordingsLoading: boolean
+ playlist: SessionRecordingPlaylistType | null
+ playlistLoading: boolean
+ projectTreeRef: ProjectTreeRef
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingsPlaylistSceneLogicActions {
+ reportRecordingPlaylistCreated: (source: 'duplicate' | 'filters' | 'new' | 'pin') => {
+ source: 'duplicate' | 'filters' | 'new' | 'pin'
+ } // sessionRecordingEventUsageLogic
+ deletePlaylist: () => any
+ deletePlaylistFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deletePlaylistSuccess: (
+ playlist: SessionRecordingPlaylistType | null,
+ payload?: any
+ ) => {
+ playlist: SessionRecordingPlaylistType | null
+ payload?: any
+ }
+ duplicatePlaylist: () => any
+ duplicatePlaylistFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ duplicatePlaylistSuccess: (
+ playlist: SessionRecordingPlaylistType | null,
+ payload?: any
+ ) => {
+ playlist: SessionRecordingPlaylistType | null
+ payload?: any
+ }
+ getPlaylist: () => any
+ getPlaylistFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ getPlaylistSuccess: (
+ playlist: SessionRecordingPlaylistType | null,
+ payload?: any
+ ) => {
+ playlist: SessionRecordingPlaylistType | null
+ payload?: any
+ }
+ loadPinnedRecordings: () => {
+ value: true
+ }
+ loadPinnedRecordingsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPinnedRecordingsSuccess: (
+ pinnedRecordings: SessionRecordingType[] | null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ pinnedRecordings: SessionRecordingType[] | null
+ payload?: {
+ value: true
+ }
+ }
+ markPlaylistViewed: () => {
+ value: true
+ }
+ onPinnedChange: (
+ recording: SessionRecordingType,
+ pinned: boolean
+ ) => {
+ pinned: boolean
+ recording: SessionRecordingType
+ }
+ onPinnedChangeFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ onPinnedChangeSuccess: (
+ pinnedRecordings: SessionRecordingType[],
+ payload?: {
+ pinned: boolean
+ recording: SessionRecordingType
+ }
+ ) => {
+ pinnedRecordings: SessionRecordingType[]
+ payload?: {
+ pinned: boolean
+ recording: SessionRecordingType
+ }
+ }
+ setFilters: (filters: LegacyRecordingFilters | RecordingUniversalFilters | null) => {
+ filters: LegacyRecordingFilters | RecordingUniversalFilters | null
+ }
+ updatePlaylist: (
+ properties?: Partial<SessionRecordingPlaylistType>,
+ silent?: any
+ ) => {
+ properties: Partial<SessionRecordingPlaylistType> | undefined
+ silent: any
+ }
+ updatePlaylistFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updatePlaylistSuccess: (
+ playlist: SessionRecordingPlaylistType | null,
+ payload?: {
+ properties: Partial<SessionRecordingPlaylistType> | undefined
+ silent: any
+ }
+ ) => {
+ playlist: SessionRecordingPlaylistType | null
+ payload?: {
+ properties: Partial<SessionRecordingPlaylistType> | undefined
+ silent: any
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingsPlaylistSceneLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ breadcrumbs: (playlist: SessionRecordingPlaylistType | null, featureFlags: FeatureFlagsSet) => Breadcrumb[]
+ projectTreeRef: (arg: string) => ProjectTreeRef
+ hasChanges: (
+ playlist: SessionRecordingPlaylistType | null,
+ filters: LegacyRecordingFilters | RecordingUniversalFilters | null
+ ) => boolean
+ derivedName: (
+ filters: LegacyRecordingFilters | RecordingUniversalFilters | null,
+ cohortsById: Partial<Record<number | string, CohortType>>
+ ) => string
+ }
+}
+
+export type sessionRecordingsPlaylistSceneLogicType = MakeLogicType<
+ sessionRecordingsPlaylistSceneLogicValues,
+ sessionRecordingsPlaylistSceneLogicActions,
+ SessionRecordingsPlaylistLogicProps,
+ sessionRecordingsPlaylistSceneLogicMeta
+>
+
export const sessionRecordingsPlaylistSceneLogic = kea<sessionRecordingsPlaylistSceneLogicType>([
path((key) => ['scenes', 'session-recordings', 'playlist', 'sessionRecordingsPlaylistSceneLogic', key]),
props({} as SessionRecordingsPlaylistLogicProps),
@@ -185,7 +359,7 @@ export const sessionRecordingsPlaylistSceneLogic = kea<sessionRecordingsPlaylist
selectors(() => ({
breadcrumbs: [
(s) => [s.playlist, s.featureFlags],
- (playlist): Breadcrumb[] => [
+ (playlist: SessionRecordingPlaylistType | null): Breadcrumb[] => [
{
key: ReplayTabs.Playlists,
name: 'Collections',
@@ -201,17 +375,23 @@ export const sessionRecordingsPlaylistSceneLogic = kea<sessionRecordingsPlaylist
],
projectTreeRef: [
() => [(_, props: SessionRecordingsPlaylistLogicProps) => props.shortId],
- (shortId): ProjectTreeRef => ({ type: 'session_recording_playlist', ref: String(shortId) }),
+ (shortId: string): ProjectTreeRef => ({ type: 'session_recording_playlist', ref: String(shortId) }),
],
hasChanges: [
(s) => [s.playlist, s.filters],
- (playlist, filters): boolean => {
+ (
+ playlist: SessionRecordingPlaylistType | null,
+ filters: LegacyRecordingFilters | RecordingUniversalFilters | null
+ ): boolean => {
return !equal(playlist?.filters, filters)
},
],
derivedName: [
(s) => [s.filters, s.cohortsById],
- (filters, cohortsById) => {
+ (
+ filters: LegacyRecordingFilters | RecordingUniversalFilters | null,
+ cohortsById: Partial<Record<number | string, import('~/types').CohortType>>
+ ) => {
if (!filters) {
return 'Unnamed'
}
diff --git a/frontend/src/scenes/session-recordings/sessionRecordingEventUsageLogic.ts b/frontend/src/scenes/session-recordings/sessionRecordingEventUsageLogic.ts
index b43daa5da193..22c840ffe4c6 100644
--- a/frontend/src/scenes/session-recordings/sessionRecordingEventUsageLogic.ts
+++ b/frontend/src/scenes/session-recordings/sessionRecordingEventUsageLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, listeners, path } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path } from 'kea'
import posthog from 'posthog-js'
import { isLogEntryPropertyFilter, isValidPropertyFilter } from 'lib/components/PropertyFilters/utils'
@@ -18,7 +18,7 @@ import {
SessionRecordingType,
} from '~/types'
-import type { sessionRecordingEventUsageLogicType } from './sessionRecordingEventUsageLogicType'
+import type { Realm, UserType } from '../../types'
export enum SessionRecordingFilterType {
Duration = 'duration',
@@ -37,6 +37,122 @@ interface RecordingViewedProps {
snapshot_source: 'web' | 'mobile' | 'unknown'
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingEventUsageLogicValues {
+ realm: Realm | null // preflightLogic
+ user: UserType | null // userLogic
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingEventUsageLogicActions {
+ reportAISessionSummaryCopiedForLLM: (
+ recording_id: string,
+ properties: {
+ has_session_outcome: boolean
+ key_action_count: number
+ segment_count: number
+ }
+ ) => {
+ has_session_outcome: boolean
+ key_action_count: number
+ recording_id: string
+ segment_count: number
+ }
+ reportAISessionSummaryViewed: (
+ recording_id: string,
+ source: 'dock',
+ summary_id: string | null
+ ) => {
+ recording_id: string
+ source: 'dock'
+ summary_id: string | null
+ }
+ reportNextRecordingTriggered: (automatic: boolean) => {
+ automatic: boolean
+ }
+ reportRecordingExportedToFile: () => {
+ value: true
+ }
+ reportRecordingInspectorItemExpanded: (
+ tab: InspectorListItemType,
+ index: number
+ ) => {
+ index: number
+ tab:
+ | 'app-state'
+ | 'browser-visibility'
+ | 'comment'
+ | 'console'
+ | 'doctor'
+ | 'events'
+ | 'experiment-variant'
+ | 'inactivity'
+ | 'inspector-summary'
+ | 'logs'
+ | 'network'
+ | 'offline-status'
+ | 'performance'
+ | 'session-change'
+ }
+ reportRecordingInspectorMiniFilterViewed: (
+ minifilterKey: MiniFilterKey,
+ enabled: boolean
+ ) => {
+ enabled: boolean
+ minifilterKey: string
+ }
+ reportRecordingListVisibilityToggled: (
+ type: string,
+ visible: boolean
+ ) => {
+ type: string
+ visible: boolean
+ }
+ reportRecordingLoaded: (
+ playerData: SessionPlayerData,
+ metadata: SessionRecordingType | null
+ ) => {
+ metadata: SessionRecordingType | null
+ playerData: SessionPlayerData
+ }
+ reportRecordingLoadedFromFile: (data: { error?: string; success: boolean }) => {
+ error?: string | undefined
+ success: boolean
+ }
+ reportRecordingOpenedFromRecentRecordingList: () => {
+ value: true
+ }
+ reportRecordingPinnedToList: (pinned: boolean) => {
+ pinned: boolean
+ }
+ reportRecordingPlayerSeekbarEventHovered: () => {
+ value: true
+ }
+ reportRecordingPlaylistCreated: (source: 'duplicate' | 'filters' | 'new' | 'pin') => {
+ source: 'duplicate' | 'filters' | 'new' | 'pin'
+ }
+ reportRecordingsListFetched: (
+ loadTime: number,
+ filters: RecordingUniversalFilters,
+ defaultDurationFilter: RecordingDurationFilter
+ ) => {
+ defaultDurationFilter: RecordingDurationFilter
+ filters: RecordingUniversalFilters
+ loadTime: number
+ }
+ reportRecordingsListFilterAdded: (filterType: SessionRecordingFilterType) => {
+ filterType: SessionRecordingFilterType
+ }
+ reportRecordingsListPropertiesFetched: (loadTime: number) => {
+ loadTime: number
+ }
+}
+
+export type sessionRecordingEventUsageLogicType = MakeLogicType<
+ sessionRecordingEventUsageLogicValues,
+ sessionRecordingEventUsageLogicActions
+>
+
export const sessionRecordingEventUsageLogic = kea<sessionRecordingEventUsageLogicType>([
path(['scenes', 'session-recordings', 'sessionRecordingEventUsageLogic']),
connect(() => ({
diff --git a/frontend/src/scenes/session-recordings/sessionReplaySceneLogic.ts b/frontend/src/scenes/session-recordings/sessionReplaySceneLogic.ts
index 498dc6dcedce..2c00d2e83a8c 100644
--- a/frontend/src/scenes/session-recordings/sessionReplaySceneLogic.ts
+++ b/frontend/src/scenes/session-recordings/sessionReplaySceneLogic.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 { router, urlToAction } from 'kea-router'
import { trackedActionToUrl } from 'lib/logic/scenes/trackedActionToUrl'
@@ -10,8 +10,6 @@ import { urls } from 'scenes/urls'
import { SIDE_PANEL_CONTEXT_KEY, SidePanelSceneContext } from '~/layout/navigation-3000/sidepanel/types'
import { ActivityScope, Breadcrumb, ReplayTabs } from '~/types'
-import type { sessionReplaySceneLogicType } from './sessionReplaySceneLogicType'
-
export const humanFriendlyTabName = (tab: ReplayTabs): string => {
switch (tab) {
case ReplayTabs.Home:
@@ -27,6 +25,39 @@ export const humanFriendlyTabName = (tab: ReplayTabs): string => {
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionReplaySceneLogicValues {
+ breadcrumbs: Breadcrumb[]
+ shouldShowNewBadge: boolean
+ sidePanelContext: SidePanelSceneContext
+ tab: ReplayTabs
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionReplaySceneLogicActions {
+ hideNewBadge: () => {
+ value: true
+ }
+ setTab: (tab?: ReplayTabs) => {
+ tab: ReplayTabs
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionReplaySceneLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ breadcrumbs: (tab: ReplayTabs) => Breadcrumb[]
+ sidePanelContext: (searchParams: Record<string, any>) => SidePanelSceneContext
+ }
+}
+
+export type sessionReplaySceneLogicType = MakeLogicType<
+ sessionReplaySceneLogicValues,
+ sessionReplaySceneLogicActions,
+ Record<string, any>,
+ sessionReplaySceneLogicMeta
+>
+
export const sessionReplaySceneLogic = kea<sessionReplaySceneLogicType>([
path(() => ['scenes', 'session-recordings', 'sessionReplaySceneLogic']),
actions({
diff --git a/frontend/src/scenes/session-recordings/settings/SessionRecordingsSettingsScene.tsx b/frontend/src/scenes/session-recordings/settings/SessionRecordingsSettingsScene.tsx
index 689d51c46e17..92bd879ede00 100644
--- a/frontend/src/scenes/session-recordings/settings/SessionRecordingsSettingsScene.tsx
+++ b/frontend/src/scenes/session-recordings/settings/SessionRecordingsSettingsScene.tsx
@@ -1,4 +1,4 @@
-import { BindLogic, kea, path, selectors } from 'kea'
+import { MakeLogicType, BindLogic, kea, path, selectors } from 'kea'
import { router } from 'kea-router'
import { sceneConfigurations } from 'scenes/scenes'
@@ -13,10 +13,16 @@ import { Breadcrumb } from '~/types'
import { SessionRecordingsPageTabs } from '../SessionRecordings'
import { sessionReplaySceneLogic } from '../sessionReplaySceneLogic'
-import type { sessionRecordingsSettingsSceneLogicType } from './SessionRecordingsSettingsSceneType'
export const SETTINGS_LOGIC_KEY = 'replaySettings'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionRecordingsSettingsSceneLogicValues {
+ breadcrumbs: Breadcrumb[]
+}
+
+export type sessionRecordingsSettingsSceneLogicType = MakeLogicType<sessionRecordingsSettingsSceneLogicValues, {}>
+
export const sessionRecordingsSettingsSceneLogic = kea<sessionRecordingsSettingsSceneLogicType>([
path(['scenes', 'session-recordings', 'settings', 'sessionRecordingsSettingsSceneLogic']),
selectors({
diff --git a/frontend/src/scenes/session-recordings/templates/sessionRecordingTemplatesLogic.tsx b/frontend/src/scenes/session-recordings/templates/sessionRecordingTemplatesLogic.tsx
index 4738e19d0d2b..fc21139dcc1c 100644
--- a/frontend/src/scenes/session-recordings/templates/sessionRecordingTemplatesLogic.tsx
+++ b/frontend/src/scenes/session-recordings/templates/sessionRecordingTemplatesLogic.tsx
@@ -1,5 +1,5 @@
import clsx from 'clsx'
-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 { router } from 'kea-router'
import posthog from 'posthog-js'
@@ -18,7 +18,7 @@ import {
UniversalFiltersGroupValue,
} from '~/types'
-import type { sessionReplayTemplatesLogicType } from './sessionRecordingTemplatesLogicType'
+import type { TeamPublicType, TeamType } from '../../../types'
const getPageviewFilterValue = (pageview: string): UniversalFiltersGroupValue => {
return {
@@ -64,6 +64,57 @@ export interface ReplayTemplateLogicPropsType {
category: ReplayTemplateCategory
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionReplayTemplatesLogicValues {
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ areAnyVariablesTouched: boolean
+ canApplyFilters: boolean
+ editableVariables: ReplayTemplateVariableType[]
+ filterGroup: Partial<RecordingUniversalFilters>
+ variables: ReplayTemplateVariableType[]
+ variablesVisible: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionReplayTemplatesLogicActions {
+ hideVariables: () => {
+ value: true
+ }
+ navigate: () => {
+ value: true
+ }
+ resetVariable: (variable: ReplayTemplateVariableType) => {
+ variable: ReplayTemplateVariableType
+ }
+ setVariable: (variable: ReplayTemplateVariableType) => {
+ variable: ReplayTemplateVariableType
+ }
+ setVariables: (variables?: ReplayTemplateVariableType[]) => {
+ variables: ReplayTemplateVariableType[] | undefined
+ }
+ showVariables: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionReplayTemplatesLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ filterGroup: (variables: ReplayTemplateVariableType[]) => Partial<RecordingUniversalFilters>
+ canApplyFilters: (variables: ReplayTemplateVariableType[], areAnyVariablesTouched: boolean) => boolean
+ areAnyVariablesTouched: (variables: ReplayTemplateVariableType[]) => boolean
+ editableVariables: (variables: ReplayTemplateVariableType[]) => ReplayTemplateVariableType[]
+ }
+}
+
+export type sessionReplayTemplatesLogicType = MakeLogicType<
+ sessionReplayTemplatesLogicValues,
+ sessionReplayTemplatesLogicActions,
+ ReplayTemplateLogicPropsType,
+ sessionReplayTemplatesLogicMeta
+>
+
export const sessionReplayTemplatesLogic = kea<sessionReplayTemplatesLogicType>([
path(() => ['scenes', 'session-recordings', 'templates', 'sessionReplayTemplatesLogic']),
props({} as ReplayTemplateLogicPropsType),
@@ -110,7 +161,7 @@ export const sessionReplayTemplatesLogic = kea<sessionReplayTemplatesLogicType>(
selectors({
filterGroup: [
(s) => [s.variables],
- (variables) => {
+ (variables: ReplayTemplateVariableType[]) => {
const filters = variables
.map((variable) => {
if (variable.type === 'pageview' && variable.value) {
@@ -146,13 +197,18 @@ export const sessionReplayTemplatesLogic = kea<sessionReplayTemplatesLogicType>(
],
canApplyFilters: [
(s) => [s.variables, s.areAnyVariablesTouched],
- (variables, areAnyVariablesTouched) => areAnyVariablesTouched || variables.length === 0,
+ (variables: ReplayTemplateVariableType[], areAnyVariablesTouched: boolean) =>
+ areAnyVariablesTouched || variables.length === 0,
],
areAnyVariablesTouched: [
(s) => [s.variables],
- (variables) => variables.some((v) => v.touched) || variables.some((v) => v.noTouch),
+ (variables: ReplayTemplateVariableType[]) =>
+ variables.some((v) => v.touched) || variables.some((v) => v.noTouch),
+ ],
+ editableVariables: [
+ (s) => [s.variables],
+ (variables: ReplayTemplateVariableType[]) => variables.filter((v) => !v.noTouch),
],
- editableVariables: [(s) => [s.variables], (variables) => variables.filter((v) => !v.noTouch)],
}),
listeners(({ values, props }) => ({
navigate: () => {
diff --git a/frontend/src/scenes/welcome/welcomeDialogLogic.ts b/frontend/src/scenes/welcome/welcomeDialogLogic.ts
index 7e5b85f481cc..ec3b015c38b6 100644
--- a/frontend/src/scenes/welcome/welcomeDialogLogic.ts
+++ b/frontend/src/scenes/welcome/welcomeDialogLogic.ts
@@ -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 { subscriptions } from 'kea-subscriptions'
import posthog from 'posthog-js'
@@ -6,7 +6,7 @@ import posthog from 'posthog-js'
import api from 'lib/api'
import { userLogic } from 'scenes/userLogic'
-import type { welcomeDialogLogicType } from './welcomeDialogLogicType'
+import type { UserType } from '../../types'
export interface WelcomeInviter {
name: string
@@ -133,6 +133,101 @@ function wasLookedAround(orgId: string | undefined): boolean {
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface welcomeDialogLogicValues {
+ isProvisionedUser: boolean // userLogic
+ user: UserType | null // userLogic
+ hasLoadedOnce: boolean
+ interactedCards: Record<WelcomeCardKind, boolean>
+ inviter: WelcomeInviter | null
+ locallyClosed: boolean
+ organizationName: string
+ popularDashboards: WelcomePopularDashboard[]
+ productsInUse: string[]
+ recentActivity: WelcomeRecentActivity[]
+ shouldShowDialog: boolean
+ shownAt: number | null
+ storageTick: number
+ suggestedNextSteps: WelcomeSuggestedStep[]
+ teamMembers: WelcomeTeamMember[]
+ welcomeData: WelcomePayload
+ welcomeDataError: boolean
+ welcomeDataLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface welcomeDialogLogicActions {
+ acknowledgeStorageChange: () => {
+ value: true
+ }
+ closeDialog: () => {
+ value: true
+ }
+ dismissWelcome: () => {
+ value: true
+ }
+ loadWelcomeData: () => any
+ loadWelcomeDataFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadWelcomeDataSuccess: (
+ welcomeData: WelcomePayload,
+ payload?: any
+ ) => {
+ welcomeData: WelcomePayload
+ payload?: any
+ }
+ markCardInteracted: (card: WelcomeCardKind) => {
+ card: WelcomeCardKind
+ }
+ markShown: () => {
+ value: true
+ }
+ resetForOrgChange: () => {
+ value: true
+ }
+ setWelcomeDataError: (error: boolean) => {
+ error: boolean
+ }
+ trackCardClick: (
+ card: WelcomeCardKind,
+ targetHref: string
+ ) => {
+ card: WelcomeCardKind
+ targetHref: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface welcomeDialogLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ inviter: (welcomeData: WelcomePayload) => WelcomeInviter | null
+ teamMembers: (welcomeData: WelcomePayload) => WelcomeTeamMember[]
+ recentActivity: (welcomeData: WelcomePayload) => WelcomeRecentActivity[]
+ popularDashboards: (welcomeData: WelcomePayload) => WelcomePopularDashboard[]
+ productsInUse: (welcomeData: WelcomePayload) => string[]
+ suggestedNextSteps: (welcomeData: WelcomePayload) => WelcomeSuggestedStep[]
+ organizationName: (welcomeData: WelcomePayload, user: UserType | null) => string
+ shouldShowDialog: (
+ user: UserType | null,
+ isProvisionedUser: boolean,
+ locallyClosed: boolean,
+ storageTick: number
+ ) => boolean
+ }
+}
+
+export type welcomeDialogLogicType = MakeLogicType<
+ welcomeDialogLogicValues,
+ welcomeDialogLogicActions,
+ Record<string, any>,
+ welcomeDialogLogicMeta
+>
+
export const welcomeDialogLogic = kea<welcomeDialogLogicType>([
path(['scenes', 'welcome', 'welcomeDialogLogic']),
@@ -228,22 +323,36 @@ export const welcomeDialogLogic = kea<welcomeDialogLogicType>([
})),
selectors({
- inviter: [(s) => [s.welcomeData], (data): WelcomeInviter | null => data.inviter],
- teamMembers: [(s) => [s.welcomeData], (data): WelcomeTeamMember[] => data.team_members],
- recentActivity: [(s) => [s.welcomeData], (data): WelcomeRecentActivity[] => data.recent_activity],
- popularDashboards: [(s) => [s.welcomeData], (data): WelcomePopularDashboard[] => data.popular_dashboards],
- productsInUse: [(s) => [s.welcomeData], (data): string[] => data.products_in_use],
- suggestedNextSteps: [(s) => [s.welcomeData], (data): WelcomeSuggestedStep[] => data.suggested_next_steps],
+ inviter: [(s) => [s.welcomeData], (data: WelcomePayload): WelcomeInviter | null => data.inviter],
+ teamMembers: [(s) => [s.welcomeData], (data: WelcomePayload): WelcomeTeamMember[] => data.team_members],
+ recentActivity: [
+ (s) => [s.welcomeData],
+ (data: WelcomePayload): WelcomeRecentActivity[] => data.recent_activity,
+ ],
+ popularDashboards: [
+ (s) => [s.welcomeData],
+ (data: WelcomePayload): WelcomePopularDashboard[] => data.popular_dashboards,
+ ],
+ productsInUse: [(s) => [s.welcomeData], (data: WelcomePayload): string[] => data.products_in_use],
+ suggestedNextSteps: [
+ (s) => [s.welcomeData],
+ (data: WelcomePayload): WelcomeSuggestedStep[] => data.suggested_next_steps,
+ ],
organizationName: [
(s) => [s.welcomeData, s.user],
- (data, user): string => data.organization_name || user?.organization?.name || '',
+ (data: WelcomePayload, user: null | import('../../types').UserType): string =>
+ data.organization_name || user?.organization?.name || '',
],
// Open for invitees (not the org creator) and for partner-provisioned accounts (which have no
// inviter, so they'd otherwise never see it), when not already dismissed.
// `storageTick` is in the dependency list so cross-tab localStorage changes re-run the selector.
shouldShowDialog: [
(s) => [s.user, s.isProvisionedUser, s.locallyClosed, s.storageTick],
- (user, isProvisionedUser, locallyClosed): boolean => {
+ (
+ user: null | import('../../types').UserType,
+ isProvisionedUser: boolean,
+ locallyClosed: boolean
+ ): boolean => {
if (!user || (user.is_organization_first_user !== false && !isProvisionedUser)) {
return false
}
diff --git a/frontend/src/scenes/wizard/wizardLogic.tsx b/frontend/src/scenes/wizard/wizardLogic.tsx
index 8bf1fd03bbb4..5cc97ae5fd51 100644
--- a/frontend/src/scenes/wizard/wizardLogic.tsx
+++ b/frontend/src/scenes/wizard/wizardLogic.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 { loaders } from 'kea-loaders'
import { urlToAction } from 'kea-router'
@@ -6,12 +6,109 @@ import api from 'lib/api'
import { organizationLogic } from 'scenes/organizationLogic'
import { projectLogic } from 'scenes/projectLogic'
-import type { wizardLogicType } from './wizardLogicType'
+import type { OrganizationType, ProjectType } from '../../types'
export interface WizardTokenResponseType {
success: boolean
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface wizardLogicValues {
+ currentOrganization: OrganizationType | null // organizationLogic
+ currentProject: ProjectType | null // projectLogic
+ availableProjects: {
+ api_token: string
+ label: string
+ organization: string
+ value: number
+ }[]
+ selectedProject:
+ | {
+ api_token: string
+ label: string
+ organization: string
+ value: number
+ }
+ | undefined
+ selectedProjectId: number | null
+ view: 'invalid' | 'pending' | 'project' | 'success'
+ wizardHash: string | null
+ wizardToken: WizardTokenResponseType | null
+ wizardTokenLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface wizardLogicActions {
+ authenticateWizard: (
+ wizardHash: string,
+ projectId: number
+ ) => {
+ projectId: number
+ wizardHash: string
+ }
+ authenticateWizardFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ authenticateWizardSuccess: (
+ wizardToken: WizardTokenResponseType,
+ payload?: {
+ projectId: number
+ wizardHash: string
+ }
+ ) => {
+ wizardToken: WizardTokenResponseType
+ payload?: {
+ projectId: number
+ wizardHash: string
+ }
+ }
+ continueToAuthentication: () => {}
+ handleWizardRouting: () => {}
+ setSelectedProjectId: (projectId: number | null) => {
+ projectId: number | null
+ }
+ setView: (view: 'invalid' | 'pending' | 'project' | 'success') => {
+ view: 'invalid' | 'pending' | 'project' | 'success'
+ }
+ setWizardHash: (wizardHash: string | null) => {
+ wizardHash: string | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface wizardLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ availableProjects: (currentOrganization: OrganizationType | null) => {
+ api_token: string
+ label: string
+ organization: string
+ value: number
+ }[]
+ selectedProject: (
+ availableProjects: {
+ api_token: string
+ label: string
+ organization: string
+ value: number
+ }[],
+ selectedProjectId: number | null
+ ) =>
+ | {
+ api_token: string
+ label: string
+ organization: string
+ value: number
+ }
+ | undefined
+ }
+}
+
+export type wizardLogicType = MakeLogicType<wizardLogicValues, wizardLogicActions, Record<string, any>, wizardLogicMeta>
+
export const wizardLogic = kea<wizardLogicType>([
path(['scenes', 'wizard', 'wizardLogic']),
connect(() => ({
@@ -70,7 +167,7 @@ export const wizardLogic = kea<wizardLogicType>([
selectors({
availableProjects: [
(s) => [s.currentOrganization],
- (currentOrganization) => {
+ (currentOrganization: null | import('../../types').OrganizationType) => {
return (
currentOrganization?.teams?.map((team) => ({
value: team.id,
@@ -83,7 +180,15 @@ export const wizardLogic = kea<wizardLogicType>([
],
selectedProject: [
(s) => [s.availableProjects, s.selectedProjectId],
- (availableProjects, selectedProjectId) => {
+ (
+ availableProjects: {
+ api_token: string
+ label: string
+ organization: string
+ value: number
+ }[],
+ selectedProjectId: number | null
+ ) => {
return availableProjects.find((project) => project.value === selectedProjectId)
},
],
diff --git a/products/alerts/frontend/logic/alertFormLogic.ts b/products/alerts/frontend/logic/alertFormLogic.ts
index 1599e4913e1e..9ea07c63053b 100644
--- a/products/alerts/frontend/logic/alertFormLogic.ts
+++ b/products/alerts/frontend/logic/alertFormLogic.ts
@@ -1,5 +1,6 @@
-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 { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
import { subscriptions } from 'kea-subscriptions'
@@ -41,7 +42,6 @@ import {
isTrendsAlertConfig,
supportsOngoingInterval,
} from '../types'
-import type { alertFormLogicType } from './alertFormLogicType'
import { getAlertFormValidationErrors } from './alertFormSchema'
import { alertLogic } from './alertLogic'
import { alertNotificationLogic } from './alertNotificationLogic'
@@ -256,6 +256,194 @@ const getThresholdBounds = (goalLines?: GoalLine[] | null): InsightsThresholdBou
return { upper: smallerValue }
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface alertFormLogicValues {
+ insightData: Record<string, any> // insightVizDataLogic
+ goalLines: GoalLine[] | null | undefined // trendsDataLogic
+ alertForm: AlertFormType
+ alertFormAllErrors: Record<string, any>
+ alertFormChanged: boolean
+ alertFormErrors: DeepPartialMap<AlertFormType, ValidationErrorType>
+ alertFormHasErrors: boolean
+ alertFormManualErrors: Record<string, any>
+ alertFormSubmitAttempted: boolean
+ alertFormTouched: boolean
+ alertFormTouches: Record<string, boolean>
+ alertFormValidationErrors: DeepPartialMap<AlertFormType, ValidationErrorType>
+ funnelAlertPreview: FunnelAlertPreview | null
+ hogqlAlertPreview: HogQLAlertPreview | null
+ hogqlConfigPrefill: Partial<Pick<HogQLAlertConfig, 'column' | 'label_column'>> | null
+ hogqlLabelColumnOptions: {
+ label: string
+ value: string
+ }[]
+ hogqlNumericColumns: string[] | null
+ hogqlResultColumns: string[] | null
+ hogqlSuggestedColumn: string | null
+ hogqlValueColumnOptions: {
+ label: string
+ value: string
+ }[]
+ isAlertFormSubmitting: boolean
+ isAlertFormValid: boolean
+ showAlertFormErrors: boolean
+ simulationDateFrom: string | null
+ simulationResult: AlertSimulationResult | null
+ simulationResultLoading: boolean
+ thresholdBoundsFormError: string | undefined
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface alertFormLogicActions {
+ clearSimulation: () => {
+ value: true
+ }
+ clearSimulationFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ clearSimulationSuccess: (
+ simulationResult: null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ simulationResult: null
+ payload?: {
+ value: true
+ }
+ }
+ clearSnooze: () => {
+ value: true
+ }
+ deleteAlert: () => {
+ value: true
+ }
+ resetAlertForm: (values?: AlertFormType) => {
+ values?: AlertFormType
+ }
+ setAlertFormManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setAlertFormSubmitAttempted: () => {
+ value: true
+ }
+ setAlertFormValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setAlertFormValues: (values: DeepPartial<AlertFormType>) => {
+ values: DeepPartial<AlertFormType>
+ }
+ setSimulationDateFrom: (dateFrom: string) => {
+ dateFrom: string
+ }
+ simulateAlert: () => {
+ value: true
+ }
+ simulateAlertFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ simulateAlertSuccess: (
+ simulationResult: AlertSimulationResult | null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ simulationResult: AlertSimulationResult | null
+ payload?: {
+ value: true
+ }
+ }
+ snoozeAlert: (snoozeUntil: string) => {
+ snoozeUntil: string
+ }
+ submitAlertForm: () => {
+ value: boolean
+ }
+ submitAlertFormFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitAlertFormRequest: (alertForm: AlertFormType) => {
+ alertForm: AlertFormType
+ }
+ submitAlertFormSuccess: (alertForm: AlertFormType) => {
+ alertForm: AlertFormType
+ }
+ touchAlertFormField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface alertFormLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ thresholdBoundsFormError: (
+ alertFormSubmitAttempted: boolean,
+ alertFormErrors: DeepPartialMap<AlertFormType, ValidationErrorType>
+ ) => string | undefined
+ hogqlAlertPreview: (
+ insightData: Record<string, any>,
+ arg: AlertConfig,
+ arg2: InsightsThresholdBounds | undefined
+ ) => HogQLAlertPreview | null
+ funnelAlertPreview: (
+ insightData: Record<string, any>,
+ arg: AlertConfig,
+ arg2: InsightsThresholdBounds | undefined,
+ arg3: AlertConditionType,
+ arg4: InsightThresholdType
+ ) => FunnelAlertPreview | null
+ hogqlResultColumns: (insightData: Record<string, any>) => string[] | null
+ hogqlNumericColumns: (insightData: Record<string, any>, hogqlResultColumns: string[] | null) => string[] | null
+ hogqlSuggestedColumn: (
+ hogqlResultColumns: string[] | null,
+ hogqlNumericColumns: string[] | null
+ ) => string | null
+ hogqlConfigPrefill: (
+ hogqlResultColumns: string[] | null,
+ hogqlSuggestedColumn: string | null,
+ arg: AlertConfig
+ ) => Partial<Pick<HogQLAlertConfig, 'column' | 'label_column'>> | null
+ hogqlValueColumnOptions: (
+ hogqlResultColumns: string[] | null,
+ hogqlNumericColumns: string[] | null
+ ) => {
+ label: string
+ value: string
+ }[]
+ hogqlLabelColumnOptions: (
+ hogqlResultColumns: string[] | null,
+ arg: AlertConfig
+ ) => {
+ label: string
+ value: string
+ }[]
+ }
+}
+
+export type alertFormLogicType = MakeLogicType<
+ alertFormLogicValues,
+ alertFormLogicActions,
+ AlertFormLogicProps,
+ alertFormLogicMeta
+>
+
export const alertFormLogic = kea<alertFormLogicType>([
path(['lib', 'components', 'Alerts', 'alertFormLogic']),
props({} as AlertFormLogicProps),
@@ -493,7 +681,13 @@ export const alertFormLogic = kea<alertFormLogicType>([
selectors(({ props }) => ({
thresholdBoundsFormError: [
(s) => [s.alertFormSubmitAttempted, s.alertFormErrors],
- (submitAttempted, alertFormErrors): string | undefined => {
+ (
+ submitAttempted: boolean,
+ alertFormErrors: import('node_modules/kea-forms/lib').DeepPartialMap<
+ AlertFormType,
+ import('node_modules/kea-forms/lib').ValidationErrorType
+ >
+ ): string | undefined => {
if (!submitAttempted) {
return undefined
}
@@ -546,7 +740,7 @@ export const alertFormLogic = kea<alertFormLogicType>([
/** Result column names of the SQL insight, for the column pickers. */
hogqlResultColumns: [
(s) => [s.insightData],
- (insightData): string[] | null =>
+ (insightData: Record<string, any>): string[] | null =>
props.insightAlertKind === 'hogql' && Array.isArray(insightData?.columns)
? insightData.columns.map(String)
: null,
@@ -554,7 +748,7 @@ export const alertFormLogic = kea<alertFormLogicType>([
/** Result columns with numeric cells — the only valid picks for the evaluated column. */
hogqlNumericColumns: [
(s) => [s.insightData, s.hogqlResultColumns],
- (insightData, resultColumns): string[] | null =>
+ (insightData: Record<string, any>, resultColumns: string[] | null): string[] | null =>
resultColumns && Array.isArray(insightData?.result)
? resultColumns.filter((_, index) => columnIsNumeric(insightData.result, index))
: null,
@@ -565,7 +759,7 @@ export const alertFormLogic = kea<alertFormLogicType>([
* (single-column results) or nothing numeric is detectable. */
hogqlSuggestedColumn: [
(s) => [s.hogqlResultColumns, s.hogqlNumericColumns],
- (resultColumns, numericColumns): string | null =>
+ (resultColumns: string[] | null, numericColumns: string[] | null): string | null =>
(resultColumns?.length ?? 0) > 1 && numericColumns && numericColumns.length > 0
? numericColumns[numericColumns.length - 1]
: null,
diff --git a/products/alerts/frontend/logic/alertLogic.ts b/products/alerts/frontend/logic/alertLogic.ts
index 9b490b594187..c2ed17f64184 100644
--- a/products/alerts/frontend/logic/alertLogic.ts
+++ b/products/alerts/frontend/logic/alertLogic.ts
@@ -1,4 +1,4 @@
-import { actions, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
@@ -8,7 +8,6 @@ import { formatDate } from 'lib/utils/datetime'
import { AlertState } from '~/queries/schema/schema-general'
import type { AlertCheck, AlertType } from '../types'
-import type { alertLogicType } from './alertLogicType'
export const CHART_CHECKS_LIMIT = 50
export const TABLE_CHECKS_PAGE_SIZE = 25
@@ -56,6 +55,81 @@ function getCheckPlotValue(check: AlertCheck, isAnomalyDetection: boolean): numb
return v != null && !Number.isNaN(v) ? v : null
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface alertLogicValues {
+ alert: AlertType | null
+ alertHistoryChartSeries: AlertHistoryChartPoint[]
+ alertHistoryChartSeriesName: 'Anomaly score' | 'Value'
+ alertHistoryChecksSortedDesc: AlertCheck[]
+ alertHistoryHasHistory: boolean
+ alertHistoryIsAnomalyDetection: boolean
+ alertHistoryTableEntryCount: number
+ alertHistoryTablePageCount: number
+ alertHistoryUsesAnomalyScores: boolean
+ alertHistoryView: 'chart' | 'table'
+ alertLoading: boolean
+ checksHistoryParams: ChecksHistoryParams
+ checksHistoryTablePage: number
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface alertLogicActions {
+ alertHistoryTablePageBackward: () => {
+ value: true
+ }
+ alertHistoryTablePageForward: () => {
+ value: true
+ }
+ loadAlert: () => any
+ loadAlertFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAlertSuccess: (
+ alert: AlertType | null,
+ payload?: any
+ ) => {
+ alert: AlertType | null
+ payload?: any
+ }
+ selectAlertHistoryView: (view: 'chart' | 'table') => {
+ view: 'chart' | 'table'
+ }
+ setAlertHistoryView: (view: 'chart' | 'table') => {
+ view: 'chart' | 'table'
+ }
+ setChecksHistoryParams: (
+ limit: number,
+ offset: number
+ ) => {
+ limit: number
+ offset: number
+ }
+ setChecksHistoryTablePage: (page: number) => {
+ page: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface alertLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ alertHistoryIsAnomalyDetection: (alert: AlertType | null) => boolean
+ alertHistoryChecksSortedDesc: (alert: AlertType | null) => AlertCheck[]
+ alertHistoryChartSeries: (alert: AlertType | null) => AlertHistoryChartPoint[]
+ alertHistoryUsesAnomalyScores: (alert: AlertType | null) => boolean
+ alertHistoryChartSeriesName: (alertHistoryUsesAnomalyScores: boolean) => 'Anomaly score' | 'Value'
+ alertHistoryHasHistory: (alert: AlertType | null) => boolean
+ alertHistoryTablePageCount: (alert: AlertType | null) => number
+ alertHistoryTableEntryCount: (alert: AlertType | null) => number
+ }
+}
+
+export type alertLogicType = MakeLogicType<alertLogicValues, alertLogicActions, AlertLogicProps, alertLogicMeta>
+
export const alertLogic = kea<alertLogicType>([
path(['lib', 'components', 'Alerts', 'alertLogic']),
props({
diff --git a/products/alerts/frontend/logic/alertNotificationLogic.ts b/products/alerts/frontend/logic/alertNotificationLogic.ts
index 14dc26a6d3b1..d1105a56736b 100644
--- a/products/alerts/frontend/logic/alertNotificationLogic.ts
+++ b/products/alerts/frontend/logic/alertNotificationLogic.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'
@@ -22,7 +22,7 @@ import {
notificationTypeFromTemplateId,
} from 'products/alerts/frontend/logic/alertNotifications'
-import type { alertNotificationLogicType } from './alertNotificationLogicType'
+import type { UserBasicType } from '../../../../frontend/src/types'
export const ALERT_NOTIFICATION_TYPE_OPTIONS = [
{ label: 'Slack', value: ALERT_NOTIFICATION_TYPE_SLACK },
@@ -35,6 +35,185 @@ export interface AlertNotificationLogicProps {
alertId?: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface alertNotificationLogicValues {
+ slackIntegrations: IntegrationType[] | undefined // integrationsLogic
+ currentProjectId: number | null // projectLogic
+ existingHogFunctions: HogFunctionType[]
+ existingHogFunctionsLoading: boolean
+ firstSlackIntegration: IntegrationType | undefined
+ pendingNotifications: PendingAlertNotification[]
+ selectedType: AlertNotificationType
+ slackChannelValue: string | null
+ webhookUrl: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface alertNotificationLogicActions {
+ loadIntegrationsSuccess: (
+ integrations: {
+ config: any
+ created_at: string
+ created_by?: UserBasicType | null | undefined
+ display_name: string
+ errors?: string | undefined
+ icon_url: any
+ id: number
+ kind:
+ | 'apns'
+ | 'aws-s3'
+ | 'azure-blob'
+ | 'bing-ads'
+ | 'clickup'
+ | 'customerio-app'
+ | 'customerio-track'
+ | 'customerio-webhook'
+ | 'databricks'
+ | 'email'
+ | 'firebase'
+ | 'github'
+ | 'gitlab'
+ | 'google-ads'
+ | 'google-analytics'
+ | 'google-cloud-service-account'
+ | 'google-cloud-storage'
+ | 'google-pubsub'
+ | 'google-search-console'
+ | 'google-sheets'
+ | 'hubspot'
+ | 'intercom'
+ | 'jira'
+ | 'linear'
+ | 'linkedin-ads'
+ | 'meta-ads'
+ | 'pinterest-ads'
+ | 'postgresql'
+ | 'reddit-ads'
+ | 's3-compatible'
+ | 'salesforce'
+ | 'slack'
+ | 'snapchat'
+ | 'snowflake'
+ | 'stripe'
+ | 'tiktok-ads'
+ | 'twilio'
+ | 'vercel'
+ }[],
+ payload?: any
+ ) => {
+ integrations: {
+ config: any
+ created_at: string
+ created_by?: UserBasicType | null | undefined
+ display_name: string
+ errors?: string | undefined
+ icon_url: any
+ id: number
+ kind:
+ | 'apns'
+ | 'aws-s3'
+ | 'azure-blob'
+ | 'bing-ads'
+ | 'clickup'
+ | 'customerio-app'
+ | 'customerio-track'
+ | 'customerio-webhook'
+ | 'databricks'
+ | 'email'
+ | 'firebase'
+ | 'github'
+ | 'gitlab'
+ | 'google-ads'
+ | 'google-analytics'
+ | 'google-cloud-service-account'
+ | 'google-cloud-storage'
+ | 'google-pubsub'
+ | 'google-search-console'
+ | 'google-sheets'
+ | 'hubspot'
+ | 'intercom'
+ | 'jira'
+ | 'linear'
+ | 'linkedin-ads'
+ | 'meta-ads'
+ | 'pinterest-ads'
+ | 'postgresql'
+ | 'reddit-ads'
+ | 's3-compatible'
+ | 'salesforce'
+ | 'slack'
+ | 'snapchat'
+ | 'snowflake'
+ | 'stripe'
+ | 'tiktok-ads'
+ | 'twilio'
+ | 'vercel'
+ }[]
+ payload?: any
+ } // integrationsLogic
+ addPendingNotification: (notification: PendingAlertNotification) => {
+ notification: PendingAlertNotification
+ }
+ clearPendingNotifications: () => {
+ value: true
+ }
+ createPendingHogFunctions: (
+ alertId: string,
+ alertName?: string
+ ) => {
+ alertId: string
+ alertName: string | undefined
+ }
+ deleteExistingHogFunction: (hogFunction: HogFunctionType) => {
+ hogFunction: HogFunctionType
+ }
+ loadExistingHogFunctions: () => any
+ loadExistingHogFunctionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadExistingHogFunctionsSuccess: (
+ existingHogFunctions: HogFunctionType[],
+ payload?: any
+ ) => {
+ existingHogFunctions: HogFunctionType[]
+ payload?: any
+ }
+ removePendingNotification: (index: number) => {
+ index: number
+ }
+ setPendingNotifications: (notifications: PendingAlertNotification[]) => {
+ notifications: PendingAlertNotification[]
+ }
+ setSelectedType: (selectedType: AlertNotificationType) => {
+ selectedType: AlertNotificationType
+ }
+ setSlackChannelValue: (slackChannelValue: string | null) => {
+ slackChannelValue: string | null
+ }
+ setWebhookUrl: (webhookUrl: string) => {
+ webhookUrl: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface alertNotificationLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ firstSlackIntegration: (slackIntegrations: IntegrationType[] | undefined) => IntegrationType | undefined
+ }
+}
+
+export type alertNotificationLogicType = MakeLogicType<
+ alertNotificationLogicValues,
+ alertNotificationLogicActions,
+ AlertNotificationLogicProps,
+ alertNotificationLogicMeta
+>
+
export const alertNotificationLogic = kea<alertNotificationLogicType>([
path(['lib', 'components', 'Alerts', 'alertNotificationLogic']),
props({} as AlertNotificationLogicProps),
diff --git a/products/alerts/frontend/logic/alertsLogic.ts b/products/alerts/frontend/logic/alertsLogic.ts
index 220bd8d97548..47ec9b05ac7d 100644
--- a/products/alerts/frontend/logic/alertsLogic.ts
+++ b/products/alerts/frontend/logic/alertsLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { PaginationManual } from '@posthog/lemon-ui'
@@ -10,7 +10,6 @@ import { AlertState } from '~/queries/schema/schema-general'
import { AlertType } from '../types'
import { AlertLogicProps } from './alertLogic'
-import type { alertsLogicType } from './alertsLogicType'
export interface AlertsLogicProps extends AlertLogicProps {}
@@ -26,6 +25,66 @@ export const DEFAULT_ALERTS_FILTERS: AlertsFilters = {
createdBy: 'All users',
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface alertsLogicValues {
+ alerts: AlertType[]
+ alertsCount: number
+ alertsResponse: {
+ count: number
+ results: AlertType[]
+ }
+ alertsResponseLoading: boolean
+ alertsSortedByState: AlertType[]
+ filters: AlertsFilters
+ isFiltering: boolean
+ page: number
+ pagination: PaginationManual
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface alertsLogicActions {
+ loadAlerts: () => any
+ loadAlertsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAlertsSuccess: (
+ alertsResponse: {
+ count: number
+ results: AlertType[]
+ },
+ payload?: any
+ ) => {
+ alertsResponse: {
+ count: number
+ results: AlertType[]
+ }
+ payload?: any
+ }
+ setFilters: (filters: Partial<AlertsFilters>) => {
+ filters: Partial<AlertsFilters>
+ }
+ setPage: (page: number) => {
+ page: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface alertsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ alerts: (alertsResponse: { count: number; results: AlertType[] }) => AlertType[]
+ alertsCount: (alertsResponse: { count: number; results: AlertType[] }) => number
+ isFiltering: (filters: AlertsFilters) => boolean
+ alertsSortedByState: (alerts: AlertType[]) => AlertType[]
+ pagination: (page: number, alertsCount: number) => PaginationManual
+ }
+}
+
+export type alertsLogicType = MakeLogicType<alertsLogicValues, alertsLogicActions, Record<string, any>, alertsLogicMeta>
+
export const alertsLogic = kea<alertsLogicType>([
path(['lib', 'components', 'Alerts', 'alertsLogic']),
@@ -73,11 +132,17 @@ export const alertsLogic = kea<alertsLogicType>([
})),
selectors(({ actions }) => ({
- alerts: [(s) => [s.alertsResponse], (response): AlertType[] => response.results],
- alertsCount: [(s) => [s.alertsResponse], (response): number => response.count],
+ alerts: [
+ (s) => [s.alertsResponse],
+ (response: { count: number; results: AlertType[] }): AlertType[] => response.results,
+ ],
+ alertsCount: [
+ (s) => [s.alertsResponse],
+ (response: { count: number; results: AlertType[] }): number => response.count,
+ ],
isFiltering: [
(s) => [s.filters],
- (filters): boolean =>
+ (filters: AlertsFilters): boolean =>
filters.search !== DEFAULT_ALERTS_FILTERS.search ||
filters.createdBy !== DEFAULT_ALERTS_FILTERS.createdBy,
],
@@ -88,7 +153,7 @@ export const alertsLogic = kea<alertsLogicType>([
],
pagination: [
(s) => [s.page, s.alertsCount],
- (page, count): PaginationManual => ({
+ (page: number, count: number): PaginationManual => ({
controlled: true,
pageSize: ALERTS_PER_PAGE,
currentPage: page,
diff --git a/products/alerts/frontend/logic/insightAlertsLogic.ts b/products/alerts/frontend/logic/insightAlertsLogic.ts
index 3c5148da3e1e..90e0e8590e65 100644
--- a/products/alerts/frontend/logic/insightAlertsLogic.ts
+++ b/products/alerts/frontend/logic/insightAlertsLogic.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 api from 'lib/api'
@@ -18,8 +18,10 @@ import {
} from '~/queries/utils'
import { FunnelVizType, InsightLogicProps } from '~/types'
+import type { FeatureFlagsSet } from '../../../../frontend/src/lib/logic/featureFlagLogic'
+import type { Node } from '../../../../frontend/src/queries/schema/schema-general'
+import type { QueryBasedInsightModel } from '../../../../frontend/src/types'
import { AlertType, AnomalyPoint, isTrendsAlertConfig } from '../types'
-import type { insightAlertsLogicType } from './insightAlertsLogicType'
export interface InsightAlertsLogicProps {
insightId: number
@@ -135,6 +137,84 @@ export function alertsToThresholdGoalLines(alerts: AlertType[]): GoalLine[] {
})
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightAlertsLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>> // insightLogic
+ breakdownFilter: BreakdownFilter | null | undefined // insightVizDataLogic
+ showAlertThresholdLines: boolean | null | undefined // insightVizDataLogic
+ alertAnomalyPoints: AnomalyPoint[]
+ alertThresholdLines: GoalLine[]
+ alerts: AlertType[]
+ alertsLoading: boolean
+ hasDetectorAlerts: boolean
+ shouldShowAlertDeletionWarning: boolean
+ showAlertAnomalyPointsFlag: boolean
+ simulationAnomalyPoints: AnomalyPoint[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightAlertsLogicActions {
+ setQuery: (query: Node<Record<string, any>> | null) => {
+ query: Node<Record<string, any>> | null
+ } // insightVizDataLogic
+ clearSimulationAnomalyPoints: () => {
+ value: true
+ }
+ loadAlerts: () => any
+ loadAlertsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAlertsSuccess: (
+ alerts: AlertType[],
+ payload?: any
+ ) => {
+ alerts: AlertType[]
+ payload?: any
+ }
+ removeAlert: (alertId: AlertType['id']) => {
+ alertId: string
+ }
+ setShouldShowAlertDeletionWarning: (show: boolean) => {
+ show: boolean
+ }
+ setShowAlertAnomalyPoints: (show: boolean) => {
+ show: boolean
+ }
+ setSimulationAnomalyPoints: (points: AnomalyPoint[]) => {
+ points: AnomalyPoint[]
+ }
+ upsertAlert: (alert: AlertType) => {
+ alert: AlertType
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightAlertsLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ alertThresholdLines: (alerts: AlertType[], showAlertThresholdLines: boolean | null | undefined) => GoalLine[]
+ hasDetectorAlerts: (alerts: AlertType[]) => boolean
+ alertAnomalyPoints: (
+ alerts: AlertType[],
+ showAlertAnomalyPointsFlag: boolean,
+ simulationAnomalyPoints: AnomalyPoint[],
+ breakdownFilter: BreakdownFilter | null | undefined
+ ) => AnomalyPoint[]
+ }
+}
+
+export type insightAlertsLogicType = MakeLogicType<
+ insightAlertsLogicValues,
+ insightAlertsLogicActions,
+ InsightAlertsLogicProps,
+ insightAlertsLogicMeta
+>
+
export const insightAlertsLogic = kea<insightAlertsLogicType>([
path(['lib', 'components', 'Alerts', 'insightAlertsLogic']),
props({} as InsightAlertsLogicProps),
diff --git a/products/data_modeling/frontend/lineage/lineageGraphLogic.ts b/products/data_modeling/frontend/lineage/lineageGraphLogic.ts
index 1a624948fdf9..b6308e4f7cf7 100644
--- a/products/data_modeling/frontend/lineage/lineageGraphLogic.ts
+++ b/products/data_modeling/frontend/lineage/lineageGraphLogic.ts
@@ -1,12 +1,11 @@
import { MarkerType, Position, type Edge as ReactFlowEdge, type Node as ReactFlowNode } from '@xyflow/react'
-import { actions, afterMount, kea, key, listeners, path, props, propsChanged, reducers } from 'kea'
+import { MakeLogicType, actions, afterMount, kea, key, listeners, path, props, propsChanged, reducers } from 'kea'
import { getFormattedNodes } from 'scenes/data-warehouse/scene/modeling/autolayout'
import { ElkDirection, NodeHandle } from 'scenes/data-warehouse/scene/modeling/types'
import { DataModelingEdge, DataModelingNode } from '~/types'
-import type { lineageGraphLogicType } from './lineageGraphLogicType'
import { LineageNodeData, LineageVariant } from './LineageNode'
const NODE_SIZES: Record<LineageVariant, { width: number; height: number }> = {
@@ -73,6 +72,33 @@ async function layoutGraph(
return { nodes: laidOut as unknown as ReactFlowNode<LineageNodeData>[], edges: rfEdges }
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface lineageGraphLogicValues {
+ layout: LineageGraphLayout | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface lineageGraphLogicActions {
+ computeLayout: () => {
+ value: true
+ }
+ layoutComputed: (layout: LineageGraphLayout) => {
+ layout: LineageGraphLayout
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface lineageGraphLogicMeta {
+ key: string
+}
+
+export type lineageGraphLogicType = MakeLogicType<
+ lineageGraphLogicValues,
+ lineageGraphLogicActions,
+ LineageGraphLogicProps,
+ lineageGraphLogicMeta
+>
+
export const lineageGraphLogic = kea<lineageGraphLogicType>([
path(['products', 'data_modeling', 'frontend', 'lineage', 'lineageGraphLogic']),
props({} as LineageGraphLogicProps),
diff --git a/products/notifications/frontend/resourceEditedLogic.ts b/products/notifications/frontend/resourceEditedLogic.ts
index d84d3f8a7e1d..008d704cad77 100644
--- a/products/notifications/frontend/resourceEditedLogic.ts
+++ b/products/notifications/frontend/resourceEditedLogic.ts
@@ -1,12 +1,19 @@
-import { actions, kea, path } from 'kea'
+import { MakeLogicType, actions, kea, path } from 'kea'
import { ResourceEditedEvent } from '~/types'
-import type { resourceEditedLogicType } from './resourceEditedLogicType'
-
/** Discriminator on `notification_type` for transient "edited elsewhere" events on the SSE stream. */
export const RESOURCE_EDITED_EVENT_TYPE = 'resource_edited'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface resourceEditedLogicActions {
+ resourceEdited: (event: ResourceEditedEvent) => {
+ event: ResourceEditedEvent
+ }
+}
+
+export type resourceEditedLogicType = MakeLogicType<{}, resourceEditedLogicActions>
+
/**
* A tiny event bus that decouples the notifications SSE consumer from editors that care about
* "this resource was edited elsewhere" events. The SSE consumer (sidePanelNotificationsLogic)
diff --git a/products/skills/frontend/llmSkillLogic.ts b/products/skills/frontend/llmSkillLogic.ts
index 62b1449a7eb3..d142fe3bdfdc 100644
--- a/products/skills/frontend/llmSkillLogic.ts
+++ b/products/skills/frontend/llmSkillLogic.ts
@@ -1,5 +1,18 @@
-import { actions, afterMount, defaults, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ defaults,
+ 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 { combineUrl, router, urlToAction } from 'kea-router'
@@ -23,7 +36,6 @@ import type {
LLMSkillVersionSummaryApi,
} from 'products/skills/frontend/generated/api.schemas'
-import type { llmSkillLogicType } from './llmSkillLogicType'
import { exportAndDownloadSkill, llmSkillsLogic, LLM_SKILLS_FORCE_RELOAD_PARAM } from './llmSkillsLogic'
import { SKILL_DESCRIPTION_MAX_LENGTH, validateSkillName } from './skillConstants'
@@ -121,6 +133,194 @@ function findExistingSkill(skillName: string): LLMSkillListApi | undefined {
return llmSkillsLogic.findMounted()?.values.skills.results.find((s) => s.name === skillName)
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface llmSkillLogicValues {
+ breadcrumbs: Breadcrumb[]
+ canCompareVersions: boolean
+ canLoadMoreVersions: boolean
+ compareSkill: LLMSkillApi | null
+ compareSkillLoading: boolean
+ compareVersion: number | null
+ compareVersionOptions: Array<{
+ label: string
+ value: number
+ }>
+ downloadingZip: boolean
+ fileContentsLoading: boolean
+ isDiffVisible: boolean
+ isEditMode: boolean
+ isHistoricalVersion: boolean
+ isNewSkill: boolean
+ isOutlineExpanded: boolean
+ isSkillFormSubmitting: boolean
+ isSkillFormValid: boolean
+ isSkillMissing: boolean
+ isViewMode: boolean
+ mode: SkillMode
+ shouldDisplaySkeleton: boolean
+ showSkillFormErrors: boolean
+ skill: ResolvedLLMSkill | SkillFormValues | null
+ skillFetched: boolean
+ skillForm: SkillFormValues
+ skillFormAllErrors: Record<string, any>
+ skillFormChanged: boolean
+ skillFormErrors: DeepPartialMap<SkillFormValues, ValidationErrorType>
+ skillFormHasErrors: boolean
+ skillFormManualErrors: Record<string, any>
+ skillFormTouched: boolean
+ skillFormTouches: Record<string, boolean>
+ skillFormValidationErrors: DeepPartialMap<SkillFormValues, ValidationErrorType>
+ skillLoading: boolean
+ versions: LLMSkillVersionSummaryApi[]
+ versionsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface llmSkillLogicActions {
+ deleteSkill: () => {
+ value: true
+ }
+ downloadSkill: () => {
+ value: true
+ }
+ loadCompareSkill: (version: number) => number
+ loadCompareSkillFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadCompareSkillSuccess: (
+ compareSkill: LLMSkillApi,
+ payload?: number
+ ) => {
+ compareSkill: LLMSkillApi
+ payload?: number
+ }
+ loadFileContents: () => {
+ value: true
+ }
+ loadMoreVersions: () => {
+ value: true
+ }
+ loadSkill: () => any
+ loadSkillFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSkillSuccess: (
+ skill: ResolvedLLMSkill,
+ payload?: any
+ ) => {
+ skill: ResolvedLLMSkill
+ payload?: any
+ }
+ resetSkillForm: (values?: SkillFormValues) => {
+ values?: SkillFormValues
+ }
+ setCompareVersion: (compareVersion: number | null) => {
+ compareVersion: number | null
+ }
+ setDownloadingZip: (downloadingZip: boolean) => {
+ downloadingZip: boolean
+ }
+ setFileContentsLoading: (loading: boolean) => {
+ loading: boolean
+ }
+ setMode: (mode: SkillMode) => {
+ mode: SkillMode
+ }
+ setSkill: (skill: ResolvedLLMSkill | SkillFormValues) => {
+ skill: ResolvedLLMSkill | SkillFormValues
+ }
+ setSkillFormManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setSkillFormValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setSkillFormValues: (values: DeepPartial<SkillFormValues>) => {
+ values: DeepPartial<SkillFormValues>
+ }
+ setVersionsLoading: (versionsLoading: boolean) => {
+ versionsLoading: boolean
+ }
+ submitSkillForm: () => {
+ value: boolean
+ }
+ submitSkillFormFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitSkillFormRequest: (skillForm: SkillFormValues) => {
+ skillForm: SkillFormValues
+ }
+ submitSkillFormSuccess: (skillForm: SkillFormValues) => {
+ skillForm: SkillFormValues
+ }
+ toggleOutlineExpanded: () => {
+ value: true
+ }
+ touchSkillFormField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface llmSkillLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ isNewSkill: (arg: any) => boolean
+ isSkillMissing: (
+ skill: ResolvedLLMSkill | SkillFormValues | null,
+ skillLoading: boolean,
+ skillFetched: boolean
+ ) => boolean
+ shouldDisplaySkeleton: (
+ skill: ResolvedLLMSkill | SkillFormValues | null,
+ skillLoading: boolean,
+ skillFetched: boolean,
+ isNewSkill: boolean
+ ) => boolean
+ isHistoricalVersion: (skill: ResolvedLLMSkill | SkillFormValues | null) => boolean
+ breadcrumbs: (
+ skill: ResolvedLLMSkill | SkillFormValues | null,
+ searchParams: Record<string, any>
+ ) => Breadcrumb[]
+ isViewMode: (mode: SkillMode, arg: any) => boolean
+ isEditMode: (mode: SkillMode, arg: any) => boolean
+ versions: (skill: ResolvedLLMSkill | SkillFormValues | null) => LLMSkillVersionSummaryApi[]
+ canLoadMoreVersions: (skill: ResolvedLLMSkill | SkillFormValues | null) => boolean
+ isDiffVisible: (compareVersion: number | null) => boolean
+ canCompareVersions: (skill: ResolvedLLMSkill | SkillFormValues | null) => boolean
+ compareVersionOptions: (
+ skill: ResolvedLLMSkill | SkillFormValues | null,
+ versions: LLMSkillVersionSummaryApi[]
+ ) => Array<{
+ label: string
+ value: number
+ }>
+ }
+}
+
+export type llmSkillLogicType = MakeLogicType<
+ llmSkillLogicValues,
+ llmSkillLogicActions,
+ SkillLogicProps,
+ llmSkillLogicMeta
+>
+
export const llmSkillLogic = kea<llmSkillLogicType>([
path(['scenes', 'skills', 'llmSkillLogic']),
props({ skillName: 'new' } as SkillLogicProps),
@@ -341,16 +541,24 @@ export const llmSkillLogic = kea<llmSkillLogicType>([
isSkillMissing: [
(s) => [s.skill, s.skillLoading, s.skillFetched],
- (skill, skillLoading, skillFetched) => skillFetched && !skillLoading && skill === null,
+ (skill: ResolvedLLMSkill | SkillFormValues | null, skillLoading: boolean, skillFetched: boolean) =>
+ skillFetched && !skillLoading && skill === null,
],
shouldDisplaySkeleton: [
(s) => [s.skill, s.skillLoading, s.skillFetched, s.isNewSkill],
- (skill, skillLoading, skillFetched, isNewSkill) =>
- !isNewSkill && (!skillFetched || (skillLoading && skill === null)),
+ (
+ skill: ResolvedLLMSkill | SkillFormValues | null,
+ skillLoading: boolean,
+ skillFetched: boolean,
+ isNewSkill: boolean
+ ) => !isNewSkill && (!skillFetched || (skillLoading && skill === null)),
],
- isHistoricalVersion: [(s) => [s.skill], (skill) => (isSkill(skill) ? !skill.is_latest : false)],
+ isHistoricalVersion: [
+ (s) => [s.skill],
+ (skill: ResolvedLLMSkill | SkillFormValues | null) => (isSkill(skill) ? !skill.is_latest : false),
+ ],
breadcrumbs: [
(s) => [s.skill, router.selectors.searchParams],
@@ -374,25 +582,38 @@ export const llmSkillLogic = kea<llmSkillLogicType>([
isViewMode: [
(s) => [s.mode, (_, props) => props],
- (mode, props) => props.skillName !== 'new' && mode === SkillMode.View,
+ (mode: SkillMode, props) => props.skillName !== 'new' && mode === SkillMode.View,
],
isEditMode: [
(s) => [s.mode, (_, props) => props],
- (mode, props) => props.skillName === 'new' || mode === SkillMode.Edit,
+ (mode: SkillMode, props) => props.skillName === 'new' || mode === SkillMode.Edit,
],
- versions: [(s) => [s.skill], (skill): LLMSkillVersionSummaryApi[] => (isSkill(skill) ? skill.versions : [])],
+ versions: [
+ (s) => [s.skill],
+ (skill: ResolvedLLMSkill | SkillFormValues | null): LLMSkillVersionSummaryApi[] =>
+ isSkill(skill) ? skill.versions : [],
+ ],
- canLoadMoreVersions: [(s) => [s.skill], (skill) => (isSkill(skill) ? skill.has_more : false)],
+ canLoadMoreVersions: [
+ (s) => [s.skill],
+ (skill: ResolvedLLMSkill | SkillFormValues | null) => (isSkill(skill) ? skill.has_more : false),
+ ],
- isDiffVisible: [(s) => [s.compareVersion], (compareVersion): boolean => compareVersion !== null],
+ isDiffVisible: [(s) => [s.compareVersion], (compareVersion: number | null): boolean => compareVersion !== null],
- canCompareVersions: [(s) => [s.skill], (skill): boolean => isSkill(skill) && skill.version_count > 1],
+ canCompareVersions: [
+ (s) => [s.skill],
+ (skill: ResolvedLLMSkill | SkillFormValues | null): boolean => isSkill(skill) && skill.version_count > 1,
+ ],
compareVersionOptions: [
(s) => [s.skill, s.versions],
- (skill, versions: LLMSkillVersionSummaryApi[]): Array<{ value: number; label: string }> => {
+ (
+ skill: ResolvedLLMSkill | SkillFormValues | null,
+ versions: LLMSkillVersionSummaryApi[]
+ ): Array<{ value: number; label: string }> => {
if (!isSkill(skill)) {
return []
}
diff --git a/products/skills/frontend/llmSkillsLogic.ts b/products/skills/frontend/llmSkillsLogic.ts
index 3ab7194937ee..9ef6ad1fd6ac 100644
--- a/products/skills/frontend/llmSkillsLogic.ts
+++ b/products/skills/frontend/llmSkillsLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, kea, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, kea, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { router, urlToAction } from 'kea-router'
@@ -28,8 +28,6 @@ import type {
PaginatedLLMSkillListListApi,
} from 'products/skills/frontend/generated/api.schemas'
-import type { llmSkillsLogicType } from './llmSkillsLogicType'
-
/** Builds the `/plugin marketplace add` command. The token is embedded once minted; until then
* a placeholder is shown. */
export function buildMarketplaceCommand(token: string | null): string {
@@ -234,6 +232,155 @@ export function groupSkillsByPrefix(skills: LLMSkillListApi[]): SkillGroupTree {
export type LLMSkillsLogicProps = Record<string, never>
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface llmSkillsLogicValues {
+ activeCategory: string
+ activeTabDescription: string
+ activeTabKey: string
+ categoryCounts: Record<string, number>
+ categoryCountsLoading: boolean
+ codexCommand: string
+ connectModalOpen: boolean
+ count: number
+ filters: SkillFilters
+ groupedSkills: SkillGroupTree | null
+ importing: boolean
+ issuingCredential: boolean
+ marketplaceCommand: string
+ marketplaceLoading: boolean
+ marketplaceState: LLMSkillMarketplaceCommandApi | null
+ pagination: PaginationManual | undefined
+ rawFilters: Partial<SkillFilters> | null
+ skillCountLabel: string
+ skills: PaginatedLLMSkillListListApi
+ skillsLoading: boolean
+ sorting: Sorting | null
+ visibleCategoryTabs: SkillCategoryTab[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface llmSkillsLogicActions {
+ deleteSkill: (skillName: string) => {
+ skillName: string
+ }
+ downloadSkillZip: (skillName: string) => {
+ skillName: string
+ }
+ duplicateSkill: (
+ skillName: string,
+ newName: string
+ ) => {
+ newName: string
+ skillName: string
+ }
+ importSkill: (file: File) => {
+ file: File
+ }
+ issueMarketplaceCommand: (rotate?: boolean) => {
+ rotate: boolean
+ }
+ loadCategoryCounts: () => {
+ value: true
+ }
+ loadCategoryCountsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadCategoryCountsSuccess: (
+ categoryCounts: {
+ [k: string]: number
+ },
+ payload?: {
+ value: true
+ }
+ ) => {
+ categoryCounts: {
+ [k: string]: number
+ }
+ payload?: {
+ value: true
+ }
+ }
+ loadMarketplaceState: () => {
+ value: true
+ }
+ loadSkills: (debounce?: boolean) => {
+ debounce: boolean
+ }
+ loadSkillsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSkillsSuccess: (
+ skills: PaginatedLLMSkillListListApi,
+ payload?: {
+ debounce: boolean
+ }
+ ) => {
+ skills: PaginatedLLMSkillListListApi
+ payload?: {
+ debounce: boolean
+ }
+ }
+ setActiveTab: (tabKey: string) => {
+ tabKey: string
+ }
+ setConnectModalOpen: (open: boolean) => {
+ open: boolean
+ }
+ setFilters: (
+ filters: Partial<SkillFilters>,
+ merge?: boolean,
+ debounce?: boolean
+ ) => {
+ debounce: boolean
+ filters: Partial<SkillFilters>
+ merge: boolean
+ }
+ setImporting: (importing: boolean) => {
+ importing: boolean
+ }
+ setIssuingCredential: (issuing: boolean) => {
+ issuing: boolean
+ }
+ setMarketplaceLoading: (loading: boolean) => {
+ loading: boolean
+ }
+ setMarketplaceState: (state: LLMSkillMarketplaceCommandApi | null) => {
+ state: LLMSkillMarketplaceCommandApi | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface llmSkillsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ filters: (rawFilters: Partial<SkillFilters> | null) => SkillFilters
+ activeCategory: (activeTabKey: string) => string
+ activeTabDescription: (activeTabKey: string) => string
+ visibleCategoryTabs: (categoryCounts: Record<string, number>, activeTabKey: string) => SkillCategoryTab[]
+ count: (skills: PaginatedLLMSkillListListApi) => number
+ marketplaceCommand: (marketplaceState: LLMSkillMarketplaceCommandApi | null) => string
+ codexCommand: (marketplaceState: LLMSkillMarketplaceCommandApi | null) => string
+ sorting: (filters: SkillFilters) => Sorting | null
+ pagination: (filters: SkillFilters, count: number) => PaginationManual | undefined
+ groupedSkills: (skills: PaginatedLLMSkillListListApi, filters: SkillFilters) => SkillGroupTree | null
+ skillCountLabel: (filters: SkillFilters, count: number, skills: PaginatedLLMSkillListListApi) => string
+ }
+}
+
+export type llmSkillsLogicType = MakeLogicType<
+ llmSkillsLogicValues,
+ llmSkillsLogicActions,
+ LLMSkillsLogicProps,
+ llmSkillsLogicMeta
+>
+
export const llmSkillsLogic = kea<llmSkillsLogicType>([
path(['scenes', 'skills', 'llmSkillsLogic']),
props({} as LLMSkillsLogicProps),
diff --git a/products/skills/frontend/skillFileLogic.ts b/products/skills/frontend/skillFileLogic.ts
index 7b349399cda4..487bee4589de 100644
--- a/products/skills/frontend/skillFileLogic.ts
+++ b/products/skills/frontend/skillFileLogic.ts
@@ -1,4 +1,4 @@
-import { actions, kea, key, listeners, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, kea, key, listeners, path, props, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import { ApiConfig } from '~/lib/api'
@@ -6,14 +6,56 @@ import { ApiConfig } from '~/lib/api'
import { llmSkillsNameFilesRetrieve } from 'products/skills/frontend/generated/api'
import type { LLMSkillFileApi } from 'products/skills/frontend/generated/api.schemas'
-import type { skillFileLogicType } from './skillFileLogicType'
-
export interface SkillFileLogicProps {
skillName: string
filePath: string
version?: number
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface skillFileLogicValues {
+ content: string | null
+ contentLoading: boolean
+ expanded: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface skillFileLogicActions {
+ autoOpen: () => {
+ value: true
+ }
+ loadContent: () => any
+ loadContentFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadContentSuccess: (
+ content: string,
+ payload?: any
+ ) => {
+ content: string
+ payload?: any
+ }
+ toggleExpand: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface skillFileLogicMeta {
+ key: string
+}
+
+export type skillFileLogicType = MakeLogicType<
+ skillFileLogicValues,
+ skillFileLogicActions,
+ SkillFileLogicProps,
+ skillFileLogicMeta
+>
+
export const skillFileLogic = kea<skillFileLogicType>([
path(['scenes', 'skills', 'skillFileLogic']),
props({ skillName: '', filePath: '' } as SkillFileLogicProps),
diff --git a/products/visual_review/frontend/scenes/visualReviewIndexSceneLogic.ts b/products/visual_review/frontend/scenes/visualReviewIndexSceneLogic.ts
index 11766bcbdc32..cac011e34fb9 100644
--- a/products/visual_review/frontend/scenes/visualReviewIndexSceneLogic.ts
+++ b/products/visual_review/frontend/scenes/visualReviewIndexSceneLogic.ts
@@ -1,4 +1,4 @@
-import { afterMount, connect, kea, path, selectors } from 'kea'
+import { MakeLogicType, afterMount, connect, kea, path, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
@@ -9,7 +9,38 @@ import { Breadcrumb } from '~/types'
import { visualReviewReposList } from '../generated/api'
import type { RepoApi } from '../generated/api.schemas'
-import type { visualReviewIndexSceneLogicType } from './visualReviewIndexSceneLogicType'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewIndexSceneLogicValues {
+ currentProjectId: number | string // teamLogic
+ breadcrumbs: Breadcrumb[]
+ repos: RepoApi[]
+ reposLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewIndexSceneLogicActions {
+ loadRepos: () => any
+ loadReposFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadReposSuccess: (
+ repos: RepoApi[],
+ payload?: any
+ ) => {
+ repos: RepoApi[]
+ payload?: any
+ }
+}
+
+export type visualReviewIndexSceneLogicType = MakeLogicType<
+ visualReviewIndexSceneLogicValues,
+ visualReviewIndexSceneLogicActions
+>
// Index scene logic. Loads the team's repos and forwards to the first repo's
// Runs page. The header-bar repo switcher handles the multi-repo case, so
diff --git a/products/visual_review/frontend/scenes/visualReviewPreferencesLogic.ts b/products/visual_review/frontend/scenes/visualReviewPreferencesLogic.ts
index f23bf6af6d03..16cfaeb6b2b3 100644
--- a/products/visual_review/frontend/scenes/visualReviewPreferencesLogic.ts
+++ b/products/visual_review/frontend/scenes/visualReviewPreferencesLogic.ts
@@ -1,8 +1,27 @@
-import { actions, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
import type { ComparisonMode } from 'lib/components/VisualImageDiffViewer/VisualImageDiffViewer'
-import type { visualReviewPreferencesLogicType } from './visualReviewPreferencesLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewPreferencesLogicValues {
+ addImagesToComment: boolean
+ comparisonMode: ComparisonMode
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewPreferencesLogicActions {
+ setAddImagesToComment: (enabled: boolean) => {
+ enabled: boolean
+ }
+ setComparisonMode: (mode: ComparisonMode) => {
+ mode: ComparisonMode
+ }
+}
+
+export type visualReviewPreferencesLogicType = MakeLogicType<
+ visualReviewPreferencesLogicValues,
+ visualReviewPreferencesLogicActions
+>
export const visualReviewPreferencesLogic = kea<visualReviewPreferencesLogicType>([
path(['products', 'visual_review', 'frontend', 'scenes', 'visualReviewPreferencesLogic']),
diff --git a/products/visual_review/frontend/scenes/visualReviewRepoLogic.ts b/products/visual_review/frontend/scenes/visualReviewRepoLogic.ts
index 2326ce02e1ca..1f223bf564b3 100644
--- a/products/visual_review/frontend/scenes/visualReviewRepoLogic.ts
+++ b/products/visual_review/frontend/scenes/visualReviewRepoLogic.ts
@@ -1,16 +1,76 @@
-import { afterMount, connect, kea, key, path, props, selectors } from 'kea'
+import { MakeLogicType, afterMount, connect, kea, key, path, props, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { teamLogic } from 'scenes/teamLogic'
import { visualReviewReposList, visualReviewReposRetrieve } from '../generated/api'
import type { RepoApi } from '../generated/api.schemas'
-import type { visualReviewRepoLogicType } from './visualReviewRepoLogicType'
export interface VisualReviewRepoLogicProps {
repoId: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewRepoLogicValues {
+ currentProjectId: number | string // teamLogic
+ allRepos: RepoApi[]
+ allReposLoading: boolean
+ otherRepos: RepoApi[]
+ repo: RepoApi | null
+ repoFullName: string | undefined
+ repoLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewRepoLogicActions {
+ loadAllRepos: () => any
+ loadAllReposFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAllReposSuccess: (
+ allRepos: RepoApi[],
+ payload?: any
+ ) => {
+ allRepos: RepoApi[]
+ payload?: any
+ }
+ loadRepo: () => any
+ loadRepoFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRepoSuccess: (
+ repo: RepoApi,
+ payload?: any
+ ) => {
+ repo: RepoApi
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewRepoLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ repoFullName: (repo: RepoApi | null) => string | undefined
+ otherRepos: (allRepos: RepoApi[], arg: any) => RepoApi[]
+ }
+}
+
+export type visualReviewRepoLogicType = MakeLogicType<
+ visualReviewRepoLogicValues,
+ visualReviewRepoLogicActions,
+ VisualReviewRepoLogicProps,
+ visualReviewRepoLogicMeta
+>
+
// Shared repo state for both Runs and Snapshots scenes — keyed by repoId so
// the data only loads once per workspace and survives tab navigation. Without
// this, each scene's own loadRepo re-fetches on mount and the title/tab
diff --git a/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.ts b/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.ts
index e29bda004d38..d6e8299fa25d 100644
--- a/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.ts
+++ b/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.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 { actionToUrl, urlToAction } from 'kea-router'
import posthog from 'posthog-js'
@@ -30,12 +30,213 @@ import type {
} from '../generated/api.schemas'
import { isReportingOnlyRun } from '../lib/runPredicates'
import { visualReviewPreferencesLogic } from './visualReviewPreferencesLogic'
-import type { visualReviewRunSceneLogicType } from './visualReviewRunSceneLogicType'
export interface VisualReviewRunSceneLogicProps {
runId: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewRunSceneLogicValues {
+ currentProjectId: number | string // teamLogic
+ addImagesToComment: boolean // visualReviewPreferencesLogic
+ breadcrumbs: Breadcrumb[]
+ changedSnapshots: SnapshotApi[]
+ failedThumbnails: Set<string>
+ hasChanges: boolean
+ isApprovingSnapshot: boolean
+ isFinalizing: boolean
+ isRecomputing: boolean
+ isReportingOnly: boolean
+ isRunInProgress: boolean
+ isRunProcessing: boolean
+ quarantinedIdentifierSet: Set<string>
+ quarantinedIdentifiers: QuarantinedIdentifierEntryApi[]
+ quarantinedIdentifiersLoading: boolean
+ repo: RepoApi | null
+ repoFullName: string | null
+ repoLoading: boolean
+ run: RunApi | null
+ runLoading: boolean
+ selectedSnapshot: SnapshotApi | null
+ selectedSnapshotId: string | null
+ showQuarantinedThumbnails: boolean
+ snapshots: SnapshotApi[]
+ snapshotsLoading: boolean
+ sortedChangedSnapshots: SnapshotApi[]
+ thumbnailBasePath: string | null
+ toleratedHashes: ToleratedHashEntryApi[]
+ toleratedHashesLoading: boolean
+ unreviewedChangesCount: number
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewRunSceneLogicActions {
+ setAddImagesToComment: (enabled: boolean) => {
+ enabled: boolean
+ } // visualReviewPreferencesLogic
+ approveSnapshot: (snapshot: SnapshotApi) => {
+ snapshot: SnapshotApi
+ }
+ approveSnapshotFailure: () => {
+ value: true
+ }
+ approveSnapshotSuccess: () => {
+ value: true
+ }
+ finalizeRun: () => {
+ value: true
+ }
+ finalizeRunFailure: () => {
+ value: true
+ }
+ finalizeRunSuccess: () => {
+ value: true
+ }
+ loadQuarantinedIdentifiers: () => any
+ loadQuarantinedIdentifiersFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadQuarantinedIdentifiersSuccess: (
+ quarantinedIdentifiers: QuarantinedIdentifierEntryApi[],
+ payload?: any
+ ) => {
+ quarantinedIdentifiers: QuarantinedIdentifierEntryApi[]
+ payload?: any
+ }
+ loadRepo: () => any
+ loadRepoFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRepoSuccess: (
+ repo: RepoApi | null,
+ payload?: any
+ ) => {
+ repo: RepoApi | null
+ payload?: any
+ }
+ loadRun: () => any
+ loadRunFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRunSuccess: (
+ run: RunApi,
+ payload?: any
+ ) => {
+ run: RunApi
+ payload?: any
+ }
+ loadSnapshots: () => any
+ loadSnapshotsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSnapshotsSuccess: (
+ snapshots: SnapshotApi[],
+ payload?: any
+ ) => {
+ snapshots: SnapshotApi[]
+ payload?: any
+ }
+ loadToleratedHashes: (identifier: string) => string
+ loadToleratedHashesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadToleratedHashesSuccess: (
+ toleratedHashes: ToleratedHashEntryApi[],
+ payload?: string
+ ) => {
+ toleratedHashes: ToleratedHashEntryApi[]
+ payload?: string
+ }
+ markAsTolerated: (snapshot: SnapshotApi) => {
+ snapshot: SnapshotApi
+ }
+ markThumbnailFailed: (identifier: string) => {
+ identifier: string
+ }
+ quarantineSnapshot: (
+ reason: string,
+ identifiers: string[],
+ expiresAt: string | null,
+ sourceRunId?: string | null
+ ) => {
+ expiresAt: string | null
+ identifiers: string[]
+ reason: string
+ sourceRunId: string | null
+ }
+ recomputeRun: () => {
+ value: true
+ }
+ recomputeRunFailure: () => {
+ value: true
+ }
+ recomputeRunSuccess: () => {
+ value: true
+ }
+ setSelectedSnapshotId: (snapshotId: string | null) => {
+ snapshotId: string | null
+ }
+ toggleQuarantinedThumbnails: () => {
+ value: true
+ }
+ unquarantineSnapshot: (snapshot: SnapshotApi) => {
+ snapshot: SnapshotApi
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewRunSceneLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ selectedSnapshot: (
+ snapshots: SnapshotApi[],
+ selectedSnapshotId: string | null,
+ quarantinedIdentifierSet: Set<string>
+ ) => SnapshotApi | null
+ changedSnapshots: (snapshots: SnapshotApi[]) => SnapshotApi[]
+ sortedChangedSnapshots: (changedSnapshots: SnapshotApi[]) => SnapshotApi[]
+ hasChanges: (changedSnapshots: SnapshotApi[]) => boolean
+ unreviewedChangesCount: (changedSnapshots: SnapshotApi[]) => number
+ quarantinedIdentifierSet: (
+ quarantinedIdentifiers: QuarantinedIdentifierEntryApi[],
+ run: RunApi | null
+ ) => Set<string>
+ repoFullName: (repo: RepoApi | null) => string | null
+ thumbnailBasePath: (run: RunApi | null, currentProjectId: number | string) => string | null
+ isRunInProgress: (run: RunApi | null) => boolean
+ isRunProcessing: (run: RunApi | null) => boolean
+ isReportingOnly: (run: RunApi | null) => boolean
+ breadcrumbs: (run: RunApi | null) => Breadcrumb[]
+ }
+}
+
+export type visualReviewRunSceneLogicType = MakeLogicType<
+ visualReviewRunSceneLogicValues,
+ visualReviewRunSceneLogicActions,
+ VisualReviewRunSceneLogicProps,
+ visualReviewRunSceneLogicMeta
+>
+
export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([
path(['products', 'visual_review', 'frontend', 'scenes', 'visualReviewRunSceneLogic']),
props({} as VisualReviewRunSceneLogicProps),
@@ -186,7 +387,11 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([
selectors({
selectedSnapshot: [
(s) => [s.snapshots, s.selectedSnapshotId, s.quarantinedIdentifierSet],
- (snapshots, selectedSnapshotId, quarantinedIdentifierSet): SnapshotApi | null => {
+ (
+ snapshots: SnapshotApi[],
+ selectedSnapshotId: string | null,
+ quarantinedIdentifierSet: Set<string>
+ ): SnapshotApi | null => {
if (selectedSnapshotId) {
return snapshots.find((s) => s.id === selectedSnapshotId) || null
}
@@ -197,7 +402,7 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([
],
changedSnapshots: [
(s) => [s.snapshots],
- (snapshots): SnapshotApi[] => snapshots.filter((s) => s.result !== 'unchanged'),
+ (snapshots: SnapshotApi[]): SnapshotApi[] => snapshots.filter((s) => s.result !== 'unchanged'),
],
sortedChangedSnapshots: [
(s) => [s.changedSnapshots],
@@ -247,10 +452,13 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([
return sortedGroups.flat()
},
],
- hasChanges: [(s) => [s.changedSnapshots], (changedSnapshots): boolean => changedSnapshots.length > 0],
+ hasChanges: [
+ (s) => [s.changedSnapshots],
+ (changedSnapshots: SnapshotApi[]): boolean => changedSnapshots.length > 0,
+ ],
unreviewedChangesCount: [
(s) => [s.changedSnapshots],
- (changedSnapshots): number =>
+ (changedSnapshots: SnapshotApi[]): number =>
changedSnapshots.filter((s) => s.review_state !== 'approved' && s.review_state !== 'tolerated').length,
],
quarantinedIdentifierSet: [
@@ -265,22 +473,25 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([
.map((q: QuarantinedIdentifierEntryApi) => q.identifier)
),
],
- repoFullName: [(s) => [s.repo], (repo): string | null => repo?.repo_full_name || null],
+ repoFullName: [(s) => [s.repo], (repo: RepoApi | null): string | null => repo?.repo_full_name || null],
thumbnailBasePath: [
(s) => [s.run, s.currentProjectId],
- (run, projectId): string | null => {
+ (run: RunApi | null, projectId: number | string): string | null => {
if (!run || !projectId) {
return null
}
return `/api/projects/${projectId}/visual_review/repos/${run.repo_id}/thumbnails`
},
],
- isRunInProgress: [(s) => [s.run], (run): boolean => run?.status === 'pending' || run?.status === 'processing'],
- isRunProcessing: [(s) => [s.run], (run): boolean => run?.status === 'processing'],
- isReportingOnly: [(s) => [s.run], (run): boolean => isReportingOnlyRun(run)],
+ isRunInProgress: [
+ (s) => [s.run],
+ (run: RunApi | null): boolean => run?.status === 'pending' || run?.status === 'processing',
+ ],
+ isRunProcessing: [(s) => [s.run], (run: RunApi | null): boolean => run?.status === 'processing'],
+ isReportingOnly: [(s) => [s.run], (run: RunApi | null): boolean => isReportingOnlyRun(run)],
breadcrumbs: [
(s) => [s.run],
- (run): Breadcrumb[] => [
+ (run: RunApi | null): Breadcrumb[] => [
{
key: 'visual_review',
name: 'Visual review',
diff --git a/products/visual_review/frontend/scenes/visualReviewRunsSceneLogic.ts b/products/visual_review/frontend/scenes/visualReviewRunsSceneLogic.ts
index 35a99552cf59..cf52bb9c61b0 100644
--- a/products/visual_review/frontend/scenes/visualReviewRunsSceneLogic.ts
+++ b/products/visual_review/frontend/scenes/visualReviewRunsSceneLogic.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 { teamLogic } from 'scenes/teamLogic'
@@ -8,7 +8,6 @@ import { Breadcrumb } from '~/types'
import { visualReviewReposRunsCountsRetrieve, visualReviewReposRunsList } from '../generated/api'
import type { PaginatedRunListApi, RepoApi, ReviewStateCountsApi } from '../generated/api.schemas'
import { visualReviewRepoLogic } from './visualReviewRepoLogic'
-import type { visualReviewRunsSceneLogicType } from './visualReviewRunsSceneLogicType'
export type ReviewState = 'needs_review' | 'clean' | 'processing' | 'stale'
@@ -18,6 +17,87 @@ export interface VisualReviewRunsSceneLogicProps {
repoId: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewRunsSceneLogicValues {
+ currentProjectId: number | string // teamLogic
+ repo: RepoApi | null // visualReviewRepoLogic
+ repoFullName: string | undefined // visualReviewRepoLogic
+ activeTab: ReviewState
+ breadcrumbs: Breadcrumb[]
+ counts: ReviewStateCountsApi
+ countsLoading: boolean
+ page: number
+ repoId: string
+ runs: PaginatedRunListApi['results']
+ runsLoading: boolean
+ runsResponse: PaginatedRunListApi
+ runsResponseLoading: boolean
+ searchQuery: string
+ totalCount: number
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewRunsSceneLogicActions {
+ loadCounts: () => any
+ loadCountsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadCountsSuccess: (
+ counts: ReviewStateCountsApi,
+ payload?: any
+ ) => {
+ counts: ReviewStateCountsApi
+ payload?: any
+ }
+ loadRuns: () => any
+ loadRunsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRunsSuccess: (
+ runsResponse: PaginatedRunListApi,
+ payload?: any
+ ) => {
+ runsResponse: PaginatedRunListApi
+ payload?: any
+ }
+ setActiveTab: (tab: ReviewState) => {
+ tab: ReviewState
+ }
+ setPage: (page: number) => {
+ page: number
+ }
+ setSearchQuery: (searchQuery: string) => {
+ searchQuery: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewRunsSceneLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ repoId: (arg: any) => string
+ runs: (runsResponse: PaginatedRunListApi) => PaginatedRunListApi['results']
+ runsLoading: (runsResponseLoading: boolean) => boolean
+ totalCount: (runsResponse: PaginatedRunListApi) => number
+ breadcrumbs: (repo: RepoApi | null) => Breadcrumb[]
+ }
+}
+
+export type visualReviewRunsSceneLogicType = MakeLogicType<
+ visualReviewRunsSceneLogicValues,
+ visualReviewRunsSceneLogicActions,
+ VisualReviewRunsSceneLogicProps,
+ visualReviewRunsSceneLogicMeta
+>
+
export const visualReviewRunsSceneLogic = kea<visualReviewRunsSceneLogicType>([
path(['products', 'visual_review', 'frontend', 'scenes', 'visualReviewRunsSceneLogic']),
props({} as VisualReviewRunsSceneLogicProps),
diff --git a/products/visual_review/frontend/scenes/visualReviewSettingsSceneLogic.ts b/products/visual_review/frontend/scenes/visualReviewSettingsSceneLogic.ts
index 969ac368cd9d..c6191a884602 100644
--- a/products/visual_review/frontend/scenes/visualReviewSettingsSceneLogic.ts
+++ b/products/visual_review/frontend/scenes/visualReviewSettingsSceneLogic.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 { integrationsLogic } from 'lib/integrations/integrationsLogic'
@@ -9,9 +9,9 @@ import { Breadcrumb } from '~/types'
import type { GitHubRepoApi } from 'products/integrations/frontend/generated/api.schemas'
+import type { IntegrationType, UserBasicType } from '../../../../frontend/src/types'
import { visualReviewReposCreate, visualReviewReposList, visualReviewReposPartialUpdate } from '../generated/api'
import type { PatchedUpdateRepoRequestInputApi, RepoApi } from '../generated/api.schemas'
-import type { visualReviewSettingsSceneLogicType } from './visualReviewSettingsSceneLogicType'
export interface RepoFormValues {
baseline_file_paths: Record<string, string>
@@ -30,6 +30,184 @@ function formValuesFromRepo(repo: RepoApi): RepoFormValues {
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewSettingsSceneLogicValues {
+ getGitHubRepositoriesFull: (integrationId: number) => GitHubRepoApi[] // integrationsLogic
+ integrations: IntegrationType[] | null // integrationsLogic
+ currentProjectId: number | string // teamLogic
+ availableRepos: GitHubRepoApi[]
+ breadcrumbs: Breadcrumb[]
+ editingRepo: RepoApi | null
+ editingRepoId: string | null
+ existingRepoNames: Set<string>
+ formValues: RepoFormValues
+ githubManageAccessUrl: string | null
+ hasChanges: boolean
+ repos: RepoApi[]
+ reposLoading: boolean
+ saving: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewSettingsSceneLogicActions {
+ loadIntegrationsSuccess: (
+ integrations: {
+ config: any
+ created_at: string
+ created_by?: UserBasicType | null | undefined
+ display_name: string
+ errors?: string | undefined
+ icon_url: any
+ id: number
+ kind:
+ | 'apns'
+ | 'aws-s3'
+ | 'azure-blob'
+ | 'bing-ads'
+ | 'clickup'
+ | 'customerio-app'
+ | 'customerio-track'
+ | 'customerio-webhook'
+ | 'databricks'
+ | 'email'
+ | 'firebase'
+ | 'github'
+ | 'gitlab'
+ | 'google-ads'
+ | 'google-analytics'
+ | 'google-cloud-service-account'
+ | 'google-cloud-storage'
+ | 'google-pubsub'
+ | 'google-search-console'
+ | 'google-sheets'
+ | 'hubspot'
+ | 'intercom'
+ | 'jira'
+ | 'linear'
+ | 'linkedin-ads'
+ | 'meta-ads'
+ | 'pinterest-ads'
+ | 'postgresql'
+ | 'reddit-ads'
+ | 's3-compatible'
+ | 'salesforce'
+ | 'slack'
+ | 'snapchat'
+ | 'snowflake'
+ | 'stripe'
+ | 'tiktok-ads'
+ | 'twilio'
+ | 'vercel'
+ }[],
+ payload?: any
+ ) => {
+ integrations: {
+ config: any
+ created_at: string
+ created_by?: UserBasicType | null | undefined
+ display_name: string
+ errors?: string | undefined
+ icon_url: any
+ id: number
+ kind:
+ | 'apns'
+ | 'aws-s3'
+ | 'azure-blob'
+ | 'bing-ads'
+ | 'clickup'
+ | 'customerio-app'
+ | 'customerio-track'
+ | 'customerio-webhook'
+ | 'databricks'
+ | 'email'
+ | 'firebase'
+ | 'github'
+ | 'gitlab'
+ | 'google-ads'
+ | 'google-analytics'
+ | 'google-cloud-service-account'
+ | 'google-cloud-storage'
+ | 'google-pubsub'
+ | 'google-search-console'
+ | 'google-sheets'
+ | 'hubspot'
+ | 'intercom'
+ | 'jira'
+ | 'linear'
+ | 'linkedin-ads'
+ | 'meta-ads'
+ | 'pinterest-ads'
+ | 'postgresql'
+ | 'reddit-ads'
+ | 's3-compatible'
+ | 'salesforce'
+ | 'slack'
+ | 'snapchat'
+ | 'snowflake'
+ | 'stripe'
+ | 'tiktok-ads'
+ | 'twilio'
+ | 'vercel'
+ }[]
+ payload?: any
+ } // integrationsLogic
+ addRepo: (githubRepo: GitHubRepoApi) => {
+ githubRepo: GitHubRepoApi
+ }
+ cancelEdit: () => {
+ value: true
+ }
+ editRepo: (repoId: string) => {
+ repoId: string
+ }
+ loadRepos: () => any
+ loadReposFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadReposSuccess: (
+ repos: RepoApi[],
+ payload?: any
+ ) => {
+ repos: RepoApi[]
+ payload?: any
+ }
+ saveRepo: () => {
+ value: true
+ }
+ setFormField: (
+ field: keyof RepoFormValues,
+ value: RepoFormValues[keyof RepoFormValues]
+ ) => {
+ field: keyof RepoFormValues
+ value: boolean | Record<string, string>
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewSettingsSceneLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ editingRepo: (repos: RepoApi[], editingRepoId: string | null) => RepoApi | null
+ hasChanges: (formValues: RepoFormValues, editingRepo: RepoApi | null) => boolean
+ availableRepos: (
+ integrations: IntegrationType[] | null,
+ getGitHubRepositoriesFull: (integrationId: number) => GitHubRepoApi[]
+ ) => GitHubRepoApi[]
+ existingRepoNames: (repos: RepoApi[]) => Set<string>
+ githubManageAccessUrl: (integrations: IntegrationType[] | null) => string | null
+ }
+}
+
+export type visualReviewSettingsSceneLogicType = MakeLogicType<
+ visualReviewSettingsSceneLogicValues,
+ visualReviewSettingsSceneLogicActions,
+ Record<string, any>,
+ visualReviewSettingsSceneLogicMeta
+>
+
export const visualReviewSettingsSceneLogic = kea<visualReviewSettingsSceneLogicType>([
path(['products', 'visual_review', 'frontend', 'scenes', 'visualReviewSettingsSceneLogic']),
@@ -89,7 +267,7 @@ export const visualReviewSettingsSceneLogic = kea<visualReviewSettingsSceneLogic
selectors({
editingRepo: [
(s) => [s.repos, s.editingRepoId],
- (repos, editingRepoId): RepoApi | null => {
+ (repos: RepoApi[], editingRepoId: string | null): RepoApi | null => {
if (!editingRepoId) {
return null
}
@@ -98,7 +276,7 @@ export const visualReviewSettingsSceneLogic = kea<visualReviewSettingsSceneLogic
],
hasChanges: [
(s) => [s.formValues, s.editingRepo],
- (formValues, editingRepo): boolean => {
+ (formValues: RepoFormValues, editingRepo: RepoApi | null): boolean => {
if (!editingRepo) {
return false
}
@@ -125,7 +303,10 @@ export const visualReviewSettingsSceneLogic = kea<visualReviewSettingsSceneLogic
return repos
},
],
- existingRepoNames: [(s) => [s.repos], (repos): Set<string> => new Set(repos.map((r) => r.repo_full_name))],
+ existingRepoNames: [
+ (s) => [s.repos],
+ (repos: RepoApi[]): Set<string> => new Set(repos.map((r) => r.repo_full_name)),
+ ],
githubManageAccessUrl: [
(s) => [s.integrations],
(integrations: any[] | null): string | null => {
diff --git a/products/visual_review/frontend/scenes/visualReviewSnapshotHistorySceneLogic.ts b/products/visual_review/frontend/scenes/visualReviewSnapshotHistorySceneLogic.ts
index 116814800f79..9510bf411311 100644
--- a/products/visual_review/frontend/scenes/visualReviewSnapshotHistorySceneLogic.ts
+++ b/products/visual_review/frontend/scenes/visualReviewSnapshotHistorySceneLogic.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 { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
@@ -15,7 +15,6 @@ import {
visualReviewReposSnapshotsList,
} from '../generated/api'
import type { QuarantinedIdentifierEntryApi, RepoApi, SnapshotHistoryEntryApi } from '../generated/api.schemas'
-import type { visualReviewSnapshotHistorySceneLogicType } from './visualReviewSnapshotHistorySceneLogicType'
export interface VisualReviewSnapshotHistorySceneLogicProps {
repoId: string
@@ -44,6 +43,149 @@ function detectTheme(identifier: string): { stem: string; theme: 'light' | 'dark
return { stem: identifier, theme: null }
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewSnapshotHistorySceneLogicValues {
+ currentProjectId: number | string // teamLogic
+ breadcrumbs: Breadcrumb[]
+ history: SnapshotHistoryEntryApi[]
+ historyLoading: boolean
+ identifier: string
+ pairedHistory: ThemePair[]
+ partnerHistory: SnapshotHistoryEntryApi[]
+ partnerHistoryLoading: boolean
+ primaryTheme: 'dark' | 'light' | null
+ quarantineEntry: QuarantinedIdentifierEntryApi | null
+ quarantineEntryLoading: boolean
+ repo: RepoApi | null
+ repoId: string
+ repoLoading: boolean
+ runType: string
+ siblingIdentifier: string | null
+ siblingQuarantineEntry: QuarantinedIdentifierEntryApi | null
+ siblingQuarantineEntryLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewSnapshotHistorySceneLogicActions {
+ loadHistory: () => any
+ loadHistoryFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadHistorySuccess: (
+ history: SnapshotHistoryEntryApi[],
+ payload?: any
+ ) => {
+ history: SnapshotHistoryEntryApi[]
+ payload?: any
+ }
+ loadPartnerHistory: () => any
+ loadPartnerHistoryFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPartnerHistorySuccess: (
+ partnerHistory: SnapshotHistoryEntryApi[],
+ payload?: any
+ ) => {
+ partnerHistory: SnapshotHistoryEntryApi[]
+ payload?: any
+ }
+ loadQuarantineEntry: () => any
+ loadQuarantineEntryFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadQuarantineEntrySuccess: (
+ quarantineEntry: QuarantinedIdentifierEntryApi | null,
+ payload?: any
+ ) => {
+ quarantineEntry: QuarantinedIdentifierEntryApi | null
+ payload?: any
+ }
+ loadRepo: () => any
+ loadRepoFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRepoSuccess: (
+ repo: RepoApi,
+ payload?: any
+ ) => {
+ repo: RepoApi
+ payload?: any
+ }
+ loadSiblingQuarantineEntry: () => any
+ loadSiblingQuarantineEntryFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSiblingQuarantineEntrySuccess: (
+ siblingQuarantineEntry: QuarantinedIdentifierEntryApi | null,
+ payload?: any
+ ) => {
+ siblingQuarantineEntry: QuarantinedIdentifierEntryApi | null
+ payload?: any
+ }
+ quarantineIdentifier: (
+ reason: string,
+ identifiers: string[],
+ expiresAt: string | null,
+ sourceRunId?: string | null
+ ) => {
+ expiresAt: string | null
+ identifiers: string[]
+ reason: string
+ sourceRunId: string | null
+ }
+ unquarantineIdentifier: () => {
+ value: true
+ }
+ unquarantineSibling: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewSnapshotHistorySceneLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ identifier: (arg: any) => string
+ runType: (arg: any) => string
+ repoId: (arg: any) => string
+ primaryTheme: (arg: any) => 'dark' | 'light' | null
+ siblingIdentifier: (arg: any) => string | null
+ pairedHistory: (
+ history: SnapshotHistoryEntryApi[],
+ partnerHistory: SnapshotHistoryEntryApi[],
+ primaryTheme: 'dark' | 'light' | null
+ ) => ThemePair[]
+ breadcrumbs: (arg: any, arg2: any) => Breadcrumb[]
+ }
+}
+
+export type visualReviewSnapshotHistorySceneLogicType = MakeLogicType<
+ visualReviewSnapshotHistorySceneLogicValues,
+ visualReviewSnapshotHistorySceneLogicActions,
+ VisualReviewSnapshotHistorySceneLogicProps,
+ visualReviewSnapshotHistorySceneLogicMeta
+>
+
export const visualReviewSnapshotHistorySceneLogic = kea<visualReviewSnapshotHistorySceneLogicType>([
path(['products', 'visual_review', 'frontend', 'scenes', 'visualReviewSnapshotHistorySceneLogic']),
props({} as VisualReviewSnapshotHistorySceneLogicProps),
diff --git a/products/visual_review/frontend/scenes/visualReviewSnapshotOverviewSceneLogic.ts b/products/visual_review/frontend/scenes/visualReviewSnapshotOverviewSceneLogic.ts
index 4d0dfae9b977..ea2969787b30 100644
--- a/products/visual_review/frontend/scenes/visualReviewSnapshotOverviewSceneLogic.ts
+++ b/products/visual_review/frontend/scenes/visualReviewSnapshotOverviewSceneLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, key, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, key, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, urlToAction } from 'kea-router'
@@ -10,9 +10,9 @@ import type { FacetBucket, FacetGroups, FacetSelection } from '../components/Sna
import type { StatPreset } from '../components/SnapshotStatRow'
import { visualReviewReposBaselinesRetrieve } from '../generated/api'
import type { BaselineEntryApi, BaselineOverviewApi } from '../generated/api.schemas'
+import type { RepoApi } from '../generated/api.schemas'
import { parseArea, parseTheme, runTypeLabel } from '../lib/parseIdentifier'
import { visualReviewRepoLogic } from './visualReviewRepoLogic'
-import type { visualReviewSnapshotOverviewSceneLogicType } from './visualReviewSnapshotOverviewSceneLogicType'
export interface VisualReviewSnapshotOverviewSceneLogicProps {
repoId: string
@@ -156,6 +156,135 @@ function applyFilters(
})
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewSnapshotOverviewSceneLogicValues {
+ currentProjectId: number | string // teamLogic
+ repo: RepoApi | null // visualReviewRepoLogic
+ breadcrumbs: Breadcrumb[]
+ decoratedEntries: Array<
+ BaselineEntryApi & {
+ _area: string
+ _stability: string[]
+ _theme: 'dark' | 'light' | null
+ _typeKey: string
+ }
+ >
+ entries: BaselineEntryApi[]
+ facetGroups: FacetGroups
+ facetSelection: FacetSelection
+ filteredEntries: DecoratedEntry[]
+ filters: Filters
+ frequentlyToleratedCount: number
+ overview: BaselineOverviewApi | null
+ overviewLoading: boolean
+ repoId: string
+ statCounts: Record<StatPreset, number>
+ thumbnailBasePath: string | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewSnapshotOverviewSceneLogicActions {
+ clearAllFilters: () => {
+ value: true
+ }
+ loadOverview: () => any
+ loadOverviewFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadOverviewSuccess: (
+ overview: BaselineOverviewApi,
+ payload?: any
+ ) => {
+ overview: BaselineOverviewApi
+ payload?: any
+ }
+ setSearch: (search: string) => {
+ search: string
+ }
+ setStatPreset: (preset: StatPreset) => {
+ preset: StatPreset
+ }
+ setTheme: (theme: ThemeFilter) => {
+ theme: ThemeFilter
+ }
+ toggleArea: (value: string) => {
+ value: string
+ }
+ toggleStability: (value: string) => {
+ value: string
+ }
+ toggleType: (value: string) => {
+ value: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visualReviewSnapshotOverviewSceneLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ repoId: (arg: any) => string
+ entries: (overview: BaselineOverviewApi | null) => BaselineEntryApi[]
+ decoratedEntries: (entries: BaselineEntryApi[]) => Array<
+ BaselineEntryApi & {
+ _area: string
+ _stability: string[]
+ _theme: 'dark' | 'light' | null
+ _typeKey: string
+ }
+ >
+ filteredEntries: (
+ decoratedEntries: (BaselineEntryApi & {
+ _area: string
+ _stability: string[]
+ _theme: 'dark' | 'light' | null
+ _typeKey: string
+ })[],
+ filters: Filters
+ ) => DecoratedEntry[]
+ frequentlyToleratedCount: (
+ decoratedEntries: (BaselineEntryApi & {
+ _area: string
+ _stability: string[]
+ _theme: 'dark' | 'light' | null
+ _typeKey: string
+ })[],
+ overview: BaselineOverviewApi | null
+ ) => number
+ statCounts: (
+ decoratedEntries: (BaselineEntryApi & {
+ _area: string
+ _stability: string[]
+ _theme: 'dark' | 'light' | null
+ _typeKey: string
+ })[],
+ overview: BaselineOverviewApi | null
+ ) => Record<StatPreset, number>
+ facetGroups: (
+ decoratedEntries: (BaselineEntryApi & {
+ _area: string
+ _stability: string[]
+ _theme: 'dark' | 'light' | null
+ _typeKey: string
+ })[],
+ filters: Filters
+ ) => FacetGroups
+ facetSelection: (filters: Filters) => FacetSelection
+ thumbnailBasePath: (currentProjectId: number | string, arg: any) => string | null
+ breadcrumbs: (repo: RepoApi | null) => Breadcrumb[]
+ }
+}
+
+export type visualReviewSnapshotOverviewSceneLogicType = MakeLogicType<
+ visualReviewSnapshotOverviewSceneLogicValues,
+ visualReviewSnapshotOverviewSceneLogicActions,
+ VisualReviewSnapshotOverviewSceneLogicProps,
+ visualReviewSnapshotOverviewSceneLogicMeta
+>
+
export const visualReviewSnapshotOverviewSceneLogic = kea<visualReviewSnapshotOverviewSceneLogicType>([
path(['products', 'visual_review', 'frontend', 'scenes', 'visualReviewSnapshotOverviewSceneLogic']),
props({} as VisualReviewSnapshotOverviewSceneLogicProps),
@@ -213,13 +342,16 @@ export const visualReviewSnapshotOverviewSceneLogic = kea<visualReviewSnapshotOv
})),
selectors({
repoId: [() => [(_, p) => p.repoId], (repoId: string): string => repoId],
- entries: [(s) => [s.overview], (overview): BaselineEntryApi[] => overview?.entries ?? []],
+ entries: [
+ (s) => [s.overview],
+ (overview: BaselineOverviewApi | null): BaselineEntryApi[] => overview?.entries ?? [],
+ ],
// Pre-compute parsed area + theme + typeKey + stability tags for each
// entry so subsequent filter passes don't re-derive on every keystroke.
decoratedEntries: [
(s) => [s.entries],
(
- entries
+ entries: BaselineEntryApi[]
): Array<
BaselineEntryApi & {
_area: string
@@ -244,7 +376,17 @@ export const visualReviewSnapshotOverviewSceneLogic = kea<visualReviewSnapshotOv
// re-explaining itself; one axis everywhere is calmer.
filteredEntries: [
(s) => [s.decoratedEntries, s.filters],
- (entries, filters) => {
+ (
+ entries: Array<
+ BaselineEntryApi & {
+ _area: string
+ _stability: string[]
+ _theme: 'dark' | 'light' | null
+ _typeKey: string
+ }
+ >,
+ filters: Filters
+ ) => {
const filtered = applyFilters(entries, filters)
filtered.sort(
(a, b) =>
@@ -260,12 +402,32 @@ export const visualReviewSnapshotOverviewSceneLogic = kea<visualReviewSnapshotOv
// to recomputing client-side when the server didn't ship totals.
frequentlyToleratedCount: [
(s) => [s.decoratedEntries, s.overview],
- (entries, overview): number =>
+ (
+ entries: Array<
+ BaselineEntryApi & {
+ _area: string
+ _stability: string[]
+ _theme: 'dark' | 'light' | null
+ _typeKey: string
+ }
+ >,
+ overview: BaselineOverviewApi | null
+ ): number =>
overview?.totals.frequently_tolerated ?? entries.filter((e) => e.tolerate_count_90d >= 3).length,
],
statCounts: [
(s) => [s.decoratedEntries, s.overview],
- (entries, overview): Record<StatPreset, number> => {
+ (
+ entries: Array<
+ BaselineEntryApi & {
+ _area: string
+ _stability: string[]
+ _theme: 'dark' | 'light' | null
+ _typeKey: string
+ }
+ >,
+ overview: BaselineOverviewApi | null
+ ): Record<StatPreset, number> => {
const totals = overview?.totals
// When the filter set is "neutral" (preset=all) we want the
// stat row to show the full universe counts even if entries
@@ -289,7 +451,17 @@ export const visualReviewSnapshotOverviewSceneLogic = kea<visualReviewSnapshotOv
// (otherwise picking a TYPE would zero out every other TYPE bucket).
facetGroups: [
(s) => [s.decoratedEntries, s.filters],
- (entries, filters): FacetGroups => {
+ (
+ entries: Array<
+ BaselineEntryApi & {
+ _area: string
+ _stability: string[]
+ _theme: 'dark' | 'light' | null
+ _typeKey: string
+ }
+ >,
+ filters: Filters
+ ): FacetGroups => {
const typeBase = applyFilters(entries, filters, 'typeKeys')
const areaBase = applyFilters(entries, filters, 'areas')
const stabilityBase = applyFilters(entries, filters, 'stability')
@@ -310,7 +482,7 @@ export const visualReviewSnapshotOverviewSceneLogic = kea<visualReviewSnapshotOv
],
facetSelection: [
(s) => [s.filters],
- (filters): FacetSelection => ({
+ (filters: Filters): FacetSelection => ({
type: new Set(filters.typeKeys),
area: new Set(filters.areas),
stability: new Set(filters.stability),
@@ -318,13 +490,13 @@ export const visualReviewSnapshotOverviewSceneLogic = kea<visualReviewSnapshotOv
],
thumbnailBasePath: [
(s) => [s.currentProjectId, (_, p) => p.repoId],
- (projectId, repoId): string | null =>
+ (projectId: number | string, repoId): string | null =>
projectId ? `/api/projects/${projectId}/visual_review/repos/${repoId}/thumbnails` : null,
],
// Single scene crumb — see runs scene for why we collapse to one.
breadcrumbs: [
(s) => [s.repo],
- (repo): Breadcrumb[] => [
+ (repo: null | import('../generated/api.schemas').RepoApi): Breadcrumb[] => [
{
key: ['visual_review_repo', repo?.id ?? 'unknown'],
name: repo?.repo_full_name ?? 'Visual review',