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 4 (#71458)

Marius Andrac4a9775f537e
diff --git a/.kearc b/.kearc
index 206d08973eab..7cc7c609725b 100644
--- a/.kearc
+++ b/.kearc
@@ -38,20 +38,20 @@
"./products/visual_review",
"./.kea-inline-separator-03",
"./.kea-inline-separator-03-b",
- "./.kea-inline-batch-04-slot-01",
- "./.kea-inline-batch-04-slot-02",
- "./.kea-inline-batch-04-slot-03",
- "./.kea-inline-batch-04-slot-04",
- "./.kea-inline-batch-04-slot-05",
- "./.kea-inline-batch-04-slot-06",
- "./.kea-inline-batch-04-slot-07",
- "./.kea-inline-batch-04-slot-08",
- "./.kea-inline-batch-04-slot-09",
- "./.kea-inline-batch-04-slot-10",
- "./.kea-inline-batch-04-slot-11",
- "./.kea-inline-batch-04-slot-12",
- "./.kea-inline-batch-04-slot-13",
- "./.kea-inline-batch-04-slot-14",
+ "./frontend/src/exporter",
+ "./frontend/src/scenes/annotations",
+ "./frontend/src/scenes/authentication",
+ "./frontend/src/scenes/billing",
+ "./frontend/src/scenes/dashboard",
+ "./frontend/src/scenes/exports",
+ "./frontend/src/scenes/integrations",
+ "./frontend/src/scenes/onboarding",
+ "./frontend/src/scenes/persons-management",
+ "./frontend/src/scenes/project-homepage",
+ "./frontend/src/scenes/sessions",
+ "./products/logs",
+ "./products/revenue_analytics",
+ "./products/review_hog",
"./.kea-inline-separator-04",
"./.kea-inline-separator-04-b",
"./frontend/src/scenes/audit-logs",
diff --git a/frontend/src/exporter/ExporterLogin.tsx b/frontend/src/exporter/ExporterLogin.tsx
index a2a8d51095c0..e9e2db8c0891 100644
--- a/frontend/src/exporter/ExporterLogin.tsx
+++ b/frontend/src/exporter/ExporterLogin.tsx
@@ -1,8 +1,9 @@
import '../scenes/authentication/login/Login.scss'
import clsx from 'clsx'
-import { actions, kea, path, reducers, useValues } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers, useValues } from 'kea'
import { Form, forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { BridgePage } from 'lib/components/BridgePage/BridgePage'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
@@ -12,12 +13,85 @@ import { LemonInput } from 'lib/lemon-ui/LemonInput'
import { ERROR_MESSAGES } from 'scenes/authentication/shared/loginErrorMessages'
import { SupportModalButton } from 'scenes/authentication/shared/SupportModalButton'
-import type { loginLogicType } from './ExporterLoginType'
-
export interface LoginForm {
password: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface loginLogicValues {
+ generalError: {
+ code: string
+ detail: string
+ } | null
+ isLoginSubmitting: boolean
+ isLoginValid: boolean
+ isSuccess: boolean
+ login: LoginForm
+ loginAllErrors: Record<string, any>
+ loginChanged: boolean
+ loginErrors: DeepPartialMap<LoginForm, ValidationErrorType>
+ loginHasErrors: boolean
+ loginManualErrors: Record<string, any>
+ loginTouched: boolean
+ loginTouches: Record<string, boolean>
+ loginValidationErrors: DeepPartialMap<LoginForm, ValidationErrorType>
+ showLoginErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface loginLogicActions {
+ clearGeneralError: () => {
+ value: true
+ }
+ resetLogin: (values?: LoginForm) => {
+ values?: LoginForm
+ }
+ setGeneralError: (
+ code: string,
+ detail: string
+ ) => {
+ code: string
+ detail: string
+ }
+ setLoginManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setLoginValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setLoginValues: (values: DeepPartial<LoginForm>) => {
+ values: DeepPartial<LoginForm>
+ }
+ setSuccess: () => {
+ value: true
+ }
+ submitLogin: () => {
+ value: boolean
+ }
+ submitLoginFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitLoginRequest: (login: LoginForm) => {
+ login: LoginForm
+ }
+ submitLoginSuccess: (login: LoginForm) => {
+ login: LoginForm
+ }
+ touchLoginField: (key: string) => {
+ key: string
+ }
+}
+
+export type loginLogicType = MakeLogicType<loginLogicValues, loginLogicActions>
+
export const loginLogic = kea<loginLogicType>([
path(['exporter', 'ExporterLogin']),
actions({
diff --git a/frontend/src/exporter/exporterViewLogic.ts b/frontend/src/exporter/exporterViewLogic.ts
index af16e6e9ff45..25a554ef9325 100644
--- a/frontend/src/exporter/exporterViewLogic.ts
+++ b/frontend/src/exporter/exporterViewLogic.ts
@@ -1,14 +1,70 @@
-import { actions, afterMount, connect, kea, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, props, reducers, selectors } from 'kea'
import { heatmapDataLogic } from 'lib/components/heatmaps/heatmapDataLogic'
-import type { exporterViewLogicType } from './exporterViewLogicType'
+import type { HrefMatchType } from '../lib/components/heatmaps/heatmapDataLogic'
+import type { CommonFilters, HeatmapFilters, HeatmapFixedPositionMode } from '../lib/components/heatmaps/types'
import { ExportType, ExportedData } from './types'
const isUrlPattern = (url: string): boolean => {
return /[*+?^${}()|[\]\\]/.test(url)
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface exporterViewLogicValues {
+ exportedData: ExportedData
+ isLoading: boolean
+ screenshotUrl: string | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface exporterViewLogicActions {
+ setCommonFilters: (filters: CommonFilters) => {
+ filters: CommonFilters
+ } // heatmapDataLogic
+ setHeatmapColorPalette: (palette: string | null) => {
+ palette: string | null
+ } // heatmapDataLogic
+ setHeatmapFilters: (filters: HeatmapFilters) => {
+ filters: HeatmapFilters
+ } // heatmapDataLogic
+ setHeatmapFixedPositionMode: (mode: HeatmapFixedPositionMode) => {
+ mode: HeatmapFixedPositionMode
+ } // heatmapDataLogic
+ setHref: (href: string) => {
+ href: string
+ } // heatmapDataLogic
+ setHrefMatchType: (matchType: HrefMatchType) => {
+ matchType: HrefMatchType
+ } // heatmapDataLogic
+ setWindowWidthOverride: (widthOverride: number | null) => {
+ widthOverride: number | null
+ } // heatmapDataLogic
+ fetchScreenshotUrl: () => {
+ value: true
+ }
+ setIsLoading: (isLoading: boolean) => {
+ isLoading: boolean
+ }
+ setScreenshotUrl: (screenshotUrl: string) => {
+ screenshotUrl: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface exporterViewLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ exportedData: (arg: ExportedData) => ExportedData
+ }
+}
+
+export type exporterViewLogicType = MakeLogicType<
+ exporterViewLogicValues,
+ exporterViewLogicActions,
+ ExportedData,
+ exporterViewLogicMeta
+>
+
// This is a simple logic that is mounted by the Exporter view and then can be found by any nested callers
// This simplifies passing props everywhere.
// E.g. api.ts uses this to add the sharing_access_token
diff --git a/frontend/src/layout/navigation-3000/navigationLogic.tsx b/frontend/src/layout/navigation-3000/navigationLogic.tsx
index da23f1ce524d..6f387178bf18 100644
--- a/frontend/src/layout/navigation-3000/navigationLogic.tsx
+++ b/frontend/src/layout/navigation-3000/navigationLogic.tsx
@@ -114,8 +114,8 @@ export interface navigation3000LogicActions {
sceneId: string,
sceneKey: string | undefined,
params: SceneParams,
- scrollToTop?: boolean,
- exportedScene?: SceneExport
+ scrollToTop?: boolean | undefined,
+ exportedScene?: SceneExport<SceneProps> | undefined
) => {
exportedScene: SceneExport<SceneProps> | undefined
params: SceneParams
diff --git a/frontend/src/layout/navigation/Breadcrumbs/breadcrumbsLogic.tsx b/frontend/src/layout/navigation/Breadcrumbs/breadcrumbsLogic.tsx
index 3256cd8f2628..bd9e9d3b6aaf 100644
--- a/frontend/src/layout/navigation/Breadcrumbs/breadcrumbsLogic.tsx
+++ b/frontend/src/layout/navigation/Breadcrumbs/breadcrumbsLogic.tsx
@@ -13,7 +13,7 @@ import { userLogic } from 'scenes/userLogic'
import { Breadcrumb, ProjectTreeRef } from '~/types'
-import type { SceneConfig, SceneParams } from '../../../scenes/sceneTypes'
+import type { SceneConfig } from '../../../scenes/sceneTypes'
import type { OrganizationBasicType, OrganizationType, PreflightStatus, ProjectType, UserType } from '../../../types'
import type { TeamPublicType, TeamType } from '../../../types'
@@ -82,22 +82,6 @@ export interface breadcrumbsLogicMeta {
sceneBreadcrumbsDisplayString: (sceneBreadcrumbs: Breadcrumb[]) => string
documentTitle: (sceneBreadcrumbs: Breadcrumb[], preflight: PreflightStatus | null) => string
}
- __keaTypeGenInternalReducerActions: {
- 'load scene (scenes.sceneLogic)': (
- sceneId: string,
- sceneKey: string | undefined,
- params: SceneParams,
- method: string
- ) => {
- payload: {
- method: string
- params: SceneParams
- sceneId: string
- sceneKey: string | undefined
- }
- type: 'load scene (scenes.sceneLogic)'
- }
- }
}
export type breadcrumbsLogicType = MakeLogicType<
diff --git a/frontend/src/layout/navigation/ImpersonationNotice/impersonationNoticeLogic.ts b/frontend/src/layout/navigation/ImpersonationNotice/impersonationNoticeLogic.ts
index 58a2ed21bcc6..55447aa022f9 100644
--- a/frontend/src/layout/navigation/ImpersonationNotice/impersonationNoticeLogic.ts
+++ b/frontend/src/layout/navigation/ImpersonationNotice/impersonationNoticeLogic.ts
@@ -72,14 +72,16 @@ export interface impersonationNoticeLogicActions {
ensureAllMembersLoaded: () => {
value: true
} // membersLogic
- loadUser: (resetOnFailure?: boolean) => {
+ loadUser: (resetOnFailure?: boolean | undefined) => {
resetOnFailure: boolean | undefined
} // userLogic
loadUserSuccess: (
user: UserType | null,
- payload?: {
- resetOnFailure: boolean | undefined
- }
+ payload?:
+ | {
+ resetOnFailure: boolean | undefined
+ }
+ | undefined
) => {
payload?: {
resetOnFailure: boolean | undefined
@@ -91,9 +93,11 @@ export interface impersonationNoticeLogicActions {
} // userLogic
upgradeImpersonationSuccess: (
user: UserType | null,
- payload?: {
- reason: string
- }
+ payload?:
+ | {
+ reason: string
+ }
+ | undefined
) => {
payload?: {
reason: string
diff --git a/frontend/src/lib/components/AddToDashboard/addToDashboardModalLogic.ts b/frontend/src/lib/components/AddToDashboard/addToDashboardModalLogic.ts
index 2b7ec89635fd..e344fb26ea80 100644
--- a/frontend/src/lib/components/AddToDashboard/addToDashboardModalLogic.ts
+++ b/frontend/src/lib/components/AddToDashboard/addToDashboardModalLogic.ts
@@ -138,14 +138,6 @@ export interface addToDashboardModalLogicMeta {
user: UserType | null
) => DashboardBasicType[]
}
- __keaTypeGenInternalReducerActions: {
- 'add dashboard success (models.dashboardsModel)': (dashboard: DashboardType<QueryBasedInsightModel>) => {
- payload: {
- dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>
- }
- type: 'add dashboard success (models.dashboardsModel)'
- }
- }
}
export type addToDashboardModalLogicType = MakeLogicType<
diff --git a/frontend/src/lib/components/AnnotationsOverlay/annotationsOverlayLogic.ts b/frontend/src/lib/components/AnnotationsOverlay/annotationsOverlayLogic.ts
index 4d17688f1819..03a79c701cfc 100644
--- a/frontend/src/lib/components/AnnotationsOverlay/annotationsOverlayLogic.ts
+++ b/frontend/src/lib/components/AnnotationsOverlay/annotationsOverlayLogic.ts
@@ -110,10 +110,7 @@ export interface annotationsOverlayLogicActions {
deleteAnnotation: (annotation: AnnotationType) => {
annotation: AnnotationType
} // annotationsModel
- updateAnnotation: ({
- annotationId,
- annotationData,
- }: {
+ updateAnnotation: (args_0: {
annotationData: AnnotationDataWithoutInsight
annotationId: RawAnnotationType['id']
}) => {
diff --git a/frontend/src/lib/components/Cards/ButtonTileCard/buttonTileCardModalLogic.ts b/frontend/src/lib/components/Cards/ButtonTileCard/buttonTileCardModalLogic.ts
index b2a953215400..88cc58b33ce5 100644
--- a/frontend/src/lib/components/Cards/ButtonTileCard/buttonTileCardModalLogic.ts
+++ b/frontend/src/lib/components/Cards/ButtonTileCard/buttonTileCardModalLogic.ts
@@ -72,7 +72,7 @@ export interface buttonTileCardModalLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface buttonTileCardModalLogicActions {
- updateDashboard: ({ id, allowUndo, discardResult, ...payload }: any) => any // dashboardsModel
+ updateDashboard: (args_0: any) => any // dashboardsModel
resetButtonTile: (values?: ButtonTileForm) => {
values?: ButtonTileForm
}
diff --git a/frontend/src/lib/components/Cards/TextCard/textCardModalLogic.ts b/frontend/src/lib/components/Cards/TextCard/textCardModalLogic.ts
index 0392b3051b80..113472db2918 100644
--- a/frontend/src/lib/components/Cards/TextCard/textCardModalLogic.ts
+++ b/frontend/src/lib/components/Cards/TextCard/textCardModalLogic.ts
@@ -47,7 +47,7 @@ export interface textCardModalLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface textCardModalLogicActions {
- updateDashboard: ({ id, allowUndo, discardResult, ...payload }: any) => any // dashboardsModel
+ updateDashboard: (args_0: any) => any // dashboardsModel
resetTextTile: (values?: TextTileForm) => {
values?: TextTileForm
}
diff --git a/frontend/src/lib/components/TimeSensitiveAuthentication/modalInterruptionTrackingLogic.ts b/frontend/src/lib/components/TimeSensitiveAuthentication/modalInterruptionTrackingLogic.ts
index c1aa81734634..d3d32a53ced1 100644
--- a/frontend/src/lib/components/TimeSensitiveAuthentication/modalInterruptionTrackingLogic.ts
+++ b/frontend/src/lib/components/TimeSensitiveAuthentication/modalInterruptionTrackingLogic.ts
@@ -14,7 +14,7 @@ export interface modalInterruptionTrackingLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface modalInterruptionTrackingLogicActions {
createOrganization: (name: string) => string // organizationLogic
- createProject: ({ name }: { name: string }) => {
+ createProject: (args_0: { name: string }) => {
name: string
} // projectLogic
setInterruptedForm: (form: string | null) => {
diff --git a/frontend/src/scenes/annotations/annotationModalLogic.ts b/frontend/src/scenes/annotations/annotationModalLogic.ts
index 32de9cb29ea1..d1f12547fd45 100644
--- a/frontend/src/scenes/annotations/annotationModalLogic.ts
+++ b/frontend/src/scenes/annotations/annotationModalLogic.ts
@@ -1,5 +1,6 @@
-import { actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { urlToAction } from 'kea-router'
import '@posthog/lemon-ui'
@@ -14,7 +15,8 @@ import { userLogic } from 'scenes/userLogic'
import { annotationsModel, deserializeAnnotation } from '~/models/annotationsModel'
import { AnnotationScope, AnnotationType, DashboardBasicType, QueryBasedInsightModel } from '~/types'
-import type { annotationModalLogicType } from './annotationModalLogicType'
+import type { UserType } from '../../types'
+import type { RawAnnotationType } from '../../types'
export const ANNOTATION_DAYJS_FORMAT = 'MMMM DD, YYYY h:mm A'
@@ -41,6 +43,124 @@ export interface AnnotationModalForm {
dashboardId: AnnotationType['dashboard_id'] | null
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface annotationModalLogicValues {
+ annotations: AnnotationType[] // annotationsModel
+ annotationsLoading: boolean // annotationsModel
+ timezone: string // teamLogic
+ user: UserType | null // userLogic
+ annotationModal: AnnotationModalForm
+ annotationModalAllErrors: Record<string, any>
+ annotationModalChanged: boolean
+ annotationModalErrors: DeepPartialMap<AnnotationModalForm, ValidationErrorType>
+ annotationModalHasErrors: boolean
+ annotationModalManualErrors: Record<string, any>
+ annotationModalTouched: boolean
+ annotationModalTouches: Record<string, boolean>
+ annotationModalValidationErrors: DeepPartialMap<AnnotationModalForm, ValidationErrorType>
+ existingModalAnnotation: AnnotationType | null
+ isAnnotationModalSubmitting: boolean
+ isAnnotationModalValid: boolean
+ isModalOpen: boolean
+ onSavedInsight: boolean
+ scope: AnnotationType['scope'] | null
+ shouldShowEmptyState: boolean
+ showAnnotationModalErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface annotationModalLogicActions {
+ appendAnnotations: (annotations: RawAnnotationType[]) => {
+ annotations: RawAnnotationType[]
+ } // annotationsModel
+ deleteAnnotation: (annotation: AnnotationType) => {
+ annotation: AnnotationType
+ } // annotationsModel
+ loadAnnotationsSuccess: (
+ rawAnnotations: RawAnnotationType[],
+ payload?: any
+ ) => {
+ payload?: any
+ rawAnnotations: RawAnnotationType[]
+ } // annotationsModel
+ replaceAnnotation: (annotation: RawAnnotationType) => {
+ annotation: RawAnnotationType
+ } // annotationsModel
+ closeModal: () => {
+ value: true
+ }
+ openModalToCreateAnnotation: (
+ initialDate?: Dayjs | null,
+ insightId?: QueryBasedInsightModel['id'] | null,
+ dashboardId?: DashboardBasicType['id'] | null
+ ) => {
+ dashboardId: number | null | undefined
+ initialDate: Dayjs | null | undefined
+ insightId: number | null | undefined
+ }
+ openModalToEditAnnotation: (
+ annotation: AnnotationType,
+ insightId?: QueryBasedInsightModel['id'] | null,
+ dashboardId?: DashboardBasicType['id'] | null
+ ) => {
+ annotation: AnnotationType
+ dashboardId: number | null | undefined
+ insightId: number | null | undefined
+ }
+ resetAnnotationModal: (values?: AnnotationModalForm) => {
+ values?: AnnotationModalForm
+ }
+ setAnnotationModalManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setAnnotationModalValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setAnnotationModalValues: (values: DeepPartial<AnnotationModalForm>) => {
+ values: DeepPartial<AnnotationModalForm>
+ }
+ setScope: (scope: AnnotationType['scope'] | null) => {
+ scope: AnnotationScope | null
+ }
+ submitAnnotationModal: () => {
+ value: boolean
+ }
+ submitAnnotationModalFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitAnnotationModalRequest: (annotationModal: AnnotationModalForm) => {
+ annotationModal: AnnotationModalForm
+ }
+ submitAnnotationModalSuccess: (annotationModal: AnnotationModalForm) => {
+ annotationModal: AnnotationModalForm
+ }
+ touchAnnotationModalField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface annotationModalLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ shouldShowEmptyState: (annotations: AnnotationType[], annotationsLoading: boolean) => boolean
+ }
+}
+
+export type annotationModalLogicType = MakeLogicType<
+ annotationModalLogicValues,
+ annotationModalLogicActions,
+ Record<string, any>,
+ annotationModalLogicMeta
+>
+
export const annotationModalLogic = kea<annotationModalLogicType>([
path(['scenes', 'annotations', 'annotationModalLogic']),
connect(() => ({
@@ -138,7 +258,7 @@ export const annotationModalLogic = kea<annotationModalLogicType>([
selectors(() => ({
shouldShowEmptyState: [
(s) => [s.annotations, s.annotationsLoading],
- (annotations, annotationsLoading): boolean => {
+ (annotations: AnnotationType[], annotationsLoading: boolean): boolean => {
return annotations.length === 0 && !annotationsLoading
},
],
diff --git a/frontend/src/scenes/annotations/annotationsLogic.ts b/frontend/src/scenes/annotations/annotationsLogic.ts
index 0ef37414bffd..b06cc19ad932 100644
--- a/frontend/src/scenes/annotations/annotationsLogic.ts
+++ b/frontend/src/scenes/annotations/annotationsLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, path, reducers, selectors } from 'kea'
import { actionToUrl, router, urlToAction } from 'kea-router'
import { LemonSelectOption, LemonSelectOptions } from '@posthog/lemon-ui'
@@ -10,7 +10,6 @@ import { annotationsModel } from '~/models/annotationsModel'
import { AnnotationScope, AnnotationType } from '~/types'
import { annotationScopeToName } from './annotationModalLogic'
-import type { annotationsLogicType } from './annotationsLogicType'
const isValidAnnotationScope = (scope: string): scope is AnnotationScope => {
return Object.values(AnnotationScope).includes(scope as AnnotationScope)
@@ -31,6 +30,40 @@ export const annotationScopesMenuOptions = (): LemonSelectOptions<AnnotationType
return scopeOptions
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface annotationsLogicValues {
+ annotations: AnnotationType[] // annotationsModel
+ annotationsLoading: boolean // annotationsModel
+ loadingNext: boolean // annotationsModel
+ next: string | null // annotationsModel
+ timezone: string // teamLogic
+ filteredAnnotations: AnnotationType[]
+ scope: AnnotationType['scope'] | null
+ shouldShowEmptyState: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface annotationsLogicActions {
+ setScope: (scope: AnnotationType['scope'] | null) => {
+ scope: AnnotationScope | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface annotationsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ shouldShowEmptyState: (annotations: AnnotationType[], annotationsLoading: boolean) => boolean
+ filteredAnnotations: (annotations: AnnotationType[], scope: AnnotationScope | null) => AnnotationType[]
+ }
+}
+
+export type annotationsLogicType = MakeLogicType<
+ annotationsLogicValues,
+ annotationsLogicActions,
+ Record<string, any>,
+ annotationsLogicMeta
+>
+
export const annotationsLogic = kea<annotationsLogicType>([
path(['scenes', 'annotations', 'annotationsLogic']),
connect(() => ({
@@ -50,13 +83,13 @@ export const annotationsLogic = kea<annotationsLogicType>([
selectors(() => ({
shouldShowEmptyState: [
(s) => [s.annotations, s.annotationsLoading],
- (annotations, annotationsLoading): boolean => {
+ (annotations: AnnotationType[], annotationsLoading: boolean): boolean => {
return annotations.length === 0 && !annotationsLoading
},
],
filteredAnnotations: [
(s) => [s.annotations, s.scope],
- (annotations, scope): AnnotationType[] => {
+ (annotations: AnnotationType[], scope: AnnotationType['scope'] | null): AnnotationType[] => {
return scope
? annotations.filter((annotation) => {
return annotation.scope === scope
diff --git a/frontend/src/scenes/appContextLogic.ts b/frontend/src/scenes/appContextLogic.ts
index 0da032d98048..82ad8c5882d1 100644
--- a/frontend/src/scenes/appContextLogic.ts
+++ b/frontend/src/scenes/appContextLogic.ts
@@ -25,9 +25,11 @@ export interface appContextLogicActions {
loadCurrentTeam: () => any // teamLogic
loadUserSuccess: (
user: UserType | null,
- payload?: {
- resetOnFailure: boolean | undefined
- }
+ payload?:
+ | {
+ resetOnFailure: boolean | undefined
+ }
+ | undefined
) => {
payload?: {
resetOnFailure: boolean | undefined
diff --git a/frontend/src/scenes/authentication/account/credential-review/credentialReviewLogic.ts b/frontend/src/scenes/authentication/account/credential-review/credentialReviewLogic.ts
index 5073ef75bc65..5bcade0ce60d 100644
--- a/frontend/src/scenes/authentication/account/credential-review/credentialReviewLogic.ts
+++ b/frontend/src/scenes/authentication/account/credential-review/credentialReviewLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, listeners, path } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path } from 'kea'
import { router } from 'kea-router'
import api from 'lib/api'
@@ -8,7 +8,18 @@ import { personalAPIKeysLogic } from 'scenes/settings/user/personalAPIKeysLogic'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
-import type { credentialReviewLogicType } from './credentialReviewLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface credentialReviewLogicActions {
+ loadPasskeys: () => any // passkeySettingsLogic
+ loadKeys: () => {
+ value: true
+ } // personalAPIKeysLogic
+ markComplete: () => {
+ value: true
+ }
+}
+
+export type credentialReviewLogicType = MakeLogicType<{}, credentialReviewLogicActions>
export const credentialReviewLogic = kea<credentialReviewLogicType>([
path(['scenes', 'authentication', 'account', 'credential-review', 'credentialReviewLogic']),
diff --git a/frontend/src/scenes/authentication/cli/cliAuthorizeLogic.ts b/frontend/src/scenes/authentication/cli/cliAuthorizeLogic.ts
index 029c7c083b42..164f0273addf 100644
--- a/frontend/src/scenes/authentication/cli/cliAuthorizeLogic.ts
+++ b/frontend/src/scenes/authentication/cli/cliAuthorizeLogic.ts
@@ -1,5 +1,6 @@
-import { actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { loaders } from 'kea-loaders'
import { urlToAction } from 'kea-router'
@@ -9,7 +10,7 @@ import { userLogic } from 'scenes/userLogic'
import { OrganizationBasicType } from '~/types'
-import type { cliAuthorizeLogicType } from './cliAuthorizeLogicType'
+import type { UserType } from '../../../types'
export type CLIUseCase = 'schema' | 'error_tracking' | 'endpoints' | 'agent-cli'
@@ -93,6 +94,157 @@ function parseCLIUseCase(useCase: string): CLIUseCase | null {
return null
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface cliAuthorizeLogicValues {
+ user: UserType | null // userLogic
+ allAccessSelected: boolean
+ authorize: CLIAuthorizeForm
+ authorizeAllErrors: Record<string, any>
+ authorizeChanged: boolean
+ authorizeErrors: DeepPartialMap<CLIAuthorizeForm, ValidationErrorType>
+ authorizeHasErrors: boolean
+ authorizeManualErrors: Record<string, any>
+ authorizeTouched: boolean
+ authorizeTouches: Record<string, boolean>
+ authorizeValidationErrors: DeepPartialMap<CLIAuthorizeForm, ValidationErrorType>
+ filteredScopes: APIScope[]
+ formScopeRadioValues: Record<string, string>
+ isAuthorizeSubmitting: boolean
+ isAuthorizeValid: boolean
+ isSuccess: boolean
+ missingAgentScopes: boolean
+ missingEndpointsScopes: boolean
+ missingErrorTrackingScopes: boolean
+ missingSchemaScopes: boolean
+ organizations: OrganizationBasicType[]
+ projects: {
+ id: number
+ name: string
+ }[]
+ projectsLoading: boolean
+ requestedUseCases: CLIUseCase[]
+ scopePreset: string | null
+ searchTerm: string
+ showAuthorizeErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface cliAuthorizeLogicActions {
+ loadUserSuccess: (
+ user: UserType | null,
+ payload?:
+ | {
+ resetOnFailure: boolean | undefined
+ }
+ | undefined
+ ) => {
+ payload?: {
+ resetOnFailure: boolean | undefined
+ }
+ user: UserType | null
+ } // userLogic
+ loadProjects: (organizationId: string) => string
+ loadProjectsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadProjectsSuccess: (
+ projects: {
+ id: number
+ name: string
+ }[],
+ payload?: string
+ ) => {
+ projects: {
+ id: number
+ name: string
+ }[]
+ payload?: string
+ }
+ resetAuthorize: (values?: CLIAuthorizeForm) => {
+ values?: CLIAuthorizeForm
+ }
+ resetScopes: () => {
+ value: true
+ }
+ setAuthorizeManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setAuthorizeValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setAuthorizeValues: (values: DeepPartial<CLIAuthorizeForm>) => {
+ values: DeepPartial<CLIAuthorizeForm>
+ }
+ setRequestedUseCases: (useCases: CLIUseCase[]) => {
+ useCases: CLIUseCase[]
+ }
+ setScopePreset: (preset: string | null) => {
+ preset: string | null
+ }
+ setScopeRadioValue: (
+ key: string,
+ action: string
+ ) => {
+ action: string
+ key: string
+ }
+ setSearchTerm: (searchTerm: string) => {
+ searchTerm: string
+ }
+ setSuccess: (success: boolean) => {
+ success: boolean
+ }
+ submitAuthorize: () => {
+ value: boolean
+ }
+ submitAuthorizeFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitAuthorizeRequest: (authorize: CLIAuthorizeForm) => {
+ authorize: CLIAuthorizeForm
+ }
+ submitAuthorizeSuccess: (authorize: CLIAuthorizeForm) => {
+ authorize: CLIAuthorizeForm
+ }
+ touchAuthorizeField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface cliAuthorizeLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ organizations: (user: UserType | null) => OrganizationBasicType[]
+ formScopeRadioValues: (authorize: CLIAuthorizeForm) => Record<string, string>
+ filteredScopes: (searchTerm: string) => APIScope[]
+ allAccessSelected: (authorize: CLIAuthorizeForm) => boolean
+ scopePreset: (authorize: CLIAuthorizeForm) => string | null
+ missingSchemaScopes: (authorize: CLIAuthorizeForm, requestedUseCases: CLIUseCase[]) => boolean
+ missingErrorTrackingScopes: (authorize: CLIAuthorizeForm, requestedUseCases: CLIUseCase[]) => boolean
+ missingEndpointsScopes: (authorize: CLIAuthorizeForm, requestedUseCases: CLIUseCase[]) => boolean
+ missingAgentScopes: (authorize: CLIAuthorizeForm, requestedUseCases: CLIUseCase[]) => boolean
+ }
+}
+
+export type cliAuthorizeLogicType = MakeLogicType<
+ cliAuthorizeLogicValues,
+ cliAuthorizeLogicActions,
+ Record<string, any>,
+ cliAuthorizeLogicMeta
+>
+
export const cliAuthorizeLogic = kea<cliAuthorizeLogicType>([
path(['scenes', 'authentication', 'cli', 'cliAuthorizeLogic']),
connect(() => ({
@@ -189,10 +341,13 @@ export const cliAuthorizeLogic = kea<cliAuthorizeLogicType>([
},
})),
selectors(() => ({
- organizations: [(s) => [s.user], (user): OrganizationBasicType[] => user?.organizations ?? []],
+ organizations: [
+ (s) => [s.user],
+ (user: null | import('~/types').UserType): OrganizationBasicType[] => user?.organizations ?? [],
+ ],
formScopeRadioValues: [
(s) => [s.authorize],
- (authorize): Record<string, string> => {
+ (authorize: CLIAuthorizeForm): Record<string, string> => {
if (!authorize || !authorize.scopes) {
return {}
}
@@ -201,7 +356,7 @@ export const cliAuthorizeLogic = kea<cliAuthorizeLogicType>([
],
filteredScopes: [
(s) => [s.searchTerm],
- (searchTerm): APIScope[] => {
+ (searchTerm: string): APIScope[] => {
const search = searchTerm.trim().toLowerCase()
if (!search) {
return API_SCOPES
@@ -212,11 +367,17 @@ export const cliAuthorizeLogic = kea<cliAuthorizeLogicType>([
)
},
],
- allAccessSelected: [(s) => [s.authorize], (authorize): boolean => !!authorize?.scopes?.includes('*')],
- scopePreset: [(s) => [s.authorize], (authorize): string | null => presetForScopes(authorize?.scopes ?? [])],
+ allAccessSelected: [
+ (s) => [s.authorize],
+ (authorize: CLIAuthorizeForm): boolean => !!authorize?.scopes?.includes('*'),
+ ],
+ scopePreset: [
+ (s) => [s.authorize],
+ (authorize: CLIAuthorizeForm): string | null => presetForScopes(authorize?.scopes ?? []),
+ ],
missingSchemaScopes: [
(s) => [s.authorize, s.requestedUseCases],
- (authorize, requestedUseCases): boolean => {
+ (authorize: CLIAuthorizeForm, requestedUseCases: CLIUseCase[]): boolean => {
// Only show warning if schema use case was requested
if (!requestedUseCases.includes('schema')) {
return false
@@ -237,7 +398,7 @@ export const cliAuthorizeLogic = kea<cliAuthorizeLogicType>([
],
missingErrorTrackingScopes: [
(s) => [s.authorize, s.requestedUseCases],
- (authorize, requestedUseCases): boolean => {
+ (authorize: CLIAuthorizeForm, requestedUseCases: CLIUseCase[]): boolean => {
// Only show warning if error_tracking use case was requested
if (!requestedUseCases.includes('error_tracking')) {
return false
@@ -255,7 +416,7 @@ export const cliAuthorizeLogic = kea<cliAuthorizeLogicType>([
],
missingEndpointsScopes: [
(s) => [s.authorize, s.requestedUseCases],
- (authorize, requestedUseCases): boolean => {
+ (authorize: CLIAuthorizeForm, requestedUseCases: CLIUseCase[]): boolean => {
// Only show warning if endpoints use case was requested
if (!requestedUseCases.includes('endpoints')) {
return false
@@ -270,7 +431,7 @@ export const cliAuthorizeLogic = kea<cliAuthorizeLogicType>([
],
missingAgentScopes: [
(s) => [s.authorize, s.requestedUseCases],
- (authorize, requestedUseCases): boolean => {
+ (authorize: CLIAuthorizeForm, requestedUseCases: CLIUseCase[]): boolean => {
// Only show warning if the agent-cli use case was requested
if (!requestedUseCases.includes('agent-cli')) {
return false
diff --git a/frontend/src/scenes/authentication/cli/cliLiveLogic.ts b/frontend/src/scenes/authentication/cli/cliLiveLogic.ts
index fe4056cabba0..a34e8d5711a3 100644
--- a/frontend/src/scenes/authentication/cli/cliLiveLogic.ts
+++ b/frontend/src/scenes/authentication/cli/cliLiveLogic.ts
@@ -1,10 +1,60 @@
-import { actions, afterMount, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, afterMount, kea, listeners, path, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import { urlToAction } from 'kea-router'
import api from 'lib/api'
-import type { cliLiveLogicType } from './cliLiveLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface cliLiveLogicValues {
+ error: string
+ port: string
+ projects: {
+ id: number
+ name: string
+ }[]
+ projectsLoading: boolean
+ redirected: boolean
+ selectedProjectId: number | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface cliLiveLogicActions {
+ loadProjects: () => any
+ loadProjectsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadProjectsSuccess: (
+ projects: {
+ id: number
+ name: string
+ }[],
+ payload?: any
+ ) => {
+ projects: {
+ id: number
+ name: string
+ }[]
+ payload?: any
+ }
+ selectProject: (projectId: number) => {
+ projectId: number
+ }
+ setError: (error: string) => {
+ error: string
+ }
+ setPort: (port: string) => {
+ port: string
+ }
+ setRedirected: (redirected: boolean) => {
+ redirected: boolean
+ }
+}
+
+export type cliLiveLogicType = MakeLogicType<cliLiveLogicValues, cliLiveLogicActions>
export const cliLiveLogic = kea<cliLiveLogicType>([
path(['scenes', 'authentication', 'cli', 'cliLiveLogic']),
diff --git a/frontend/src/scenes/authentication/invite-signup/inviteSignupLogic.ts b/frontend/src/scenes/authentication/invite-signup/inviteSignupLogic.ts
index afd2f19ba8f8..a2139cb0eb59 100644
--- a/frontend/src/scenes/authentication/invite-signup/inviteSignupLogic.ts
+++ b/frontend/src/scenes/authentication/invite-signup/inviteSignupLogic.ts
@@ -1,6 +1,7 @@
import { startRegistration } from '@simplewebauthn/browser'
-import { actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { loaders } from 'kea-loaders'
import { urlToAction } from 'kea-router'
import posthog from 'posthog-js'
@@ -14,7 +15,7 @@ import type { RegistrationBeginResponse } from 'scenes/settings/user/passkeySett
import { PrevalidatedInvite } from '~/types'
-import type { inviteSignupLogicType } from './inviteSignupLogicType'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
export enum ErrorCodes {
InvalidInvite = 'invalid_invite',
@@ -34,6 +35,151 @@ export interface AcceptInvitePayloadInterface {
role_at_organization?: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface inviteSignupLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ acceptedInvite: null
+ acceptedInviteLoading: boolean
+ challengeNonce: string | null
+ challengeRequired: boolean
+ error: ErrorInterface | null
+ invite: PrevalidatedInvite | null
+ inviteLoading: boolean
+ isPasskeyRegistering: boolean
+ isSignupSubmitting: boolean
+ isSignupValid: boolean
+ passkeyError: string | null
+ passkeyRegistered: boolean
+ passkeySignupEnabled: boolean
+ showSignupErrors: boolean
+ signup: AcceptInvitePayloadInterface
+ signupAllErrors: Record<string, any>
+ signupChanged: boolean
+ signupErrors: DeepPartialMap<AcceptInvitePayloadInterface, ValidationErrorType>
+ signupHasErrors: boolean
+ signupManualErrors: Record<string, any>
+ signupTouched: boolean
+ signupTouches: Record<string, boolean>
+ signupValidationErrors: DeepPartialMap<AcceptInvitePayloadInterface, ValidationErrorType>
+ turnstileSiteKey: string | null
+ turnstileToken: string | null
+ validatedPassword: ValidatedPasswordResult
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface inviteSignupLogicActions {
+ acceptInvite: () => any
+ acceptInviteFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ acceptInviteSuccess: (
+ acceptedInvite: Promise<null> | null,
+ payload?: any
+ ) => {
+ acceptedInvite: Promise<null> | null
+ payload?: any
+ }
+ prevalidateInvite: (id: string) => string
+ prevalidateInviteFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ prevalidateInviteSuccess: (
+ invite: PrevalidatedInvite | null,
+ payload?: string
+ ) => {
+ invite: PrevalidatedInvite | null
+ payload?: string
+ }
+ registerPasskey: () => {
+ value: true
+ }
+ resetChallenge: () => {
+ value: true
+ }
+ resetSignup: (values?: AcceptInvitePayloadInterface) => {
+ values?: AcceptInvitePayloadInterface
+ }
+ setChallengeNonce: (nonce: string | null) => {
+ nonce: string | null
+ }
+ setChallengeRequired: (required: boolean) => {
+ required: boolean
+ }
+ setError: (payload: ErrorInterface) => {
+ payload: ErrorInterface
+ }
+ setPasskeyError: (error: string | null) => {
+ error: string | null
+ }
+ setPasskeyRegistered: (registered: boolean) => {
+ registered: boolean
+ }
+ setPasskeyRegistering: (registering: boolean) => {
+ registering: boolean
+ }
+ setSignupManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setSignupValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setSignupValues: (values: DeepPartial<AcceptInvitePayloadInterface>) => {
+ values: DeepPartial<AcceptInvitePayloadInterface>
+ }
+ setTurnstileSiteKey: (siteKey: string | null) => {
+ siteKey: string | null
+ }
+ setTurnstileToken: (token: string | null) => {
+ token: string | null
+ }
+ submitSignup: () => {
+ value: boolean
+ }
+ submitSignupFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitSignupRequest: (signup: AcceptInvitePayloadInterface) => {
+ signup: AcceptInvitePayloadInterface
+ }
+ submitSignupSuccess: (signup: AcceptInvitePayloadInterface) => {
+ signup: AcceptInvitePayloadInterface
+ }
+ touchSignupField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface inviteSignupLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ validatedPassword: (signup: AcceptInvitePayloadInterface) => ValidatedPasswordResult
+ passkeySignupEnabled: (featureFlags: FeatureFlagsSet) => boolean
+ }
+}
+
+export type inviteSignupLogicType = MakeLogicType<
+ inviteSignupLogicValues,
+ inviteSignupLogicActions,
+ Record<string, any>,
+ inviteSignupLogicMeta
+>
+
export const inviteSignupLogic = kea<inviteSignupLogicType>([
path(['scenes', 'authentication', 'invite-signup', 'inviteSignupLogic']),
connect(() => ({
@@ -229,7 +375,7 @@ export const inviteSignupLogic = kea<inviteSignupLogicType>([
],
passkeySignupEnabled: [
(s) => [s.featureFlags],
- (featureFlags): boolean => {
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet): boolean => {
return !!featureFlags[FEATURE_FLAGS.PASSKEY_SIGNUP_ENABLED]
},
],
diff --git a/frontend/src/scenes/authentication/login-2fa/login2FALogic.ts b/frontend/src/scenes/authentication/login-2fa/login2FALogic.ts
index e3bd5dcb3b8b..0711da55049f 100644
--- a/frontend/src/scenes/authentication/login-2fa/login2FALogic.ts
+++ b/frontend/src/scenes/authentication/login-2fa/login2FALogic.ts
@@ -1,6 +1,7 @@
import { type PublicKeyCredentialRequestOptionsJSON, startAuthentication } from '@simplewebauthn/browser'
-import { actions, afterMount, connect, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { loaders } from 'kea-loaders'
import api, { ApiError } from 'lib/api'
@@ -9,7 +10,8 @@ import { handleLoginRedirect } from 'scenes/authentication/login/loginLogic'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { getPasskeyErrorMessage, isWebAuthnCancellation } from 'scenes/settings/user/passkeys/utils'
-import type { login2FALogicType } from './login2FALogicType'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { PreflightStatus } from '../../../types'
export interface AuthenticateResponseType {
success: boolean
@@ -35,6 +37,136 @@ export interface LoginTokenResponse {
success: boolean
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface login2FALogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ preflight: PreflightStatus | null // preflightLogic
+ generalError: {
+ code: string
+ detail: string
+ } | null
+ isTwofactortokenSubmitting: boolean
+ isTwofactortokenValid: boolean
+ passkey2FA: null
+ passkey2FALoading: boolean
+ passkey2FAWasCancelled: boolean
+ passkeysAvailable: boolean
+ passkeysAvailableLoading: boolean
+ showTwofactortokenErrors: boolean
+ totpAvailable: boolean
+ twofactortoken: TwoFactorForm
+ twofactortokenAllErrors: Record<string, any>
+ twofactortokenChanged: boolean
+ twofactortokenErrors: DeepPartialMap<TwoFactorForm, ValidationErrorType>
+ twofactortokenHasErrors: boolean
+ twofactortokenManualErrors: Record<string, any>
+ twofactortokenTouched: boolean
+ twofactortokenTouches: Record<string, boolean>
+ twofactortokenValidationErrors: DeepPartialMap<TwoFactorForm, ValidationErrorType>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface login2FALogicActions {
+ beginPasskey2FA: () => {
+ value: true
+ }
+ beginPasskey2FAFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ beginPasskey2FASuccess: (
+ passkey2FA: null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ passkey2FA: null
+ payload?: {
+ value: true
+ }
+ }
+ checkPasskeysAvailable: () => {
+ value: true
+ }
+ checkPasskeysAvailableFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ checkPasskeysAvailableSuccess: (
+ passkeysAvailable: boolean,
+ payload?: {
+ value: true
+ }
+ ) => {
+ passkeysAvailable: boolean
+ payload?: {
+ value: true
+ }
+ }
+ clearGeneralError: () => {
+ value: true
+ }
+ passkey2FACancelled: () => {
+ value: true
+ }
+ resetTwofactortoken: (values?: TwoFactorForm) => {
+ values?: TwoFactorForm
+ }
+ setGeneralError: (
+ code: string,
+ detail: string
+ ) => {
+ code: string
+ detail: string
+ }
+ setLoginStep: (step: LoginStep) => {
+ step: LoginStep
+ }
+ setTotpAvailable: (available: boolean) => {
+ available: boolean
+ }
+ setTwofactortokenManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setTwofactortokenValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setTwofactortokenValues: (values: DeepPartial<TwoFactorForm>) => {
+ values: DeepPartial<TwoFactorForm>
+ }
+ submitTwofactortoken: () => {
+ value: boolean
+ }
+ submitTwofactortokenFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitTwofactortokenRequest: (twofactortoken: TwoFactorForm) => {
+ twofactortoken: TwoFactorForm
+ }
+ submitTwofactortokenSuccess: (twofactortoken: TwoFactorForm) => {
+ twofactortoken: TwoFactorForm
+ }
+ touchTwofactortokenField: (key: string) => {
+ key: string
+ }
+}
+
+export type login2FALogicType = MakeLogicType<login2FALogicValues, login2FALogicActions>
+
export const login2FALogic = kea<login2FALogicType>([
path(['scenes', 'authentication', 'login-2fa', 'login2FALogic']),
connect(() => ({
diff --git a/frontend/src/scenes/authentication/login/loginLogic.ts b/frontend/src/scenes/authentication/login/loginLogic.ts
index 3d25d95b58c9..0852de05bf0e 100644
--- a/frontend/src/scenes/authentication/login/loginLogic.ts
+++ b/frontend/src/scenes/authentication/login/loginLogic.ts
@@ -1,6 +1,7 @@
import type { PublicKeyCredentialDescriptorJSON } from '@simplewebauthn/browser'
-import { actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { loaders } from 'kea-loaders'
import { encodeParams, urlToAction } from 'kea-router'
import { router } from 'kea-router'
@@ -17,7 +18,9 @@ import { urls } from 'scenes/urls'
import { SSOProvider } from '~/types'
-import type { loginLogicType } from './loginLogicType'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { PreflightStatus } from '../../../types'
+import type { DevUser } from '../shared/devLoginLogic'
export interface AuthenticateResponseType {
success: boolean
@@ -80,6 +83,199 @@ export interface CodeVerificationForm {
code: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface loginLogicValues {
+ devLoginTimeSavedLabel: string | null // devLoginLogic
+ devUsers: DevUser[] // devLoginLogic
+ devUsersLoading: boolean // devLoginLogic
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ preflight: PreflightStatus | null // preflightLogic
+ codeVerification: CodeVerificationForm
+ codeVerificationAllErrors: Record<string, any>
+ codeVerificationChanged: boolean
+ codeVerificationErrors: DeepPartialMap<CodeVerificationForm, ValidationErrorType>
+ codeVerificationHasErrors: boolean
+ codeVerificationManualErrors: Record<string, any>
+ codeVerificationRequired: boolean
+ codeVerificationTouched: boolean
+ codeVerificationTouches: Record<string, boolean>
+ codeVerificationValidationErrors: DeepPartialMap<CodeVerificationForm, ValidationErrorType>
+ generalError: {
+ code: string
+ detail: string
+ } | null
+ isCodeVerificationSubmitting: boolean
+ isCodeVerificationValid: boolean
+ isLoginSubmitting: boolean
+ isLoginValid: boolean
+ login: LoginForm
+ loginAllErrors: Record<string, any>
+ loginChanged: boolean
+ loginErrors: DeepPartialMap<LoginForm, ValidationErrorType>
+ loginHasErrors: boolean
+ loginManualErrors: Record<string, any>
+ loginTouched: boolean
+ loginTouches: Record<string, boolean>
+ loginValidationErrors: DeepPartialMap<LoginForm, ValidationErrorType>
+ precheckResponse: PrecheckResponseType
+ precheckResponseLoading: boolean
+ resendResponse: {
+ message: string
+ success: boolean
+ } | null
+ resendResponseLoading: boolean
+ showCodeVerificationErrors: boolean
+ showLoginErrors: boolean
+ signupUrl: string
+ wasSignedOutForSessionRisk: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface loginLogicActions {
+ devLogin: (email: string) => {
+ email: string
+ } // devLoginLogic
+ loadDevUsers: (_: any) => any // devLoginLogic
+ clearGeneralError: () => {
+ value: true
+ }
+ exitCodeVerification: () => {
+ value: true
+ }
+ precheck: ({ email }: { email: string }) => {
+ email: string
+ }
+ precheckFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ precheckSuccess: (
+ precheckResponse: PrecheckResponseType,
+ payload?: {
+ email: string
+ }
+ ) => {
+ precheckResponse: PrecheckResponseType
+ payload?: {
+ email: string
+ }
+ }
+ resendCodeBasedVerification: (_: any) => any
+ resendCodeBasedVerificationFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ resendCodeBasedVerificationSuccess: (
+ resendResponse: {
+ message: string
+ success: boolean
+ } | null,
+ payload?: any
+ ) => {
+ resendResponse: {
+ message: string
+ success: boolean
+ } | null
+ payload?: any
+ }
+ resetCodeVerification: (values?: CodeVerificationForm) => {
+ values?: CodeVerificationForm
+ }
+ resetLogin: (values?: LoginForm) => {
+ values?: LoginForm
+ }
+ setCodeVerificationManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setCodeVerificationRequired: () => {
+ value: true
+ }
+ setCodeVerificationValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setCodeVerificationValues: (values: DeepPartial<CodeVerificationForm>) => {
+ values: DeepPartial<CodeVerificationForm>
+ }
+ setGeneralError: (
+ code: string,
+ detail: string
+ ) => {
+ code: string
+ detail: string
+ }
+ setLoginManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setLoginValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setLoginValues: (values: DeepPartial<LoginForm>) => {
+ values: DeepPartial<LoginForm>
+ }
+ submitCodeVerification: () => {
+ value: boolean
+ }
+ submitCodeVerificationFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitCodeVerificationRequest: (codeVerification: CodeVerificationForm) => {
+ codeVerification: CodeVerificationForm
+ }
+ submitCodeVerificationSuccess: (codeVerification: CodeVerificationForm) => {
+ codeVerification: CodeVerificationForm
+ }
+ submitLogin: () => {
+ value: boolean
+ }
+ submitLoginFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitLoginRequest: (login: LoginForm) => {
+ login: LoginForm
+ }
+ submitLoginSuccess: (login: LoginForm) => {
+ login: LoginForm
+ }
+ touchCodeVerificationField: (key: string) => {
+ key: string
+ }
+ touchLoginField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface loginLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ signupUrl: (searchParams: Record<string, any>) => string
+ wasSignedOutForSessionRisk: (searchParams: Record<string, any>) => boolean
+ }
+}
+
+export type loginLogicType = MakeLogicType<loginLogicValues, loginLogicActions, Record<string, any>, loginLogicMeta>
+
export const loginLogic = kea<loginLogicType>([
path(['scenes', 'authentication', 'login', 'loginLogic']),
connect(() => ({
diff --git a/frontend/src/scenes/authentication/password-reset/passwordResetLogic.ts b/frontend/src/scenes/authentication/password-reset/passwordResetLogic.ts
index 1e39eed72973..0161fc450f7c 100644
--- a/frontend/src/scenes/authentication/password-reset/passwordResetLogic.ts
+++ b/frontend/src/scenes/authentication/password-reset/passwordResetLogic.ts
@@ -1,5 +1,6 @@
-import { kea, path, reducers, selectors } from 'kea'
+import { MakeLogicType, kea, path, reducers, selectors } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { loaders } from 'kea-loaders'
import { urlToAction } from 'kea-router'
import posthog from 'posthog-js'
@@ -8,8 +9,6 @@ import api from 'lib/api'
import { ValidatedPasswordResult, validatePassword } from 'lib/components/PasswordStrength'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
-import type { passwordResetLogicType } from './passwordResetLogicType'
-
export interface ResponseType {
success: boolean
errorCode?: string
@@ -29,6 +28,203 @@ export interface PasswordResetForm {
passwordConfirm: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface passwordResetLogicValues {
+ isPasswordResetSubmitting: boolean
+ isPasswordResetValid: boolean
+ isRequestPasswordResetSubmitting: boolean
+ isRequestPasswordResetValid: boolean
+ passwordReset: PasswordResetForm
+ passwordResetAllErrors: Record<string, any>
+ passwordResetChanged: boolean
+ passwordResetErrors: DeepPartialMap<PasswordResetForm, ValidationErrorType>
+ passwordResetHasErrors: boolean
+ passwordResetManualErrors: Record<string, any>
+ passwordResetSucceeded: boolean
+ passwordResetTouched: boolean
+ passwordResetTouches: Record<string, boolean>
+ passwordResetValidationErrors: DeepPartialMap<PasswordResetForm, ValidationErrorType>
+ requestPasswordReset: {
+ email: string
+ }
+ requestPasswordResetAllErrors: Record<string, any>
+ requestPasswordResetChanged: boolean
+ requestPasswordResetErrors: DeepPartialMap<
+ {
+ email: string
+ },
+ ValidationErrorType
+ >
+ requestPasswordResetHasErrors: boolean
+ requestPasswordResetManualErrors: Record<string, any>
+ requestPasswordResetSucceeded: boolean
+ requestPasswordResetTouched: boolean
+ requestPasswordResetTouches: Record<string, boolean>
+ requestPasswordResetValidationErrors: DeepPartialMap<
+ {
+ email: string
+ },
+ ValidationErrorType
+ >
+ showPasswordResetErrors: boolean
+ showRequestPasswordResetErrors: boolean
+ validatedPassword: ValidatedPasswordResult
+ validatedResetToken: ValidatedTokenResponseType | null
+ validatedResetTokenLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface passwordResetLogicActions {
+ resetPasswordReset: (values?: PasswordResetForm) => {
+ values?: PasswordResetForm
+ }
+ resetRequestPasswordReset: (values?: { email: string }) => {
+ values?: {
+ email: string
+ }
+ }
+ setPasswordResetManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setPasswordResetValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setPasswordResetValues: (values: DeepPartial<PasswordResetForm>) => {
+ values: DeepPartial<PasswordResetForm>
+ }
+ setRequestPasswordResetManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setRequestPasswordResetValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setRequestPasswordResetValues: (
+ values: DeepPartial<{
+ email: string
+ }>
+ ) => {
+ values: DeepPartial<{
+ email: string
+ }>
+ }
+ submitPasswordReset: () => {
+ value: boolean
+ }
+ submitPasswordResetFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitPasswordResetRequest: (passwordReset: PasswordResetForm) => {
+ passwordReset: PasswordResetForm
+ }
+ submitPasswordResetSuccess: (passwordReset: PasswordResetForm) => {
+ passwordReset: PasswordResetForm
+ }
+ submitRequestPasswordReset: () => {
+ value: boolean
+ }
+ submitRequestPasswordResetFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitRequestPasswordResetRequest: (requestPasswordReset: { email: string }) => {
+ requestPasswordReset: {
+ email: string
+ }
+ }
+ submitRequestPasswordResetSuccess: (requestPasswordReset: { email: string }) => {
+ requestPasswordReset: {
+ email: string
+ }
+ }
+ touchPasswordResetField: (key: string) => {
+ key: string
+ }
+ touchRequestPasswordResetField: (key: string) => {
+ key: string
+ }
+ validateResetToken: ({ uuid, token }: { token: string; uuid: string }) => {
+ uuid: string
+ token: string
+ }
+ validateResetTokenFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ validateResetTokenSuccess: (
+ validatedResetToken:
+ | {
+ errorCode: any
+ errorDetail: any
+ success: false
+ token?: undefined
+ uuid?: undefined
+ }
+ | {
+ errorCode?: undefined
+ errorDetail?: undefined
+ success: true
+ token: string
+ uuid: string
+ },
+ payload?: {
+ uuid: string
+ token: string
+ }
+ ) => {
+ validatedResetToken:
+ | {
+ errorCode: any
+ errorDetail: any
+ success: false
+ token?: undefined
+ uuid?: undefined
+ }
+ | {
+ errorCode?: undefined
+ errorDetail?: undefined
+ success: true
+ token: string
+ uuid: string
+ }
+ payload?: {
+ uuid: string
+ token: string
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface passwordResetLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ validatedPassword: (passwordReset: PasswordResetForm) => ValidatedPasswordResult
+ }
+}
+
+export type passwordResetLogicType = MakeLogicType<
+ passwordResetLogicValues,
+ passwordResetLogicActions,
+ Record<string, any>,
+ passwordResetLogicMeta
+>
+
export const passwordResetLogic = kea<passwordResetLogicType>([
path(['scenes', 'authentication', 'password-reset', 'passwordResetLogic']),
loaders(() => ({
diff --git a/frontend/src/scenes/authentication/shared/devLoginLogic.ts b/frontend/src/scenes/authentication/shared/devLoginLogic.ts
index 20b0a7bb61ca..be472988a90e 100644
--- a/frontend/src/scenes/authentication/shared/devLoginLogic.ts
+++ b/frontend/src/scenes/authentication/shared/devLoginLogic.ts
@@ -1,10 +1,8 @@
-import { actions, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
-import type { devLoginLogicType } from './devLoginLogicType'
-
export interface DevUser {
email: string
is_staff: boolean
@@ -15,6 +13,50 @@ export const DEV_LOGIN_SECONDS_SAVED_PER_CLICK = 5
export const DEV_LOGIN_DEFAULT_EMAIL = '[email protected]'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface devLoginLogicValues {
+ devLoginCount: number
+ devLoginTimeSavedLabel: string | null
+ devUsers: DevUser[]
+ devUsersLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface devLoginLogicActions {
+ devLogin: (email: string) => {
+ email: string
+ }
+ loadDevUsers: (_: any) => any
+ loadDevUsersFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadDevUsersSuccess: (
+ devUsers: DevUser[],
+ payload?: any
+ ) => {
+ devUsers: DevUser[]
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface devLoginLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ devLoginTimeSavedLabel: (devLoginCount: number) => string | null
+ }
+}
+
+export type devLoginLogicType = MakeLogicType<
+ devLoginLogicValues,
+ devLoginLogicActions,
+ Record<string, any>,
+ devLoginLogicMeta
+>
+
export const devLoginLogic = kea<devLoginLogicType>([
path(['scenes', 'authentication', 'shared', 'devLoginLogic']),
actions({
@@ -56,7 +98,7 @@ export const devLoginLogic = kea<devLoginLogicType>([
selectors(() => ({
devLoginTimeSavedLabel: [
(s) => [s.devLoginCount],
- (devLoginCount): string | null => {
+ (devLoginCount: number): string | null => {
if (devLoginCount === 0) {
return null
}
diff --git a/frontend/src/scenes/authentication/shared/passkeyLogic.ts b/frontend/src/scenes/authentication/shared/passkeyLogic.ts
index 431b494022d5..6fd6524a7d8a 100644
--- a/frontend/src/scenes/authentication/shared/passkeyLogic.ts
+++ b/frontend/src/scenes/authentication/shared/passkeyLogic.ts
@@ -3,7 +3,7 @@ import {
type PublicKeyCredentialDescriptorJSON,
startAuthentication,
} from '@simplewebauthn/browser'
-import { actions, connect, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
@@ -14,8 +14,6 @@ import { handleLoginRedirect, loginLogic } from 'scenes/authentication/login/log
import { getPasskeyErrorMessage, isWebAuthnCancellation } from 'scenes/settings/user/passkeys/utils'
import { userLogic } from 'scenes/userLogic'
-import type { passkeyLogicType } from './passkeyLogicType'
-
export interface PasskeyLoginBeginResponse {
challenge: string
timeout: number
@@ -30,6 +28,73 @@ export interface BeginPasskeyLoginParams {
reauth?: 'true' | 'false'
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface passkeyLogicValues {
+ allowCredentialsFromPrecheck: PublicKeyCredentialDescriptorJSON[]
+ isLoading: boolean
+ isReauth: boolean
+ loginWithPasskey: null
+ loginWithPasskeyLoading: boolean
+ redirectLink: string | undefined
+ wasCancelled: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface passkeyLogicActions {
+ setTimeSensitiveAuthenticationRequired: (required: boolean | [onSuccess: () => void, onFailure: () => void]) => {
+ required: boolean | [onSuccess: () => void, onFailure: () => void]
+ } // apiStatusLogic
+ setGeneralError: (
+ code: string,
+ detail: string
+ ) => {
+ code: string
+ detail: string
+ } // loginLogic
+ loadUser: (resetOnFailure?: boolean | undefined) => {
+ resetOnFailure: boolean | undefined
+ } // userLogic
+ beginPasskeyLogin: (
+ allowCredentials?: PublicKeyCredentialDescriptorJSON[],
+ params?: BeginPasskeyLoginParams
+ ) => {
+ allowCredentials: PublicKeyCredentialDescriptorJSON[] | undefined
+ params: BeginPasskeyLoginParams | undefined
+ }
+ passkeyAuthenticationCancelled: () => {
+ value: true
+ }
+ reset: () => {
+ value: true
+ }
+ startConditionalPasskeyLogin: () => {
+ value: true
+ }
+ startPasskeyAuthentication: () => {
+ value: true
+ }
+ startPasskeyAuthenticationFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ startPasskeyAuthenticationSuccess: (
+ loginWithPasskey: null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ loginWithPasskey: null
+ payload?: {
+ value: true
+ }
+ }
+}
+
+export type passkeyLogicType = MakeLogicType<passkeyLogicValues, passkeyLogicActions>
+
export const passkeyLogic = kea<passkeyLogicType>([
path(['scenes', 'authentication', 'shared', 'passkeyLogic']),
connect(() => ({
diff --git a/frontend/src/scenes/authentication/signup/signupForm/signupLogic.ts b/frontend/src/scenes/authentication/signup/signupForm/signupLogic.ts
index dab83576fcff..9843f357fe20 100644
--- a/frontend/src/scenes/authentication/signup/signupForm/signupLogic.ts
+++ b/frontend/src/scenes/authentication/signup/signupForm/signupLogic.ts
@@ -1,6 +1,7 @@
import { startRegistration } from '@simplewebauthn/browser'
-import { actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { router, urlToAction } from 'kea-router'
import posthog from 'posthog-js'
@@ -16,7 +17,8 @@ import { getPasskeyErrorMessage, isWebAuthnCancellation } from 'scenes/settings/
import { RegistrationBeginResponse } from 'scenes/settings/user/passkeySettingsLogic'
import { urls } from 'scenes/urls'
-import type { signupLogicType } from './signupLogicType'
+import type { FeatureFlagsSet } from '../../../../lib/logic/featureFlagLogic'
+import type { PreflightStatus } from '../../../../types'
export interface AccountResponse {
success: boolean
@@ -60,6 +62,341 @@ export const emailRegex: RegExp =
// oxlint-disable-next-line no-control-regex
/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface signupLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ preflight: PreflightStatus | null // preflightLogic
+ challengeNonce: string | null
+ challengeRequired: boolean
+ emailCaseNotice: string | undefined
+ emailWasNormalized: boolean
+ error: string | null
+ isPasskeyRegistering: boolean
+ isPendingInviteResending: boolean
+ isSignupPanel1Submitting: boolean
+ isSignupPanel1Valid: boolean
+ isSignupPanel2Submitting: boolean
+ isSignupPanel2Valid: boolean
+ isSignupPanelAuthSubmitting: boolean
+ isSignupPanelAuthValid: boolean
+ isSignupPanelEmailSubmitting: boolean
+ isSignupPanelEmailValid: boolean
+ isSignupPanelOnboardingSubmitting: boolean
+ isSignupPanelOnboardingValid: boolean
+ loginUrl: string
+ panel: number
+ panelTitle: string
+ passkeyError: string | null
+ passkeyRegistered: boolean
+ passkeySignupEnabled: boolean
+ pendingInvite: PendingInvite | null
+ pendingInviteResent: boolean
+ showSignupPanel1Errors: boolean
+ showSignupPanel2Errors: boolean
+ showSignupPanelAuthErrors: boolean
+ showSignupPanelEmailErrors: boolean
+ showSignupPanelOnboardingErrors: boolean
+ signupPanel1: SignupForm
+ signupPanel1AllErrors: Record<string, any>
+ signupPanel1Changed: boolean
+ signupPanel1Errors: DeepPartialMap<SignupForm, ValidationErrorType>
+ signupPanel1HasErrors: boolean
+ signupPanel1ManualErrors: Record<string, any>
+ signupPanel1Touched: boolean
+ signupPanel1Touches: Record<string, boolean>
+ signupPanel1ValidationErrors: DeepPartialMap<SignupForm, ValidationErrorType>
+ signupPanel2: SignupForm
+ signupPanel2AllErrors: Record<string, any>
+ signupPanel2Changed: boolean
+ signupPanel2Errors: DeepPartialMap<SignupForm, ValidationErrorType>
+ signupPanel2HasErrors: boolean
+ signupPanel2ManualErrors: Record<string, any>
+ signupPanel2Touched: boolean
+ signupPanel2Touches: Record<string, boolean>
+ signupPanel2ValidationErrors: DeepPartialMap<SignupForm, ValidationErrorType>
+ signupPanelAuth: SignupPanelAuthForm
+ signupPanelAuthAllErrors: Record<string, any>
+ signupPanelAuthChanged: boolean
+ signupPanelAuthErrors: DeepPartialMap<SignupPanelAuthForm, ValidationErrorType>
+ signupPanelAuthHasErrors: boolean
+ signupPanelAuthManualErrors: Record<string, any>
+ signupPanelAuthTouched: boolean
+ signupPanelAuthTouches: Record<string, boolean>
+ signupPanelAuthValidationErrors: DeepPartialMap<SignupPanelAuthForm, ValidationErrorType>
+ signupPanelEmail: SignupPanelEmailForm
+ signupPanelEmailAllErrors: Record<string, any>
+ signupPanelEmailChanged: boolean
+ signupPanelEmailErrors: DeepPartialMap<SignupPanelEmailForm, ValidationErrorType>
+ signupPanelEmailHasErrors: boolean
+ signupPanelEmailManualErrors: Record<string, any>
+ signupPanelEmailTouched: boolean
+ signupPanelEmailTouches: Record<string, boolean>
+ signupPanelEmailValidationErrors: DeepPartialMap<SignupPanelEmailForm, ValidationErrorType>
+ signupPanelOnboarding: SignupPanelOnboardingForm
+ signupPanelOnboardingAllErrors: Record<string, any>
+ signupPanelOnboardingChanged: boolean
+ signupPanelOnboardingErrors: DeepPartialMap<SignupPanelOnboardingForm, ValidationErrorType>
+ signupPanelOnboardingHasErrors: boolean
+ signupPanelOnboardingManualErrors: Record<string, any>
+ signupPanelOnboardingTouched: boolean
+ signupPanelOnboardingTouches: Record<string, boolean>
+ signupPanelOnboardingValidationErrors: DeepPartialMap<SignupPanelOnboardingForm, ValidationErrorType>
+ turnstileSiteKey: string | null
+ turnstileToken: string | null
+ validatedPassword: ValidatedPasswordResult
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface signupLogicActions {
+ dismissPendingInvite: () => {
+ value: true
+ }
+ normalizeEmailWithDelay: (email: string) => {
+ email: string
+ }
+ registerPasskey: () => {
+ value: true
+ }
+ resendPendingInvite: (email: string) => {
+ email: string
+ }
+ resetChallenge: () => {
+ value: true
+ }
+ resetSignupPanel1: (values?: SignupForm) => {
+ values?: SignupForm
+ }
+ resetSignupPanel2: (values?: SignupForm) => {
+ values?: SignupForm
+ }
+ resetSignupPanelAuth: (values?: SignupPanelAuthForm) => {
+ values?: SignupPanelAuthForm
+ }
+ resetSignupPanelEmail: (values?: SignupPanelEmailForm) => {
+ values?: SignupPanelEmailForm
+ }
+ resetSignupPanelOnboarding: (values?: SignupPanelOnboardingForm) => {
+ values?: SignupPanelOnboardingForm
+ }
+ setChallengeNonce: (nonce: string | null) => {
+ nonce: string | null
+ }
+ setChallengeRequired: (required: boolean) => {
+ required: boolean
+ }
+ setEmailNormalized: (wasNormalized: boolean) => {
+ wasNormalized: boolean
+ }
+ setError: (error: string | null) => {
+ error: string | null
+ }
+ setPanel: (panel: number) => {
+ panel: number
+ }
+ setPasskeyError: (error: string | null) => {
+ error: string | null
+ }
+ setPasskeyRegistered: (registered: boolean) => {
+ registered: boolean
+ }
+ setPasskeyRegistering: (registering: boolean) => {
+ registering: boolean
+ }
+ setPendingInvite: (invite: PendingInvite | null) => {
+ invite: PendingInvite | null
+ }
+ setPendingInviteResending: (resending: boolean) => {
+ resending: boolean
+ }
+ setPendingInviteResent: (resent: boolean) => {
+ resent: boolean
+ }
+ setSignupPanel1ManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setSignupPanel1Value: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setSignupPanel1Values: (values: DeepPartial<SignupForm>) => {
+ values: DeepPartial<SignupForm>
+ }
+ setSignupPanel2ManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setSignupPanel2Value: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setSignupPanel2Values: (values: DeepPartial<SignupForm>) => {
+ values: DeepPartial<SignupForm>
+ }
+ setSignupPanelAuthManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setSignupPanelAuthValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setSignupPanelAuthValues: (values: DeepPartial<SignupPanelAuthForm>) => {
+ values: DeepPartial<SignupPanelAuthForm>
+ }
+ setSignupPanelEmailManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setSignupPanelEmailValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setSignupPanelEmailValues: (values: DeepPartial<SignupPanelEmailForm>) => {
+ values: DeepPartial<SignupPanelEmailForm>
+ }
+ setSignupPanelOnboardingManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setSignupPanelOnboardingValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setSignupPanelOnboardingValues: (values: DeepPartial<SignupPanelOnboardingForm>) => {
+ values: DeepPartial<SignupPanelOnboardingForm>
+ }
+ setTurnstileSiteKey: (siteKey: string | null) => {
+ siteKey: string | null
+ }
+ setTurnstileToken: (token: string | null) => {
+ token: string | null
+ }
+ submitSignupPanel1: () => {
+ value: boolean
+ }
+ submitSignupPanel1Failure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitSignupPanel1Request: (signupPanel1: SignupForm) => {
+ signupPanel1: SignupForm
+ }
+ submitSignupPanel1Success: (signupPanel1: SignupForm) => {
+ signupPanel1: SignupForm
+ }
+ submitSignupPanel2: () => {
+ value: boolean
+ }
+ submitSignupPanel2Failure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitSignupPanel2Request: (signupPanel2: SignupForm) => {
+ signupPanel2: SignupForm
+ }
+ submitSignupPanel2Success: (signupPanel2: SignupForm) => {
+ signupPanel2: SignupForm
+ }
+ submitSignupPanelAuth: () => {
+ value: boolean
+ }
+ submitSignupPanelAuthFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitSignupPanelAuthRequest: (signupPanelAuth: SignupPanelAuthForm) => {
+ signupPanelAuth: SignupPanelAuthForm
+ }
+ submitSignupPanelAuthSuccess: (signupPanelAuth: SignupPanelAuthForm) => {
+ signupPanelAuth: SignupPanelAuthForm
+ }
+ submitSignupPanelEmail: () => {
+ value: boolean
+ }
+ submitSignupPanelEmailFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitSignupPanelEmailRequest: (signupPanelEmail: SignupPanelEmailForm) => {
+ signupPanelEmail: SignupPanelEmailForm
+ }
+ submitSignupPanelEmailSuccess: (signupPanelEmail: SignupPanelEmailForm) => {
+ signupPanelEmail: SignupPanelEmailForm
+ }
+ submitSignupPanelOnboarding: () => {
+ value: boolean
+ }
+ submitSignupPanelOnboardingFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitSignupPanelOnboardingRequest: (signupPanelOnboarding: SignupPanelOnboardingForm) => {
+ signupPanelOnboarding: SignupPanelOnboardingForm
+ }
+ submitSignupPanelOnboardingSuccess: (signupPanelOnboarding: SignupPanelOnboardingForm) => {
+ signupPanelOnboarding: SignupPanelOnboardingForm
+ }
+ touchSignupPanel1Field: (key: string) => {
+ key: string
+ }
+ touchSignupPanel2Field: (key: string) => {
+ key: string
+ }
+ touchSignupPanelAuthField: (key: string) => {
+ key: string
+ }
+ touchSignupPanelEmailField: (key: string) => {
+ key: string
+ }
+ touchSignupPanelOnboardingField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface signupLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ validatedPassword: (signupPanelAuth: SignupPanelAuthForm, signupPanel1: SignupForm) => ValidatedPasswordResult
+ emailCaseNotice: (emailWasNormalized: boolean) => string | undefined
+ loginUrl: (searchParams: Record<string, any>) => string
+ passkeySignupEnabled: (featureFlags: FeatureFlagsSet) => boolean
+ panelTitle: (
+ panel: number,
+ passkeySignupEnabled: boolean,
+ preflight: PreflightStatus | null,
+ pendingInvite: PendingInvite | null
+ ) => string
+ }
+}
+
+export type signupLogicType = MakeLogicType<signupLogicValues, signupLogicActions, Record<string, any>, signupLogicMeta>
+
export const signupLogic = kea<signupLogicType>([
path(['scenes', 'authentication', 'signupLogic']),
connect(() => ({
@@ -493,14 +830,14 @@ export const signupLogic = kea<signupLogicType>([
selectors({
validatedPassword: [
(s) => [s.signupPanelAuth, s.signupPanel1],
- (signupPanelAuth, signupPanel1): ValidatedPasswordResult => {
+ (signupPanelAuth: SignupPanelAuthForm, signupPanel1: SignupForm): ValidatedPasswordResult => {
// Use new form if available, fallback to legacy
return validatePassword(signupPanelAuth.password || signupPanel1.password)
},
],
emailCaseNotice: [
(s) => [s.emailWasNormalized],
- (emailWasNormalized): string | undefined => {
+ (emailWasNormalized: boolean): string | undefined => {
return emailWasNormalized ? '⚠ Your email was automatically converted to lowercase' : undefined
},
],
@@ -513,13 +850,18 @@ export const signupLogic = kea<signupLogicType>([
],
passkeySignupEnabled: [
(s) => [s.featureFlags],
- (featureFlags): boolean => {
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet): boolean => {
return !!featureFlags[FEATURE_FLAGS.PASSKEY_SIGNUP_ENABLED]
},
],
panelTitle: [
(s) => [s.panel, s.passkeySignupEnabled, s.preflight, s.pendingInvite],
- (panel: number, passkeySignupEnabled: boolean, preflight, pendingInvite): string => {
+ (
+ panel: number,
+ passkeySignupEnabled: boolean,
+ preflight: null | import('../../../../types').PreflightStatus,
+ pendingInvite: PendingInvite | null
+ ): string => {
if (panel === 0 && pendingInvite) {
return ''
}
diff --git a/frontend/src/scenes/authentication/two-factor-reset/twoFactorResetLogic.ts b/frontend/src/scenes/authentication/two-factor-reset/twoFactorResetLogic.ts
index b4ff904b3d3b..a2f430f6fea4 100644
--- a/frontend/src/scenes/authentication/two-factor-reset/twoFactorResetLogic.ts
+++ b/frontend/src/scenes/authentication/two-factor-reset/twoFactorResetLogic.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 { loaders } from 'kea-loaders'
import { urlToAction } from 'kea-router'
@@ -6,8 +6,6 @@ import api from 'lib/api'
import { loginLogic } from 'scenes/authentication/login/loginLogic'
import { urls } from 'scenes/urls'
-import type { twoFactorResetLogicType } from './twoFactorResetLogicType'
-
export interface ValidatedTokenResponse {
success: boolean
token?: string
@@ -21,6 +19,114 @@ export interface ResetResponse {
requires_login?: boolean
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface twoFactorResetLogicValues {
+ currentToken: string
+ currentUuid: string
+ loginRedirectUrl: string
+ requiresLogin: boolean
+ resetComplete: boolean
+ resetError: string | null
+ resetLoading: boolean
+ resetResult: ResetResponse | null
+ resetResultLoading: boolean
+ validatedResetToken: ValidatedTokenResponse | null
+ validatedResetTokenLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface twoFactorResetLogicActions {
+ confirmReset: (token: string) => {
+ token: string
+ }
+ executeReset: ({ uuid, token }: { token: string; uuid: string }) => {
+ uuid: string
+ token: string
+ }
+ executeResetFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ executeResetSuccess: (
+ resetResult: ResetResponse,
+ payload?: {
+ uuid: string
+ token: string
+ }
+ ) => {
+ resetResult: ResetResponse
+ payload?: {
+ uuid: string
+ token: string
+ }
+ }
+ resetState: () => {
+ value: true
+ }
+ setRequiresLogin: (requires: boolean) => {
+ requires: boolean
+ }
+ setResetComplete: (complete: boolean) => {
+ complete: boolean
+ }
+ setResetError: (error: string | null) => {
+ error: string | null
+ }
+ validateResetToken: ({ uuid, token }: { token: string; uuid: string }) => {
+ uuid: string
+ token: string
+ }
+ validateResetTokenFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ validateResetTokenSuccess: (
+ validatedResetToken:
+ | ValidatedTokenResponse
+ | {
+ error: any
+ requires_login: boolean
+ success: false
+ },
+ payload?: {
+ uuid: string
+ token: string
+ }
+ ) => {
+ validatedResetToken:
+ | ValidatedTokenResponse
+ | {
+ error: any
+ requires_login: boolean
+ success: false
+ }
+ payload?: {
+ uuid: string
+ token: string
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface twoFactorResetLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ loginRedirectUrl: (currentUuid: string, currentToken: string) => string
+ }
+}
+
+export type twoFactorResetLogicType = MakeLogicType<
+ twoFactorResetLogicValues,
+ twoFactorResetLogicActions,
+ Record<string, any>,
+ twoFactorResetLogicMeta
+>
+
export const twoFactorResetLogic = kea<twoFactorResetLogicType>([
path(['scenes', 'authentication', 'two-factor-reset', 'twoFactorResetLogic']),
actions({
@@ -114,7 +220,7 @@ export const twoFactorResetLogic = kea<twoFactorResetLogicType>([
selectors({
loginRedirectUrl: [
(s) => [s.currentUuid, s.currentToken],
- (uuid, token): string => {
+ (uuid: string, token: string): string => {
// Redirect to login with the 2FA reset URL as the next parameter
const resetUrl = urls.twoFactorReset(uuid, token)
return `${urls.login()}?next=${encodeURIComponent(resetUrl)}`
diff --git a/frontend/src/scenes/authentication/two-factor-setup/twoFactorLogic.ts b/frontend/src/scenes/authentication/two-factor-setup/twoFactorLogic.ts
index 7dd3a638a84a..e271725b05b0 100644
--- a/frontend/src/scenes/authentication/two-factor-setup/twoFactorLogic.ts
+++ b/frontend/src/scenes/authentication/two-factor-setup/twoFactorLogic.ts
@@ -1,5 +1,6 @@
-import { actions, afterMount, connect, kea, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, 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 { lemonToast } from '@posthog/lemon-ui'
@@ -10,7 +11,8 @@ import { membersLogic } from 'scenes/organization/membersLogic'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { userLogic } from 'scenes/userLogic'
-import type { twoFactorLogicType } from './twoFactorLogicType'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { PreflightStatus, UserType } from '../../../types'
export interface TwoFactorForm {
token: number | null
@@ -29,6 +31,207 @@ export interface TwoFactorLogicProps {
onSuccess?: () => void
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface twoFactorLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ preflight: PreflightStatus | null // preflightLogic
+ user: UserType | null // userLogic
+ canSwitchOrg: boolean
+ forceOpenTwoFactorSetupModal: boolean
+ generalError: {
+ code: string
+ detail: string
+ } | null
+ generatingCodes: {
+ backup_codes: string[]
+ } | null
+ generatingCodesLoading: boolean
+ is2FAEnabled: boolean
+ isBackupCodesModalOpen: boolean
+ isDisable2FAModalOpen: boolean
+ isTokenSubmitting: boolean
+ isTokenValid: boolean
+ isTwoFactorSetupModalOpen: boolean
+ setupCallState: {
+ isOngoing: boolean
+ }
+ showTokenErrors: boolean
+ startSetup: {
+ secret: string
+ success: boolean
+ } | null
+ startSetupLoading: boolean
+ status: TwoFactorStatus | null
+ statusLoading: boolean
+ token: TwoFactorForm
+ tokenAllErrors: Record<string, any>
+ tokenChanged: boolean
+ tokenErrors: DeepPartialMap<TwoFactorForm, ValidationErrorType>
+ tokenHasErrors: boolean
+ tokenManualErrors: Record<string, any>
+ tokenTouched: boolean
+ tokenTouches: Record<string, boolean>
+ tokenValidationErrors: DeepPartialMap<TwoFactorForm, ValidationErrorType>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface twoFactorLogicActions {
+ loadAllMembers: () => {
+ value: true
+ } // membersLogic
+ loadUser: (resetOnFailure?: boolean | undefined) => {
+ resetOnFailure: boolean | undefined
+ } // userLogic
+ clearGeneralError: () => {
+ value: true
+ }
+ closeTwoFactorSetupModal: () => {
+ value: true
+ }
+ disable2FA: () => {
+ value: true
+ }
+ generateBackupCodes: () => {
+ value: true
+ }
+ generateBackupCodesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ generateBackupCodesSuccess: (
+ generatingCodes: {
+ backup_codes: string[]
+ } | null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ generatingCodes: {
+ backup_codes: string[]
+ } | null
+ payload?: {
+ value: true
+ }
+ }
+ loadStatus: () => {
+ value: true
+ }
+ loadStatusFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadStatusSuccess: (
+ status: TwoFactorStatus | null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ status: TwoFactorStatus | null
+ payload?: {
+ value: true
+ }
+ }
+ openTwoFactorSetupModal: (forceOpen?: boolean) => {
+ forceOpen: boolean | undefined
+ }
+ openTwoFactorSetupModalFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ openTwoFactorSetupModalSuccess: (
+ startSetup: {
+ secret: string
+ success: boolean
+ } | null,
+ payload?: {
+ forceOpen: boolean | undefined
+ }
+ ) => {
+ startSetup: {
+ secret: string
+ success: boolean
+ } | null
+ payload?: {
+ forceOpen: boolean | undefined
+ }
+ }
+ resetToken: (values?: TwoFactorForm) => {
+ values?: TwoFactorForm
+ }
+ setGeneralError: (
+ code: string,
+ detail: string
+ ) => {
+ code: string
+ detail: string
+ }
+ setSetupCallOngoing: (ongoing: boolean) => {
+ ongoing: boolean
+ }
+ setTokenManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setTokenValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setTokenValues: (values: DeepPartial<TwoFactorForm>) => {
+ values: DeepPartial<TwoFactorForm>
+ }
+ submitToken: () => {
+ value: boolean
+ }
+ submitTokenFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitTokenRequest: (token: TwoFactorForm) => {
+ token: TwoFactorForm
+ }
+ submitTokenSuccess: (token: TwoFactorForm) => {
+ token: TwoFactorForm
+ }
+ toggleBackupCodesModal: (open: boolean) => {
+ open: boolean
+ }
+ toggleDisable2FAModal: (open: boolean) => {
+ open: boolean
+ }
+ touchTokenField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface twoFactorLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ is2FAEnabled: (status: TwoFactorStatus | null) => boolean
+ canSwitchOrg: (user: UserType | null) => boolean
+ }
+}
+
+export type twoFactorLogicType = MakeLogicType<
+ twoFactorLogicValues,
+ twoFactorLogicActions,
+ TwoFactorLogicProps,
+ twoFactorLogicMeta
+>
+
export const twoFactorLogic = kea<twoFactorLogicType>([
path(['scenes', 'authentication', 'two-factor-setup', 'twoFactorLogic']),
props({} as TwoFactorLogicProps),
@@ -109,8 +312,11 @@ export const twoFactorLogic = kea<twoFactorLogicType>([
],
}),
selectors({
- is2FAEnabled: [(s) => [s.status], (status): boolean => !!status?.is_enabled],
- canSwitchOrg: [(s) => [s.user], (user): boolean => (user?.organizations || []).length > 1],
+ is2FAEnabled: [(s) => [s.status], (status: TwoFactorStatus | null): boolean => !!status?.is_enabled],
+ canSwitchOrg: [
+ (s) => [s.user],
+ (user: null | import('../../../types').UserType): boolean => (user?.organizations || []).length > 1,
+ ],
}),
loaders(({ values, actions }) => ({
startSetup: [
diff --git a/frontend/src/scenes/authentication/verify-email/verifyEmailLogic.ts b/frontend/src/scenes/authentication/verify-email/verifyEmailLogic.ts
index b9c23f2edf1e..551875cbae25 100644
--- a/frontend/src/scenes/authentication/verify-email/verifyEmailLogic.ts
+++ b/frontend/src/scenes/authentication/verify-email/verifyEmailLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, path, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import { router, urlToAction } from 'kea-router'
@@ -8,7 +8,7 @@ import { getRelativeNextPath } from 'lib/utils/url'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
-import type { verifyEmailLogicType } from './verifyEmailLogicType'
+import type { UserType } from '../../../types'
// Must stay in sync with the `VerifyEmail__Progress` animation duration in VerifyEmail.scss.
export const VERIFY_EMAIL_REDIRECT_DELAY_MS = 2000
@@ -35,6 +35,102 @@ export interface ValidatedTokenResponseType extends ResponseType {
uuid?: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface verifyEmailLogicValues {
+ user: UserType | null // userLogic
+ newlyRequestedVerificationLink: boolean | null
+ newlyRequestedVerificationLinkLoading: boolean
+ uuid: string | null
+ validatedEmailToken: ValidatedTokenResponseType | null
+ validatedEmailTokenLoading: boolean
+ view: 'invalid' | 'pending' | 'success' | 'verify' | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface verifyEmailLogicActions {
+ requestVerificationLink: (uuid: string) => {
+ uuid: string
+ }
+ requestVerificationLinkFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ requestVerificationLinkSuccess: (
+ newlyRequestedVerificationLink: boolean,
+ payload?: {
+ uuid: string
+ }
+ ) => {
+ newlyRequestedVerificationLink: boolean
+ payload?: {
+ uuid: string
+ }
+ }
+ setUuid: (uuid: string | null) => {
+ uuid: string | null
+ }
+ setView: (view: 'invalid' | 'pending' | 'success' | 'verify' | null) => {
+ view: 'invalid' | 'pending' | 'success' | 'verify' | null
+ }
+ validateEmailToken: ({ uuid, token }: { token: string; uuid: string }) => {
+ uuid: string
+ token: string
+ }
+ validateEmailTokenFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ validateEmailTokenSuccess: (
+ validatedEmailToken:
+ | {
+ errorCode: any
+ errorDetail: any
+ success: false
+ token?: undefined
+ uuid?: undefined
+ }
+ | {
+ errorCode?: undefined
+ errorDetail?: undefined
+ success: true
+ token: string
+ uuid: string
+ },
+ payload?: {
+ uuid: string
+ token: string
+ }
+ ) => {
+ validatedEmailToken:
+ | {
+ errorCode: any
+ errorDetail: any
+ success: false
+ token?: undefined
+ uuid?: undefined
+ }
+ | {
+ errorCode?: undefined
+ errorDetail?: undefined
+ success: true
+ token: string
+ uuid: string
+ }
+ payload?: {
+ uuid: string
+ token: string
+ }
+ }
+}
+
+export type verifyEmailLogicType = MakeLogicType<verifyEmailLogicValues, verifyEmailLogicActions>
+
export const verifyEmailLogic = kea<verifyEmailLogicType>([
path(['scenes', 'authentication', 'verify-email', 'verifyEmailLogic']),
connect(() => ({ values: [userLogic, ['user']] })),
diff --git a/frontend/src/scenes/billing/billingLogic.tsx b/frontend/src/scenes/billing/billingLogic.tsx
index 8b2b037d6393..f2c6a6230557 100644
--- a/frontend/src/scenes/billing/billingLogic.tsx
+++ b/frontend/src/scenes/billing/billingLogic.tsx
@@ -1,5 +1,6 @@
-import { actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { FieldNamePath, capitalizeFirstLetter, forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { lazyLoaders } from 'kea-loaders'
import { router, urlToAction } from 'kea-router'
import posthog from 'posthog-js'
@@ -30,13 +31,14 @@ import {
StartupProgramLabel,
} from '~/types'
+import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
+import type { OrganizationType, PreflightStatus } from '../../types'
import {
buildUsageLimitApproachingMessage,
buildUsageLimitExceededMessage,
canAccessBilling as canAccessBillingUtil,
getMinimumBillingAccessLevel,
} from './billing-utils'
-import type { billingLogicType } from './billingLogicType'
import { DEFAULT_ESTIMATED_MONTHLY_CREDIT_AMOUNT_USD } from './CreditCTAHero'
export const ALLOCATION_THRESHOLD_ALERT = 0.85 // Threshold to show warning of event usage near limit
@@ -152,6 +154,512 @@ const isBillingAlertDismissed = (
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface billingLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ currentOrganization: OrganizationType | null // organizationLogic
+ currentOrganizationId: string // organizationLogic
+ preflight: PreflightStatus | null // preflightLogic
+ accountOwner: {
+ email?: string
+ name?: string
+ } | null
+ activateLicense: {
+ license: string
+ }
+ activateLicenseAllErrors: Record<string, any>
+ activateLicenseChanged: boolean
+ activateLicenseErrors: DeepPartialMap<
+ {
+ license: string
+ },
+ ValidationErrorType
+ >
+ activateLicenseHasErrors: boolean
+ activateLicenseManualErrors: Record<string, any>
+ activateLicenseTouched: boolean
+ activateLicenseTouches: Record<string, boolean>
+ activateLicenseValidationErrors: DeepPartialMap<
+ {
+ license: string
+ },
+ ValidationErrorType
+ >
+ billing: BillingType | null
+ billingAlert: BillingAlertConfig | null
+ billingError: BillingError | null
+ billingErrorLoading: boolean
+ billingLoading: boolean
+ billingPeriodUTC: BillingPeriod
+ billingPlan: BillingPlan | null
+ canAccessBilling: boolean
+ computedDiscount: number | null
+ creditBrackets: any[]
+ creditDiscount: number
+ creditForm: {
+ collectionMethod: string
+ creditInput: string
+ }
+ creditFormAllErrors: Record<string, any>
+ creditFormChanged: boolean
+ creditFormErrors: DeepPartialMap<
+ {
+ collectionMethod: string
+ creditInput: string
+ },
+ ValidationErrorType
+ >
+ creditFormHasErrors: boolean
+ creditFormManualErrors: Record<string, any>
+ creditFormTouched: boolean
+ creditFormTouches: Record<string, boolean>
+ creditFormValidationErrors: DeepPartialMap<
+ {
+ collectionMethod: string
+ creditInput: string
+ },
+ ValidationErrorType
+ >
+ creditOverview: {
+ cc_last_four: null
+ collection_method: null
+ credit_brackets: never[]
+ eligible: false
+ email: null
+ estimated_monthly_credit_amount_usd: null
+ invoice_url: null
+ status: string
+ }
+ creditOverviewLoading: boolean
+ currentPlatformAddon: BillingProductV2AddonType | null
+ estimatedMonthlyCreditAmountUsd: number | null
+ hasSupportAddonPlan: boolean
+ isActivateLicenseSubmitting: boolean
+ isActivateLicenseValid: boolean
+ isAnnualPlanCustomer: boolean
+ isCreditCTAHeroDismissed: boolean
+ isCreditFormSubmitting: boolean
+ isCreditFormValid: boolean
+ isManagedAccount: boolean
+ isOnboarding: boolean
+ isProductOverUsageLimit: (productKey: ProductKey) => boolean
+ isPurchaseCreditsModalOpen: boolean
+ isUnlicensedDebug: boolean
+ minimumBillingAccessLevel: OrganizationMembershipLevel
+ platformAddons: BillingProductV2AddonType[]
+ productSpecificAlert: BillingAlertConfig | null
+ products: BillingProductV2Type[]
+ productsLoading: boolean
+ redirectPath: string
+ scrollToProductKey: ProductKey | null
+ showActivateLicenseErrors: boolean
+ showBillingHero: boolean
+ showBillingSummary: boolean
+ showCreditCTAHero: boolean
+ showCreditFormErrors: boolean
+ showLicenseDirectInput: boolean
+ startupProgramLabelCurrent: StartupProgramLabel | null
+ startupProgramLabelPrevious: StartupProgramLabel | null
+ supportPlans: BillingPlanType[]
+ switchPlanLoading: string | null
+ timeRemainingInSeconds: number
+ timeTotalInSeconds: number
+ unsubscribeError: UnsubscribeError | null
+ unusedPlatformAddonAmount: number
+ upgradeLink: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface billingLogicActions {
+ reportProductUnsubscribed: (product: string) => {
+ product: string
+ } // eventUsageLogic
+ resetUsageLimitApproachingKey: () => {
+ value: true
+ } // lemonBannerLogic
+ resetUsageLimitExceededKey: () => {
+ value: true
+ } // lemonBannerLogic
+ loadCurrentOrganization: () => any // organizationLogic
+ loadUser: (resetOnFailure?: boolean | undefined) => {
+ resetOnFailure: boolean | undefined
+ } // userLogic
+ deactivateProduct: (key: string) => string
+ deactivateProductFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deactivateProductSuccess: (
+ billing: BillingType | null,
+ payload?: string
+ ) => {
+ billing: BillingType | null
+ payload?: string
+ }
+ determineBillingAlert: () => {
+ value: true
+ }
+ loadBilling: () => any
+ loadBillingFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadBillingSuccess: (
+ billing: BillingType,
+ payload?: any
+ ) => {
+ billing: BillingType
+ payload?: any
+ }
+ loadCreditOverview: () => any
+ loadCreditOverviewFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadCreditOverviewSuccess: (
+ creditOverview: {
+ cc_last_four: null
+ collection_method: null
+ credit_brackets: never[]
+ eligible: false
+ email: null
+ estimated_monthly_credit_amount_usd: null
+ invoice_url: null
+ status: string
+ },
+ payload?: any
+ ) => {
+ creditOverview: {
+ cc_last_four: null
+ collection_method: null
+ credit_brackets: never[]
+ eligible: false
+ email: null
+ estimated_monthly_credit_amount_usd: null
+ invoice_url: null
+ status: string
+ }
+ payload?: any
+ }
+ loadInvoices: () => any
+ loadInvoicesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadInvoicesSuccess: (
+ billingError: {
+ action: {
+ children: string
+ targetBlank: boolean
+ to: any
+ }
+ message: string
+ status: 'warning'
+ } | null,
+ payload?: any
+ ) => {
+ billingError: {
+ action: {
+ children: string
+ targetBlank: boolean
+ to: any
+ }
+ message: string
+ status: 'warning'
+ } | null
+ payload?: any
+ }
+ loadProducts: () => any
+ loadProductsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadProductsSuccess: (
+ products: BillingProductV2Type[],
+ payload?: any
+ ) => {
+ products: BillingProductV2Type[]
+ payload?: any
+ }
+ registerInstrumentationProps: () => {
+ value: true
+ }
+ reportBillingAlertActionClicked: (alertConfig: BillingAlertConfig) => {
+ alertConfig: BillingAlertConfig
+ }
+ reportBillingAlertShown: (alertConfig: BillingAlertConfig) => {
+ alertConfig: BillingAlertConfig
+ }
+ reportBillingShown: () => {
+ value: true
+ }
+ reportCreditsCTAShown: (creditOverview: any) => {
+ creditOverview: any
+ }
+ reportCreditsFormSubmitted: (creditInput: number) => {
+ creditInput: number
+ }
+ reportCreditsModalShown: () => {
+ value: true
+ }
+ resetActivateLicense: (values?: { license: string }) => {
+ values?: {
+ license: string
+ }
+ }
+ resetCreditForm: (values?: { collectionMethod: string; creditInput: string }) => {
+ values?: {
+ collectionMethod: string
+ creditInput: string
+ }
+ }
+ resetUnsubscribeError: () => {
+ value: true
+ }
+ scrollToProduct: (productType: string) => {
+ productType: string
+ }
+ setActivateLicenseManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setActivateLicenseValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setActivateLicenseValues: (
+ values: DeepPartial<{
+ license: string
+ }>
+ ) => {
+ values: DeepPartial<{
+ license: string
+ }>
+ }
+ setBillingAlert: (billingAlert: BillingAlertConfig | null) => {
+ billingAlert: BillingAlertConfig | null
+ }
+ setComputedDiscount: (discount: number) => {
+ discount: number
+ }
+ setCreditBrackets: (creditBrackets: any[]) => {
+ creditBrackets: any[]
+ }
+ setCreditFormManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setCreditFormValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setCreditFormValues: (
+ values: DeepPartial<{
+ collectionMethod: string
+ creditInput: string
+ }>
+ ) => {
+ values: DeepPartial<{
+ collectionMethod: string
+ creditInput: string
+ }>
+ }
+ setIsOnboarding: (isOnboarding: boolean) => {
+ isOnboarding: boolean
+ }
+ setProductSpecificAlert: (productSpecificAlert: BillingAlertConfig | null) => {
+ productSpecificAlert: BillingAlertConfig | null
+ }
+ setRedirectPath: (redirectPath: string) => {
+ redirectPath: string
+ }
+ setScrollToProductKey: (scrollToProductKey: ProductKey | null) => {
+ scrollToProductKey: ProductKey | null
+ }
+ setShowLicenseDirectInput: (show: boolean) => {
+ show: boolean
+ }
+ setSwitchPlanLoading: (productKey: string | null) => {
+ productKey: string | null
+ }
+ setUnsubscribeError: (error: UnsubscribeError | null) => {
+ error: UnsubscribeError | null
+ }
+ showPurchaseCreditsModal: (isOpen: boolean) => {
+ isOpen: boolean
+ }
+ submitActivateLicense: () => {
+ value: boolean
+ }
+ submitActivateLicenseFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitActivateLicenseRequest: (activateLicense: { license: string }) => {
+ activateLicense: {
+ license: string
+ }
+ }
+ submitActivateLicenseSuccess: (activateLicense: { license: string }) => {
+ activateLicense: {
+ license: string
+ }
+ }
+ submitCreditForm: () => {
+ value: boolean
+ }
+ submitCreditFormFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitCreditFormRequest: (creditForm: { collectionMethod: string; creditInput: string }) => {
+ creditForm: {
+ collectionMethod: string
+ creditInput: string
+ }
+ }
+ submitCreditFormSuccess: (creditForm: { collectionMethod: string; creditInput: string }) => {
+ creditForm: {
+ collectionMethod: string
+ creditInput: string
+ }
+ }
+ switchFlatrateSubscriptionPlan: (data: SwitchPlanPayload) => SwitchPlanPayload
+ switchFlatrateSubscriptionPlanFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ switchFlatrateSubscriptionPlanSuccess: (
+ billing: BillingType,
+ payload?: SwitchPlanPayload
+ ) => {
+ billing: BillingType
+ payload?: SwitchPlanPayload
+ }
+ toggleCreditCTAHeroDismissed: (isDismissed: boolean) => {
+ isDismissed: boolean
+ }
+ touchActivateLicenseField: (key: string) => {
+ key: string
+ }
+ touchCreditFormField: (key: string) => {
+ key: string
+ }
+ updateBillingLimits: (limits: { [key: string]: number | null }) => {
+ [key: string]: number | null
+ }
+ updateBillingLimitsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateBillingLimitsSuccess: (
+ billing: BillingType,
+ payload?: {
+ [key: string]: number | null
+ }
+ ) => {
+ billing: BillingType
+ payload?: {
+ [key: string]: number | null
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface billingLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ minimumBillingAccessLevel: (featureFlags: FeatureFlagsSet) => OrganizationMembershipLevel
+ canAccessBilling: (currentOrganization: OrganizationType | null, featureFlags: FeatureFlagsSet) => boolean
+ upgradeLink: (preflight: PreflightStatus | null) => string
+ isUnlicensedDebug: (preflight: PreflightStatus | null, billing: BillingType | null) => boolean
+ supportPlans: (billing: BillingType | null) => BillingPlanType[]
+ hasSupportAddonPlan: (billing: BillingType | null) => boolean
+ platformAddons: (billing: BillingType | null) => BillingProductV2AddonType[]
+ currentPlatformAddon: (billing: BillingType | null) => BillingProductV2AddonType | null
+ unusedPlatformAddonAmount: (
+ currentPlatformAddon: BillingProductV2AddonType | null,
+ timeRemainingInSeconds: number,
+ timeTotalInSeconds: number
+ ) => number
+ creditDiscount: (computedDiscount: number | null) => number
+ billingPlan: (billing: BillingType | null) => BillingPlan | null
+ startupProgramLabelCurrent: (billing: BillingType | null) => StartupProgramLabel | null
+ startupProgramLabelPrevious: (billing: BillingType | null) => StartupProgramLabel | null
+ isAnnualPlanCustomer: (billing: BillingType | null) => boolean
+ isProductOverUsageLimit: (billing: BillingType | null) => (productKey: ProductKey) => boolean
+ billingPeriodUTC: (billing: BillingType | null) => BillingPeriod
+ showBillingSummary: (billing: BillingType | null, isOnboarding: boolean) => boolean
+ showCreditCTAHero: (creditOverview: {
+ cc_last_four: null
+ collection_method: null
+ credit_brackets: never[]
+ eligible: false
+ email: null
+ estimated_monthly_credit_amount_usd: null
+ invoice_url: null
+ status: string
+ }) => boolean
+ showBillingHero: (
+ billing: BillingType | null,
+ billingPlan: BillingPlan | null,
+ showCreditCTAHero: boolean
+ ) => boolean
+ isManagedAccount: (billing: BillingType | null) => boolean
+ accountOwner: (billing: BillingType | null) => {
+ email?: string
+ name?: string
+ } | null
+ estimatedMonthlyCreditAmountUsd: (creditOverview: {
+ cc_last_four: null
+ collection_method: null
+ credit_brackets: never[]
+ eligible: false
+ email: null
+ estimated_monthly_credit_amount_usd: null
+ invoice_url: null
+ status: string
+ }) => number | null
+ }
+}
+
+export type billingLogicType = MakeLogicType<
+ billingLogicValues,
+ billingLogicActions,
+ Record<string, any>,
+ billingLogicMeta
+>
+
export const billingLogic = kea<billingLogicType>([
path(['scenes', 'billing', 'billingLogic']),
actions({
@@ -519,12 +1027,15 @@ export const billingLogic = kea<billingLogicType>([
selectors({
minimumBillingAccessLevel: [
(s) => [s.featureFlags],
- (featureFlags): OrganizationMembershipLevel =>
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet): OrganizationMembershipLevel =>
getMinimumBillingAccessLevel(!!featureFlags[FEATURE_FLAGS.OWNER_ONLY_BILLING]),
],
canAccessBilling: [
(s) => [s.currentOrganization, s.featureFlags],
- (currentOrganization, featureFlags): boolean =>
+ (
+ currentOrganization: null | import('~/types').OrganizationType,
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet
+ ): boolean =>
canAccessBillingUtil(
currentOrganization?.membership_level,
!!featureFlags[FEATURE_FLAGS.OWNER_ONLY_BILLING]
@@ -533,7 +1044,8 @@ export const billingLogic = kea<billingLogicType>([
upgradeLink: [(s) => [s.preflight], (): string => '/organization/billing'],
isUnlicensedDebug: [
(s) => [s.preflight, s.billing],
- (preflight, billing): boolean => !!preflight?.is_debug && !billing?.billing_period,
+ (preflight: null | import('~/types').PreflightStatus, billing: BillingType | null): boolean =>
+ !!preflight?.is_debug && !billing?.billing_period,
],
supportPlans: [
(s) => [s.billing],
@@ -594,7 +1106,7 @@ export const billingLogic = kea<billingLogicType>([
return Math.round(amount * 100) / 100
},
],
- creditDiscount: [(s) => [s.computedDiscount], (computedDiscount) => computedDiscount || 0],
+ creditDiscount: [(s) => [s.computedDiscount], (computedDiscount: number | null) => computedDiscount || 0],
billingPlan: [
(s) => [s.billing],
(billing: BillingType | null): BillingPlan | null => billing?.billing_plan || null,
@@ -636,7 +1148,16 @@ export const billingLogic = kea<billingLogicType>([
],
showCreditCTAHero: [
(s) => [s.creditOverview],
- (creditOverview): boolean => {
+ (creditOverview: {
+ cc_last_four: null
+ collection_method: null
+ credit_brackets: never[]
+ eligible: false
+ email: null
+ estimated_monthly_credit_amount_usd: null
+ invoice_url: null
+ status: string
+ }): boolean => {
const isEligible = creditOverview.eligible
return isEligible && creditOverview.status !== 'paid'
},
@@ -662,7 +1183,16 @@ export const billingLogic = kea<billingLogicType>([
],
estimatedMonthlyCreditAmountUsd: [
(s) => [s.creditOverview],
- (creditOverview): number | null => {
+ (creditOverview: {
+ cc_last_four: null
+ collection_method: null
+ credit_brackets: never[]
+ eligible: false
+ email: null
+ estimated_monthly_credit_amount_usd: null
+ invoice_url: null
+ status: string
+ }): number | null => {
if (creditOverview === null) {
return null
}
diff --git a/frontend/src/scenes/billing/billingProductLogic.ts b/frontend/src/scenes/billing/billingProductLogic.ts
index 26f30cf90288..cf0745031f08 100644
--- a/frontend/src/scenes/billing/billingProductLogic.ts
+++ b/frontend/src/scenes/billing/billingProductLogic.ts
@@ -1,5 +1,6 @@
-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 { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { router } from 'kea-router'
import posthog from 'posthog-js'
import React from 'react'
@@ -21,10 +22,13 @@ import {
SurveyEventName,
} from '~/types'
+import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
+import type { ProductKey } from '../../queries/schema/schema-general'
import { calculateFreeTier, createGaugeItems, isAddonVisible, isProductVariantPrimary } from './billing-utils'
import { getBillingLimitConfig } from './billingLimitConfig'
+import type { BillingLimitConfig } from './billingLimitConfig'
import { billingLogic } from './billingLogic'
-import type { billingProductLogicType } from './billingProductLogicType'
+import type { BillingAlertConfig, SwitchPlanPayload, UnsubscribeError } from './billingLogic'
import { DATA_PIPELINES_CUTOFF_DATE } from './constants'
import { paymentEntryLogic } from './paymentEntryLogic'
import { BillingGaugeItemKind, BillingGaugeItemType } from './types'
@@ -81,6 +85,403 @@ export interface BillingProductLogicProps {
hogfettiTrigger?: () => void
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface billingProductLogicValues {
+ billing: BillingType | null // billingLogic
+ currentPlatformAddon: BillingProductV2AddonType | null // billingLogic
+ isUnlicensedDebug: boolean // billingLogic
+ platformAddons: BillingProductV2AddonType[] // billingLogic
+ scrollToProductKey: ProductKey | null // billingLogic
+ timeRemainingInSeconds: number // billingLogic
+ timeTotalInSeconds: number // billingLogic
+ unsubscribeError: UnsubscribeError | null // billingLogic
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ billingGaugeItems: BillingGaugeItemType[]
+ billingLimitAsUsage: number
+ billingLimitConfig: BillingLimitConfig
+ billingLimitInput: Record<string, any>
+ billingLimitInputAllErrors: Record<string, any>
+ billingLimitInputChanged: boolean
+ billingLimitInputErrors: DeepPartialMap<Record<string, any>, ValidationErrorType>
+ billingLimitInputHasErrors: boolean
+ billingLimitInputManualErrors: Record<string, any>
+ billingLimitInputTouched: boolean
+ billingLimitInputTouches: Record<string, boolean>
+ billingLimitInputValidationErrors: DeepPartialMap<Record<string, any>, ValidationErrorType>
+ billingLimitNextPeriod: number | null
+ billingProductLoading: string | null
+ combinedMonetaryData: {
+ billingLimit: number | null
+ currentTotal: number
+ discountPercent: number
+ projectedTotal: number
+ rawCurrentTotal: string
+ rawProjectedTotal: string
+ }
+ combinedMonetaryGaugeItems: BillingGaugeItemType[]
+ comparisonModalHighlightedFeatureKey: string | null
+ confirmDowngradeModalOpen: boolean
+ confirmUpgradeModalOpen: boolean
+ currentAmountTotalActual: string
+ currentAndUpgradePlans: {
+ currentPlan: BillingPlanType | null
+ upgradePlan: BillingPlanType
+ }
+ customLimitUsd: number | null
+ freeTier: number
+ hasCustomLimitSet: boolean
+ hedgehogSatisfied: boolean
+ isAddonProduct: boolean
+ isBillingLimitInputSubmitting: boolean
+ isBillingLimitInputValid: boolean
+ isDataPipelinesDeprecated: boolean
+ isEditingBillingLimit: boolean
+ isLowerTierThanCurrentAddon: boolean
+ isPlanComparisonModalOpen: boolean
+ isPricingModalOpen: boolean
+ isProductWithVariants: boolean
+ isProrated: boolean
+ isSubscribedToAnotherAddon: boolean
+ productVariants: Array<{
+ displayName: string
+ key: string
+ product: BillingProductV2AddonType | BillingProductV2Type
+ }> | null
+ projectedAmountExcludingAddons: string
+ proratedAmount: number
+ removingBillingLimitNextPeriod: boolean
+ showBillingLimitInputErrors: boolean
+ showTierBreakdown: boolean
+ surveyID: string
+ surveyResponse: {
+ $survey_response: string
+ $survey_response_2: string[]
+ }
+ trialCancelReasonQuestions: string
+ trialLoading: boolean
+ unsubscribeModalStep: number
+ unsubscribeReasonQuestions: string
+ unsubscribeReasonSurvey: null
+ variantExpandedStates: Record<string, boolean>
+ visibleAddons: BillingProductV2AddonType[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface billingProductLogicActions {
+ deactivateProduct: (key: string) => string // billingLogic
+ deactivateProductSuccess: (
+ billing: BillingType | null,
+ payload?: string | undefined
+ ) => {
+ billing: BillingType | null
+ payload?: string
+ } // billingLogic
+ loadBilling: () => any // billingLogic
+ loadBillingSuccess: (
+ billing: BillingType,
+ payload?: any
+ ) => {
+ billing: BillingType
+ payload?: any
+ } // billingLogic
+ setProductSpecificAlert: (productSpecificAlert: BillingAlertConfig | null) => {
+ productSpecificAlert: BillingAlertConfig | null
+ } // billingLogic
+ setScrollToProductKey: (scrollToProductKey: ProductKey | null) => {
+ scrollToProductKey: ProductKey | null
+ } // billingLogic
+ setSwitchPlanLoading: (productKey: string | null) => {
+ productKey: string | null
+ } // billingLogic
+ switchFlatrateSubscriptionPlan: (data: SwitchPlanPayload) => SwitchPlanPayload // billingLogic
+ updateBillingLimits: (limits: { [key: string]: number | null }) => {
+ [key: string]: number | null
+ } // billingLogic
+ updateBillingLimitsSuccess: (
+ billing: BillingType,
+ payload?:
+ | {
+ [key: string]: number | null
+ }
+ | undefined
+ ) => {
+ billing: BillingType
+ payload?: {
+ [key: string]: number | null
+ }
+ } // billingLogic
+ activateTrial: () => {
+ value: true
+ }
+ billingLoaded: () => {
+ value: true
+ }
+ cancelTrial: () => {
+ value: true
+ }
+ confirmProductDowngrade: () => {
+ value: true
+ }
+ confirmProductUpgrade: () => {
+ value: true
+ }
+ handleProductUpgrade: (
+ products: string,
+ redirectPath?: string
+ ) => {
+ products: string
+ redirectPath: string | undefined
+ }
+ hideConfirmDowngradeModal: () => {
+ value: true
+ }
+ hideConfirmUpgradeModal: () => {
+ value: true
+ }
+ initiateProductUpgrade: (
+ product: BillingProductV2AddonType | BillingProductV2Type,
+ plan: BillingPlanType,
+ redirectPath?: string
+ ) => {
+ plan: BillingPlanType
+ product: BillingProductV2AddonType | BillingProductV2Type
+ redirectPath: string | undefined
+ }
+ removeBillingLimitNextPeriod: (productType: string) => {
+ productType: string
+ }
+ reportSurveyDismissed: (surveyID: string) => {
+ surveyID: string
+ }
+ reportSurveySent: (
+ surveyID: string,
+ surveyResponse: Record<string, string | string[]>
+ ) => {
+ surveyID: string
+ surveyResponse: Record<string, string | string[]>
+ }
+ reportSurveyShown: (
+ surveyID: string,
+ productType: string
+ ) => {
+ productType: string
+ surveyID: string
+ }
+ resetBillingLimitInput: (values?: Record<string, any>) => {
+ values?: Record<string, any>
+ }
+ resetUnsubscribeModalStep: () => {
+ value: true
+ }
+ setBillingLimitInput: (billingLimitInput: number | null) => {
+ billingLimitInput: number | null
+ }
+ setBillingLimitInputManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setBillingLimitInputValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setBillingLimitInputValues: (values: DeepPartial<Record<string, any>>) => {
+ values: DeepPartial<Record<string, any>>
+ }
+ setBillingProductLoading: (productKey: string | null) => {
+ productKey: string | null
+ }
+ setHedgehogSatisfied: (satisfied: boolean) => {
+ satisfied: boolean
+ }
+ setIsEditingBillingLimit: (isEditingBillingLimit: boolean) => {
+ isEditingBillingLimit: boolean
+ }
+ setRemovingBillingLimitNextPeriod: (removingBillingLimitNextPeriod: boolean) => {
+ removingBillingLimitNextPeriod: boolean
+ }
+ setShowTierBreakdown: (showTierBreakdown: boolean) => {
+ showTierBreakdown: boolean
+ }
+ setSurveyID: (surveyID: string) => {
+ surveyID: string
+ }
+ setSurveyResponse: (
+ key: string,
+ value: string | string[]
+ ) => {
+ key: string
+ value: string | string[]
+ }
+ setTrialLoading: (loading: boolean) => {
+ loading: boolean
+ }
+ setUnsubscribeModalStep: (step: number) => {
+ step: number
+ }
+ showConfirmDowngradeModal: () => {
+ value: true
+ }
+ showConfirmUpgradeModal: () => {
+ value: true
+ }
+ submitBillingLimitInput: () => {
+ value: boolean
+ }
+ submitBillingLimitInputFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitBillingLimitInputRequest: (billingLimitInput: Record<string, any>) => {
+ billingLimitInput: Record<string, any>
+ }
+ submitBillingLimitInputSuccess: (billingLimitInput: Record<string, any>) => {
+ billingLimitInput: Record<string, any>
+ }
+ toggleIsPlanComparisonModalOpen: (highlightedFeatureKey?: string) => {
+ highlightedFeatureKey: string | undefined
+ }
+ toggleIsPricingModalOpen: () => {
+ value: true
+ }
+ toggleSurveyReason: (reason: string) => {
+ reason: string
+ }
+ toggleVariantExpanded: (variantKey: string) => {
+ variantKey: string
+ }
+ touchBillingLimitInputField: (key: string) => {
+ key: string
+ }
+ triggerMoreHedgehogs: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface billingProductLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ proratedAmount: (
+ currentAndUpgradePlans: {
+ currentPlan: BillingPlanType | null
+ upgradePlan: BillingPlanType
+ },
+ timeRemainingInSeconds: number,
+ timeTotalInSeconds: number
+ ) => number
+ isProrated: (
+ billing: BillingType | null,
+ currentAndUpgradePlans: {
+ currentPlan: BillingPlanType | null
+ upgradePlan: BillingPlanType
+ },
+ proratedAmount: number
+ ) => boolean
+ isLowerTierThanCurrentAddon: (
+ product: BillingProductV2AddonType | BillingProductV2Type,
+ currentPlatformAddon: BillingProductV2AddonType | null,
+ platformAddons: BillingProductV2AddonType[]
+ ) => boolean
+ isSubscribedToAnotherAddon: (
+ billing: BillingType | null,
+ product: BillingProductV2AddonType | BillingProductV2Type
+ ) => boolean
+ customLimitUsd: (
+ billing: BillingType | null,
+ product: BillingProductV2AddonType | BillingProductV2Type
+ ) => number | null
+ visibleAddons: (
+ featureFlags: FeatureFlagsSet,
+ product: BillingProductV2AddonType | BillingProductV2Type
+ ) => BillingProductV2AddonType[]
+ hasCustomLimitSet: (customLimitUsd: number | null) => boolean
+ isDataPipelinesDeprecated: (product: BillingProductV2AddonType | BillingProductV2Type) => boolean
+ currentAndUpgradePlans: (product: BillingProductV2AddonType | BillingProductV2Type) => {
+ currentPlan: BillingPlanType | null
+ upgradePlan: BillingPlanType
+ }
+ freeTier: (product: BillingProductV2AddonType | BillingProductV2Type) => number
+ billingLimitAsUsage: (product: BillingProductV2AddonType | BillingProductV2Type) => number
+ billingLimitNextPeriod: (
+ billing: BillingType | null,
+ product: BillingProductV2AddonType | BillingProductV2Type
+ ) => number | null
+ billingLimitConfig: (
+ billing: BillingType | null,
+ product: BillingProductV2AddonType | BillingProductV2Type,
+ customLimitUsd: number | null,
+ billingLimitNextPeriod: number | null
+ ) => BillingLimitConfig
+ billingGaugeItems: (
+ product: BillingProductV2AddonType | BillingProductV2Type,
+ billing: BillingType | null,
+ billingLimitAsUsage: number
+ ) => BillingGaugeItemType[]
+ isAddonProduct: (
+ billing: BillingType | null,
+ product: BillingProductV2AddonType | BillingProductV2Type
+ ) => boolean
+ unsubscribeReasonQuestions: (surveyResponse: {
+ $survey_response: string
+ $survey_response_2: string[]
+ }) => string
+ trialCancelReasonQuestions: (surveyResponse: {
+ $survey_response: string
+ $survey_response_2: string[]
+ }) => string
+ isProductWithVariants: (product: BillingProductV2AddonType | BillingProductV2Type) => boolean
+ projectedAmountExcludingAddons: (
+ isProductWithVariants: boolean,
+ product: BillingProductV2AddonType | BillingProductV2Type
+ ) => string
+ productVariants: (
+ isProductWithVariants: boolean,
+ product: BillingProductV2AddonType | BillingProductV2Type
+ ) => Array<{
+ displayName: string
+ key: string
+ product: BillingProductV2AddonType | BillingProductV2Type
+ }> | null
+ combinedMonetaryData: (
+ customLimitUsd: number | null,
+ product: BillingProductV2AddonType | BillingProductV2Type,
+ billing: BillingType | null
+ ) => {
+ billingLimit: number | null
+ currentTotal: number
+ discountPercent: number
+ projectedTotal: number
+ rawCurrentTotal: string
+ rawProjectedTotal: string
+ }
+ combinedMonetaryGaugeItems: (combinedMonetaryData: {
+ billingLimit: number | null
+ currentTotal: number
+ discountPercent: number
+ projectedTotal: number
+ rawCurrentTotal: string
+ rawProjectedTotal: string
+ }) => BillingGaugeItemType[]
+ currentAmountTotalActual: (
+ isProductWithVariants: boolean,
+ product: BillingProductV2AddonType | BillingProductV2Type,
+ visibleAddons: BillingProductV2AddonType[]
+ ) => string
+ }
+}
+
+export type billingProductLogicType = MakeLogicType<
+ billingProductLogicValues,
+ billingProductLogicActions,
+ BillingProductLogicProps,
+ billingProductLogicMeta
+>
+
export const billingProductLogic = kea<billingProductLogicType>([
props({} as BillingProductLogicProps),
key((props) => props.product.type),
@@ -295,7 +696,14 @@ export const billingProductLogic = kea<billingProductLogicType>([
selectors(({ values }) => ({
proratedAmount: [
(s) => [s.currentAndUpgradePlans, s.timeRemainingInSeconds, s.timeTotalInSeconds],
- (currentAndUpgradePlans, timeRemainingInSeconds, timeTotalInSeconds): number => {
+ (
+ currentAndUpgradePlans: {
+ currentPlan: BillingPlanType | null
+ upgradePlan: BillingPlanType
+ },
+ timeRemainingInSeconds: number,
+ timeTotalInSeconds: number
+ ): number => {
if (!timeTotalInSeconds) {
return 0
}
@@ -307,7 +715,14 @@ export const billingProductLogic = kea<billingProductLogicType>([
],
isProrated: [
(s) => [s.billing, s.currentAndUpgradePlans, s.proratedAmount],
- (billing, currentAndUpgradePlans, proratedAmount): boolean => {
+ (
+ billing: BillingType | null,
+ currentAndUpgradePlans: {
+ currentPlan: BillingPlanType | null
+ upgradePlan: BillingPlanType
+ },
+ proratedAmount: number
+ ): boolean => {
const hasActiveSubscription = billing?.has_active_subscription
const amountUsd = currentAndUpgradePlans.upgradePlan?.unit_amount_usd
if (!hasActiveSubscription || !amountUsd) {
@@ -318,7 +733,11 @@ export const billingProductLogic = kea<billingProductLogicType>([
],
isLowerTierThanCurrentAddon: [
(s, p) => [p.product, s.currentPlatformAddon, s.platformAddons],
- (product, currentPlatformAddon, platformAddons): boolean => {
+ (
+ product: BillingProductV2AddonType | BillingProductV2Type,
+ currentPlatformAddon: BillingProductV2AddonType | null,
+ platformAddons: BillingProductV2AddonType[]
+ ): boolean => {
if (!currentPlatformAddon || platformAddons.length === 0) {
return false
}
@@ -356,7 +775,7 @@ export const billingProductLogic = kea<billingProductLogicType>([
],
customLimitUsd: [
(s, p) => [s.billing, p.product],
- (billing, product) => {
+ (billing: BillingType | null, product: BillingProductV2AddonType | BillingProductV2Type) => {
const customLimit = billing?.custom_limits_usd?.[product.type]
if (customLimit === 0 || customLimit) {
return Number(customLimit)
@@ -379,7 +798,7 @@ export const billingProductLogic = kea<billingProductLogicType>([
],
hasCustomLimitSet: [
(s) => [s.customLimitUsd],
- (customLimitUsd) => (!!customLimitUsd || customLimitUsd === 0) && customLimitUsd >= 0,
+ (customLimitUsd: number | null) => (!!customLimitUsd || customLimitUsd === 0) && customLimitUsd >= 0,
],
isDataPipelinesDeprecated: [
(_s, p) => [p.product],
@@ -389,7 +808,7 @@ export const billingProductLogic = kea<billingProductLogicType>([
],
currentAndUpgradePlans: [
(_s, p) => [p.product],
- (product) => {
+ (product: BillingProductV2AddonType | BillingProductV2Type) => {
const currentPlanIndex = product.plans.findIndex((plan: BillingPlanType) => plan.current_plan)
const currentPlan = currentPlanIndex >= 0 ? product.plans?.[currentPlanIndex] : null
const upgradePlan =
@@ -401,16 +820,19 @@ export const billingProductLogic = kea<billingProductLogicType>([
return { currentPlan, upgradePlan }
},
],
- freeTier: [(_s, p) => [p.product], (product) => calculateFreeTier(product)],
+ freeTier: [
+ (_s, p) => [p.product],
+ (product: BillingProductV2AddonType | BillingProductV2Type) => calculateFreeTier(product),
+ ],
billingLimitAsUsage: [
(_, p) => [p.product],
- (product) => {
+ (product: BillingProductV2AddonType | BillingProductV2Type) => {
return product.usage_limit || 0
},
],
billingLimitNextPeriod: [
(s, p) => [s.billing, p.product],
- (billing, product) => {
+ (billing: BillingType | null, product: BillingProductV2AddonType | BillingProductV2Type) => {
const nextPeriodLimit = billing?.next_period_custom_limits_usd?.[product.type]
if (nextPeriodLimit === 0 || nextPeriodLimit) {
return nextPeriodLimit
@@ -420,7 +842,12 @@ export const billingProductLogic = kea<billingProductLogicType>([
],
billingLimitConfig: [
(s, p) => [s.billing, p.product, s.customLimitUsd, s.billingLimitNextPeriod],
- (billing, product, customLimitUsd, billingLimitNextPeriod) => {
+ (
+ billing: BillingType | null,
+ product: BillingProductV2AddonType | BillingProductV2Type,
+ customLimitUsd: number | null,
+ billingLimitNextPeriod: number | null
+ ) => {
return getBillingLimitConfig({
billing,
product,
@@ -431,7 +858,11 @@ export const billingProductLogic = kea<billingProductLogicType>([
],
billingGaugeItems: [
(s, p) => [p.product, s.billing, s.billingLimitAsUsage],
- (product, billing, billingLimitAsUsage): BillingGaugeItemType[] => {
+ (
+ product: BillingProductV2AddonType | BillingProductV2Type,
+ billing: BillingType | null,
+ billingLimitAsUsage: number
+ ): BillingGaugeItemType[] => {
return createGaugeItems(product, {
billing,
billingLimitAsUsage,
@@ -440,12 +871,12 @@ export const billingProductLogic = kea<billingProductLogicType>([
],
isAddonProduct: [
(s, p) => [s.billing, p.product],
- (billing, product): boolean =>
+ (billing: BillingType | null, product: BillingProductV2AddonType | BillingProductV2Type): boolean =>
!!billing?.products?.some((p) => p.addons?.some((addon) => addon.type === product?.type)),
],
unsubscribeReasonQuestions: [
(s) => [s.surveyResponse],
- (surveyResponse): string => {
+ (surveyResponse: { $survey_response: string; $survey_response_2: string[] }): string => {
return surveyResponse['$survey_response_2']
.map((reason) => {
const reasonObject = UNSUBSCRIBE_REASONS.find((r) => r.reason === reason)
@@ -456,7 +887,7 @@ export const billingProductLogic = kea<billingProductLogicType>([
],
trialCancelReasonQuestions: [
(s) => [s.surveyResponse],
- (surveyResponse): string => {
+ (surveyResponse: { $survey_response: string; $survey_response_2: string[] }): string => {
return surveyResponse['$survey_response_2']
.map((reason) => {
const reasonObject = TRIAL_CANCEL_REASONS.find((r) => r.reason === reason)
@@ -467,12 +898,12 @@ export const billingProductLogic = kea<billingProductLogicType>([
],
isProductWithVariants: [
(_s, p) => [p.product],
- (product): boolean =>
+ (product: BillingProductV2AddonType | BillingProductV2Type): boolean =>
isProductVariantPrimary(product.type) && 'addons' in product && product.addons?.length > 0,
],
projectedAmountExcludingAddons: [
(s, p) => [s.isProductWithVariants, p.product],
- (isProductWithVariants, product): string => {
+ (isProductWithVariants: boolean, product: BillingProductV2AddonType | BillingProductV2Type): string => {
if (!isProductWithVariants) {
return product.projected_amount_usd || '0'
}
@@ -587,7 +1018,11 @@ export const billingProductLogic = kea<billingProductLogicType>([
],
currentAmountTotalActual: [
(s, p) => [s.isProductWithVariants, p.product, s.visibleAddons],
- (isProductWithVariants, product, visibleAddons): string => {
+ (
+ isProductWithVariants: boolean,
+ product: BillingProductV2AddonType | BillingProductV2Type,
+ visibleAddons: BillingProductV2AddonType[]
+ ): string => {
if (!product.tiers) {
return '0.00'
}
diff --git a/frontend/src/scenes/billing/billingSpendLogic.ts b/frontend/src/scenes/billing/billingSpendLogic.ts
index 32e3062f31fe..ac9640ee2bbc 100644
--- a/frontend/src/scenes/billing/billingSpendLogic.ts
+++ b/frontend/src/scenes/billing/billingSpendLogic.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 { actionToUrl, router, urlToAction } from 'kea-router'
import difference from 'lodash.difference'
@@ -17,6 +17,7 @@ import { Params } from 'scenes/sceneTypes'
import { DateMappingOption, OrganizationType } from '~/types'
+import type { BillingPeriod, BillingType } from '../../types'
import {
buildTrackingProperties,
calculateBillingPeriodMarkers,
@@ -25,8 +26,8 @@ import {
} from './billing-utils'
import type { BillingPeriodMarker } from './BillingLineGraph'
import { billingLogic } from './billingLogic'
-import type { billingSpendLogicType } from './billingSpendLogicType'
import type { BillingFilters } from './types'
+import type { BillingUsageInteractionProps } from './types'
export enum BillingSpendResponseBreakdownType {
TYPE = 'type',
@@ -68,6 +69,175 @@ export interface BillingSpendLogicProps {
syncWithUrl?: boolean // Default false - only intended on usage and spend pages
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface billingSpendLogicValues {
+ billing: BillingType | null // billingLogic
+ billingPeriodUTC: BillingPeriod // billingLogic
+ canAccessBilling: boolean // billingLogic
+ currentOrganization: OrganizationType | null // billingLogic
+ isHobby: boolean // preflightLogic
+ billingPeriodMarkers: BillingPeriodMarker[]
+ billingSpendResponse: BillingSpendResponse | null
+ billingSpendResponseLoading: boolean
+ dateFrom: string
+ dateOptions: DateMappingOption[]
+ dateTo: string
+ dates: string[]
+ emptySeriesIDs: number[]
+ excludeEmptySeries: boolean
+ filters: {
+ breakdowns?: ('team' | 'type')[] | undefined
+ interval?: 'day' | 'month' | 'week' | undefined
+ team_ids?: number[] | undefined
+ usage_types?: string[] | undefined
+ }
+ finalHiddenSeries: number[]
+ heading: string
+ headingTooltip: string | null
+ series: {
+ breakdown_type: BillingSpendResponseBreakdownType | null
+ breakdown_value: string | string[] | null
+ data: number[]
+ dates: string[]
+ id: number
+ label: string
+ }[]
+ showEmptyState: boolean
+ showSeries: boolean
+ teamOptions: {
+ key: string
+ label: string
+ }[]
+ userHiddenSeries: number[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface billingSpendLogicActions {
+ reportBillingSpendInteraction: (properties: BillingUsageInteractionProps) => {
+ properties: BillingUsageInteractionProps
+ } // eventUsageLogic
+ loadBillingSpend: () => any
+ loadBillingSpendFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadBillingSpendSuccess: (
+ billingSpendResponse: BillingSpendResponse | null,
+ payload?: any
+ ) => {
+ billingSpendResponse: BillingSpendResponse | null
+ payload?: any
+ }
+ resetFilters: () => {
+ value: true
+ }
+ setDateRange: (
+ dateFrom: string | null,
+ dateTo: string | null,
+ shouldDebounce?: boolean
+ ) => {
+ dateFrom: string | null
+ dateTo: string | null
+ shouldDebounce: boolean
+ }
+ setExcludeEmptySeries: (
+ exclude: boolean,
+ shouldDebounce?: boolean
+ ) => {
+ exclude: boolean
+ shouldDebounce: boolean
+ }
+ setFilters: (
+ filters: Partial<BillingFilters>,
+ shouldDebounce?: boolean
+ ) => {
+ filters: Partial<BillingFilters>
+ shouldDebounce: boolean
+ }
+ toggleAllSeries: () => {
+ value: true
+ }
+ toggleBreakdown: (dimension: 'team' | 'type') => {
+ dimension: 'team' | 'type'
+ }
+ toggleSeries: (id: number) => {
+ id: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface billingSpendLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ series: (billingSpendResponse: BillingSpendResponse | null) => {
+ breakdown_type: BillingSpendResponseBreakdownType | null
+ breakdown_value: string | string[] | null
+ data: number[]
+ dates: string[]
+ id: number
+ label: string
+ }[]
+ dates: (billingSpendResponse: BillingSpendResponse | null) => string[]
+ dateOptions: (billingPeriodUTC: BillingPeriod) => DateMappingOption[]
+ billingPeriodMarkers: (
+ billingPeriodUTC: BillingPeriod,
+ dateFrom: string,
+ dateTo: string
+ ) => BillingPeriodMarker[]
+ emptySeriesIDs: (
+ series: {
+ breakdown_type: BillingSpendResponseBreakdownType | null
+ breakdown_value: string | string[] | null
+ data: number[]
+ dates: string[]
+ id: number
+ label: string
+ }[]
+ ) => number[]
+ finalHiddenSeries: (
+ userHiddenSeries: number[],
+ excludeEmptySeries: boolean,
+ emptySeriesIDs: number[]
+ ) => number[]
+ showSeries: (
+ billingSpendResponseLoading: boolean,
+ series: {
+ breakdown_type: BillingSpendResponseBreakdownType | null
+ breakdown_value: string | string[] | null
+ data: number[]
+ dates: string[]
+ id: number
+ label: string
+ }[]
+ ) => boolean
+ showEmptyState: (showSeries: boolean, billingSpendResponse: BillingSpendResponse | null) => boolean
+ heading: (filters: {
+ breakdowns?: ('team' | 'type')[] | undefined
+ interval?: 'day' | 'month' | 'week' | undefined
+ team_ids?: number[] | undefined
+ usage_types?: string[] | undefined
+ }) => string
+ headingTooltip: (dateTo: string) => string | null
+ teamOptions: (
+ currentOrganization: OrganizationType | null,
+ billingSpendResponse: BillingSpendResponse | null
+ ) => {
+ key: string
+ label: string
+ }[]
+ }
+}
+
+export type billingSpendLogicType = MakeLogicType<
+ billingSpendLogicValues,
+ billingSpendLogicActions,
+ BillingSpendLogicProps,
+ billingSpendLogicMeta
+>
+
export const billingSpendLogic = kea<billingSpendLogicType>([
path(['scenes', 'billing', 'billingSpendLogic']),
props({} as BillingSpendLogicProps),
@@ -186,7 +356,7 @@ export const billingSpendLogic = kea<billingSpendLogicType>([
],
dateOptions: [
(s) => [s.billingPeriodUTC],
- (currentPeriod): DateMappingOption[] => {
+ (currentPeriod: import('~/types').BillingPeriod): DateMappingOption[] => {
const currentBillingPeriodStart = currentPeriod.start
const currentBillingPeriodEnd = currentPeriod.end
const currentBillingPeriodOption: DateMappingOption = {
@@ -210,7 +380,11 @@ export const billingSpendLogic = kea<billingSpendLogicType>([
],
billingPeriodMarkers: [
(s) => [s.billingPeriodUTC, s.dateFrom, s.dateTo],
- (currentPeriod, dateFrom: string, dateTo: string): BillingPeriodMarker[] => {
+ (
+ currentPeriod: import('~/types').BillingPeriod,
+ dateFrom: string,
+ dateTo: string
+ ): BillingPeriodMarker[] => {
return calculateBillingPeriodMarkers(currentPeriod, dateFrom, dateTo)
},
],
diff --git a/frontend/src/scenes/billing/billingUsageLogic.ts b/frontend/src/scenes/billing/billingUsageLogic.ts
index 3d00eaecb545..5ede8a0e5422 100644
--- a/frontend/src/scenes/billing/billingUsageLogic.ts
+++ b/frontend/src/scenes/billing/billingUsageLogic.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 { actionToUrl, router, urlToAction } from 'kea-router'
import difference from 'lodash.difference'
@@ -17,6 +17,7 @@ import { Params } from 'scenes/sceneTypes'
import { DateMappingOption, OrganizationType } from '~/types'
+import type { BillingPeriod, BillingType } from '../../types'
import {
buildTrackingProperties,
calculateBillingPeriodMarkers,
@@ -25,8 +26,8 @@ import {
} from './billing-utils'
import type { BillingPeriodMarker } from './BillingLineGraph'
import { billingLogic } from './billingLogic'
-import type { billingUsageLogicType } from './billingUsageLogicType'
import type { BillingFilters } from './types'
+import type { BillingUsageInteractionProps } from './types'
// These date filters return correct data but there's an issue with filter label after selecting it, showing 'No date range override' instead
const TEMPORARILY_EXCLUDED_DATE_FILTER_OPTIONS = ['This month', 'Year to date', 'All time']
@@ -71,6 +72,175 @@ export interface BillingUsageLogicProps {
syncWithUrl?: boolean // Default false - only intended on usage and spend pages
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface billingUsageLogicValues {
+ billing: BillingType | null // billingLogic
+ billingPeriodUTC: BillingPeriod // billingLogic
+ canAccessBilling: boolean // billingLogic
+ currentOrganization: OrganizationType | null // billingLogic
+ isHobby: boolean // preflightLogic
+ billingPeriodMarkers: BillingPeriodMarker[]
+ billingUsageResponse: BillingUsageResponse | null
+ billingUsageResponseLoading: boolean
+ dateFrom: string
+ dateOptions: DateMappingOption[]
+ dateTo: string
+ dates: string[]
+ emptySeriesIDs: number[]
+ excludeEmptySeries: boolean
+ filters: {
+ breakdowns?: ('team' | 'type')[] | undefined
+ interval?: 'day' | 'month' | 'week' | undefined
+ team_ids?: number[] | undefined
+ usage_types?: string[] | undefined
+ }
+ finalHiddenSeries: number[]
+ heading: string
+ headingTooltip: string | null
+ series: {
+ breakdown_type: BillingUsageResponseBreakdownType | null
+ breakdown_value: string | string[] | null
+ data: number[]
+ dates: string[]
+ id: number
+ label: string
+ }[]
+ showEmptyState: boolean
+ showSeries: boolean
+ teamOptions: {
+ key: string
+ label: string
+ }[]
+ userHiddenSeries: number[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface billingUsageLogicActions {
+ reportBillingUsageInteraction: (properties: BillingUsageInteractionProps) => {
+ properties: BillingUsageInteractionProps
+ } // eventUsageLogic
+ loadBillingUsage: () => any
+ loadBillingUsageFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadBillingUsageSuccess: (
+ billingUsageResponse: BillingUsageResponse | null,
+ payload?: any
+ ) => {
+ billingUsageResponse: BillingUsageResponse | null
+ payload?: any
+ }
+ resetFilters: () => {
+ value: true
+ }
+ setDateRange: (
+ dateFrom: string | null,
+ dateTo: string | null,
+ shouldDebounce?: boolean
+ ) => {
+ dateFrom: string | null
+ dateTo: string | null
+ shouldDebounce: boolean
+ }
+ setExcludeEmptySeries: (
+ exclude: boolean,
+ shouldDebounce?: boolean
+ ) => {
+ exclude: boolean
+ shouldDebounce: boolean
+ }
+ setFilters: (
+ filters: Partial<BillingFilters>,
+ shouldDebounce?: boolean
+ ) => {
+ filters: Partial<BillingFilters>
+ shouldDebounce: boolean
+ }
+ toggleAllSeries: () => {
+ value: true
+ }
+ toggleSeries: (id: number) => {
+ id: number
+ }
+ toggleTeamBreakdown: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface billingUsageLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ dateOptions: (billingPeriodUTC: BillingPeriod) => DateMappingOption[]
+ billingPeriodMarkers: (
+ billingPeriodUTC: BillingPeriod,
+ dateFrom: string,
+ dateTo: string
+ ) => BillingPeriodMarker[]
+ series: (billingUsageResponse: BillingUsageResponse | null) => {
+ breakdown_type: BillingUsageResponseBreakdownType | null
+ breakdown_value: string | string[] | null
+ data: number[]
+ dates: string[]
+ id: number
+ label: string
+ }[]
+ dates: (billingUsageResponse: BillingUsageResponse | null) => string[]
+ emptySeriesIDs: (
+ series: {
+ breakdown_type: BillingUsageResponseBreakdownType | null
+ breakdown_value: string | string[] | null
+ data: number[]
+ dates: string[]
+ id: number
+ label: string
+ }[]
+ ) => number[]
+ finalHiddenSeries: (
+ userHiddenSeries: number[],
+ excludeEmptySeries: boolean,
+ emptySeriesIDs: number[]
+ ) => number[]
+ showSeries: (
+ billingUsageResponseLoading: boolean,
+ series: {
+ breakdown_type: BillingUsageResponseBreakdownType | null
+ breakdown_value: string | string[] | null
+ data: number[]
+ dates: string[]
+ id: number
+ label: string
+ }[]
+ ) => boolean
+ showEmptyState: (showSeries: boolean, billingUsageResponse: BillingUsageResponse | null) => boolean
+ heading: (filters: {
+ breakdowns?: ('team' | 'type')[] | undefined
+ interval?: 'day' | 'month' | 'week' | undefined
+ team_ids?: number[] | undefined
+ usage_types?: string[] | undefined
+ }) => string
+ headingTooltip: (dateTo: string) => string | null
+ teamOptions: (
+ currentOrganization: OrganizationType | null,
+ billingUsageResponse: BillingUsageResponse | null
+ ) => {
+ key: string
+ label: string
+ }[]
+ }
+}
+
+export type billingUsageLogicType = MakeLogicType<
+ billingUsageLogicValues,
+ billingUsageLogicActions,
+ BillingUsageLogicProps,
+ billingUsageLogicMeta
+>
+
export const billingUsageLogic = kea<billingUsageLogicType>([
path(['scenes', 'billing', 'billingUsageLogic']),
props({} as BillingUsageLogicProps),
@@ -176,7 +346,7 @@ export const billingUsageLogic = kea<billingUsageLogicType>([
selectors({
dateOptions: [
(s) => [s.billingPeriodUTC],
- (currentPeriod): DateMappingOption[] => {
+ (currentPeriod: import('~/types').BillingPeriod): DateMappingOption[] => {
const currentBillingPeriodStart = currentPeriod.start
const currentBillingPeriodEnd = currentPeriod.end
const currentBillingPeriodOption: DateMappingOption = {
@@ -202,7 +372,11 @@ export const billingUsageLogic = kea<billingUsageLogicType>([
],
billingPeriodMarkers: [
(s) => [s.billingPeriodUTC, s.dateFrom, s.dateTo],
- (currentPeriod, dateFrom: string, dateTo: string): BillingPeriodMarker[] => {
+ (
+ currentPeriod: import('~/types').BillingPeriod,
+ dateFrom: string,
+ dateTo: string
+ ): BillingPeriodMarker[] => {
return calculateBillingPeriodMarkers(currentPeriod, dateFrom, dateTo)
},
],
diff --git a/frontend/src/scenes/billing/paymentEntryLogic.ts b/frontend/src/scenes/billing/paymentEntryLogic.ts
index 05eafc30bbf7..9bca3b39cfd2 100644
--- a/frontend/src/scenes/billing/paymentEntryLogic.ts
+++ b/frontend/src/scenes/billing/paymentEntryLogic.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 { router } from 'kea-router'
import posthog from 'posthog-js'
@@ -12,7 +12,67 @@ import { BillingProductV2Type } from '~/types'
import { billingLogic } from './billingLogic'
import { billingProductLogic } from './billingProductLogic'
-import type { paymentEntryLogicType } from './paymentEntryLogicType'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface paymentEntryLogicValues {
+ apiError: null
+ authorizationStatus: string | null
+ clientSecret: null
+ isLoading: boolean
+ paymentEntryModalOpen: boolean
+ redirectPath: string | null
+ stripeError: null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface paymentEntryLogicActions {
+ loadCurrentOrganization: () => any // organizationLogic
+ loadUser: (resetOnFailure?: boolean | undefined) => {
+ resetOnFailure: boolean | undefined
+ } // userLogic
+ clearErrors: () => {
+ value: true
+ }
+ hidePaymentEntryModal: () => {
+ value: true
+ }
+ initiateAuthorization: () => {
+ value: true
+ }
+ pollAuthorizationStatus: (paymentIntentId?: string) => {
+ paymentIntentId: string | undefined
+ }
+ setApiError: (error: any) => {
+ error: any
+ }
+ setAuthorizationStatus: (status: string | null) => {
+ status: string | null
+ }
+ setClientSecret: (clientSecret: any) => {
+ clientSecret: any
+ }
+ setLoading: (loading: any) => {
+ loading: any
+ }
+ setRedirectPath: (redirectPath: string | null) => {
+ redirectPath: string | null
+ }
+ setStripeError: (error: any) => {
+ error: any
+ }
+ showPaymentEntryModal: () => {
+ value: true
+ }
+ startPaymentEntryFlow: (
+ product?: BillingProductV2Type | null,
+ redirectPath?: string | null
+ ) => {
+ product: BillingProductV2Type | null | undefined
+ redirectPath: string | null | undefined
+ }
+}
+
+export type paymentEntryLogicType = MakeLogicType<paymentEntryLogicValues, paymentEntryLogicActions>
export const paymentEntryLogic = kea<paymentEntryLogicType>([
path(['scenes', 'billing', 'PaymentEntryLogic']),
diff --git a/frontend/src/scenes/billing/seatBillingLogic.ts b/frontend/src/scenes/billing/seatBillingLogic.ts
index 62bb1139e320..ba1da116e709 100644
--- a/frontend/src/scenes/billing/seatBillingLogic.ts
+++ b/frontend/src/scenes/billing/seatBillingLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, listeners, path, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { lemonToast } from '@posthog/lemon-ui'
@@ -9,8 +9,9 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { membersLogic } from 'scenes/organization/membersLogic'
import { organizationLogic } from 'scenes/organizationLogic'
+import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
+import type { OrganizationMemberType, OrganizationType } from '../../types'
import { CODE_FREE_PLAN_PREFIX, CODE_PLAN_ALPHA_PRO, CODE_PRO_PLAN_PREFIX, CODE_PRODUCT_KEY } from './constants'
-import type { seatBillingLogicType } from './seatBillingLogicType'
import type { SeatData } from './types'
export function isProPlanKey(planKey: string | null | undefined): boolean {
@@ -45,6 +46,63 @@ function seatErrorMessage(e: unknown, fallback: string): string {
return fallback
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface seatBillingLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ members: OrganizationMemberType[] | null // membersLogic
+ currentOrganization: OrganizationType | null // organizationLogic
+ activeCount: number
+ cancelingCount: number
+ displaySeats: SeatData[]
+ isAdmin: boolean
+ monthlyTotal: number
+ orgSeats: SeatData[]
+ orgSeatsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface seatBillingLogicActions {
+ ensureAllMembersLoaded: () => {
+ value: true
+ } // membersLogic
+ adminCancelSeat: (userDistinctId: string) => {
+ userDistinctId: string
+ }
+ loadOrgSeats: () => any
+ loadOrgSeatsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadOrgSeatsSuccess: (
+ orgSeats: SeatData[],
+ payload?: any
+ ) => {
+ orgSeats: SeatData[]
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface seatBillingLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ isAdmin: (currentOrganization: OrganizationType | null) => boolean
+ displaySeats: (orgSeats: SeatData[]) => SeatData[]
+ activeCount: (displaySeats: SeatData[]) => number
+ cancelingCount: (displaySeats: SeatData[]) => number
+ monthlyTotal: (displaySeats: SeatData[]) => number
+ }
+}
+
+export type seatBillingLogicType = MakeLogicType<
+ seatBillingLogicValues,
+ seatBillingLogicActions,
+ Record<string, any>,
+ seatBillingLogicMeta
+>
+
export const seatBillingLogic = kea<seatBillingLogicType>([
path(['scenes', 'billing', 'seatBillingLogic']),
connect(() => ({
@@ -83,7 +141,7 @@ export const seatBillingLogic = kea<seatBillingLogicType>([
selectors({
isAdmin: [
(s) => [s.currentOrganization],
- (currentOrganization): boolean =>
+ (currentOrganization: null | import('../../types').OrganizationType): boolean =>
!!(
currentOrganization?.membership_level &&
currentOrganization.membership_level >= OrganizationMembershipLevel.Admin
@@ -91,7 +149,7 @@ export const seatBillingLogic = kea<seatBillingLogicType>([
],
displaySeats: [
(s) => [s.orgSeats],
- (orgSeats): SeatData[] => {
+ (orgSeats: SeatData[]): SeatData[] => {
const STATUS_PRIORITY: Record<string, number> = {
active: 0,
canceling: 1,
@@ -116,15 +174,15 @@ export const seatBillingLogic = kea<seatBillingLogicType>([
],
activeCount: [
(s) => [s.displaySeats],
- (displaySeats): number => displaySeats.filter((s: SeatData) => s.status === 'active').length,
+ (displaySeats: SeatData[]): number => displaySeats.filter((s: SeatData) => s.status === 'active').length,
],
cancelingCount: [
(s) => [s.displaySeats],
- (displaySeats): number => displaySeats.filter((s: SeatData) => s.status === 'canceling').length,
+ (displaySeats: SeatData[]): number => displaySeats.filter((s: SeatData) => s.status === 'canceling').length,
],
monthlyTotal: [
(s) => [s.displaySeats],
- (displaySeats): number =>
+ (displaySeats: SeatData[]): number =>
displaySeats
.filter((s: SeatData) => s.status === 'active')
.reduce((sum: number, s: SeatData) => sum + seatPriceFromPlanKey(s.plan_key), 0),
diff --git a/frontend/src/scenes/dashboard/addInsightToDashboardModalLogic.ts b/frontend/src/scenes/dashboard/addInsightToDashboardModalLogic.ts
index 3a84c291b4fa..473c06e0964c 100644
--- a/frontend/src/scenes/dashboard/addInsightToDashboardModalLogic.ts
+++ b/frontend/src/scenes/dashboard/addInsightToDashboardModalLogic.ts
@@ -1,6 +1,28 @@
-import { actions, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
-import type { addInsightToDashboardLogicType } from './addInsightToDashboardModalLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface addInsightToDashboardLogicValues {
+ addInsightToDashboardModalVisible: boolean
+ showMoreInsightTypes: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface addInsightToDashboardLogicActions {
+ hideAddInsightToDashboardModal: () => {
+ value: true
+ }
+ showAddInsightToDashboardModal: () => {
+ value: true
+ }
+ toggleShowMoreInsightTypes: () => {
+ value: true
+ }
+}
+
+export type addInsightToDashboardLogicType = MakeLogicType<
+ addInsightToDashboardLogicValues,
+ addInsightToDashboardLogicActions
+>
export const addInsightToDashboardLogic = kea<addInsightToDashboardLogicType>([
path(['scenes', 'dashboard', 'addInsightToDashboardLogic']),
diff --git a/frontend/src/scenes/dashboard/dashboardInsightColorsModalLogic.ts b/frontend/src/scenes/dashboard/dashboardInsightColorsModalLogic.ts
index 93f82ab42279..345ac255b9d6 100644
--- a/frontend/src/scenes/dashboard/dashboardInsightColorsModalLogic.ts
+++ b/frontend/src/scenes/dashboard/dashboardInsightColorsModalLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, path, reducers, selectors } from 'kea'
import { getFunnelDatasetKey, getTrendDatasetKey, sortCohorts } from 'scenes/insights/utils'
@@ -6,8 +6,8 @@ import { cohortsModel } from '~/models/cohortsModel'
import { isFunnelsQuery, isInsightVizNode, isTrendsQuery } from '~/queries/utils'
import { CohortType, DashboardTile, FunnelVizType, QueryBasedInsightModel } from '~/types'
+import type { CountedPaginatedResponse } from '../../lib/api'
import { BreakdownColorConfig } from './DashboardInsightColorsModal'
-import type { dashboardInsightColorsModalLogicType } from './dashboardInsightColorsModalLogicType'
import { dashboardLogic } from './dashboardLogic'
export type BreakdownValueAndType = Omit<BreakdownColorConfig, 'colorToken'>
@@ -83,6 +83,52 @@ export function extractBreakdownValues(
})
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardInsightColorsModalLogicValues {
+ allCohorts: CountedPaginatedResponse<CohortType> // cohortsModel
+ breakdownValues: BreakdownValueAndType[]
+ dashboardId: number | null
+ insightTiles: DashboardTile<QueryBasedInsightModel>[] | null
+ insightTilesLoading: boolean | null
+ isOpen: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardInsightColorsModalLogicActions {
+ hideInsightColorsModal: () => {
+ value: true
+ }
+ showInsightColorsModal: (id: number) => {
+ id: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardInsightColorsModalLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ isOpen: (dashboardId: number | null) => boolean
+ insightTiles: (
+ arg:
+ | DashboardTile<QueryBasedInsightModel<import('../../queries/schema').Node<Record<string, any>>>>[]
+ | null
+ ) => DashboardTile<QueryBasedInsightModel>[] | null
+ insightTilesLoading: (arg: null | true) => boolean | null
+ breakdownValues: (
+ insightTiles:
+ | DashboardTile<QueryBasedInsightModel<import('../../queries/schema').Node<Record<string, any>>>>[]
+ | null,
+ allCohorts: CountedPaginatedResponse<CohortType>
+ ) => BreakdownValueAndType[]
+ }
+}
+
+export type dashboardInsightColorsModalLogicType = MakeLogicType<
+ dashboardInsightColorsModalLogicValues,
+ dashboardInsightColorsModalLogicActions,
+ Record<string, any>,
+ dashboardInsightColorsModalLogicMeta
+>
+
export const dashboardInsightColorsModalLogic = kea<dashboardInsightColorsModalLogicType>([
path(['scenes', 'dashboard', 'dashboardInsightColorsModalLogic']),
connect(() => ({
@@ -102,19 +148,26 @@ export const dashboardInsightColorsModalLogic = kea<dashboardInsightColorsModalL
],
}),
selectors({
- isOpen: [(s) => [s.dashboardId], (dashboardId) => dashboardId != null],
+ isOpen: [(s) => [s.dashboardId], (dashboardId: number | null) => dashboardId != null],
insightTiles: [
(s) => [(state) => dashboardLogic.findMounted({ id: s.dashboardId(state) })?.values.insightTiles || null],
- (insightTiles): DashboardTile<QueryBasedInsightModel>[] | null => insightTiles,
+ (
+ insightTiles:
+ | DashboardTile<QueryBasedInsightModel<import('../../queries/schema').Node<Record<string, any>>>>[]
+ | null
+ ): DashboardTile<QueryBasedInsightModel>[] | null => insightTiles,
],
insightTilesLoading: [
(s) => [(state) => dashboardLogic.findMounted({ id: s.dashboardId(state) })?.values.itemsLoading || null],
- (itemsLoading): boolean | null => itemsLoading,
+ (itemsLoading: null | true): boolean | null => itemsLoading,
{ resultEqualityCheck: () => false },
],
breakdownValues: [
(s) => [s.insightTiles, s.allCohorts],
- (insightTiles, allCohorts) => extractBreakdownValues(insightTiles, allCohorts?.results),
+ (
+ insightTiles: DashboardTile<QueryBasedInsightModel>[] | null,
+ allCohorts: import('../../lib/api').CountedPaginatedResponse<CohortType>
+ ) => extractBreakdownValues(insightTiles, allCohorts?.results),
],
}),
])
diff --git a/frontend/src/scenes/dashboard/dashboardLogic.tsx b/frontend/src/scenes/dashboard/dashboardLogic.tsx
index 262b9a40ff45..8645ae487c95 100644
--- a/frontend/src/scenes/dashboard/dashboardLogic.tsx
+++ b/frontend/src/scenes/dashboard/dashboardLogic.tsx
@@ -1,5 +1,6 @@
import { deepEqual as equal } from 'fast-equals'
import {
+ MakeLogicType,
BindLogic,
actions,
connect,
@@ -13,11 +14,13 @@ import {
selectors,
sharedListeners,
} from 'kea'
+import type { BreakPointFunction } from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, beforeUnload, router, urlToAction } from 'kea-router'
import { CombinedLocation } from 'kea-router/lib/utils'
import uniqBy from 'lodash.uniqby'
import { ResponsiveLayouts } from 'react-grid-layout'
+import type { Layout } from 'react-grid-layout'
import { LemonDialog, lemonToast } from '@posthog/lemon-ui'
import type { DashboardWidgetRunResultApi } from '@posthog/products-dashboards/frontend/generated/api.schemas'
@@ -106,12 +109,13 @@ import {
TileLayout,
} from '~/types'
+import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
+import type { Node } from '../../queries/schema/schema-general'
import { getResponseBytes, sortDayJsDates } from '../insights/utils'
import { filterVariablesReferencedInQuery } from '../insights/utils/queryUtils'
import { teamLogic } from '../teamLogic'
import { AUTO_REFRESH_INITIAL_INTERVAL_SECONDS } from './dashboardConstants'
import { BreakdownColorConfig } from './DashboardInsightColorsModal'
-import type { dashboardLogicType } from './dashboardLogicType'
import {
BREAKPOINT_COLUMN_COUNTS,
DASHBOARD_MIN_REFRESH_INTERVAL_MINUTES,
@@ -216,6 +220,873 @@ function mergeUpdatedWidgetTileIntoDashboard(
} as DashboardType<InsightModel>)
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardLogicValues {
+ getTheme: (themeId: number | string | null | undefined) => DataColorTheme | null // dataThemeLogic
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ currentTeamId: number | null // teamLogic
+ variables: Variable[] // variableDataLogic
+ accessDeniedToDashboard: boolean
+ addWidgetCollapsedGroups: string[]
+ addWidgetModalOpen: boolean
+ addWidgetSelectedTypes: string[]
+ addWidgetTileLoading: boolean
+ apiUrl: (
+ refresh?: RefreshType | undefined,
+ filtersOverride?: DashboardFilter | undefined,
+ variablesOverride?: Record<string, HogQLVariable> | undefined,
+ layoutSize?: 'sm' | 'xs' | undefined
+ ) => string
+ asDashboardTemplate: DashboardTemplateEditorType | undefined
+ autoRefresh: {
+ enabled: boolean
+ interval: number
+ }
+ blockRefresh: boolean
+ breadcrumbs: Breadcrumb[]
+ buttonTileId: number | 'new' | null
+ canAutoPreview: boolean
+ canEditDashboard: boolean
+ canRestrictDashboard: boolean
+ canSaveProjectDashboardTemplate: boolean
+ cancellingPreview: boolean
+ columns: number | null
+ containerWidth: number | null
+ currentLayoutSize: 'sm' | 'xs'
+ dashboard: DashboardType<QueryBasedInsightModel> | null
+ dashboardFailedToLoad: boolean
+ dashboardLayouts: Record<DashboardTile['id'], DashboardTile['layouts']>
+ dashboardLoadData: {
+ action: DashboardLoadAction | undefined
+ dashboardQueryId: string
+ responseBytes: number
+ startTime: number
+ }
+ dashboardLoading: boolean
+ dashboardMode: DashboardMode | null
+ dashboardStreaming: boolean
+ dashboardWidgetsEnabled: boolean
+ dataColorTheme: DataColorTheme | null
+ dataColorThemeId: number | null
+ effectiveDashboardVariableOverrides: {
+ [x: string]: HogQLVariable
+ }
+ effectiveEditBarFilters: DashboardFilter
+ effectiveLastRefresh: Dayjs | null
+ effectiveRefreshFilters: DashboardFilter
+ effectiveVariablesAndAssociatedInsights: {
+ insightNames: string[]
+ variable: Variable
+ }[]
+ error404: boolean
+ externalFilters: DashboardFilter
+ filtersOverrideForLoad: DashboardFilter
+ hasIntermittentFilters: boolean
+ hasUnsavedLayoutChanges: boolean
+ hasUrlFilters: boolean
+ hasVariables: boolean
+ highlightedInsightId: any
+ initialVariablesLoaded: boolean
+ inlineTileInsertionEnabled: boolean
+ insightTiles: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>[]
+ intermittentFilters: DashboardFilter
+ isPinned: boolean
+ isRefreshing: (id: string) => boolean
+ isRefreshingQueued: (id: string) => boolean
+ isSavingTags: boolean
+ itemsLoading: boolean
+ lastDashboardRefresh: Dayjs | null
+ layout: Layout | undefined
+ layoutEditMode: boolean
+ layoutForItem: Record<string, TileLayout>
+ layoutZoom: number
+ layouts: Partial<Record<DashboardLayoutSize, Layout>>
+ loadLayoutFromServerOnPreview: boolean
+ loadTimer: Date | null
+ loadingPreview: boolean
+ maxContext: MaxContextInput[]
+ nextAllowedDashboardRefresh: Dayjs | null
+ oldestRefreshed: Dayjs | null
+ pageVisibility: boolean
+ pendingInsertion: PendingInsertion | null
+ placement: DashboardPlacement
+ projectTreeRef: ProjectTreeRef
+ refreshMetrics: {
+ completed: number
+ total: number
+ }
+ refreshStatus: Record<string, RefreshStatus>
+ refreshTilesTotal: number | null
+ scrollToBottomSignal: number
+ shouldReportOnAPILoad: boolean
+ shouldUseStreaming: boolean
+ showApplyFiltersBanner: boolean
+ showButtonTileModal: boolean
+ showSubscriptions: boolean
+ showTextTileModal: boolean
+ sidePanelContext: SidePanelSceneContext | null
+ sizeKey: DashboardLayoutSize | undefined
+ sortedDates: Dayjs[]
+ subscriptionId: number | 'new' | null
+ temporaryBreakdownColors: BreakdownColorConfig[]
+ terraformModalOpen: boolean
+ textTileId: number | 'new' | null
+ textTiles: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>[]
+ tiles: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>[]
+ urlFilters: DashboardFilter
+ urlSearchParamsAtEditModeEntry: {
+ filters?: unknown
+ variables?: unknown
+ } | null
+ urlVariables: Record<string, HogQLVariable>
+ widgetRefreshStatus: Record<
+ number,
+ {
+ error?: string | null
+ fetchedAt?: number
+ loading?: boolean
+ }
+ >
+ widgetResultsByTileId: Record<number, DashboardWidgetRunResultApi>
+ widgetTileUpdate: null
+ widgetTileUpdateLoading: boolean
+ widgetTiles: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardLogicActions {
+ abortAnyRunningQuery: () => {
+ value: true
+ }
+ abortQuery: (payload: { queryId: string; queryStartTime: number; shortId: InsightShortId }) => {
+ queryId: string
+ queryStartTime: number
+ shortId: InsightShortId
+ }
+ addWidgetTileFinished: () => {
+ value: true
+ }
+ addWidgetTiles: (payload: {
+ dashboardId: number
+ widgets: {
+ config: Record<string, unknown>
+ widgetType: string
+ }[]
+ }) => {
+ dashboardId: number
+ widgets: {
+ config: Record<string, unknown>
+ widgetType: string
+ }[]
+ }
+ applyFilters: () => {
+ value: true
+ }
+ applyPendingInsertion: () => {
+ value: true
+ }
+ applyWidgetIssueMetadataChange: (payload: {
+ context: WidgetIssueMetadataContext
+ delta: WidgetIssueMetadataDelta
+ issueId: string
+ tileId: number
+ }) => {
+ context: WidgetIssueMetadataContext
+ delta: WidgetIssueMetadataDelta
+ issueId: string
+ tileId: number
+ }
+ cancelDashboardRefresh: () => {
+ value: true
+ }
+ cancelEditMode: () => {
+ value: true
+ }
+ clearAddWidgetSelectedTypes: () => {
+ value: true
+ }
+ copyToDashboard: (
+ tile: DashboardTile<QueryBasedInsightModel>,
+ fromDashboard: number,
+ toDashboard: number,
+ toDashboardName: string
+ ) => {
+ fromDashboard: number
+ tile: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>
+ toDashboard: number
+ toDashboardName: string
+ }
+ copyToDashboardFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ copyToDashboardSuccess: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null,
+ payload?: {
+ fromDashboard: number
+ tile: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>
+ toDashboard: number
+ toDashboardName: string
+ }
+ ) => {
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null
+ payload?: {
+ fromDashboard: number
+ tile: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>
+ toDashboard: number
+ toDashboardName: string
+ }
+ }
+ dashboardNotFound: () => {
+ value: true
+ }
+ duplicateTile: (tile: DashboardTile<QueryBasedInsightModel>) => {
+ tile: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>
+ }
+ duplicateTileFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ duplicateTileSuccess: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null,
+ payload?: {
+ tile: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>
+ }
+ ) => {
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null
+ payload?: {
+ tile: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>
+ }
+ }
+ forceRefreshIfStale: () => {
+ value: true
+ }
+ loadDashboard: (payload: { action: DashboardLoadAction }) => {
+ action: DashboardLoadAction
+ }
+ loadDashboardFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadDashboardMetadataSuccess: (dashboard: DashboardType<QueryBasedInsightModel> | null) => {
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null
+ }
+ loadDashboardStreaming: (payload: { action: DashboardLoadAction; manualDashboardRefresh?: boolean }) => {
+ action: DashboardLoadAction
+ manualDashboardRefresh?: boolean | undefined
+ }
+ loadDashboardStreamingFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadDashboardStreamingSuccess: (
+ dashboard: null,
+ payload?: {
+ action: DashboardLoadAction
+ manualDashboardRefresh?: boolean | undefined
+ }
+ ) => {
+ dashboard: null
+ payload?: {
+ action: DashboardLoadAction
+ manualDashboardRefresh?: boolean | undefined
+ }
+ }
+ loadDashboardSuccess: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null,
+ payload?: {
+ action: DashboardLoadAction
+ }
+ ) => {
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null
+ payload?: {
+ action: DashboardLoadAction
+ }
+ }
+ loadingDashboardItemsStarted: (action: DashboardLoadAction) => {
+ action: DashboardLoadAction
+ }
+ moveToDashboard: (
+ tile: DashboardTile<QueryBasedInsightModel>,
+ fromDashboard: number,
+ toDashboard: number,
+ toDashboardName: string,
+ allowUndo?: boolean
+ ) => {
+ allowUndo: boolean
+ fromDashboard: number
+ tile: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>
+ toDashboard: number
+ toDashboardName: string
+ }
+ moveToDashboardFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ moveToDashboardSuccess: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null,
+ payload?: {
+ allowUndo: boolean
+ fromDashboard: number
+ tile: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>
+ toDashboard: number
+ toDashboardName: string
+ }
+ ) => {
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null
+ payload?: {
+ allowUndo: boolean
+ fromDashboard: number
+ tile: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>
+ toDashboard: number
+ toDashboardName: string
+ }
+ }
+ overrideVariableValue: (
+ variableId: string,
+ value: any,
+ isNull: boolean
+ ) => {
+ isNull: boolean
+ value: any
+ variableId: string
+ }
+ receiveTileFromStream: (data: { order: number; tile: any }) => {
+ order: number
+ tile: any
+ }
+ refreshDashboardItem: (payload: { tile: DashboardTile<QueryBasedInsightModel> }) => {
+ tile: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>
+ }
+ refreshDashboardItems: (payload: {
+ action: DashboardLoadAction | RefreshDashboardItemsAction
+ forceRefresh?: boolean
+ }) => {
+ action: DashboardLoadAction | RefreshDashboardItemsAction
+ forceRefresh?: boolean | undefined
+ }
+ refreshDashboardWidgets: (payload: { forceRefresh?: boolean; tileIds: number[] }) => {
+ forceRefresh?: boolean | undefined
+ tileIds: number[]
+ }
+ removeTile: (tile: DashboardTile<QueryBasedInsightModel>) => {
+ tile: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>
+ }
+ removeTileFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ removeTileSuccess: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null,
+ payload?: {
+ tile: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>
+ }
+ ) => {
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null
+ payload?: {
+ tile: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>
+ }
+ }
+ reportDashboardViewed: () => {
+ value: true
+ }
+ reportInsightsViewed: (insights: QueryBasedInsightModel[]) => {
+ insights: QueryBasedInsightModel<Node<Record<string, any>>>[]
+ }
+ requestScrollToBottom: () => {
+ value: true
+ }
+ resetIntermittentFilters: () => boolean
+ resetInterval: () => {
+ value: true
+ }
+ resetUrlFilters: () => boolean
+ resetUrlVariables: () => {
+ value: true
+ }
+ restoreUrlStateAtEditModeEntry: (
+ snapshot: {
+ filters?: unknown
+ variables?: unknown
+ } | null
+ ) => {
+ snapshot: {
+ filters?: unknown
+ variables?: unknown
+ } | null
+ }
+ saveEditModeChanges: () => boolean
+ saveEditModeChangesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ saveEditModeChangesSuccess: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null,
+ payload?: boolean
+ ) => {
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null
+ payload?: boolean
+ }
+ scheduleRefreshDashboardWidgets: (tileId: number) => {
+ tileId: number
+ }
+ setAccessDeniedToDashboard: () => {
+ value: true
+ }
+ setAddWidgetModalOpen: (open: boolean) => {
+ open: boolean
+ }
+ setAutoRefresh: (
+ enabled: boolean,
+ interval: number
+ ) => {
+ enabled: boolean
+ interval: number
+ }
+ setBreakdownColorConfig: (config: BreakdownColorConfig) => {
+ config: BreakdownColorConfig
+ }
+ setBreakdownFilter: (breakdown_filter: BreakdownFilter | null) => {
+ breakdown_filter: BreakdownFilter | null
+ }
+ setButtonTileId: (buttonTileId: number | 'new' | null) => {
+ buttonTileId: number | 'new' | null
+ }
+ setDashboardMode: (
+ mode: DashboardMode | null,
+ source: DashboardEventSource
+ ) => {
+ mode: DashboardMode | null
+ source: DashboardEventSource
+ }
+ setDashboardModeFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ setDashboardModeSuccess: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null,
+ payload?: {
+ mode: DashboardMode | null
+ source: DashboardEventSource
+ }
+ ) => {
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null
+ payload?: {
+ mode: DashboardMode | null
+ source: DashboardEventSource
+ }
+ }
+ setDataColorThemeId: (dataColorThemeId: number | null) => {
+ dataColorThemeId: number | null
+ }
+ setDates: (
+ date_from: string | null,
+ date_to: string | null | undefined,
+ explicitDate?: boolean
+ ) => {
+ date_from: string | null
+ date_to: string | null | undefined
+ explicitDate: boolean | undefined
+ }
+ setExternalFilters: (filters: DashboardFilter) => {
+ filters: DashboardFilter
+ }
+ setInitialLoadResponseBytes: (responseBytes: number) => {
+ responseBytes: number
+ }
+ setInitialVariablesLoaded: (initialVariablesLoaded: boolean) => {
+ initialVariablesLoaded: boolean
+ }
+ setInterval: (interval: IntervalType | null) => {
+ interval: IntervalType | null
+ }
+ setLayoutZoom: (layoutZoom: number) => {
+ layoutZoom: number
+ }
+ setLoadLayoutFromServerOnPreview: (loadLayoutFromServerOnPreview: boolean) => {
+ loadLayoutFromServerOnPreview: boolean
+ }
+ setPageVisibility: (visible: boolean) => {
+ visible: boolean
+ }
+ setPendingInsertion: (pendingInsertion: PendingInsertion | null) => {
+ pendingInsertion: PendingInsertion | null
+ }
+ setProperties: (properties: AnyPropertyFilter[] | null) => {
+ properties: AnyPropertyFilter[] | null
+ }
+ setRefreshError: (
+ shortId: InsightShortId,
+ error?: Error
+ ) => {
+ error: Error | undefined
+ shortId: InsightShortId
+ }
+ setRefreshStatus: (
+ shortId: InsightShortId,
+ loading?: any,
+ queued?: any
+ ) => {
+ loading: any
+ queued: any
+ shortId: InsightShortId
+ }
+ setRefreshStatuses: (
+ shortIds: InsightShortId[],
+ loading?: any,
+ queued?: any
+ ) => {
+ loading: any
+ queued: any
+ shortIds: InsightShortId[]
+ }
+ setRefreshTilesTotal: (total: number) => {
+ total: number
+ }
+ setShouldReportOnAPILoad: (shouldReport: boolean) => {
+ shouldReport: boolean
+ }
+ setSubscriptionMode: (
+ enabled: boolean,
+ id?: number | 'new'
+ ) => {
+ enabled: boolean
+ id: number | 'new' | undefined
+ }
+ setTerraformModalOpen: (open: boolean) => {
+ open: boolean
+ }
+ setTextTileId: (textTileId: number | 'new' | null) => {
+ textTileId: number | 'new' | null
+ }
+ setTileOverride: (tile: DashboardTile<QueryBasedInsightModel>) => {
+ tile: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>
+ }
+ setTileProperty: (
+ tileId: number,
+ properties: Partial<Pick<DashboardTile, 'color' | 'show_description'>>
+ ) => {
+ properties: Partial<Pick<DashboardTile<InsightModel>, 'color' | 'show_description'>>
+ tileId: number
+ }
+ setUrlSearchParamsAtEditModeEntry: (snapshot: { filters?: unknown; variables?: unknown }) => {
+ snapshot: {
+ filters?: unknown
+ variables?: unknown
+ }
+ }
+ setWidgetRefreshStatuses: (
+ tileIds: number[],
+ loading: boolean,
+ error?: string | null
+ ) => {
+ error: string | null | undefined
+ loading: boolean
+ tileIds: number[]
+ }
+ setWidgetRunResults: (results: Record<number, DashboardWidgetRunResultApi>) => {
+ results: Record<number, DashboardWidgetRunResultApi>
+ }
+ tileStreamingComplete: () => {
+ value: true
+ }
+ tileStreamingFailure: (error: any) => {
+ error: any
+ }
+ toggleAddWidgetCollapsedGroup: (groupId: string) => {
+ groupId: string
+ }
+ toggleAddWidgetSelectedType: (widgetType: string) => {
+ widgetType: string
+ }
+ togglePinned: () => {
+ value: true
+ }
+ toggleTileDescription: (tileId: number) => {
+ tileId: number
+ }
+ triggerDashboardRefresh: () => {
+ value: true
+ }
+ triggerDashboardUpdate: (payload: any) => {
+ payload: any
+ }
+ updateContainerWidth: (
+ containerWidth: number,
+ columns: number
+ ) => {
+ columns: number
+ containerWidth: number
+ }
+ updateDashboardLastRefresh: (lastDashboardRefresh: Dayjs) => {
+ lastDashboardRefresh: Dayjs
+ }
+ updateDashboardTags: (tags: string[]) => {
+ tags: string[]
+ }
+ updateLayouts: (layouts: ResponsiveLayouts) => {
+ layouts: Partial<Record<string, Layout>>
+ }
+ updateTileColor: (
+ tileId: number,
+ color: InsightColor | null
+ ) => {
+ color: InsightColor | null
+ tileId: number
+ }
+ updateWidgetTile: ({
+ tile,
+ config,
+ name,
+ description,
+ }: {
+ config?: Record<string, unknown>
+ description?: string
+ name?: string | null
+ tile: DashboardTile<QueryBasedInsightModel>
+ }) => {
+ tile: DashboardTile<QueryBasedInsightModel>
+ config?: Record<string, unknown>
+ name?: string | null
+ description?: string
+ }
+ updateWidgetTileFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateWidgetTileSuccess: (
+ widgetTileUpdate: null,
+ payload?: {
+ tile: DashboardTile<QueryBasedInsightModel>
+ config?: Record<string, unknown>
+ name?: string | null
+ description?: string
+ }
+ ) => {
+ widgetTileUpdate: null
+ payload?: {
+ tile: DashboardTile<QueryBasedInsightModel>
+ config?: Record<string, unknown>
+ name?: string | null
+ description?: string
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardLogicMeta {
+ key: number
+ sharedListeners: {
+ reportRefreshTiming: (
+ payload: any,
+ breakpoint: BreakPointFunction,
+ action: {
+ type: string
+ payload: any
+ },
+ previousState: any
+ ) => void | Promise<void>
+ reportLoadTiming: (
+ payload: any,
+ breakpoint: BreakPointFunction,
+ action: {
+ type: string
+ payload: any
+ },
+ previousState: any
+ ) => void | Promise<void>
+ handleDashboardLoadComplete: (
+ payload: any,
+ breakpoint: BreakPointFunction,
+ action: {
+ type: string
+ payload: any
+ },
+ previousState: any
+ ) => void | Promise<void>
+ }
+ __keaTypeGenInternalSelectorTypes: {
+ shouldUseStreaming: (featureFlags: FeatureFlagsSet) => boolean
+ canAutoPreview: (insightTiles: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>[]) => boolean
+ hasIntermittentFilters: (intermittentFilters: DashboardFilter) => boolean
+ hasUrlFilters: (urlFilters: DashboardFilter) => boolean
+ showApplyFiltersBanner: (canAutoPreview: boolean, hasIntermittentFilters: boolean) => boolean
+ urlFilters: (searchParams: Record<string, any>) => DashboardFilter
+ filtersOverrideForLoad: (externalFilters: DashboardFilter, urlFilters: DashboardFilter) => DashboardFilter
+ effectiveEditBarFilters: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null,
+ externalFilters: DashboardFilter,
+ urlFilters: DashboardFilter,
+ intermittentFilters: DashboardFilter
+ ) => DashboardFilter
+ effectiveRefreshFilters: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null,
+ externalFilters: DashboardFilter,
+ urlFilters: DashboardFilter
+ ) => DashboardFilter
+ effectiveDashboardVariableOverrides: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null,
+ urlVariables: Record<string, HogQLVariable>
+ ) => {
+ [x: string]: HogQLVariable
+ }
+ hasUnsavedLayoutChanges: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null,
+ dashboardLayouts: Record<
+ number,
+ Record<string, never> | Record<DashboardLayoutSize, TileLayout> | undefined
+ >
+ ) => boolean
+ effectiveVariablesAndAssociatedInsights: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null,
+ variables: Variable[],
+ urlVariables: Record<string, HogQLVariable>
+ ) => {
+ insightNames: string[]
+ variable: Variable
+ }[]
+ urlVariables: (
+ searchParams: Record<string, any>,
+ variables: Variable[],
+ initialVariablesLoaded: boolean
+ ) => Record<string, HogQLVariable>
+ hasVariables: (
+ effectiveVariablesAndAssociatedInsights: {
+ insightNames: string[]
+ variable: Variable
+ }[]
+ ) => boolean
+ asDashboardTemplate: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null
+ ) => DashboardTemplateEditorType | undefined
+ placement: (arg: any) => DashboardPlacement
+ apiUrl: (
+ id: number
+ ) => (
+ refresh?: RefreshType | undefined,
+ filtersOverride?: DashboardFilter | undefined,
+ variablesOverride?: Record<string, HogQLVariable> | undefined,
+ layoutSize?: 'sm' | 'xs' | undefined
+ ) => string
+ currentLayoutSize: (containerWidth: number | null) => 'sm' | 'xs'
+ tiles: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null
+ ) => DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>[]
+ widgetTiles: (
+ tiles: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>[]
+ ) => DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>[]
+ dashboardWidgetsEnabled: (
+ featureFlags: FeatureFlagsSet,
+ tiles: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>[],
+ placement: DashboardPlacement
+ ) => boolean
+ inlineTileInsertionEnabled: (featureFlags: FeatureFlagsSet) => boolean
+ insightTiles: (
+ tiles: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>[]
+ ) => DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>[]
+ textTiles: (
+ tiles: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>[]
+ ) => DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>[]
+ itemsLoading: (
+ dashboardLoading: boolean,
+ dashboardStreaming: boolean,
+ refreshStatus: Record<string, RefreshStatus>,
+ initialVariablesLoaded: boolean
+ ) => boolean
+ isRefreshingQueued: (refreshStatus: Record<string, RefreshStatus>) => (id: string) => boolean
+ isRefreshing: (refreshStatus: Record<string, RefreshStatus>) => (id: string) => boolean
+ highlightedInsightId: (searchParams: Record<string, any>) => any
+ sortedDates: (insightTiles: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>[]) => Dayjs[]
+ oldestRefreshed: (sortedDates: Dayjs[], pageVisibility: boolean) => Dayjs | null
+ effectiveLastRefresh: (lastDashboardRefresh: Dayjs | null, oldestRefreshed: Dayjs | null) => Dayjs | null
+ nextAllowedDashboardRefresh: (lastDashboardRefresh: Dayjs | null) => Dayjs | null
+ blockRefresh: (
+ nextAllowedDashboardRefresh: Dayjs | null,
+ placement: DashboardPlacement,
+ pageVisibility: boolean
+ ) => boolean
+ canEditDashboard: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null
+ ) => boolean
+ canSaveProjectDashboardTemplate: (
+ canEditDashboard: boolean,
+ asDashboardTemplate: DashboardTemplateEditorType | undefined
+ ) => boolean
+ canRestrictDashboard: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null,
+ user: null | import('~/types').UserType,
+ currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType
+ ) => boolean
+ sizeKey: (columns: number | null) => DashboardLayoutSize | undefined
+ layouts: (
+ tiles: DashboardTile<QueryBasedInsightModel<Node<Record<string, any>>>>[]
+ ) => Partial<Record<DashboardLayoutSize, Layout>>
+ layout: (
+ layouts: Partial<Record<DashboardLayoutSize, Layout>>,
+ sizeKey: DashboardLayoutSize | undefined
+ ) => Layout | undefined
+ layoutForItem: (layout: Layout | undefined) => Record<string, TileLayout>
+ refreshMetrics: (
+ refreshStatus: Record<string, RefreshStatus>,
+ refreshTilesTotal: number | null
+ ) => {
+ completed: number
+ total: number
+ }
+ breadcrumbs: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null,
+ error404: boolean,
+ dashboardFailedToLoad: boolean,
+ searchParams: Record<string, any>
+ ) => Breadcrumb[]
+ projectTreeRef: (arg: number) => ProjectTreeRef
+ sidePanelContext: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null
+ ) => SidePanelSceneContext | null
+ dataColorTheme: (
+ dataColorThemeId: number | null,
+ getTheme: (themeId: number | string | null | undefined) => DataColorTheme | null // dataThemeLogic
+ ) => DataColorTheme | null
+ maxContext: (
+ dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>> | null
+ ) => MaxContextInput[]
+ }
+}
+
+export type dashboardLogicType = MakeLogicType<
+ dashboardLogicValues,
+ dashboardLogicActions,
+ DashboardLogicProps,
+ dashboardLogicMeta
+>
+
export const dashboardLogic = kea<dashboardLogicType>([
path(['scenes', 'dashboard', 'dashboardLogic']),
connect(() => ({
@@ -1424,7 +2295,7 @@ export const dashboardLogic = kea<dashboardLogicType>([
selectors(() => ({
shouldUseStreaming: [
(s) => [s.featureFlags],
- (featureFlags): boolean => {
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet): boolean => {
const hasFeatureFlag = !!featureFlags[FEATURE_FLAGS.SSE_DASHBOARDS]
const hasSSESupport = typeof EventSource !== 'undefined'
return hasFeatureFlag && hasSSESupport
@@ -1432,7 +2303,11 @@ export const dashboardLogic = kea<dashboardLogicType>([
],
canAutoPreview: [
(s) => [s.insightTiles],
- (insightTiles) => {
+ (
+ insightTiles: DashboardTile<
+ QueryBasedInsightModel<import('~/queries/schema/schema-general').Node<Record<string, any>>>
+ >[]
+ ) => {
const payload = getFeatureFlagPayload(FEATURE_FLAGS.DASHBOARD_AUTO_PREVIEW_LIMIT)
const limit = typeof payload === 'number' ? payload : DEFAULT_AUTO_PREVIEW_TILE_LIMIT
// The limit is about the number of insights on a dashboard (per the flag's intent),
@@ -1442,24 +2317,34 @@ export const dashboardLogic = kea<dashboardLogicType>([
],
hasIntermittentFilters: [
(s) => [s.intermittentFilters],
- (intermittentFilters) => Object.values(intermittentFilters).some((filter) => filter !== undefined),
+ (intermittentFilters: DashboardFilter) =>
+ Object.values(intermittentFilters).some((filter) => filter !== undefined),
],
hasUrlFilters: [
(s) => [s.urlFilters],
- (urlFilters) => Object.values(urlFilters).some((filter) => filter !== undefined),
+ (urlFilters: DashboardFilter) => Object.values(urlFilters).some((filter) => filter !== undefined),
],
showApplyFiltersBanner: [
(s) => [s.canAutoPreview, s.hasIntermittentFilters],
- (canAutoPreview, hasIntermittentFilters) => !canAutoPreview && hasIntermittentFilters,
+ (canAutoPreview: boolean, hasIntermittentFilters: boolean) => !canAutoPreview && hasIntermittentFilters,
+ ],
+ urlFilters: [
+ () => [router.selectors.searchParams],
+ (searchParams: Record<string, any>) => parseURLFilters(searchParams),
],
- urlFilters: [() => [router.selectors.searchParams], (searchParams) => parseURLFilters(searchParams)],
filtersOverrideForLoad: [
(s) => [s.externalFilters, s.urlFilters],
- (externalFilters, urlFilters) => combineDashboardFilters(externalFilters, urlFilters),
+ (externalFilters: DashboardFilter, urlFilters: DashboardFilter) =>
+ combineDashboardFilters(externalFilters, urlFilters),
],
effectiveEditBarFilters: [
(s) => [s.dashboard, s.externalFilters, s.urlFilters, s.intermittentFilters],
- (dashboard, externalFilters, urlFilters, intermittentFilters) => {
+ (
+ dashboard: DashboardType<QueryBasedInsightModel> | null,
+ externalFilters: DashboardFilter,
+ urlFilters: DashboardFilter,
+ intermittentFilters: DashboardFilter
+ ) => {
const effectiveEditBarFilters = combineDashboardFilters(
dashboard?.persisted_filters || {},
externalFilters,
@@ -1481,7 +2366,10 @@ export const dashboardLogic = kea<dashboardLogicType>([
],
effectiveDashboardVariableOverrides: [
(s) => [s.dashboard, s.urlVariables],
- (dashboard, urlVariables) => ({ ...dashboard?.persisted_variables, ...urlVariables }),
+ (dashboard: DashboardType<QueryBasedInsightModel> | null, urlVariables: Record<string, HogQLVariable>) => ({
+ ...dashboard?.persisted_variables,
+ ...urlVariables,
+ }),
],
hasUnsavedLayoutChanges: [
(s) => [s.dashboard, s.dashboardLayouts],
@@ -1566,7 +2454,11 @@ export const dashboardLogic = kea<dashboardLogicType>([
],
urlVariables: [
(s) => [router.selectors.searchParams, s.variables, s.initialVariablesLoaded],
- (searchParams, variables, initialVariablesLoaded): Record<string, HogQLVariable> => {
+ (
+ searchParams: Record<string, any>,
+ variables: Variable[],
+ initialVariablesLoaded: boolean
+ ): Record<string, HogQLVariable> => {
if (!initialVariablesLoaded) {
// if initial variables are not loaded yet, we can't map the variables in the url
return {}
@@ -1593,8 +2485,12 @@ export const dashboardLogic = kea<dashboardLogicType>([
],
hasVariables: [
(s) => [s.effectiveVariablesAndAssociatedInsights],
- (effectiveVariablesAndAssociatedInsights) =>
- Object.keys(effectiveVariablesAndAssociatedInsights).length > 0,
+ (
+ effectiveVariablesAndAssociatedInsights: {
+ insightNames: string[]
+ variable: Variable
+ }[]
+ ) => Object.keys(effectiveVariablesAndAssociatedInsights).length > 0,
],
asDashboardTemplate: [
(s) => [s.dashboard],
@@ -1607,7 +2503,7 @@ export const dashboardLogic = kea<dashboardLogicType>([
],
apiUrl: [
(_, p) => [p.id],
- (id) => {
+ (id: number) => {
return (
refresh?: RefreshType,
filtersOverride?: DashboardFilter,
@@ -1624,7 +2520,7 @@ export const dashboardLogic = kea<dashboardLogicType>([
],
currentLayoutSize: [
(s) => [s.containerWidth],
- (containerWidth): 'sm' | 'xs' => {
+ (containerWidth: number | null): 'sm' | 'xs' => {
// Use precise container width when available, otherwise estimate from window width
if (containerWidth !== null) {
return containerWidth > BREAKPOINTS.sm ? 'sm' : 'xs'
@@ -1635,11 +2531,28 @@ export const dashboardLogic = kea<dashboardLogicType>([
return estimatedContainerWidth > BREAKPOINTS.sm ? 'sm' : 'xs'
},
],
- tiles: [(s) => [s.dashboard], (dashboard) => dashboard?.tiles?.filter((t) => !t.deleted) || []],
- widgetTiles: [(s) => [s.tiles], (tiles) => tiles.filter((t) => !!t.widget)],
+ tiles: [
+ (s) => [s.dashboard],
+ (dashboard: DashboardType<QueryBasedInsightModel> | null) =>
+ dashboard?.tiles?.filter((t) => !t.deleted) || [],
+ ],
+ widgetTiles: [
+ (s) => [s.tiles],
+ (
+ tiles: DashboardTile<
+ QueryBasedInsightModel<import('~/queries/schema/schema-general').Node<Record<string, any>>>
+ >[]
+ ) => tiles.filter((t) => !!t.widget),
+ ],
dashboardWidgetsEnabled: [
(s) => [s.featureFlags, s.tiles, s.placement],
- (featureFlags, tiles, placement): boolean => {
+ (
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet,
+ tiles: DashboardTile<
+ QueryBasedInsightModel<import('~/queries/schema/schema-general').Node<Record<string, any>>>
+ >[],
+ placement: DashboardPlacement
+ ): boolean => {
// Shared dashboards don't receive team feature flags; render widget tiles when
// metadata is already present on the exported dashboard payload.
if (placement === DashboardPlacement.Public && tiles.some((tile) => !!tile.widget)) {
@@ -1650,16 +2563,33 @@ export const dashboardLogic = kea<dashboardLogicType>([
],
inlineTileInsertionEnabled: [
(s) => [s.featureFlags],
- (featureFlags): boolean => !!featureFlags[FEATURE_FLAGS.DASHBOARD_INLINE_TILE_INSERTION],
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet): boolean =>
+ !!featureFlags[FEATURE_FLAGS.DASHBOARD_INLINE_TILE_INSERTION],
],
insightTiles: [
(s) => [s.tiles],
- (tiles) => tiles.filter((t) => !!t.insight).filter((i) => !i.insight?.deleted),
+ (
+ tiles: DashboardTile<
+ QueryBasedInsightModel<import('~/queries/schema/schema-general').Node<Record<string, any>>>
+ >[]
+ ) => tiles.filter((t) => !!t.insight).filter((i) => !i.insight?.deleted),
+ ],
+ textTiles: [
+ (s) => [s.tiles],
+ (
+ tiles: DashboardTile<
+ QueryBasedInsightModel<import('~/queries/schema/schema-general').Node<Record<string, any>>>
+ >[]
+ ) => tiles.filter((t) => !!t.text),
],
- textTiles: [(s) => [s.tiles], (tiles) => tiles.filter((t) => !!t.text)],
itemsLoading: [
(s) => [s.dashboardLoading, s.dashboardStreaming, s.refreshStatus, s.initialVariablesLoaded],
- (dashboardLoading, dashboardStreaming, refreshStatus, initialVariablesLoaded) => {
+ (
+ dashboardLoading: boolean,
+ dashboardStreaming: boolean,
+ refreshStatus: Record<string, RefreshStatus>,
+ initialVariablesLoaded: boolean
+ ) => {
return (
dashboardLoading ||
dashboardStreaming ||
@@ -1668,15 +2598,25 @@ export const dashboardLogic = kea<dashboardLogicType>([
)
},
],
- isRefreshingQueued: [(s) => [s.refreshStatus], (refreshStatus) => (id: string) => !!refreshStatus[id]?.queued],
- isRefreshing: [(s) => [s.refreshStatus], (refreshStatus) => (id: string) => !!refreshStatus[id]?.loading],
+ isRefreshingQueued: [
+ (s) => [s.refreshStatus],
+ (refreshStatus: Record<string, RefreshStatus>) => (id: string) => !!refreshStatus[id]?.queued,
+ ],
+ isRefreshing: [
+ (s) => [s.refreshStatus],
+ (refreshStatus: Record<string, RefreshStatus>) => (id: string) => !!refreshStatus[id]?.loading,
+ ],
highlightedInsightId: [
() => [router.selectors.searchParams],
- (searchParams) => searchParams.highlightInsightId,
+ (searchParams: Record<string, any>) => searchParams.highlightInsightId,
],
sortedDates: [
(s) => [s.insightTiles],
- (insightTiles): Dayjs[] => {
+ (
+ insightTiles: DashboardTile<
+ QueryBasedInsightModel<import('~/queries/schema/schema-general').Node<Record<string, any>>>
+ >[]
+ ): Dayjs[] => {
if (!insightTiles || !insightTiles.length) {
return []
}
@@ -1690,7 +2630,7 @@ export const dashboardLogic = kea<dashboardLogicType>([
oldestRefreshed: [
// selecting page visibility to update the refresh when a page comes back into view
(s) => [s.sortedDates, s.pageVisibility],
- (sortedDates): Dayjs | null => {
+ (sortedDates: Dayjs[]): Dayjs | null => {
if (!sortedDates.length) {
return null
}
@@ -1700,7 +2640,7 @@ export const dashboardLogic = kea<dashboardLogicType>([
],
effectiveLastRefresh: [
(s) => [s.lastDashboardRefresh, s.oldestRefreshed],
- (lastDashboardRefresh, oldestRefreshed): Dayjs | null => {
+ (lastDashboardRefresh: Dayjs | null, oldestRefreshed: Dayjs | null): Dayjs | null => {
// Pessimistic: the banner must not claim the dashboard is fresher than the stalest insight
// tile (per-tile menus use insight.last_refresh). `last_dashboard.last_refresh` and client
// `updateDashboardLastRefresh(dayjs())` can otherwise run ahead of embedded tile metadata.
@@ -1710,7 +2650,7 @@ export const dashboardLogic = kea<dashboardLogicType>([
nextAllowedDashboardRefresh: [
(s) => [s.lastDashboardRefresh],
- (lastDashboardRefresh): Dayjs | null => {
+ (lastDashboardRefresh: Dayjs | null): Dayjs | null => {
if (!lastDashboardRefresh) {
return null
}
@@ -1732,7 +2672,7 @@ export const dashboardLogic = kea<dashboardLogicType>([
],
canEditDashboard: [
(s) => [s.dashboard],
- (dashboard) => {
+ (dashboard: DashboardType<QueryBasedInsightModel> | null) => {
return dashboard?.user_access_level
? accessLevelSatisfied(
AccessControlResourceType.Dashboard,
@@ -1745,13 +2685,17 @@ export const dashboardLogic = kea<dashboardLogicType>([
/** Save-as-project-template from dashboard scene: editor on dashboard and payload has tiles. Staff use the same modal, with an optional JSON editor entry inside. */
canSaveProjectDashboardTemplate: [
(s) => [s.canEditDashboard, s.asDashboardTemplate],
- (canEditDashboard, asDashboardTemplate): boolean =>
+ (canEditDashboard: boolean, asDashboardTemplate: DashboardTemplateEditorType | undefined): boolean =>
canEditDashboard && !!(asDashboardTemplate?.tiles?.length ?? 0),
],
canRestrictDashboard: [
// Sync conditions with backend can_user_restrict
(s) => [s.dashboard, userLogic.selectors.user, teamLogic.selectors.currentTeam],
- (dashboard, user, currentTeam): boolean =>
+ (
+ dashboard: DashboardType<QueryBasedInsightModel> | null,
+ user: null | import('~/types').UserType,
+ currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType
+ ): boolean =>
!!dashboard &&
!!user &&
(user.uuid === dashboard.created_by?.uuid ||
@@ -1760,7 +2704,7 @@ export const dashboardLogic = kea<dashboardLogicType>([
],
sizeKey: [
(s) => [s.columns],
- (columns): DashboardLayoutSize | undefined => {
+ (columns: number | null): DashboardLayoutSize | undefined => {
const [size] = (Object.entries(BREAKPOINT_COLUMN_COUNTS).find(([, value]) => value === columns) ||
[]) as [DashboardLayoutSize, number]
return size
@@ -1768,7 +2712,11 @@ export const dashboardLogic = kea<dashboardLogicType>([
],
layouts: [
(s) => [s.tiles],
- (tiles) => calculateLayouts(tiles),
+ (
+ tiles: DashboardTile<
+ QueryBasedInsightModel<import('~/queries/schema/schema-general').Node<Record<string, any>>>
+ >[]
+ ) => calculateLayouts(tiles),
// Tile refreshes replace `tiles` once per insight response without touching geometry;
// keeping the result reference stable stops react-grid-layout re-laying-out every tile
// N times per dashboard refresh cycle.
@@ -1795,7 +2743,7 @@ export const dashboardLogic = kea<dashboardLogicType>([
],
refreshMetrics: [
(s) => [s.refreshStatus, s.refreshTilesTotal],
- (refreshStatus, refreshTilesTotal) => {
+ (refreshStatus: Record<string, RefreshStatus>, refreshTilesTotal: number | null) => {
const inFlight = Object.values(refreshStatus).filter((s) => s.loading || s.queued).length
// Pinned batch size keeps Y fixed for the cycle; fall back to the live map for single-insight refreshes.
const total = refreshTilesTotal ?? Object.keys(refreshStatus).length
@@ -1845,13 +2793,13 @@ export const dashboardLogic = kea<dashboardLogicType>([
],
projectTreeRef: [
() => [(_, props: DashboardLogicProps) => props.id],
- (id): ProjectTreeRef => {
+ (id: number): ProjectTreeRef => {
return { type: 'dashboard', ref: String(id) }
},
],
[SIDE_PANEL_CONTEXT_KEY]: [
(s) => [s.dashboard],
- (dashboard): SidePanelSceneContext | null => {
+ (dashboard: DashboardType<QueryBasedInsightModel> | null): SidePanelSceneContext | null => {
return dashboard
? {
activity_scope: ActivityScope.DASHBOARD,
@@ -1864,11 +2812,14 @@ export const dashboardLogic = kea<dashboardLogicType>([
],
dataColorTheme: [
(s) => [s.dataColorThemeId, s.getTheme],
- (dataColorThemeId, getTheme): DataColorTheme | null => getTheme(dataColorThemeId),
+ (
+ dataColorThemeId: number | null,
+ getTheme: (themeId: number | string | null | undefined) => DataColorTheme | null
+ ): DataColorTheme | null => getTheme(dataColorThemeId),
],
maxContext: [
(s) => [s.dashboard],
- (dashboard): MaxContextInput[] => {
+ (dashboard: DashboardType<QueryBasedInsightModel> | null): MaxContextInput[] => {
if (!dashboard) {
return []
}
diff --git a/frontend/src/scenes/dashboard/dashboardSubscribeNudgeLogic.ts b/frontend/src/scenes/dashboard/dashboardSubscribeNudgeLogic.ts
index d2c478009819..3607435e2540 100644
--- a/frontend/src/scenes/dashboard/dashboardSubscribeNudgeLogic.ts
+++ b/frontend/src/scenes/dashboard/dashboardSubscribeNudgeLogic.ts
@@ -1,4 +1,15 @@
-import { BreakPointFunction, afterMount, connect, kea, key, listeners, path, props, selectors } from 'kea'
+import {
+ MakeLogicType,
+ BreakPointFunction,
+ afterMount,
+ connect,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ selectors,
+} from 'kea'
import { loaders } from 'kea-loaders'
import { subscriptions } from 'kea-subscriptions'
@@ -24,7 +35,9 @@ import { subscriptionsLogic } from 'products/subscriptions/frontend/components/S
import { isFreeTierCreateAtLimit } from 'products/subscriptions/frontend/components/Subscriptions/views/EditSubscription'
import { subscriptionsList } from 'products/subscriptions/frontend/generated/api'
-import type { dashboardSubscribeNudgeLogicType } from './dashboardSubscribeNudgeLogicType'
+import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
+import type { DashboardType, QueryBasedInsightModel } from '../../types'
+import type { DashboardViewLog } from './dashboardSubscribeNudgeStoreLogic'
export const DASHBOARD_SUBSCRIBE_NUDGE_VIEW_THRESHOLD = 3
@@ -32,6 +45,138 @@ export interface DashboardSubscribeNudgeLogicProps {
dashboardId: number
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardSubscribeNudgeLogicValues {
+ canEditDashboard: boolean // dashboardLogic
+ dashboard: DashboardType<QueryBasedInsightModel> | null // dashboardLogic
+ placement: DashboardPlacement // dashboardLogic
+ notifiedDashboardIds: number[] // dashboardSubscribeNudgeStoreLogic
+ suppressedDashboardIds: number[] // dashboardSubscribeNudgeStoreLogic
+ viewLog: DashboardViewLog // dashboardSubscribeNudgeStoreLogic
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean // userLogic
+ flagVariant: boolean | string | undefined
+ hasExistingSubscription: boolean | null
+ hasExistingSubscriptionLoading: boolean
+ hasSubscriptionsFeature: boolean
+ isCandidate: boolean
+ isDashboardEligible: boolean
+ isEligible: boolean
+ isNotified: boolean
+ isPastViewThreshold: boolean
+ isSuppressed: boolean
+ isWithinSubscriptionLimit: boolean
+ nudgeNotification: DashboardSubscribeNudgeResponseApi | null
+ nudgeNotificationLoading: boolean
+ showNudge: boolean
+ teamSubscriptionCount: number | null
+ teamSubscriptionCountLoading: boolean
+ viewCount7d: number
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardSubscribeNudgeLogicActions {
+ reportDashboardViewed: () => {
+ value: true
+ } // dashboardLogic
+ markDashboardNotified: (dashboardId: number) => {
+ dashboardId: number
+ } // dashboardSubscribeNudgeStoreLogic
+ recordDashboardView: (dashboardId: number) => {
+ dashboardId: number
+ } // dashboardSubscribeNudgeStoreLogic
+ suppressDashboardNudge: (dashboardId: number) => {
+ dashboardId: number
+ } // dashboardSubscribeNudgeStoreLogic
+ loadExistingSubscription: (_?: unknown) => unknown
+ loadExistingSubscriptionFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadExistingSubscriptionSuccess: (
+ hasExistingSubscription: boolean,
+ payload?: unknown
+ ) => {
+ hasExistingSubscription: boolean
+ payload?: unknown
+ }
+ loadTeamSubscriptionCount: (_?: unknown) => unknown
+ loadTeamSubscriptionCountFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadTeamSubscriptionCountSuccess: (
+ teamSubscriptionCount: number,
+ payload?: unknown
+ ) => {
+ teamSubscriptionCount: number
+ payload?: unknown
+ }
+ sendNudgeNotification: (_?: unknown) => unknown
+ sendNudgeNotificationFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ sendNudgeNotificationSuccess: (
+ nudgeNotification: DashboardSubscribeNudgeResponseApi,
+ payload?: unknown
+ ) => {
+ nudgeNotification: DashboardSubscribeNudgeResponseApi
+ payload?: unknown
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardSubscribeNudgeLogicMeta {
+ key: number
+ __keaTypeGenInternalSelectorTypes: {
+ viewCount7d: (viewLog: DashboardViewLog, arg: any) => number
+ isPastViewThreshold: (viewCount7d: number) => boolean
+ isSuppressed: (suppressedDashboardIds: number[], arg: any) => boolean
+ isNotified: (notifiedDashboardIds: number[], arg: any) => boolean
+ isDashboardEligible: (
+ dashboard: DashboardType<
+ QueryBasedInsightModel<import('../../queries/schema').Node<Record<string, any>>>
+ > | null,
+ canEditDashboard: boolean,
+ placement: DashboardPlacement
+ ) => boolean
+ hasSubscriptionsFeature: (
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean
+ ) => boolean
+ isCandidate: (
+ isPastViewThreshold: boolean,
+ isSuppressed: boolean,
+ isNotified: boolean,
+ isDashboardEligible: boolean
+ ) => boolean
+ isWithinSubscriptionLimit: (hasSubscriptionsFeature: boolean, teamSubscriptionCount: number | null) => boolean
+ isEligible: (
+ isCandidate: boolean,
+ hasExistingSubscription: boolean | null,
+ isWithinSubscriptionLimit: boolean
+ ) => boolean
+ flagVariant: (isEligible: boolean, featureFlags: FeatureFlagsSet) => boolean | string | undefined
+ showNudge: (flagVariant: boolean | string | undefined) => boolean
+ }
+}
+
+export type dashboardSubscribeNudgeLogicType = MakeLogicType<
+ dashboardSubscribeNudgeLogicValues,
+ dashboardSubscribeNudgeLogicActions,
+ DashboardSubscribeNudgeLogicProps,
+ dashboardSubscribeNudgeLogicMeta
+>
+
export const dashboardSubscribeNudgeLogic = kea<dashboardSubscribeNudgeLogicType>([
path((key) => ['scenes', 'dashboard', 'dashboardSubscribeNudgeLogic', key]),
props({} as DashboardSubscribeNudgeLogicProps),
@@ -110,19 +255,20 @@ export const dashboardSubscribeNudgeLogic = kea<dashboardSubscribeNudgeLogicType
selectors({
viewCount7d: [
(s) => [s.viewLog, (_, props) => props.dashboardId],
- (viewLog, dashboardId): number => freshTimestamps(viewLog[dashboardId] ?? [], Date.now()).length,
+ (viewLog: DashboardViewLog, dashboardId): number =>
+ freshTimestamps(viewLog[dashboardId] ?? [], Date.now()).length,
],
isPastViewThreshold: [
(s) => [s.viewCount7d],
- (viewCount7d): boolean => viewCount7d >= DASHBOARD_SUBSCRIBE_NUDGE_VIEW_THRESHOLD,
+ (viewCount7d: number): boolean => viewCount7d >= DASHBOARD_SUBSCRIBE_NUDGE_VIEW_THRESHOLD,
],
isSuppressed: [
(s) => [s.suppressedDashboardIds, (_, props) => props.dashboardId],
- (suppressedDashboardIds, dashboardId): boolean => suppressedDashboardIds.includes(dashboardId),
+ (suppressedDashboardIds: number[], dashboardId): boolean => suppressedDashboardIds.includes(dashboardId),
],
isNotified: [
(s) => [s.notifiedDashboardIds, (_, props) => props.dashboardId],
- (notifiedDashboardIds, dashboardId): boolean => notifiedDashboardIds.includes(dashboardId),
+ (notifiedDashboardIds: number[], dashboardId): boolean => notifiedDashboardIds.includes(dashboardId),
],
// Excludes shared/public/embedded placements — the nudge only makes sense where "set up a
// subscription" is an action the viewer can actually take. Free-tier orgs are NOT excluded
@@ -130,19 +276,29 @@ export const dashboardSubscribeNudgeLogic = kea<dashboardSubscribeNudgeLogicType
// is the count check in `isWithinSubscriptionLimit` instead.
isDashboardEligible: [
(s) => [s.dashboard, s.canEditDashboard, s.placement],
- (dashboard, canEditDashboard, placement): boolean =>
- !!dashboard && canEditDashboard && placement === DashboardPlacement.Dashboard,
+ (
+ dashboard: DashboardType<
+ QueryBasedInsightModel<import('../../queries/schema').Node<Record<string, any>>>
+ > | null,
+ canEditDashboard: boolean,
+ placement: DashboardPlacement
+ ): boolean => !!dashboard && canEditDashboard && placement === DashboardPlacement.Dashboard,
],
hasSubscriptionsFeature: [
(s) => [s.hasAvailableFeature],
- (hasAvailableFeature): boolean => hasAvailableFeature(AvailableFeature.SUBSCRIPTIONS),
+ (hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean): boolean =>
+ hasAvailableFeature(AvailableFeature.SUBSCRIPTIONS),
],
// Cheap half of eligibility: needs no API data, so the existing-subscription fetch only
// happens for dashboards that pass this first.
isCandidate: [
(s) => [s.isPastViewThreshold, s.isSuppressed, s.isNotified, s.isDashboardEligible],
- (isPastViewThreshold, isSuppressed, isNotified, isDashboardEligible): boolean =>
- isPastViewThreshold && !isSuppressed && !isNotified && isDashboardEligible,
+ (
+ isPastViewThreshold: boolean,
+ isSuppressed: boolean,
+ isNotified: boolean,
+ isDashboardEligible: boolean
+ ): boolean => isPastViewThreshold && !isSuppressed && !isNotified && isDashboardEligible,
],
// Paid orgs are never limited. Free-tier orgs must have room under the free-tier cap —
// and unlike EditSubscription (where a null count fails open because the user explicitly
@@ -150,24 +306,30 @@ export const dashboardSubscribeNudgeLogic = kea<dashboardSubscribeNudgeLogicType
// count: don't advertise an action we can't confirm they can complete.
isWithinSubscriptionLimit: [
(s) => [s.hasSubscriptionsFeature, s.teamSubscriptionCount],
- (hasSubscriptionsFeature, teamSubscriptionCount): boolean =>
+ (hasSubscriptionsFeature: boolean, teamSubscriptionCount: number | null): boolean =>
hasSubscriptionsFeature ||
(teamSubscriptionCount !== null && !isFreeTierCreateAtLimit(teamSubscriptionCount)),
],
isEligible: [
(s) => [s.isCandidate, s.hasExistingSubscription, s.isWithinSubscriptionLimit],
- (isCandidate, hasExistingSubscription, isWithinSubscriptionLimit): boolean =>
- isCandidate && hasExistingSubscription === false && isWithinSubscriptionLimit,
+ (
+ isCandidate: boolean,
+ hasExistingSubscription: boolean | null,
+ isWithinSubscriptionLimit: boolean
+ ): boolean => isCandidate && hasExistingSubscription === false && isWithinSubscriptionLimit,
],
// CRITICAL: `featureFlags[...]` is a proxy access that reports the flag's exposure event the
// first time it's read. Only touch it once `isEligible` is true, so the experiment's exposure
// ($feature_flag_called) fires only for the population that could actually receive the nudge.
flagVariant: [
(s) => [s.isEligible, s.featureFlags],
- (isEligible, featureFlags): string | boolean | undefined =>
+ (isEligible: boolean, featureFlags: FeatureFlagsSet): string | boolean | undefined =>
isEligible ? featureFlags[FEATURE_FLAGS.DASHBOARD_SUBSCRIBE_NUDGE] : undefined,
],
- showNudge: [(s) => [s.flagVariant], (flagVariant): boolean => flagVariant === 'test'],
+ showNudge: [
+ (s) => [s.flagVariant],
+ (flagVariant: boolean | string | undefined): boolean => flagVariant === 'test',
+ ],
}),
listeners(({ actions, values, props }) => ({
reportDashboardViewed: () => {
diff --git a/frontend/src/scenes/dashboard/dashboardSubscribeNudgeStoreLogic.ts b/frontend/src/scenes/dashboard/dashboardSubscribeNudgeStoreLogic.ts
index 800c586e4b4c..88cf1bff7cd4 100644
--- a/frontend/src/scenes/dashboard/dashboardSubscribeNudgeStoreLogic.ts
+++ b/frontend/src/scenes/dashboard/dashboardSubscribeNudgeStoreLogic.ts
@@ -1,9 +1,7 @@
-import { actions, kea, key, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, kea, key, path, props, reducers } from 'kea'
import { getCurrentTeamIdOrNone, getCurrentUserIdOrNone } from 'lib/utils/getAppContext'
-import type { dashboardSubscribeNudgeStoreLogicType } from './dashboardSubscribeNudgeStoreLogicType'
-
export const DASHBOARD_VIEW_LOG_WINDOW_MS = 7 * 24 * 60 * 60 * 1000
// dashboardLogic dispatches reportDashboardViewed more than once per real page view (on mount and
// again after the API load); dispatches this close together are the same visit and count once.
@@ -56,6 +54,38 @@ export function dashboardNudgeScopeKey(): string {
return `${getCurrentTeamIdOrNone() ?? 'anon'}:${getCurrentUserIdOrNone() ?? 'anon'}`
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardSubscribeNudgeStoreLogicValues {
+ notifiedDashboardIds: number[]
+ suppressedDashboardIds: number[]
+ viewLog: DashboardViewLog
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardSubscribeNudgeStoreLogicActions {
+ markDashboardNotified: (dashboardId: number) => {
+ dashboardId: number
+ }
+ recordDashboardView: (dashboardId: number) => {
+ dashboardId: number
+ }
+ suppressDashboardNudge: (dashboardId: number) => {
+ dashboardId: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardSubscribeNudgeStoreLogicMeta {
+ key: string
+}
+
+export type dashboardSubscribeNudgeStoreLogicType = MakeLogicType<
+ dashboardSubscribeNudgeStoreLogicValues,
+ dashboardSubscribeNudgeStoreLogicActions,
+ DashboardSubscribeNudgeStoreLogicProps,
+ dashboardSubscribeNudgeStoreLogicMeta
+>
+
// Per-scope store behind the dashboard subscribe nudge: one persisted map of recent views for
// all dashboards (instead of a localStorage entry per dashboard ever viewed), plus the set of
// dashboards permanently excluded from the nudge. Keyed by scope so kea derives a distinct
diff --git a/frontend/src/scenes/dashboard/dashboardTemplateEditorLogic.ts b/frontend/src/scenes/dashboard/dashboardTemplateEditorLogic.ts
index 177d3a779989..68265c58167c 100644
--- a/frontend/src/scenes/dashboard/dashboardTemplateEditorLogic.ts
+++ b/frontend/src/scenes/dashboard/dashboardTemplateEditorLogic.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 { createElement, Fragment } from 'react'
@@ -9,8 +9,8 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { DashboardTemplateEditorType, DashboardTemplateType, MonacoMarker, NonPortableReferences } from '~/types'
+import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
import { dashboardTemplatesLogic } from './dashboards/templates/dashboardTemplatesLogic'
-import type { dashboardTemplateEditorLogicType } from './dashboardTemplateEditorLogicType'
/**
* Refresh every mounted `dashboardTemplatesLogic` slice we use in-product:
@@ -64,6 +64,157 @@ function parseDashboardTemplateEditorPayload(raw: string | undefined): Dashboard
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardTemplateEditorLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ dashboardTemplate: DashboardTemplateEditorType | null | undefined
+ dashboardTemplateLoading: boolean
+ editorValue: string
+ id: string | null
+ isOpenNewDashboardTemplateModal: boolean
+ templateSchema: Record<string, any> | null
+ templateSchemaLoading: boolean
+ validationErrors: string[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardTemplateEditorLogicActions {
+ clear: () => {
+ value: true
+ }
+ closeDashboardTemplateEditor: () => {
+ value: true
+ }
+ createDashboardTemplate: () => any
+ createDashboardTemplateFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ createDashboardTemplateSuccess: (
+ dashboardTemplate: DashboardTemplateEditorType | undefined,
+ payload?: any
+ ) => {
+ dashboardTemplate: DashboardTemplateEditorType | undefined
+ payload?: any
+ }
+ deleteDashboardTemplate: ({ id, templateName }: { id: string; templateName: string }) => {
+ id: string
+ templateName: string
+ }
+ deleteDashboardTemplateFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deleteDashboardTemplateSuccess: (
+ dashboardTemplate: null,
+ payload?: {
+ id: string
+ templateName: string
+ }
+ ) => {
+ dashboardTemplate: null
+ payload?: {
+ id: string
+ templateName: string
+ }
+ }
+ getDashboardTemplate: (id: string) => string
+ getDashboardTemplateFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ getDashboardTemplateSuccess: (
+ dashboardTemplate: DashboardTemplateType,
+ payload?: string
+ ) => {
+ dashboardTemplate: DashboardTemplateType
+ payload?: string
+ }
+ getTemplateSchema: () => any
+ getTemplateSchemaFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ getTemplateSchemaSuccess: (
+ templateSchema: Record<string, any>,
+ payload?: any
+ ) => {
+ templateSchema: Record<string, any>
+ payload?: any
+ }
+ openDashboardTemplateEditor: () => {
+ value: true
+ }
+ setDashboardTemplate: (dashboardTemplate: DashboardTemplateEditorType) => {
+ dashboardTemplate: DashboardTemplateEditorType
+ }
+ setDashboardTemplateId: (
+ id: string | null,
+ options?: {
+ hydrateEditorFromApi?: boolean
+ }
+ ) => {
+ hydrateEditorFromApi: boolean
+ id: string | null
+ }
+ setEditorValue: (value: string) => {
+ value: string
+ }
+ toggleTemplateOrganizationScope: (template: DashboardTemplateType) => {
+ template: DashboardTemplateType
+ }
+ updateDashboardTemplate: ({
+ id,
+ dashboardTemplateUpdates,
+ }: {
+ dashboardTemplateUpdates?: Partial<DashboardTemplateType>
+ id: string
+ }) => {
+ id: string
+ dashboardTemplateUpdates?: Partial<DashboardTemplateType>
+ }
+ updateDashboardTemplateFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateDashboardTemplateSuccess: (
+ dashboardTemplate: DashboardTemplateEditorType | undefined,
+ payload?: {
+ id: string
+ dashboardTemplateUpdates?: Partial<DashboardTemplateType>
+ }
+ ) => {
+ dashboardTemplate: DashboardTemplateEditorType | undefined
+ payload?: {
+ id: string
+ dashboardTemplateUpdates?: Partial<DashboardTemplateType>
+ }
+ }
+ updateValidationErrors: (markers: MonacoMarker[] | undefined) => {
+ markers: MonacoMarker[] | undefined
+ }
+}
+
+export type dashboardTemplateEditorLogicType = MakeLogicType<
+ dashboardTemplateEditorLogicValues,
+ dashboardTemplateEditorLogicActions
+>
+
export const dashboardTemplateEditorLogic = kea<dashboardTemplateEditorLogicType>([
path(['scenes', 'dashboard', 'dashboardTemplateEditorLogic']),
connect(() => ({
diff --git a/frontend/src/scenes/dashboard/dashboardTemplateVariablesLogic.ts b/frontend/src/scenes/dashboard/dashboardTemplateVariablesLogic.ts
index 057f57ffcb31..a72e4bcfed81 100644
--- a/frontend/src/scenes/dashboard/dashboardTemplateVariablesLogic.ts
+++ b/frontend/src/scenes/dashboard/dashboardTemplateVariablesLogic.ts
@@ -1,4 +1,16 @@
-import { actions, afterMount, connect, kea, listeners, path, props, propsChanged, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ connect,
+ kea,
+ listeners,
+ path,
+ props,
+ propsChanged,
+ reducers,
+ selectors,
+} from 'kea'
import { iframedToolbarBrowserLogic } from 'lib/components/IframedToolbarBrowser/iframedToolbarBrowserLogic'
import { PostHogAppToolbarEvent } from 'lib/components/IframedToolbarBrowser/utils'
@@ -14,8 +26,6 @@ import {
TemplateVariableStep,
} from '~/types'
-import type { dashboardTemplateVariablesLogicType } from './dashboardTemplateVariablesLogicType'
-
export interface DashboardTemplateVariablesLogicProps {
variables: DashboardTemplateVariableType[]
}
@@ -26,6 +36,101 @@ const FALLBACK_EVENT = {
type: EntityTypes.EVENTS,
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardTemplateVariablesLogicValues {
+ activeVariable: DashboardTemplateVariableType
+ activeVariableCustomEventName: string | null | undefined
+ activeVariableIndex: number
+ allVariablesAreTouched: boolean
+ hasTouchedAnyVariable: boolean
+ isCurrentlySelectingElement: boolean
+ variables: DashboardTemplateVariableType[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardTemplateVariablesLogicActions {
+ disableElementSelector: () => {
+ value: true
+ } // iframedToolbarBrowserLogic
+ toolbarMessageReceived: (
+ type: PostHogAppToolbarEvent,
+ payload: Record<string, any>
+ ) => {
+ payload: Record<string, any>
+ type: PostHogAppToolbarEvent
+ } // iframedToolbarBrowserLogic
+ goToNextUntouchedActiveVariableIndex: () => {
+ value: true
+ }
+ incrementActiveVariableIndex: () => {
+ value: true
+ }
+ maybeResetActiveVariableCustomEventName: () => {
+ value: true
+ }
+ possiblyIncrementActiveVariableIndex: () => {
+ value: true
+ }
+ resetVariable: (variableId: string) => {
+ variableId: string
+ }
+ setActiveVariableCustomEventName: (customEventName?: string | null) => {
+ customEventName: string | null | undefined
+ }
+ setActiveVariableIndex: (index: number) => {
+ index: number
+ }
+ setIsCurrentlySelectingElement: (isSelecting: boolean) => {
+ isSelecting: boolean
+ }
+ setVariable: (
+ variableName: string,
+ filterGroup: FilterType
+ ) => {
+ filterGroup: FilterType
+ variable_name: string
+ }
+ setVariableForPageview: (
+ variableName: string,
+ url: string
+ ) => {
+ url: string
+ variableName: string
+ }
+ setVariableForScreenview: (variableName: string) => {
+ variableName: string
+ }
+ setVariableFromAction: (
+ variableName: string,
+ action: ActionType
+ ) => {
+ action: ActionType
+ variableName: string
+ }
+ setVariables: (variables: DashboardTemplateVariableType[]) => {
+ variables: DashboardTemplateVariableType[]
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardTemplateVariablesLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ activeVariable: (
+ variables: DashboardTemplateVariableType[],
+ activeVariableIndex: number
+ ) => DashboardTemplateVariableType
+ allVariablesAreTouched: (variables: DashboardTemplateVariableType[]) => boolean
+ hasTouchedAnyVariable: (variables: DashboardTemplateVariableType[]) => boolean
+ }
+}
+
+export type dashboardTemplateVariablesLogicType = MakeLogicType<
+ dashboardTemplateVariablesLogicValues,
+ dashboardTemplateVariablesLogicActions,
+ DashboardTemplateVariablesLogicProps,
+ dashboardTemplateVariablesLogicMeta
+>
+
export const dashboardTemplateVariablesLogic = kea<dashboardTemplateVariablesLogicType>([
path(['scenes', 'dashboard', 'DashboardTemplateVariablesLogic']),
props({ variables: [] } as DashboardTemplateVariablesLogicProps),
diff --git a/frontend/src/scenes/dashboard/dashboards/dashboardsLogic.ts b/frontend/src/scenes/dashboard/dashboards/dashboardsLogic.ts
index fbc10ff41465..6b88aa31cef2 100644
--- a/frontend/src/scenes/dashboard/dashboards/dashboardsLogic.ts
+++ b/frontend/src/scenes/dashboard/dashboards/dashboardsLogic.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 { router, urlToAction } from 'kea-router'
@@ -16,7 +16,8 @@ import { dashboardsModel } from '~/models/dashboardsModel'
import { tagsModel } from '~/models/tagsModel'
import { ActivityScope, Breadcrumb, DashboardBasicType } from '~/types'
-import type { dashboardsLogicType } from './dashboardsLogicType'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { UserType } from '../../../types'
export enum DashboardsTab {
All = 'all',
@@ -51,6 +52,112 @@ function urlSearchParamToString(value: unknown): string {
return `${value ?? ''}`
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardsLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ tags: string[] // tagsModel
+ user: UserType | null // userLogic
+ breadcrumbs: Breadcrumb[]
+ currentTab: DashboardsTab
+ dashboards: DashboardBasicType[]
+ filteredTags: string[]
+ filters: DashboardsFilters
+ isFiltering: boolean
+ searchedDashboards: DashboardBasicType[] | null
+ searchedDashboardsLoading: boolean
+ showTagPopover: boolean
+ sidePanelContext: SidePanelSceneContext
+ tableSorting: Sorting
+ tagSearch: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardsLogicActions {
+ loadSearchedDashboards: ({ search, tags, folder }: { folder: string | null; search: string; tags: string[] }) => {
+ search: string
+ tags: string[]
+ folder: string | null
+ }
+ loadSearchedDashboardsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSearchedDashboardsSuccess: (
+ searchedDashboards: DashboardBasicType[] | null,
+ payload?: {
+ search: string
+ tags: string[]
+ folder: string | null
+ }
+ ) => {
+ searchedDashboards: DashboardBasicType[] | null
+ payload?: {
+ search: string
+ tags: string[]
+ folder: string | null
+ }
+ }
+ setCurrentTab: (tab: DashboardsTab) => {
+ tab: DashboardsTab
+ }
+ setFilters: (filters: Partial<DashboardsFilters>) => {
+ filters: Partial<DashboardsFilters>
+ }
+ setSearch: (search: string) => {
+ search: string
+ }
+ setShowTagPopover: (visible: boolean) => {
+ visible: boolean
+ }
+ setTagSearch: (search: string) => {
+ search: string
+ }
+ tableSortingChanged: (sorting: Sorting | null) => {
+ sorting: Sorting | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ isFiltering: (filters: DashboardsFilters) => boolean
+ filteredTags: (tags: string[], tagSearch: string) => string[]
+ dashboards: (
+ nameSortedDashboards: (
+ | DashboardBasicType
+ | import('~/types').DashboardType<
+ import('~/types').QueryBasedInsightModel<
+ import('../../../queries/schema').Node<Record<string, any>>
+ >
+ >
+ )[],
+ rawDashboards: Record<
+ string,
+ | DashboardBasicType
+ | import('~/types').DashboardType<
+ import('~/types').QueryBasedInsightModel<
+ import('../../../queries/schema').Node<Record<string, any>>
+ >
+ >
+ >,
+ searchedDashboards: DashboardBasicType[] | null,
+ filters: DashboardsFilters,
+ currentTab: DashboardsTab,
+ user: UserType | null
+ ) => DashboardBasicType[]
+ }
+}
+
+export type dashboardsLogicType = MakeLogicType<
+ dashboardsLogicValues,
+ dashboardsLogicActions,
+ Record<string, any>,
+ dashboardsLogicMeta
+>
+
export const dashboardsLogic = kea<dashboardsLogicType>([
path(['scenes', 'dashboard', 'dashboardsLogic']),
connect(() => ({
@@ -166,7 +273,7 @@ export const dashboardsLogic = kea<dashboardsLogicType>([
selectors({
isFiltering: [
(s) => [s.filters],
- (filters) => {
+ (filters: DashboardsFilters) => {
return Object.keys(filters).some((key) => {
const filterKey = key as keyof DashboardsFilters
return filters[filterKey] !== DEFAULT_FILTERS[filterKey]
@@ -175,7 +282,7 @@ export const dashboardsLogic = kea<dashboardsLogicType>([
],
filteredTags: [
(s) => [s.tags, s.tagSearch],
- (tags, search) => {
+ (tags: string[], search: string) => {
if (!search) {
return tags || []
}
@@ -191,7 +298,17 @@ export const dashboardsLogic = kea<dashboardsLogicType>([
s.currentTab,
s.user,
],
- (allDashboards, rawDashboards, searchedDashboards, filters, currentTab, user) => {
+ (
+ allDashboards: DashboardBasicType[],
+ rawDashboards: Record<
+ string,
+ DashboardBasicType | import('~/types').DashboardType<import('~/types').QueryBasedInsightModel>
+ >,
+ searchedDashboards: DashboardBasicType[] | null,
+ filters: DashboardsFilters,
+ currentTab: DashboardsTab,
+ user: null | import('~/types').UserType
+ ) => {
// When a search term is active we trust the server's trigram word similarity
// ranking; otherwise we use the model's alphabetised list. This keeps the exact
// match at the top.
diff --git a/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateChooserLogic.ts b/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateChooserLogic.ts
index 37ff28644a4a..90806fda1fd9 100644
--- a/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateChooserLogic.ts
+++ b/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateChooserLogic.ts
@@ -1,11 +1,12 @@
-import { actions, connect, kea, key, listeners, path, props, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, selectors } from 'kea'
import posthog from 'posthog-js'
import { newDashboardLogic } from 'scenes/dashboard/newDashboardLogic'
import { DashboardTemplateType, TemplateAvailabilityContext } from '~/types'
-import type { dashboardTemplateChooserLogicType } from './dashboardTemplateChooserLogicType'
+import type { DashboardTemplateVariableType } from '../../../../types'
+import type { NewDashboardForm } from '../../newDashboardLogic'
import { runBlankDashboardFlow, runDashboardTemplateClickFlow } from './dashboardTemplateCreationFlows'
import { DashboardTemplateProps, dashboardTemplatesLogic } from './dashboardTemplatesLogic'
@@ -46,6 +47,85 @@ function computeShowBlankTile(availabilityContexts: DashboardTemplateProps['avai
)
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardTemplateChooserLogicValues {
+ allTemplates: DashboardTemplateType[] // dashboardTemplatesLogic
+ allTemplatesLoading: boolean // dashboardTemplatesLogic
+ templateFilter: string // dashboardTemplatesLogic
+ isLoading: boolean // newDashboardLogic
+ newDashboardModalVisible: boolean // newDashboardLogic
+ allMatchesInFeaturedSection: boolean
+ featuredTemplates: DashboardTemplateType[]
+ hasActiveFilter: boolean
+ nonFeaturedOfficial: DashboardTemplateType[]
+ showBlankTile: boolean
+ showDashedEmptyState: boolean
+ showOfficialSection: boolean
+ teamTemplates: DashboardTemplateType[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardTemplateChooserLogicActions {
+ setTemplateFilter: (search: string) => {
+ search: string
+ } // dashboardTemplatesLogic
+ addDashboard: (form: Partial<NewDashboardForm>) => {
+ form: Partial<NewDashboardForm>
+ } // newDashboardLogic
+ createDashboardFromTemplate: (
+ template: DashboardTemplateType,
+ variables: DashboardTemplateVariableType[],
+ redirectAfterCreation?: boolean | undefined,
+ creationContext?: string | null | undefined
+ ) => {
+ creationContext: string | null
+ redirectAfterCreation: boolean | undefined
+ template: DashboardTemplateType
+ variables: DashboardTemplateVariableType[]
+ } // newDashboardLogic
+ setActiveDashboardTemplate: (template: DashboardTemplateType) => {
+ template: DashboardTemplateType
+ } // newDashboardLogic
+ setIsLoading: (isLoading: boolean) => {
+ isLoading: boolean
+ } // newDashboardLogic
+ showVariableSelectModal: (template: DashboardTemplateType) => {
+ template: DashboardTemplateType
+ } // newDashboardLogic
+ blankTileClicked: (tileLocation: 'featured_row' | 'main_grid' | 'modal_toolbar') => {
+ tileLocation: 'featured_row' | 'main_grid' | 'modal_toolbar'
+ }
+ templateTileClicked: (
+ template: DashboardTemplateType,
+ tileLocation: 'featured_row' | 'main_grid' | 'team_section'
+ ) => {
+ template: DashboardTemplateType
+ tileLocation: 'featured_row' | 'main_grid' | 'team_section'
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardTemplateChooserLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ showBlankTile: (arg: any) => boolean
+ teamTemplates: (allTemplates: DashboardTemplateType[], arg: any) => DashboardTemplateType[]
+ featuredTemplates: (allTemplates: DashboardTemplateType[], arg: any) => DashboardTemplateType[]
+ nonFeaturedOfficial: (allTemplates: DashboardTemplateType[], arg: any) => DashboardTemplateType[]
+ hasActiveFilter: (templateFilter: string) => boolean
+ showDashedEmptyState: (allTemplatesLoading: boolean, allTemplates: DashboardTemplateType[], arg: any) => boolean
+ allMatchesInFeaturedSection: (allTemplates: DashboardTemplateType[], arg: any) => boolean
+ showOfficialSection: (allTemplatesLoading: boolean, allTemplates: DashboardTemplateType[], arg: any) => boolean
+ }
+}
+
+export type dashboardTemplateChooserLogicType = MakeLogicType<
+ dashboardTemplateChooserLogicValues,
+ dashboardTemplateChooserLogicActions,
+ DashboardTemplateChooserLogicProps,
+ dashboardTemplateChooserLogicMeta
+>
+
export const dashboardTemplateChooserLogic = kea<dashboardTemplateChooserLogicType>([
path(['scenes', 'dashboard', 'dashboards', 'templates', 'dashboardTemplateChooserLogic']),
props({} as DashboardTemplateChooserLogicProps),
diff --git a/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateCopyLogic.ts b/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateCopyLogic.ts
index ed202c90b82d..4693c1e71426 100644
--- a/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateCopyLogic.ts
+++ b/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateCopyLogic.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'
import { subscriptions } from 'kea-subscriptions'
@@ -12,7 +12,7 @@ import { urls } from 'scenes/urls'
import type { DashboardTemplateType } from '~/types'
-import type { dashboardTemplateCopyLogicType } from './dashboardTemplateCopyLogicType'
+import type { OrganizationType } from '../../../../types'
import { dashboardTemplatesLogic } from './dashboardTemplatesLogic'
export interface DashboardTemplateCopyLogicProps {
@@ -30,6 +30,80 @@ function maybeReplaceUrlWithSourceTeam(props: DashboardTemplateCopyLogicProps, c
router.actions.replace(urls.dashboardTemplateCopyToProject(props.sourceTemplateId, currentTeamId))
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardTemplateCopyLogicValues {
+ currentOrganization: OrganizationType | null // organizationLogic
+ currentTeamId: number | null // teamLogic
+ copyResult: DashboardTemplateType | null
+ copyResultLoading: boolean
+ destinationTeamId: number | null
+ sourceTemplate: DashboardTemplateType | null
+ sourceTemplateLoadFailed: boolean
+ sourceTemplateLoading: boolean
+ teamOptions: {
+ label: string
+ value: number
+ }[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardTemplateCopyLogicActions {
+ loadSourceTemplate: () => any
+ loadSourceTemplateFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSourceTemplateSuccess: (
+ sourceTemplate: DashboardTemplateType,
+ payload?: any
+ ) => {
+ sourceTemplate: DashboardTemplateType
+ payload?: any
+ }
+ setDestinationTeamId: (teamId: number | null) => {
+ teamId: number | null
+ }
+ submitCopy: () => any
+ submitCopyFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ submitCopySuccess: (
+ copyResult: DashboardTemplateType,
+ payload?: any
+ ) => {
+ copyResult: DashboardTemplateType
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardTemplateCopyLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ teamOptions: (
+ currentOrganization: OrganizationType | null,
+ currentTeamId: number | null
+ ) => {
+ label: string
+ value: number
+ }[]
+ }
+}
+
+export type dashboardTemplateCopyLogicType = MakeLogicType<
+ dashboardTemplateCopyLogicValues,
+ dashboardTemplateCopyLogicActions,
+ DashboardTemplateCopyLogicProps,
+ dashboardTemplateCopyLogicMeta
+>
+
export const dashboardTemplateCopyLogic = kea<dashboardTemplateCopyLogicType>([
path(['scenes', 'dashboard', 'dashboards', 'templates', 'dashboardTemplateCopyLogic']),
props({} as DashboardTemplateCopyLogicProps),
@@ -86,7 +160,7 @@ export const dashboardTemplateCopyLogic = kea<dashboardTemplateCopyLogicType>([
selectors({
teamOptions: [
(s) => [s.currentOrganization, s.currentTeamId],
- (currentOrganization, currentTeamId) =>
+ (currentOrganization: null | import('~/types').OrganizationType, currentTeamId: number | null) =>
(currentOrganization?.teams ?? [])
.filter((team) => team.id !== currentTeamId)
.sort((a, b) => a.name.localeCompare(b.name))
diff --git a/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateModalLogic.ts b/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateModalLogic.ts
index e4ed3960229a..a052616a00cd 100644
--- a/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateModalLogic.ts
+++ b/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateModalLogic.ts
@@ -1,4 +1,4 @@
-import { actions, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import { lemonToast } from '@posthog/lemon-ui'
@@ -7,12 +7,64 @@ import api from 'lib/api'
import { DashboardTemplateEditorType, DashboardTemplateType } from '~/types'
-import type { dashboardTemplateModalLogicType } from './dashboardTemplateModalLogicType'
import { dashboardTemplatesLogic } from './dashboardTemplatesLogic'
/** Non-empty payload so Kea `ActionDefinitions` does not treat `payload.value` as `never extends true` (which forces `closeModal: true`). */
export type CloseModalActionPayload = { readonly kind: 'closeModal' }
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardTemplateModalLogicValues {
+ createPayload: DashboardTemplateEditorType | null
+ dashboardDescription: string
+ editingTemplate: DashboardTemplateType | null
+ isOpen: boolean
+ mode: 'create' | 'edit'
+ projectTemplateSave: boolean | null
+ projectTemplateSaveLoading: boolean
+ templateName: string
+ templateTags: string[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardTemplateModalLogicActions {
+ closeModal: () => CloseModalActionPayload
+ openCreate: (payload: DashboardTemplateEditorType) => {
+ payload: DashboardTemplateEditorType
+ }
+ openEdit: (template: DashboardTemplateType) => {
+ template: DashboardTemplateType
+ }
+ saveProjectTemplate: () => any
+ saveProjectTemplateFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ saveProjectTemplateSuccess: (
+ projectTemplateSave: null | true,
+ payload?: any
+ ) => {
+ projectTemplateSave: null | true
+ payload?: any
+ }
+ setDashboardDescription: (dashboardDescription: string) => {
+ dashboardDescription: string
+ }
+ setTemplateName: (name: string) => {
+ name: string
+ }
+ setTemplateTags: (templateTags: string[]) => {
+ templateTags: string[]
+ }
+}
+
+export type dashboardTemplateModalLogicType = MakeLogicType<
+ dashboardTemplateModalLogicValues,
+ dashboardTemplateModalLogicActions
+>
+
export const dashboardTemplateModalLogic = kea<dashboardTemplateModalLogicType>([
path(['scenes', 'dashboard', 'dashboards', 'templates', 'dashboardTemplateModalLogic']),
actions({
diff --git a/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplatesLogic.tsx b/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplatesLogic.tsx
index 246c0a87949e..0c62ed2cac93 100644
--- a/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplatesLogic.tsx
+++ b/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplatesLogic.tsx
@@ -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 { lazyLoaders } from 'kea-loaders'
import { router } from 'kea-router'
import { actionToUrl } from 'kea-router'
@@ -15,7 +15,7 @@ import {
TemplateAvailabilityContext,
} from '~/types'
-import type { dashboardTemplatesLogicType } from './dashboardTemplatesLogicType'
+import type { FeatureFlagsSet } from '../../../../lib/logic/featureFlagLogic'
export interface DashboardTemplateProps {
// default is to present global templates _and_ those visible only in the current team
@@ -84,6 +84,60 @@ function listQueryFeaturedKeySegment(p: DashboardTemplatesLogicProps): 'featured
return 'all'
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardTemplatesLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ allTemplates: DashboardTemplateType[]
+ allTemplatesLoaded: boolean
+ allTemplatesLoading: boolean
+ templateFilter: string
+ templateNameOrdering: DashboardTemplateTableOrdering
+ templatesTabVisibility: DashboardTemplatesTabVisibility
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardTemplatesLogicActions {
+ getAllTemplates: () => any
+ getAllTemplatesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ getAllTemplatesSuccess: (
+ allTemplates: DashboardTemplateType[],
+ payload?: any
+ ) => {
+ allTemplates: DashboardTemplateType[]
+ payload?: any
+ }
+ setTemplateFilter: (search: string) => {
+ search: string
+ }
+ setTemplateNameOrdering: (ordering: DashboardTemplateTableOrdering) => {
+ ordering: DashboardTemplateTableOrdering
+ }
+ setTemplates: (allTemplates: DashboardTemplateType[]) => {
+ allTemplates: DashboardTemplateType[]
+ }
+ setTemplatesTabVisibility: (visibility: DashboardTemplatesTabVisibility) => {
+ visibility: DashboardTemplatesTabVisibility
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardTemplatesLogicMeta {
+ key: string
+}
+
+export type dashboardTemplatesLogicType = MakeLogicType<
+ dashboardTemplatesLogicValues,
+ dashboardTemplatesLogicActions,
+ DashboardTemplatesLogicProps,
+ dashboardTemplatesLogicMeta
+>
+
export const dashboardTemplatesLogic = kea<dashboardTemplatesLogicType>([
path(['scenes', 'dashboard', 'dashboards', 'templates', 'dashboardTemplatesLogic']),
props({} as DashboardTemplatesLogicProps),
diff --git a/frontend/src/scenes/dashboard/deleteDashboardLogic.ts b/frontend/src/scenes/dashboard/deleteDashboardLogic.ts
index 8faccd0584fc..f4543bc3da0a 100644
--- a/frontend/src/scenes/dashboard/deleteDashboardLogic.ts
+++ b/frontend/src/scenes/dashboard/deleteDashboardLogic.ts
@@ -1,5 +1,6 @@
-import { actions, connect, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { router } from 'kea-router'
import { urls } from 'scenes/urls'
@@ -7,8 +8,6 @@ import { urls } from 'scenes/urls'
import { dashboardsModel } from '~/models/dashboardsModel'
import { groupsModel } from '~/models/groupsModel'
-import type { deleteDashboardLogicType } from './deleteDashboardLogicType'
-
export interface DeleteDashboardForm {
dashboardId: number | null
deleteInsights: boolean
@@ -19,6 +18,71 @@ const defaultFormValues: DeleteDashboardForm = {
deleteInsights: false,
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface deleteDashboardLogicValues {
+ deleteDashboard: DeleteDashboardForm
+ deleteDashboardAllErrors: Record<string, any>
+ deleteDashboardChanged: boolean
+ deleteDashboardErrors: DeepPartialMap<DeleteDashboardForm, ValidationErrorType>
+ deleteDashboardHasErrors: boolean
+ deleteDashboardManualErrors: Record<string, any>
+ deleteDashboardModalVisible: boolean
+ deleteDashboardTouched: boolean
+ deleteDashboardTouches: Record<string, boolean>
+ deleteDashboardValidationErrors: DeepPartialMap<DeleteDashboardForm, ValidationErrorType>
+ isDeleteDashboardSubmitting: boolean
+ isDeleteDashboardValid: boolean
+ showDeleteDashboardErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface deleteDashboardLogicActions {
+ removeDetailDashboard: (dashboardId: number) => number // groupsModel
+ hideDeleteDashboardModal: () => {
+ value: true
+ }
+ resetDeleteDashboard: (values?: DeleteDashboardForm) => {
+ values?: DeleteDashboardForm
+ }
+ setDeleteDashboardManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setDeleteDashboardValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setDeleteDashboardValues: (values: DeepPartial<DeleteDashboardForm>) => {
+ values: DeepPartial<DeleteDashboardForm>
+ }
+ showDeleteDashboardModal: (id: number) => {
+ id: number
+ }
+ submitDeleteDashboard: () => {
+ value: boolean
+ }
+ submitDeleteDashboardFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitDeleteDashboardRequest: (deleteDashboard: DeleteDashboardForm) => {
+ deleteDashboard: DeleteDashboardForm
+ }
+ submitDeleteDashboardSuccess: (deleteDashboard: DeleteDashboardForm) => {
+ deleteDashboard: DeleteDashboardForm
+ }
+ touchDeleteDashboardField: (key: string) => {
+ key: string
+ }
+}
+
+export type deleteDashboardLogicType = MakeLogicType<deleteDashboardLogicValues, deleteDashboardLogicActions>
+
export const deleteDashboardLogic = kea<deleteDashboardLogicType>([
path(['scenes', 'dashboard', 'deleteDashboardLogic']),
connect(() => ({
diff --git a/frontend/src/scenes/dashboard/duplicateDashboardLogic.ts b/frontend/src/scenes/dashboard/duplicateDashboardLogic.ts
index 53c8dc1e63b5..1ac26a61e9ce 100644
--- a/frontend/src/scenes/dashboard/duplicateDashboardLogic.ts
+++ b/frontend/src/scenes/dashboard/duplicateDashboardLogic.ts
@@ -1,14 +1,14 @@
-import { actions, connect, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { router } from 'kea-router'
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'
+import type { DashboardType, QueryBasedInsightModel } from '../../types'
export interface DuplicateDashboardForm {
dashboardId: number | null
@@ -24,6 +24,81 @@ const defaultFormValues: DuplicateDashboardForm = {
show: false,
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface duplicateDashboardLogicValues {
+ duplicateDashboard: DuplicateDashboardForm
+ duplicateDashboardAllErrors: Record<string, any>
+ duplicateDashboardChanged: boolean
+ duplicateDashboardErrors: DeepPartialMap<DuplicateDashboardForm, ValidationErrorType>
+ duplicateDashboardHasErrors: boolean
+ duplicateDashboardManualErrors: Record<string, any>
+ duplicateDashboardModalVisible: boolean
+ duplicateDashboardTouched: boolean
+ duplicateDashboardTouches: Record<string, boolean>
+ duplicateDashboardValidationErrors: DeepPartialMap<DuplicateDashboardForm, ValidationErrorType>
+ isDuplicateDashboardSubmitting: boolean
+ isDuplicateDashboardValid: boolean
+ showDuplicateDashboardErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface duplicateDashboardLogicActions {
+ insightsAddedToDashboard: (args_0: { dashboardId: number; insightIds: number[] }) => {
+ dashboardId: number
+ insightIds: number[]
+ } // insightsModel
+ duplicateAndGoToDashboard: () => {
+ value: true
+ }
+ hideDuplicateDashboardModal: () => {
+ value: true
+ }
+ resetDuplicateDashboard: (values?: DuplicateDashboardForm) => {
+ values?: DuplicateDashboardForm
+ }
+ setDuplicateDashboardManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setDuplicateDashboardValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setDuplicateDashboardValues: (values: DeepPartial<DuplicateDashboardForm>) => {
+ values: DeepPartial<DuplicateDashboardForm>
+ }
+ showDuplicateDashboardModal: (
+ id: number,
+ name: string
+ ) => {
+ id: number
+ name: string
+ }
+ submitDuplicateDashboard: () => {
+ value: boolean
+ }
+ submitDuplicateDashboardFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitDuplicateDashboardRequest: (duplicateDashboard: DuplicateDashboardForm) => {
+ duplicateDashboard: DuplicateDashboardForm
+ }
+ submitDuplicateDashboardSuccess: (duplicateDashboard: DuplicateDashboardForm) => {
+ duplicateDashboard: DuplicateDashboardForm
+ }
+ touchDuplicateDashboardField: (key: string) => {
+ key: string
+ }
+}
+
+export type duplicateDashboardLogicType = MakeLogicType<duplicateDashboardLogicValues, duplicateDashboardLogicActions>
+
export const duplicateDashboardLogic = kea<duplicateDashboardLogicType>([
path(['scenes', 'dashboard', 'duplicateDashboardLogic']),
connect(() => ({ actions: [insightsModel, ['insightsAddedToDashboard']] })),
diff --git a/frontend/src/scenes/dashboard/newDashboardLogic.ts b/frontend/src/scenes/dashboard/newDashboardLogic.ts
index 77a29bca3acd..43dfcf3eeac4 100644
--- a/frontend/src/scenes/dashboard/newDashboardLogic.ts
+++ b/frontend/src/scenes/dashboard/newDashboardLogic.ts
@@ -1,5 +1,18 @@
-import { actions, connect, isBreakpoint, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ connect,
+ isBreakpoint,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ reducers,
+ selectors,
+} from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { actionToUrl, router, urlToAction } from 'kea-router'
import api from 'lib/api'
@@ -25,8 +38,9 @@ import {
JsonType,
} from '~/types'
+import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
+import type { InsightModel } from '../../types'
import { UNFILED_DASHBOARDS_FOLDER } from './dashboardConstants'
-import type { newDashboardLogicType } from './newDashboardLogicType'
export interface NewDashboardForm {
name: string
@@ -112,6 +126,122 @@ function makeTilesUsingVariables(
})
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface newDashboardLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ activeDashboardTemplate: DashboardTemplateType | null
+ isFeatureFlagDashboard: number | undefined
+ isLoading: boolean
+ isNewDashboardSubmitting: boolean
+ isNewDashboardValid: boolean
+ newDashboard: NewDashboardForm
+ newDashboardAllErrors: Record<string, any>
+ newDashboardChanged: boolean
+ newDashboardErrors: DeepPartialMap<NewDashboardForm, ValidationErrorType>
+ newDashboardHasErrors: boolean
+ newDashboardManualErrors: Record<string, any>
+ newDashboardModalVisible: boolean
+ newDashboardTouched: boolean
+ newDashboardTouches: Record<string, boolean>
+ newDashboardValidationErrors: DeepPartialMap<NewDashboardForm, ValidationErrorType>
+ redirectAfterCreation: boolean
+ showNewDashboardErrors: boolean
+ variableSelectModalVisible: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface newDashboardLogicActions {
+ addDashboard: (form: Partial<NewDashboardForm>) => {
+ form: Partial<NewDashboardForm>
+ }
+ clearActiveDashboardTemplate: () => {
+ value: true
+ }
+ createDashboardFromTemplate: (
+ template: DashboardTemplateType,
+ variables: DashboardTemplateVariableType[],
+ redirectAfterCreation?: boolean,
+ creationContext?: string | null
+ ) => {
+ creationContext: string | null
+ redirectAfterCreation: boolean | undefined
+ template: DashboardTemplateType
+ variables: DashboardTemplateVariableType[]
+ }
+ hideNewDashboardModal: () => {
+ value: true
+ }
+ resetNewDashboard: (values?: NewDashboardForm) => {
+ values?: NewDashboardForm
+ }
+ setActiveDashboardTemplate: (template: DashboardTemplateType) => {
+ template: DashboardTemplateType
+ }
+ setIsLoading: (isLoading: boolean) => {
+ isLoading: boolean
+ }
+ setNewDashboardManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setNewDashboardValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setNewDashboardValues: (values: DeepPartial<NewDashboardForm>) => {
+ values: DeepPartial<NewDashboardForm>
+ }
+ setRedirectAfterCreation: (redirect: boolean) => {
+ redirect: boolean
+ }
+ showNewDashboardModal: () => {
+ value: true
+ }
+ showVariableSelectModal: (template: DashboardTemplateType) => {
+ template: DashboardTemplateType
+ }
+ submitNewDashboard: () => {
+ value: boolean
+ }
+ submitNewDashboardFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitNewDashboardRequest: (newDashboard: NewDashboardForm) => {
+ newDashboard: NewDashboardForm
+ }
+ submitNewDashboardSuccess: (newDashboard: NewDashboardForm) => {
+ newDashboard: NewDashboardForm
+ }
+ submitNewDashboardSuccessWithResult: (
+ result: DashboardType,
+ variables?: DashboardTemplateVariableType[]
+ ) => {
+ result: DashboardType<InsightModel>
+ variables: DashboardTemplateVariableType[] | undefined
+ }
+ touchNewDashboardField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface newDashboardLogicMeta {
+ key: number | 'new'
+}
+
+export type newDashboardLogicType = MakeLogicType<
+ newDashboardLogicValues,
+ newDashboardLogicActions,
+ NewDashboardLogicProps,
+ newDashboardLogicMeta
+>
+
export const newDashboardLogic = kea<newDashboardLogicType>([
props({} as NewDashboardLogicProps),
key(({ featureFlagId }) => featureFlagId ?? 'new'),
diff --git a/frontend/src/scenes/dashboard/tileLogic.tsx b/frontend/src/scenes/dashboard/tileLogic.tsx
index 4425481dfdd9..fb722ff24560 100644
--- a/frontend/src/scenes/dashboard/tileLogic.tsx
+++ b/frontend/src/scenes/dashboard/tileLogic.tsx
@@ -1,16 +1,48 @@
-import { actions, kea, key, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, kea, key, path, props, reducers } from 'kea'
import { BreakdownFilter, TileFilters } from '~/queries/schema/schema-general'
import { AnyPropertyFilter } from '~/types'
-import type { tileLogicType } from './tileLogicType'
-
export interface TileLogicProps {
dashboardId: number
tileId: number
filtersOverrides?: TileFilters
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tileLogicValues {
+ overrides: TileFilters
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tileLogicActions {
+ resetOverrides: () => {
+ value: true
+ }
+ setBreakdown: (breakdown_filter: BreakdownFilter | null | undefined) => {
+ breakdown_filter: BreakdownFilter | null | undefined
+ }
+ setDates: (
+ date_from: string | null | undefined,
+ date_to: string | null | undefined,
+ explicitDate?: boolean
+ ) => {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ explicitDate: boolean | undefined
+ }
+ setProperties: (properties: AnyPropertyFilter[] | null | undefined) => {
+ properties: AnyPropertyFilter[] | null | undefined
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tileLogicMeta {
+ key: string
+}
+
+export type tileLogicType = MakeLogicType<tileLogicValues, tileLogicActions, TileLogicProps, tileLogicMeta>
+
export const tileLogic = kea<tileLogicType>([
path(['scenes', 'dashboard', 'tileLogic']),
props({} as TileLogicProps),
diff --git a/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.ts b/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.ts
index cccc9e2c54cf..35cf3b377eca 100644
--- a/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.ts
+++ b/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.ts
@@ -111,9 +111,11 @@ export interface connectionSelectorLogicActions {
previous: null
results: never[]
},
- payload?: {
- value: true
- }
+ payload?:
+ | {
+ value: true
+ }
+ | undefined
) => {
dataWarehouseSources:
| PaginatedResponse<ExternalDataSource>
diff --git a/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.tsx b/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.tsx
index 0ea1a5af1a6a..89eeb82b83ff 100644
--- a/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.tsx
+++ b/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.tsx
@@ -640,7 +640,13 @@ export interface sqlEditorLogicActions {
types?: string[][]
}
} // dataWarehouseViewsLogic
- loadDatabase: ({ force }?: { force?: boolean }) => {
+ loadDatabase: (
+ args_0?:
+ | {
+ force?: boolean
+ }
+ | undefined
+ ) => {
force?: boolean
} // databaseTableListLogic
setConnection: (connectionId: string | null) => {
diff --git a/frontend/src/scenes/data-warehouse/settings/dataWarehouseSettingsSceneLogic.ts b/frontend/src/scenes/data-warehouse/settings/dataWarehouseSettingsSceneLogic.ts
index 7443e158fac4..b5db1cf18c4c 100644
--- a/frontend/src/scenes/data-warehouse/settings/dataWarehouseSettingsSceneLogic.ts
+++ b/frontend/src/scenes/data-warehouse/settings/dataWarehouseSettingsSceneLogic.ts
@@ -108,7 +108,13 @@ export interface dataWarehouseSettingsSceneLogicActions {
types?: string[][]
}
} // dataWarehouseViewsLogic
- loadDatabase: ({ force }?: { force?: boolean }) => {
+ loadDatabase: (
+ args_0?:
+ | {
+ force?: boolean
+ }
+ | undefined
+ ) => {
force?: boolean
} // databaseTableListLogic
loadDatabaseFailure: (
@@ -120,9 +126,11 @@ export interface dataWarehouseSettingsSceneLogicActions {
} // databaseTableListLogic
loadDatabaseSuccess: (
database: Required<DatabaseSchemaQueryResponse> | null,
- payload?: {
- force?: boolean
- }
+ payload?:
+ | {
+ force?: boolean
+ }
+ | undefined
) => {
database: Required<DatabaseSchemaQueryResponse> | null
payload?: {
diff --git a/frontend/src/scenes/data-warehouse/viewLinkLogic.tsx b/frontend/src/scenes/data-warehouse/viewLinkLogic.tsx
index dbd56e8219e0..c18e1d606ca9 100644
--- a/frontend/src/scenes/data-warehouse/viewLinkLogic.tsx
+++ b/frontend/src/scenes/data-warehouse/viewLinkLogic.tsx
@@ -92,7 +92,13 @@ export interface viewLinkLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface viewLinkLogicActions {
- loadDatabase: ({ force }?: { force?: boolean }) => {
+ loadDatabase: (
+ args_0?:
+ | {
+ force?: boolean
+ }
+ | undefined
+ ) => {
force?: boolean
} // databaseTableListLogic
loadJoins: () => any // joinsLogic
diff --git a/frontend/src/scenes/experiments/ExperimentForm/selectExistingFeatureFlagModalLogic.ts b/frontend/src/scenes/experiments/ExperimentForm/selectExistingFeatureFlagModalLogic.ts
index dac5be2349f3..67a688d64af9 100644
--- a/frontend/src/scenes/experiments/ExperimentForm/selectExistingFeatureFlagModalLogic.ts
+++ b/frontend/src/scenes/experiments/ExperimentForm/selectExistingFeatureFlagModalLogic.ts
@@ -54,7 +54,7 @@ export interface selectExistingFeatureFlagModalLogicActions {
} // teamLogic
updateCurrentTeamSuccess: (
currentTeam: TeamPublicType | TeamType,
- payload?: Partial<TeamType>
+ payload?: Partial<TeamType> | undefined
) => {
currentTeam: TeamPublicType | TeamType
payload?: Partial<TeamType>
diff --git a/frontend/src/scenes/experiments/experimentsLogic.ts b/frontend/src/scenes/experiments/experimentsLogic.ts
index d65418b37aed..6fb5a64d8679 100644
--- a/frontend/src/scenes/experiments/experimentsLogic.ts
+++ b/frontend/src/scenes/experiments/experimentsLogic.ts
@@ -208,7 +208,7 @@ export interface experimentsLogicActions {
} // teamLogic
updateCurrentTeamSuccess: (
currentTeam: TeamPublicType | TeamType,
- payload?: Partial<TeamType>
+ payload?: Partial<TeamType> | undefined
) => {
currentTeam: TeamPublicType | TeamType
payload?: Partial<TeamType>
diff --git a/frontend/src/scenes/exports/exportsSceneLogic.tsx b/frontend/src/scenes/exports/exportsSceneLogic.tsx
index 9b6acec2fae9..614d3168f7b6 100644
--- a/frontend/src/scenes/exports/exportsSceneLogic.tsx
+++ b/frontend/src/scenes/exports/exportsSceneLogic.tsx
@@ -1,4 +1,4 @@
-import { afterMount, connect, kea, path, selectors } from 'kea'
+import { MakeLogicType, afterMount, connect, kea, path, selectors } from 'kea'
import { exportsLogic } from 'lib/components/ExportButton/exportsLogic'
import { sceneConfigurations } from 'scenes/scenes'
@@ -6,7 +6,19 @@ import { Scene } from 'scenes/sceneTypes'
import { Breadcrumb } from '~/types'
-import type { exportsSceneLogicType } from './exportsSceneLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface exportsSceneLogicValues {
+ breadcrumbs: Breadcrumb[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface exportsSceneLogicActions {
+ loadExports: () => {
+ value: true
+ } // exportsLogic
+}
+
+export type exportsSceneLogicType = MakeLogicType<exportsSceneLogicValues, exportsSceneLogicActions>
export const exportsSceneLogic = kea<exportsSceneLogicType>([
path(['scenes', 'exports', 'exportsSceneLogic']),
diff --git a/frontend/src/scenes/feature-flags/featureFlagConfirmationSettingsLogic.ts b/frontend/src/scenes/feature-flags/featureFlagConfirmationSettingsLogic.ts
index 31818f338350..c094de4a6a91 100644
--- a/frontend/src/scenes/feature-flags/featureFlagConfirmationSettingsLogic.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagConfirmationSettingsLogic.ts
@@ -43,7 +43,7 @@ export interface featureFlagConfirmationSettingsLogicActions {
updateCurrentTeam: (payload: Partial<TeamType>) => Partial<TeamType> // teamLogic
updateCurrentTeamSuccess: (
currentTeam: TeamPublicType | TeamType,
- payload?: Partial<TeamType>
+ payload?: Partial<TeamType> | undefined
) => {
currentTeam: TeamPublicType | TeamType
payload?: Partial<TeamType>
diff --git a/frontend/src/scenes/feature-flags/featureFlagLogic.ts b/frontend/src/scenes/feature-flags/featureFlagLogic.ts
index 2793064d32be..4d15f39f2c09 100644
--- a/frontend/src/scenes/feature-flags/featureFlagLogic.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagLogic.ts
@@ -899,7 +899,7 @@ export interface featureFlagLogicActions {
updateFlag: (flag: FeatureFlagType) => {
flag: FeatureFlagType
} // featureFlagsLogic
- closeSidePanel: (tab?: SidePanelTab) => {
+ closeSidePanel: (tab?: SidePanelTab | undefined) => {
tab: SidePanelTab | undefined
} // sidePanelStateLogic
addProductIntent: (properties: ProductIntentProperties) => ProductIntentProperties // teamLogic
@@ -1838,7 +1838,7 @@ export interface featureFlagLogicMeta {
| 'Release toggle (boolean)'
| 'Remote configuration (single payload)'
roleBasedAccessEnabled: (
- hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean // userLogic
) => boolean
variants: (featureFlag: FeatureFlagType) => MultivariateFlagVariant[]
nonEmptyVariants: (variants: MultivariateFlagVariant[]) => MultivariateFlagVariant[]
@@ -1846,7 +1846,7 @@ export interface featureFlagLogicMeta {
areVariantRolloutsValid: (variants: MultivariateFlagVariant[], variantRolloutSum: number) => boolean
aggregationTargetName: (
featureFlag: FeatureFlagType,
- aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun // groupsModel
) => string
breadcrumbs: (featureFlag: FeatureFlagType) => Breadcrumb[]
projectTreeRef: (arg: number | 'link' | 'new') => ProjectTreeRef
diff --git a/frontend/src/scenes/heatmaps/components/heatmapRecordingFallbackLogic.ts b/frontend/src/scenes/heatmaps/components/heatmapRecordingFallbackLogic.ts
index 406799f1ec0a..5df32c31c665 100644
--- a/frontend/src/scenes/heatmaps/components/heatmapRecordingFallbackLogic.ts
+++ b/frontend/src/scenes/heatmaps/components/heatmapRecordingFallbackLogic.ts
@@ -42,7 +42,7 @@ export interface heatmapRecordingFallbackLogicValues {
export interface heatmapRecordingFallbackLogicActions {
openSessionPlayer: (
sessionRecording: Pick<SessionRecordingType, 'id' | 'matching_events'>,
- initialTimestamp?: number | null
+ initialTimestamp?: number | null | undefined
) => {
initialTimestamp: number | null
sessionRecording: Pick<SessionRecordingType, 'id' | 'matching_events'>
diff --git a/frontend/src/scenes/inbox/logics/reportListLogic.ts b/frontend/src/scenes/inbox/logics/reportListLogic.ts
index 20fe33040aab..46d32e2a95b6 100644
--- a/frontend/src/scenes/inbox/logics/reportListLogic.ts
+++ b/frontend/src/scenes/inbox/logics/reportListLogic.ts
@@ -232,22 +232,6 @@ export interface reportListLogicMeta {
hasMore: (reportsResponse: CountedPaginatedResponse<SignalReport> | null) => boolean
isLoaded: (reportsResponse: CountedPaginatedResponse<SignalReport> | null) => boolean
}
- __keaTypeGenInternalReducerActions: {
- 'load user success (scenes.userLogic)': (
- user: UserType | null,
- payload?: {
- resetOnFailure: boolean | undefined
- }
- ) => {
- payload: {
- payload?: {
- resetOnFailure: boolean | undefined
- }
- user: UserType | null
- }
- type: 'load user success (scenes.userLogic)'
- }
- }
}
export type reportListLogicType = MakeLogicType<
diff --git a/frontend/src/scenes/integrations/aws-s3/awsS3SetupModalLogic.ts b/frontend/src/scenes/integrations/aws-s3/awsS3SetupModalLogic.ts
index e8ed8f446acb..1e68bb94395f 100644
--- a/frontend/src/scenes/integrations/aws-s3/awsS3SetupModalLogic.ts
+++ b/frontend/src/scenes/integrations/aws-s3/awsS3SetupModalLogic.ts
@@ -1,5 +1,6 @@
-import { connect, kea, path, props } from 'kea'
+import { MakeLogicType, connect, kea, path, props } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import api from 'lib/api'
import { integrationsLogic } from 'lib/integrations/integrationsLogic'
@@ -7,14 +8,122 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { IntegrationType } from '~/types'
-import type { awsS3SetupModalLogicType } from './awsS3SetupModalLogicType'
-
export interface AwsS3SetupModalLogicProps {
isOpen: boolean
integration?: IntegrationType | null
onComplete: (integrationId?: number) => void
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface awsS3SetupModalLogicValues {
+ awsS3Integration: {
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ name: string
+ }
+ awsS3IntegrationAllErrors: Record<string, any>
+ awsS3IntegrationChanged: boolean
+ awsS3IntegrationErrors: DeepPartialMap<
+ {
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ name: string
+ },
+ ValidationErrorType
+ >
+ awsS3IntegrationHasErrors: boolean
+ awsS3IntegrationManualErrors: Record<string, any>
+ awsS3IntegrationTouched: boolean
+ awsS3IntegrationTouches: Record<string, boolean>
+ awsS3IntegrationValidationErrors: DeepPartialMap<
+ {
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ name: string
+ },
+ ValidationErrorType
+ >
+ isAwsS3IntegrationSubmitting: boolean
+ isAwsS3IntegrationValid: boolean
+ showAwsS3IntegrationErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface awsS3SetupModalLogicActions {
+ loadIntegrations: () => any // integrationsLogic
+ resetAwsS3Integration: (values?: { awsAccessKeyId: string; awsSecretAccessKey: string; name: string }) => {
+ values?: {
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ name: string
+ }
+ }
+ setAwsS3IntegrationManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setAwsS3IntegrationValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setAwsS3IntegrationValues: (
+ values: DeepPartial<{
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ name: string
+ }>
+ ) => {
+ values: DeepPartial<{
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ name: string
+ }>
+ }
+ submitAwsS3Integration: () => {
+ value: boolean
+ }
+ submitAwsS3IntegrationFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitAwsS3IntegrationRequest: (awsS3Integration: {
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ name: string
+ }) => {
+ awsS3Integration: {
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ name: string
+ }
+ }
+ submitAwsS3IntegrationSuccess: (awsS3Integration: {
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ name: string
+ }) => {
+ awsS3Integration: {
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ name: string
+ }
+ }
+ touchAwsS3IntegrationField: (key: string) => {
+ key: string
+ }
+}
+
+export type awsS3SetupModalLogicType = MakeLogicType<
+ awsS3SetupModalLogicValues,
+ awsS3SetupModalLogicActions,
+ AwsS3SetupModalLogicProps
+>
+
export const awsS3SetupModalLogic = kea<awsS3SetupModalLogicType>([
path(['integrations', 'aws-s3', 'awsS3SetupModalLogic']),
props({} as AwsS3SetupModalLogicProps),
diff --git a/frontend/src/scenes/integrations/azure-blob/azureBlobSetupModalLogic.ts b/frontend/src/scenes/integrations/azure-blob/azureBlobSetupModalLogic.ts
index e531f7000125..8c55eb406373 100644
--- a/frontend/src/scenes/integrations/azure-blob/azureBlobSetupModalLogic.ts
+++ b/frontend/src/scenes/integrations/azure-blob/azureBlobSetupModalLogic.ts
@@ -1,5 +1,6 @@
-import { connect, kea, path, props } from 'kea'
+import { MakeLogicType, connect, kea, path, props } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import api from 'lib/api'
import { integrationsLogic } from 'lib/integrations/integrationsLogic'
@@ -7,14 +8,98 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { IntegrationType } from '~/types'
-import type { azureBlobSetupModalLogicType } from './azureBlobSetupModalLogicType'
-
export interface AzureBlobSetupModalLogicProps {
isOpen: boolean
integration?: IntegrationType | null
onComplete: (integrationId?: number) => void
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface azureBlobSetupModalLogicValues {
+ azureBlobIntegration: {
+ connectionString: string
+ }
+ azureBlobIntegrationAllErrors: Record<string, any>
+ azureBlobIntegrationChanged: boolean
+ azureBlobIntegrationErrors: DeepPartialMap<
+ {
+ connectionString: string
+ },
+ ValidationErrorType
+ >
+ azureBlobIntegrationHasErrors: boolean
+ azureBlobIntegrationManualErrors: Record<string, any>
+ azureBlobIntegrationTouched: boolean
+ azureBlobIntegrationTouches: Record<string, boolean>
+ azureBlobIntegrationValidationErrors: DeepPartialMap<
+ {
+ connectionString: string
+ },
+ ValidationErrorType
+ >
+ isAzureBlobIntegrationSubmitting: boolean
+ isAzureBlobIntegrationValid: boolean
+ showAzureBlobIntegrationErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface azureBlobSetupModalLogicActions {
+ loadIntegrations: () => any // integrationsLogic
+ resetAzureBlobIntegration: (values?: { connectionString: string }) => {
+ values?: {
+ connectionString: string
+ }
+ }
+ setAzureBlobIntegrationManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setAzureBlobIntegrationValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setAzureBlobIntegrationValues: (
+ values: DeepPartial<{
+ connectionString: string
+ }>
+ ) => {
+ values: DeepPartial<{
+ connectionString: string
+ }>
+ }
+ submitAzureBlobIntegration: () => {
+ value: boolean
+ }
+ submitAzureBlobIntegrationFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitAzureBlobIntegrationRequest: (azureBlobIntegration: { connectionString: string }) => {
+ azureBlobIntegration: {
+ connectionString: string
+ }
+ }
+ submitAzureBlobIntegrationSuccess: (azureBlobIntegration: { connectionString: string }) => {
+ azureBlobIntegration: {
+ connectionString: string
+ }
+ }
+ touchAzureBlobIntegrationField: (key: string) => {
+ key: string
+ }
+}
+
+export type azureBlobSetupModalLogicType = MakeLogicType<
+ azureBlobSetupModalLogicValues,
+ azureBlobSetupModalLogicActions,
+ AzureBlobSetupModalLogicProps
+>
+
export const azureBlobSetupModalLogic = kea<azureBlobSetupModalLogicType>([
path(['integrations', 'azure-blob', 'azureBlobSetupModalLogic']),
props({} as AzureBlobSetupModalLogicProps),
diff --git a/frontend/src/scenes/integrations/databricks/databricksSetupModalLogic.ts b/frontend/src/scenes/integrations/databricks/databricksSetupModalLogic.ts
index 2f592398886c..e688bb09ceba 100644
--- a/frontend/src/scenes/integrations/databricks/databricksSetupModalLogic.ts
+++ b/frontend/src/scenes/integrations/databricks/databricksSetupModalLogic.ts
@@ -1,5 +1,6 @@
-import { connect, kea, path, props } from 'kea'
+import { MakeLogicType, connect, kea, path, props } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import api from 'lib/api'
import { integrationsLogic } from 'lib/integrations/integrationsLogic'
@@ -7,14 +8,122 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { IntegrationType } from '~/types'
-import type { databricksSetupModalLogicType } from './databricksSetupModalLogicType'
-
export interface DatabricksSetupModalLogicProps {
isOpen: boolean
integration?: IntegrationType | null
onComplete: (integrationId?: number) => void
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface databricksSetupModalLogicValues {
+ databricksIntegration: {
+ clientId: string
+ clientSecret: string
+ serverHostname: string
+ }
+ databricksIntegrationAllErrors: Record<string, any>
+ databricksIntegrationChanged: boolean
+ databricksIntegrationErrors: DeepPartialMap<
+ {
+ clientId: string
+ clientSecret: string
+ serverHostname: string
+ },
+ ValidationErrorType
+ >
+ databricksIntegrationHasErrors: boolean
+ databricksIntegrationManualErrors: Record<string, any>
+ databricksIntegrationTouched: boolean
+ databricksIntegrationTouches: Record<string, boolean>
+ databricksIntegrationValidationErrors: DeepPartialMap<
+ {
+ clientId: string
+ clientSecret: string
+ serverHostname: string
+ },
+ ValidationErrorType
+ >
+ isDatabricksIntegrationSubmitting: boolean
+ isDatabricksIntegrationValid: boolean
+ showDatabricksIntegrationErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface databricksSetupModalLogicActions {
+ loadIntegrations: () => any // integrationsLogic
+ resetDatabricksIntegration: (values?: { clientId: string; clientSecret: string; serverHostname: string }) => {
+ values?: {
+ clientId: string
+ clientSecret: string
+ serverHostname: string
+ }
+ }
+ setDatabricksIntegrationManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setDatabricksIntegrationValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setDatabricksIntegrationValues: (
+ values: DeepPartial<{
+ clientId: string
+ clientSecret: string
+ serverHostname: string
+ }>
+ ) => {
+ values: DeepPartial<{
+ clientId: string
+ clientSecret: string
+ serverHostname: string
+ }>
+ }
+ submitDatabricksIntegration: () => {
+ value: boolean
+ }
+ submitDatabricksIntegrationFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitDatabricksIntegrationRequest: (databricksIntegration: {
+ clientId: string
+ clientSecret: string
+ serverHostname: string
+ }) => {
+ databricksIntegration: {
+ clientId: string
+ clientSecret: string
+ serverHostname: string
+ }
+ }
+ submitDatabricksIntegrationSuccess: (databricksIntegration: {
+ clientId: string
+ clientSecret: string
+ serverHostname: string
+ }) => {
+ databricksIntegration: {
+ clientId: string
+ clientSecret: string
+ serverHostname: string
+ }
+ }
+ touchDatabricksIntegrationField: (key: string) => {
+ key: string
+ }
+}
+
+export type databricksSetupModalLogicType = MakeLogicType<
+ databricksSetupModalLogicValues,
+ databricksSetupModalLogicActions,
+ DatabricksSetupModalLogicProps
+>
+
export const databricksSetupModalLogic = kea<databricksSetupModalLogicType>([
path(['integrations', 'databricks', 'databricksSetupModalLogic']),
props({} as DatabricksSetupModalLogicProps),
diff --git a/frontend/src/scenes/integrations/gitlab/gitlabSetupModalLogic.ts b/frontend/src/scenes/integrations/gitlab/gitlabSetupModalLogic.ts
index 0c0f5c0af967..b3b97db065cd 100644
--- a/frontend/src/scenes/integrations/gitlab/gitlabSetupModalLogic.ts
+++ b/frontend/src/scenes/integrations/gitlab/gitlabSetupModalLogic.ts
@@ -1,17 +1,126 @@
-import { connect, kea, path, props } from 'kea'
+import { MakeLogicType, connect, kea, path, props } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import api from 'lib/api'
import { integrationsLogic } from 'lib/integrations/integrationsLogic'
import { lemonToast } from 'lib/lemon-ui/LemonToast'
-import type { gitlabSetupModalLogicType } from './gitlabSetupModalLogicType'
-
export interface GitLabSetupModalLogicProps {
isOpen: boolean
onComplete: (integrationId?: number) => void
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface gitlabSetupModalLogicValues {
+ gitlabIntegration: {
+ hostname: string
+ projectAccessToken: string
+ projectId: string
+ }
+ gitlabIntegrationAllErrors: Record<string, any>
+ gitlabIntegrationChanged: boolean
+ gitlabIntegrationErrors: DeepPartialMap<
+ {
+ hostname: string
+ projectAccessToken: string
+ projectId: string
+ },
+ ValidationErrorType
+ >
+ gitlabIntegrationHasErrors: boolean
+ gitlabIntegrationManualErrors: Record<string, any>
+ gitlabIntegrationTouched: boolean
+ gitlabIntegrationTouches: Record<string, boolean>
+ gitlabIntegrationValidationErrors: DeepPartialMap<
+ {
+ hostname: string
+ projectAccessToken: string
+ projectId: string
+ },
+ ValidationErrorType
+ >
+ isGitlabIntegrationSubmitting: boolean
+ isGitlabIntegrationValid: boolean
+ showGitlabIntegrationErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface gitlabSetupModalLogicActions {
+ loadIntegrations: () => any // integrationsLogic
+ resetGitlabIntegration: (values?: { hostname: string; projectAccessToken: string; projectId: string }) => {
+ values?: {
+ hostname: string
+ projectAccessToken: string
+ projectId: string
+ }
+ }
+ setGitlabIntegrationManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setGitlabIntegrationValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setGitlabIntegrationValues: (
+ values: DeepPartial<{
+ hostname: string
+ projectAccessToken: string
+ projectId: string
+ }>
+ ) => {
+ values: DeepPartial<{
+ hostname: string
+ projectAccessToken: string
+ projectId: string
+ }>
+ }
+ submitGitlabIntegration: () => {
+ value: boolean
+ }
+ submitGitlabIntegrationFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitGitlabIntegrationRequest: (gitlabIntegration: {
+ hostname: string
+ projectAccessToken: string
+ projectId: string
+ }) => {
+ gitlabIntegration: {
+ hostname: string
+ projectAccessToken: string
+ projectId: string
+ }
+ }
+ submitGitlabIntegrationSuccess: (gitlabIntegration: {
+ hostname: string
+ projectAccessToken: string
+ projectId: string
+ }) => {
+ gitlabIntegration: {
+ hostname: string
+ projectAccessToken: string
+ projectId: string
+ }
+ }
+ touchGitlabIntegrationField: (key: string) => {
+ key: string
+ }
+}
+
+export type gitlabSetupModalLogicType = MakeLogicType<
+ gitlabSetupModalLogicValues,
+ gitlabSetupModalLogicActions,
+ GitLabSetupModalLogicProps
+>
+
export const gitlabSetupModalLogic = kea<gitlabSetupModalLogicType>([
path(['integrations', 'gitlab', 'gitlabSetupModalLogic']),
props({} as GitLabSetupModalLogicProps),
diff --git a/frontend/src/scenes/integrations/google-cloud-service-account/googleCloudServiceAccountSetupModalLogic.ts b/frontend/src/scenes/integrations/google-cloud-service-account/googleCloudServiceAccountSetupModalLogic.ts
index c5b766ae6030..a55dc9a3431d 100644
--- a/frontend/src/scenes/integrations/google-cloud-service-account/googleCloudServiceAccountSetupModalLogic.ts
+++ b/frontend/src/scenes/integrations/google-cloud-service-account/googleCloudServiceAccountSetupModalLogic.ts
@@ -1,5 +1,6 @@
-import { actions, reducers, connect, listeners, kea, path, props } from 'kea'
+import { MakeLogicType, actions, reducers, connect, listeners, kea, path, props } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import api from 'lib/api'
import { integrationsLogic } from 'lib/integrations/integrationsLogic'
@@ -7,8 +8,6 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { IntegrationType } from '~/types'
-import type { googleCloudServiceAccountSetupModalLogicType } from './googleCloudServiceAccountSetupModalLogicType'
-
export type ServiceAccountMode = 'impersonated' | 'key_file'
export interface GoogleCloudServiceAccountSetupModalLogicProps {
@@ -17,6 +16,157 @@ export interface GoogleCloudServiceAccountSetupModalLogicProps {
onComplete: (integrationId?: number) => void
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface googleCloudServiceAccountSetupModalLogicValues {
+ googleCloudServiceAccountIntegration: {
+ jsonKeyFile: null
+ privateKey: string | null
+ privateKeyId: string | null
+ projectId: string
+ serviceAccountEmail: string
+ tokenUri: string | null
+ }
+ googleCloudServiceAccountIntegrationAllErrors: Record<string, any>
+ googleCloudServiceAccountIntegrationChanged: boolean
+ googleCloudServiceAccountIntegrationErrors: DeepPartialMap<
+ {
+ jsonKeyFile: null
+ privateKey: string | null
+ privateKeyId: string | null
+ projectId: string
+ serviceAccountEmail: string
+ tokenUri: string | null
+ },
+ ValidationErrorType
+ >
+ googleCloudServiceAccountIntegrationHasErrors: boolean
+ googleCloudServiceAccountIntegrationManualErrors: Record<string, any>
+ googleCloudServiceAccountIntegrationTouched: boolean
+ googleCloudServiceAccountIntegrationTouches: Record<string, boolean>
+ googleCloudServiceAccountIntegrationValidationErrors: DeepPartialMap<
+ {
+ jsonKeyFile: null
+ privateKey: string | null
+ privateKeyId: string | null
+ projectId: string
+ serviceAccountEmail: string
+ tokenUri: string | null
+ },
+ ValidationErrorType
+ >
+ isGoogleCloudServiceAccountIntegrationSubmitting: boolean
+ isGoogleCloudServiceAccountIntegrationValid: boolean
+ serviceAccountMode: ServiceAccountMode
+ showGoogleCloudServiceAccountIntegrationErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface googleCloudServiceAccountSetupModalLogicActions {
+ loadIntegrations: () => any // integrationsLogic
+ resetGoogleCloudServiceAccountIntegration: (values?: {
+ jsonKeyFile: null
+ privateKey: string | null
+ privateKeyId: string | null
+ projectId: string
+ serviceAccountEmail: string
+ tokenUri: string | null
+ }) => {
+ values?: {
+ jsonKeyFile: null
+ privateKey: string | null
+ privateKeyId: string | null
+ projectId: string
+ serviceAccountEmail: string
+ tokenUri: string | null
+ }
+ }
+ setGoogleCloudServiceAccountIntegrationManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setGoogleCloudServiceAccountIntegrationValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setGoogleCloudServiceAccountIntegrationValues: (
+ values: DeepPartial<{
+ jsonKeyFile: null
+ privateKey: string | null
+ privateKeyId: string | null
+ projectId: string
+ serviceAccountEmail: string
+ tokenUri: string | null
+ }>
+ ) => {
+ values: DeepPartial<{
+ jsonKeyFile: null
+ privateKey: string | null
+ privateKeyId: string | null
+ projectId: string
+ serviceAccountEmail: string
+ tokenUri: string | null
+ }>
+ }
+ setServiceAccountMode: (mode: ServiceAccountMode) => {
+ mode: ServiceAccountMode
+ }
+ submitGoogleCloudServiceAccountIntegration: () => {
+ value: boolean
+ }
+ submitGoogleCloudServiceAccountIntegrationFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitGoogleCloudServiceAccountIntegrationRequest: (googleCloudServiceAccountIntegration: {
+ jsonKeyFile: null
+ privateKey: string | null
+ privateKeyId: string | null
+ projectId: string
+ serviceAccountEmail: string
+ tokenUri: string | null
+ }) => {
+ googleCloudServiceAccountIntegration: {
+ jsonKeyFile: null
+ privateKey: string | null
+ privateKeyId: string | null
+ projectId: string
+ serviceAccountEmail: string
+ tokenUri: string | null
+ }
+ }
+ submitGoogleCloudServiceAccountIntegrationSuccess: (googleCloudServiceAccountIntegration: {
+ jsonKeyFile: null
+ privateKey: string | null
+ privateKeyId: string | null
+ projectId: string
+ serviceAccountEmail: string
+ tokenUri: string | null
+ }) => {
+ googleCloudServiceAccountIntegration: {
+ jsonKeyFile: null
+ privateKey: string | null
+ privateKeyId: string | null
+ projectId: string
+ serviceAccountEmail: string
+ tokenUri: string | null
+ }
+ }
+ touchGoogleCloudServiceAccountIntegrationField: (key: string) => {
+ key: string
+ }
+}
+
+export type googleCloudServiceAccountSetupModalLogicType = MakeLogicType<
+ googleCloudServiceAccountSetupModalLogicValues,
+ googleCloudServiceAccountSetupModalLogicActions,
+ GoogleCloudServiceAccountSetupModalLogicProps
+>
+
export const googleCloudServiceAccountSetupModalLogic = kea<googleCloudServiceAccountSetupModalLogicType>([
path(['integrations', 'googleCloudServiceAccount', 'googleCloudServiceAccountSetupModalLogic']),
props({} as GoogleCloudServiceAccountSetupModalLogicProps),
diff --git a/frontend/src/scenes/integrations/integrationsLandingSceneLogic.ts b/frontend/src/scenes/integrations/integrationsLandingSceneLogic.ts
index 0fccc95d14a5..62c98a597516 100644
--- a/frontend/src/scenes/integrations/integrationsLandingSceneLogic.ts
+++ b/frontend/src/scenes/integrations/integrationsLandingSceneLogic.ts
@@ -1,9 +1,35 @@
-import { actions, kea, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers, selectors } from 'kea'
import { urlToAction } from 'kea-router'
import { INTEGRATIONS_BY_SLUG } from './definitions'
import { Integration } from './integrationDefinition'
-import type { integrationsLandingSceneLogicType } from './integrationsLandingSceneLogicType'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface integrationsLandingSceneLogicValues {
+ integration: Integration | null
+ slug: string | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface integrationsLandingSceneLogicActions {
+ setSlug: (slug: string | null) => {
+ slug: string | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface integrationsLandingSceneLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ integration: (slug: string | null) => Integration | null
+ }
+}
+
+export type integrationsLandingSceneLogicType = MakeLogicType<
+ integrationsLandingSceneLogicValues,
+ integrationsLandingSceneLogicActions,
+ Record<string, any>,
+ integrationsLandingSceneLogicMeta
+>
export const integrationsLandingSceneLogic = kea<integrationsLandingSceneLogicType>([
path(['scenes', 'integrations', 'integrationsLandingSceneLogic']),
@@ -21,7 +47,7 @@ export const integrationsLandingSceneLogic = kea<integrationsLandingSceneLogicTy
selectors({
integration: [
(s) => [s.slug],
- (slug): Integration | null => (slug ? (INTEGRATIONS_BY_SLUG[slug] ?? null) : null),
+ (slug: string | null): Integration | null => (slug ? (INTEGRATIONS_BY_SLUG[slug] ?? null) : null),
],
}),
urlToAction(({ actions }) => ({
diff --git a/frontend/src/scenes/integrations/postgresql/postgreSQLSetupModalLogic.ts b/frontend/src/scenes/integrations/postgresql/postgreSQLSetupModalLogic.ts
index a77d2d2a4be7..e2a8a87a8221 100644
--- a/frontend/src/scenes/integrations/postgresql/postgreSQLSetupModalLogic.ts
+++ b/frontend/src/scenes/integrations/postgresql/postgreSQLSetupModalLogic.ts
@@ -1,5 +1,6 @@
-import { connect, kea, path, props } from 'kea'
+import { MakeLogicType, connect, kea, path, props } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import api from 'lib/api'
import { integrationsLogic } from 'lib/integrations/integrationsLogic'
@@ -7,14 +8,170 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast'
import type { IntegrationType } from '~/types'
-import type { postgreSQLSetupModalLogicType } from './postgreSQLSetupModalLogicType'
-
export interface PostgreSQLSetupModalLogicProps {
isOpen: boolean
integration?: IntegrationType | null
onComplete: (integrationId?: number) => void
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface postgreSQLSetupModalLogicValues {
+ isPostgreSQLIntegrationSubmitting: boolean
+ isPostgreSQLIntegrationValid: boolean
+ postgreSQLIntegration: {
+ host: string | null
+ password: string | null
+ port: number
+ ssl_mode: string
+ ssl_root_cert: string | null
+ use_system_ca: false
+ user: string | null
+ }
+ postgreSQLIntegrationAllErrors: Record<string, any>
+ postgreSQLIntegrationChanged: boolean
+ postgreSQLIntegrationErrors: DeepPartialMap<
+ {
+ host: string | null
+ password: string | null
+ port: number
+ ssl_mode: string
+ ssl_root_cert: string | null
+ use_system_ca: false
+ user: string | null
+ },
+ ValidationErrorType
+ >
+ postgreSQLIntegrationHasErrors: boolean
+ postgreSQLIntegrationManualErrors: Record<string, any>
+ postgreSQLIntegrationTouched: boolean
+ postgreSQLIntegrationTouches: Record<string, boolean>
+ postgreSQLIntegrationValidationErrors: DeepPartialMap<
+ {
+ host: string | null
+ password: string | null
+ port: number
+ ssl_mode: string
+ ssl_root_cert: string | null
+ use_system_ca: false
+ user: string | null
+ },
+ ValidationErrorType
+ >
+ showPostgreSQLIntegrationErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface postgreSQLSetupModalLogicActions {
+ loadIntegrations: () => any // integrationsLogic
+ resetPostgreSQLIntegration: (values?: {
+ host: string | null
+ password: string | null
+ port: number
+ ssl_mode: string
+ ssl_root_cert: string | null
+ use_system_ca: false
+ user: string | null
+ }) => {
+ values?: {
+ host: string | null
+ password: string | null
+ port: number
+ ssl_mode: string
+ ssl_root_cert: string | null
+ use_system_ca: false
+ user: string | null
+ }
+ }
+ setPostgreSQLIntegrationManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setPostgreSQLIntegrationValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setPostgreSQLIntegrationValues: (
+ values: DeepPartial<{
+ host: string | null
+ password: string | null
+ port: number
+ ssl_mode: string
+ ssl_root_cert: string | null
+ use_system_ca: false
+ user: string | null
+ }>
+ ) => {
+ values: DeepPartial<{
+ host: string | null
+ password: string | null
+ port: number
+ ssl_mode: string
+ ssl_root_cert: string | null
+ use_system_ca: false
+ user: string | null
+ }>
+ }
+ submitPostgreSQLIntegration: () => {
+ value: boolean
+ }
+ submitPostgreSQLIntegrationFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitPostgreSQLIntegrationRequest: (postgreSQLIntegration: {
+ host: string | null
+ password: string | null
+ port: number
+ ssl_mode: string
+ ssl_root_cert: string | null
+ use_system_ca: false
+ user: string | null
+ }) => {
+ postgreSQLIntegration: {
+ host: string | null
+ password: string | null
+ port: number
+ ssl_mode: string
+ ssl_root_cert: string | null
+ use_system_ca: false
+ user: string | null
+ }
+ }
+ submitPostgreSQLIntegrationSuccess: (postgreSQLIntegration: {
+ host: string | null
+ password: string | null
+ port: number
+ ssl_mode: string
+ ssl_root_cert: string | null
+ use_system_ca: false
+ user: string | null
+ }) => {
+ postgreSQLIntegration: {
+ host: string | null
+ password: string | null
+ port: number
+ ssl_mode: string
+ ssl_root_cert: string | null
+ use_system_ca: false
+ user: string | null
+ }
+ }
+ touchPostgreSQLIntegrationField: (key: string) => {
+ key: string
+ }
+}
+
+export type postgreSQLSetupModalLogicType = MakeLogicType<
+ postgreSQLSetupModalLogicValues,
+ postgreSQLSetupModalLogicActions,
+ PostgreSQLSetupModalLogicProps
+>
+
export const postgreSQLSetupModalLogic = kea<postgreSQLSetupModalLogicType>([
path(['integrations', 'postgreSQL', 'postgreSQLSetupModalLogic']),
props({} as PostgreSQLSetupModalLogicProps),
diff --git a/frontend/src/scenes/integrations/s3-compatible/s3CompatibleSetupModalLogic.ts b/frontend/src/scenes/integrations/s3-compatible/s3CompatibleSetupModalLogic.ts
index 468a55bbd83c..b631e1acd783 100644
--- a/frontend/src/scenes/integrations/s3-compatible/s3CompatibleSetupModalLogic.ts
+++ b/frontend/src/scenes/integrations/s3-compatible/s3CompatibleSetupModalLogic.ts
@@ -1,5 +1,6 @@
-import { connect, kea, path, props } from 'kea'
+import { MakeLogicType, connect, kea, path, props } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import api from 'lib/api'
import { integrationsLogic } from 'lib/integrations/integrationsLogic'
@@ -7,14 +8,137 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { IntegrationType } from '~/types'
-import type { s3CompatibleSetupModalLogicType } from './s3CompatibleSetupModalLogicType'
-
export interface S3CompatibleSetupModalLogicProps {
isOpen: boolean
integration?: IntegrationType | null
onComplete: (integrationId?: number) => void
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface s3CompatibleSetupModalLogicValues {
+ isS3CompatibleIntegrationSubmitting: boolean
+ isS3CompatibleIntegrationValid: boolean
+ s3CompatibleIntegration: {
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ endpointUrl: string
+ name: string
+ }
+ s3CompatibleIntegrationAllErrors: Record<string, any>
+ s3CompatibleIntegrationChanged: boolean
+ s3CompatibleIntegrationErrors: DeepPartialMap<
+ {
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ endpointUrl: string
+ name: string
+ },
+ ValidationErrorType
+ >
+ s3CompatibleIntegrationHasErrors: boolean
+ s3CompatibleIntegrationManualErrors: Record<string, any>
+ s3CompatibleIntegrationTouched: boolean
+ s3CompatibleIntegrationTouches: Record<string, boolean>
+ s3CompatibleIntegrationValidationErrors: DeepPartialMap<
+ {
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ endpointUrl: string
+ name: string
+ },
+ ValidationErrorType
+ >
+ showS3CompatibleIntegrationErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface s3CompatibleSetupModalLogicActions {
+ loadIntegrations: () => any // integrationsLogic
+ resetS3CompatibleIntegration: (values?: {
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ endpointUrl: string
+ name: string
+ }) => {
+ values?: {
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ endpointUrl: string
+ name: string
+ }
+ }
+ setS3CompatibleIntegrationManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setS3CompatibleIntegrationValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setS3CompatibleIntegrationValues: (
+ values: DeepPartial<{
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ endpointUrl: string
+ name: string
+ }>
+ ) => {
+ values: DeepPartial<{
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ endpointUrl: string
+ name: string
+ }>
+ }
+ submitS3CompatibleIntegration: () => {
+ value: boolean
+ }
+ submitS3CompatibleIntegrationFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitS3CompatibleIntegrationRequest: (s3CompatibleIntegration: {
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ endpointUrl: string
+ name: string
+ }) => {
+ s3CompatibleIntegration: {
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ endpointUrl: string
+ name: string
+ }
+ }
+ submitS3CompatibleIntegrationSuccess: (s3CompatibleIntegration: {
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ endpointUrl: string
+ name: string
+ }) => {
+ s3CompatibleIntegration: {
+ awsAccessKeyId: string
+ awsSecretAccessKey: string
+ endpointUrl: string
+ name: string
+ }
+ }
+ touchS3CompatibleIntegrationField: (key: string) => {
+ key: string
+ }
+}
+
+export type s3CompatibleSetupModalLogicType = MakeLogicType<
+ s3CompatibleSetupModalLogicValues,
+ s3CompatibleSetupModalLogicActions,
+ S3CompatibleSetupModalLogicProps
+>
+
export const s3CompatibleSetupModalLogic = kea<s3CompatibleSetupModalLogicType>([
path(['integrations', 's3-compatible', 's3CompatibleSetupModalLogic']),
props({} as S3CompatibleSetupModalLogicProps),
diff --git a/frontend/src/scenes/integrations/snowflake/snowflakeSetupModalLogic.ts b/frontend/src/scenes/integrations/snowflake/snowflakeSetupModalLogic.ts
index d218de6a8e86..3df8ba4456b7 100644
--- a/frontend/src/scenes/integrations/snowflake/snowflakeSetupModalLogic.ts
+++ b/frontend/src/scenes/integrations/snowflake/snowflakeSetupModalLogic.ts
@@ -1,5 +1,6 @@
-import { connect, kea, listeners, path, props } from 'kea'
+import { MakeLogicType, connect, kea, listeners, path, props } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import api from 'lib/api'
import { integrationsLogic } from 'lib/integrations/integrationsLogic'
@@ -7,14 +8,181 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { IntegrationType } from '~/types'
-import type { snowflakeSetupModalLogicType } from './snowflakeSetupModalLogicType'
-
export interface SnowflakeSetupModalLogicProps {
isOpen: boolean
integration?: IntegrationType | null
onComplete: (integrationId?: number) => void
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface snowflakeSetupModalLogicValues {
+ isSnowflakeIntegrationSubmitting: boolean
+ isSnowflakeIntegrationValid: boolean
+ showSnowflakeIntegrationErrors: boolean
+ snowflakeIntegration: {
+ account: string
+ authentication_type: string
+ name: string
+ password: string
+ private_key: string
+ private_key_file: File[] | null
+ private_key_passphrase: string
+ user: string
+ }
+ snowflakeIntegrationAllErrors: Record<string, any>
+ snowflakeIntegrationChanged: boolean
+ snowflakeIntegrationErrors: DeepPartialMap<
+ {
+ account: string
+ authentication_type: string
+ name: string
+ password: string
+ private_key: string
+ private_key_file: File[] | null
+ private_key_passphrase: string
+ user: string
+ },
+ ValidationErrorType
+ >
+ snowflakeIntegrationHasErrors: boolean
+ snowflakeIntegrationManualErrors: Record<string, any>
+ snowflakeIntegrationTouched: boolean
+ snowflakeIntegrationTouches: Record<string, boolean>
+ snowflakeIntegrationValidationErrors: DeepPartialMap<
+ {
+ account: string
+ authentication_type: string
+ name: string
+ password: string
+ private_key: string
+ private_key_file: File[] | null
+ private_key_passphrase: string
+ user: string
+ },
+ ValidationErrorType
+ >
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface snowflakeSetupModalLogicActions {
+ loadIntegrations: () => any // integrationsLogic
+ resetSnowflakeIntegration: (values?: {
+ account: string
+ authentication_type: string
+ name: string
+ password: string
+ private_key: string
+ private_key_file: File[] | null
+ private_key_passphrase: string
+ user: string
+ }) => {
+ values?: {
+ account: string
+ authentication_type: string
+ name: string
+ password: string
+ private_key: string
+ private_key_file: File[] | null
+ private_key_passphrase: string
+ user: string
+ }
+ }
+ setSnowflakeIntegrationManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setSnowflakeIntegrationValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setSnowflakeIntegrationValues: (
+ values: DeepPartial<{
+ account: string
+ authentication_type: string
+ name: string
+ password: string
+ private_key: string
+ private_key_file: File[] | null
+ private_key_passphrase: string
+ user: string
+ }>
+ ) => {
+ values: DeepPartial<{
+ account: string
+ authentication_type: string
+ name: string
+ password: string
+ private_key: string
+ private_key_file: File[] | null
+ private_key_passphrase: string
+ user: string
+ }>
+ }
+ submitSnowflakeIntegration: () => {
+ value: boolean
+ }
+ submitSnowflakeIntegrationFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitSnowflakeIntegrationRequest: (snowflakeIntegration: {
+ account: string
+ authentication_type: string
+ name: string
+ password: string
+ private_key: string
+ private_key_file: File[] | null
+ private_key_passphrase: string
+ user: string
+ }) => {
+ snowflakeIntegration: {
+ account: string
+ authentication_type: string
+ name: string
+ password: string
+ private_key: string
+ private_key_file: File[] | null
+ private_key_passphrase: string
+ user: string
+ }
+ }
+ submitSnowflakeIntegrationSuccess: (snowflakeIntegration: {
+ account: string
+ authentication_type: string
+ name: string
+ password: string
+ private_key: string
+ private_key_file: File[] | null
+ private_key_passphrase: string
+ user: string
+ }) => {
+ snowflakeIntegration: {
+ account: string
+ authentication_type: string
+ name: string
+ password: string
+ private_key: string
+ private_key_file: File[] | null
+ private_key_passphrase: string
+ user: string
+ }
+ }
+ touchSnowflakeIntegrationField: (key: string) => {
+ key: string
+ }
+}
+
+export type snowflakeSetupModalLogicType = MakeLogicType<
+ snowflakeSetupModalLogicValues,
+ snowflakeSetupModalLogicActions,
+ SnowflakeSetupModalLogicProps
+>
+
export const snowflakeSetupModalLogic = kea<snowflakeSetupModalLogicType>([
path(['integrations', 'snowflake', 'snowflakeSetupModalLogic']),
props({} as SnowflakeSetupModalLogicProps),
diff --git a/frontend/src/scenes/max/maxGlobalLogic.tsx b/frontend/src/scenes/max/maxGlobalLogic.tsx
index c3efe4b821de..ad7717aca7e3 100644
--- a/frontend/src/scenes/max/maxGlobalLogic.tsx
+++ b/frontend/src/scenes/max/maxGlobalLogic.tsx
@@ -125,7 +125,7 @@ export interface maxGlobalLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface maxGlobalLogicActions {
- acceptDataProcessing: (testOnlyOverride?: boolean) => {
+ acceptDataProcessing: (testOnlyOverride?: boolean | undefined) => {
testOnlyOverride: boolean | undefined
} // aiConsentLogic
dismissDataProcessing: () => {
@@ -157,7 +157,7 @@ export interface maxGlobalLogicActions {
} // router
openSidePanel: (
tab: SidePanelTab,
- options?: string
+ options?: string | undefined
) => {
options: string | undefined
tab: SidePanelTab
diff --git a/frontend/src/scenes/max/maxLogic.tsx b/frontend/src/scenes/max/maxLogic.tsx
index 7e345e9fc877..c9c1bbb161e6 100644
--- a/frontend/src/scenes/max/maxLogic.tsx
+++ b/frontend/src/scenes/max/maxLogic.tsx
@@ -359,18 +359,6 @@ export interface maxLogicMeta {
activeStreamingThreads: number
) => Breadcrumb[]
}
- __keaTypeGenInternalReducerActions: {
- 'open side panel (scenes.navigation.sidepanel.sidePanelStateLogic)': (
- tab: SidePanelTab,
- options?: string
- ) => {
- payload: {
- options: string | undefined
- tab: SidePanelTab
- }
- type: 'open side panel (scenes.navigation.sidepanel.sidePanelStateLogic)'
- }
- }
}
export type maxLogicType = MakeLogicType<maxLogicValues, maxLogicActions, MaxLogicProps, maxLogicMeta>
diff --git a/frontend/src/scenes/max/maxThreadLogic.tsx b/frontend/src/scenes/max/maxThreadLogic.tsx
index 8c66665961ce..0b88e9a6781e 100644
--- a/frontend/src/scenes/max/maxThreadLogic.tsx
+++ b/frontend/src/scenes/max/maxThreadLogic.tsx
@@ -284,7 +284,14 @@ export interface maxThreadLogicActions {
taskId: string
traceId?: string | undefined
} // runStreamLogic
- cancelSandboxRun: (run?: { runId: string; taskId: string }) => {
+ cancelSandboxRun: (
+ run?:
+ | {
+ runId: string
+ taskId: string
+ }
+ | undefined
+ ) => {
run:
| {
runId: string
@@ -300,7 +307,7 @@ export interface maxThreadLogicActions {
} // runStreamLogic
pushSandboxError: (
errorMessage: string,
- variant?: 'crash' | 'error'
+ variant?: 'crash' | 'error' | undefined
) => {
errorMessage: string
variant: 'crash' | 'error'
diff --git a/frontend/src/scenes/max/phaiSidePanelComposerSeedLogic.ts b/frontend/src/scenes/max/phaiSidePanelComposerSeedLogic.ts
index 8a41f8007ed5..fcceefd7d15b 100644
--- a/frontend/src/scenes/max/phaiSidePanelComposerSeedLogic.ts
+++ b/frontend/src/scenes/max/phaiSidePanelComposerSeedLogic.ts
@@ -51,18 +51,6 @@ export interface phaiSidePanelComposerSeedLogicActions {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface phaiSidePanelComposerSeedLogicMeta {
key: string
- __keaTypeGenInternalReducerActions: {
- 'open side panel (scenes.navigation.sidepanel.sidePanelStateLogic)': (
- tab: SidePanelTab,
- options?: string
- ) => {
- payload: {
- options: string | undefined
- tab: SidePanelTab
- }
- type: 'open side panel (scenes.navigation.sidepanel.sidePanelStateLogic)'
- }
- }
}
export type phaiSidePanelComposerSeedLogicType = MakeLogicType<
diff --git a/frontend/src/scenes/models/nodeDetailSceneLogic.ts b/frontend/src/scenes/models/nodeDetailSceneLogic.ts
index 0ad7f9462f56..e7d904f53f3f 100644
--- a/frontend/src/scenes/models/nodeDetailSceneLogic.ts
+++ b/frontend/src/scenes/models/nodeDetailSceneLogic.ts
@@ -45,16 +45,18 @@ export interface nodeDetailSceneLogicValues {
export interface nodeDetailSceneLogicActions {
updateDataWarehouseSavedQuerySuccess: (
dataWarehouseSavedQueries: DataWarehouseSavedQuery[],
- payload?: Partial<DataWarehouseSavedQuery> & {
- edited_history_id?: string
- folder_id?: string | null
- id: string
- lifecycle?: string
- shouldRematerialize?: boolean
- soft_update?: boolean
- sync_frequency?: string
- types?: string[][]
- }
+ payload?:
+ | (Partial<DataWarehouseSavedQuery> & {
+ edited_history_id?: string
+ folder_id?: string | null
+ id: string
+ lifecycle?: string
+ shouldRematerialize?: boolean
+ soft_update?: boolean
+ sync_frequency?: string
+ types?: string[][]
+ })
+ | undefined
) => {
dataWarehouseSavedQueries: DataWarehouseSavedQuery[]
payload?: Partial<DataWarehouseSavedQuery> & {
diff --git a/frontend/src/scenes/onboarding/legacy/error-tracking/onboardingErrorTrackingAlertsLogic.ts b/frontend/src/scenes/onboarding/legacy/error-tracking/onboardingErrorTrackingAlertsLogic.ts
index a13d5edcea64..944a3c4a0ea7 100644
--- a/frontend/src/scenes/onboarding/legacy/error-tracking/onboardingErrorTrackingAlertsLogic.ts
+++ b/frontend/src/scenes/onboarding/legacy/error-tracking/onboardingErrorTrackingAlertsLogic.ts
@@ -1,5 +1,6 @@
-import { actions, afterMount, connect, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, path, reducers } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { router } from 'kea-router'
import { lemonToast } from '@posthog/lemon-ui'
@@ -9,8 +10,8 @@ import { integrationsLogic } from 'lib/integrations/integrationsLogic'
import { HogFunctionConfigurationType } from '~/types'
+import type { IntegrationType } from '../../../../types'
import { onboardingLogic } from '../onboardingLogic'
-import type { onboardingErrorTrackingAlertsLogicType } from './onboardingErrorTrackingAlertsLogicType'
export type ErrorTrackingAlertIntegrationType = 'slack' | 'microsoft-teams' | 'discord'
@@ -59,6 +60,138 @@ const DEFAULT_SLACK_INPUTS: Record<string, any> = {
text: { value: 'New issue created: {event.properties.name}' },
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface onboardingErrorTrackingAlertsLogicValues {
+ slackAvailable: boolean | undefined // integrationsLogic
+ slackIntegrations: IntegrationType[] | undefined // integrationsLogic
+ connectionConfig: {
+ discordWebhookUrl: string | undefined
+ microsoftTeamsWebhookUrl: string | undefined
+ slackChannelId: string | undefined
+ slackWorkspaceId: number | undefined
+ }
+ connectionConfigAllErrors: Record<string, any>
+ connectionConfigChanged: boolean
+ connectionConfigErrors: DeepPartialMap<
+ {
+ discordWebhookUrl: string | undefined
+ microsoftTeamsWebhookUrl: string | undefined
+ slackChannelId: string | undefined
+ slackWorkspaceId: number | undefined
+ },
+ ValidationErrorType
+ >
+ connectionConfigHasErrors: boolean
+ connectionConfigManualErrors: Record<string, any>
+ connectionConfigTouched: boolean
+ connectionConfigTouches: Record<string, boolean>
+ connectionConfigValidationErrors: DeepPartialMap<
+ {
+ discordWebhookUrl: string | undefined
+ microsoftTeamsWebhookUrl: string | undefined
+ slackChannelId: string | undefined
+ slackWorkspaceId: number | undefined
+ },
+ ValidationErrorType
+ >
+ integration: ErrorTrackingAlertIntegrationType | null
+ isConnectionConfigSubmitting: boolean
+ isConnectionConfigValid: boolean
+ showConnectionConfigErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface onboardingErrorTrackingAlertsLogicActions {
+ goToNextStep: () => {
+ value: true
+ } // onboardingLogic
+ resetConnectionConfig: (values?: {
+ discordWebhookUrl: string | undefined
+ microsoftTeamsWebhookUrl: string | undefined
+ slackChannelId: string | undefined
+ slackWorkspaceId: number | undefined
+ }) => {
+ values?: {
+ discordWebhookUrl: string | undefined
+ microsoftTeamsWebhookUrl: string | undefined
+ slackChannelId: string | undefined
+ slackWorkspaceId: number | undefined
+ }
+ }
+ setConnectionConfigManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setConnectionConfigValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setConnectionConfigValues: (
+ values: DeepPartial<{
+ discordWebhookUrl: string | undefined
+ microsoftTeamsWebhookUrl: string | undefined
+ slackChannelId: string | undefined
+ slackWorkspaceId: number | undefined
+ }>
+ ) => {
+ values: DeepPartial<{
+ discordWebhookUrl: string | undefined
+ microsoftTeamsWebhookUrl: string | undefined
+ slackChannelId: string | undefined
+ slackWorkspaceId: number | undefined
+ }>
+ }
+ setIntegration: (integration: ErrorTrackingAlertIntegrationType | null) => {
+ integration: ErrorTrackingAlertIntegrationType | null
+ }
+ submitConnectionConfig: () => {
+ value: boolean
+ }
+ submitConnectionConfigFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitConnectionConfigRequest: (connectionConfig: {
+ discordWebhookUrl: string | undefined
+ microsoftTeamsWebhookUrl: string | undefined
+ slackChannelId: string | undefined
+ slackWorkspaceId: number | undefined
+ }) => {
+ connectionConfig: {
+ discordWebhookUrl: string | undefined
+ microsoftTeamsWebhookUrl: string | undefined
+ slackChannelId: string | undefined
+ slackWorkspaceId: number | undefined
+ }
+ }
+ submitConnectionConfigSuccess: (connectionConfig: {
+ discordWebhookUrl: string | undefined
+ microsoftTeamsWebhookUrl: string | undefined
+ slackChannelId: string | undefined
+ slackWorkspaceId: number | undefined
+ }) => {
+ connectionConfig: {
+ discordWebhookUrl: string | undefined
+ microsoftTeamsWebhookUrl: string | undefined
+ slackChannelId: string | undefined
+ slackWorkspaceId: number | undefined
+ }
+ }
+ touchConnectionConfigField: (key: string) => {
+ key: string
+ }
+}
+
+export type onboardingErrorTrackingAlertsLogicType = MakeLogicType<
+ onboardingErrorTrackingAlertsLogicValues,
+ onboardingErrorTrackingAlertsLogicActions
+>
+
export const onboardingErrorTrackingAlertsLogic = kea<onboardingErrorTrackingAlertsLogicType>([
path(['scenes', 'onboarding', 'error-tracking', 'onboardingErrorTrackingAlertsLogic']),
connect(() => ({
diff --git a/frontend/src/scenes/onboarding/legacy/error-tracking/source-maps/sourceMapsStepLogic.ts b/frontend/src/scenes/onboarding/legacy/error-tracking/source-maps/sourceMapsStepLogic.ts
index 87ddd22227e2..429b6832d7fd 100644
--- a/frontend/src/scenes/onboarding/legacy/error-tracking/source-maps/sourceMapsStepLogic.ts
+++ b/frontend/src/scenes/onboarding/legacy/error-tracking/source-maps/sourceMapsStepLogic.ts
@@ -1,13 +1,69 @@
-import { actions, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
import { ErrorTrackingSymbolSet } from 'lib/components/Errors/types'
-import type { sourceMapsStepLogicType } from './sourceMapsStepLogicType'
-
export type SourceMapOption = 'cli' | 'no-minification' | 'public-source-maps' | string
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sourceMapsStepLogicValues {
+ hasSourceMap: boolean
+ instructionsModalOpen: boolean
+ lastSymbolSet: ErrorTrackingSymbolSet | null
+ lastSymbolSetLoading: boolean
+ selectedOption: SourceMapOption | null
+ shouldShowContinue: boolean
+ shouldShowSourceMapStatus: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sourceMapsStepLogicActions {
+ loadLastSymbolSet: () => {
+ value: true
+ }
+ loadLastSymbolSetFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadLastSymbolSetSuccess: (
+ lastSymbolSet: ErrorTrackingSymbolSet,
+ payload?: {
+ value: true
+ }
+ ) => {
+ lastSymbolSet: ErrorTrackingSymbolSet
+ payload?: {
+ value: true
+ }
+ }
+ setInstructionsModalOpen: (open: boolean) => {
+ open: boolean
+ }
+ setSelectedOption: (option: SourceMapOption | null) => {
+ option: string | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sourceMapsStepLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ hasSourceMap: (lastSymbolSet: ErrorTrackingSymbolSet | null) => boolean
+ shouldShowContinue: (hasSourceMap: boolean, selectedOption: string | null) => boolean
+ shouldShowSourceMapStatus: (selectedOption: string | null) => boolean
+ }
+}
+
+export type sourceMapsStepLogicType = MakeLogicType<
+ sourceMapsStepLogicValues,
+ sourceMapsStepLogicActions,
+ Record<string, any>,
+ sourceMapsStepLogicMeta
+>
+
export const sourceMapsStepLogic = kea<sourceMapsStepLogicType>([
path(['scenes', 'onboarding', 'error-tracking', 'source-maps', 'sourceMapsStepLogic']),
diff --git a/frontend/src/scenes/onboarding/legacy/exit/onboardingExitLogic.ts b/frontend/src/scenes/onboarding/legacy/exit/onboardingExitLogic.ts
index 81a6fb7b734b..19c81b6c7c38 100644
--- a/frontend/src/scenes/onboarding/legacy/exit/onboardingExitLogic.ts
+++ b/frontend/src/scenes/onboarding/legacy/exit/onboardingExitLogic.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 { router } from 'kea-router'
import posthog from 'posthog-js'
@@ -10,8 +10,8 @@ import { userLogic } from 'scenes/userLogic'
import { invitesDelegateCreate } from '~/generated/core/api'
import { UserType } from '~/types'
+import type { OnboardingStepKey } from '../../../../types'
import { onboardingLogic } from '../onboardingLogic'
-import type { onboardingExitLogicType } from './onboardingExitLogicType'
const isValidEmail = (email: string): boolean => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email.trim())
@@ -57,6 +57,74 @@ function extractErrorDetail(error: unknown, fallback: string): string {
return err.message || fallback
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface onboardingExitLogicValues {
+ currentStepKey: OnboardingStepKey | null // onboardingLogic
+ onCompleteOnboardingRedirectUrl: string // onboardingLogic
+ currentOrganizationId: string // organizationLogic
+ canSubmitDelegation: boolean
+ isExitModalOpen: boolean
+ isSubmitting: boolean
+ message: string
+ orgIdAtOpen: string | null
+ targetEmail: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface onboardingExitLogicActions {
+ loadUser: (resetOnFailure?: boolean | undefined) => {
+ resetOnFailure: boolean | undefined
+ } // userLogic
+ loadUserSuccess: (
+ user: UserType | null,
+ payload?:
+ | {
+ resetOnFailure: boolean | undefined
+ }
+ | undefined
+ ) => {
+ payload?: {
+ resetOnFailure: boolean | undefined
+ }
+ user: UserType | null
+ } // userLogic
+ captureOrgIdAtOpen: (orgId: string | null) => {
+ orgId: string | null
+ }
+ closeExitModal: () => {
+ value: true
+ }
+ openExitModal: () => {
+ value: true
+ }
+ setIsSubmitting: (isSubmitting: boolean) => {
+ isSubmitting: boolean
+ }
+ setMessage: (message: string) => {
+ message: string
+ }
+ setTargetEmail: (targetEmail: string) => {
+ targetEmail: string
+ }
+ submitDelegation: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface onboardingExitLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ canSubmitDelegation: (targetEmail: string) => boolean
+ }
+}
+
+export type onboardingExitLogicType = MakeLogicType<
+ onboardingExitLogicValues,
+ onboardingExitLogicActions,
+ Record<string, any>,
+ onboardingExitLogicMeta
+>
+
export const onboardingExitLogic = kea<onboardingExitLogicType>([
path(['scenes', 'onboarding', 'onboardingExitLogic']),
connect(() => ({
diff --git a/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsx b/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsx
index 9bc0192cc1e3..4f7cd09e9223 100644
--- a/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsx
+++ b/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsx
@@ -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 { actionToUrl, router, urlToAction } from 'kea-router'
import { lemonToast } from '@posthog/lemon-ui'
@@ -25,9 +25,19 @@ import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePane
import { ProductKey } from '~/queries/schema/schema-general'
import { Breadcrumb, OnboardingProduct, OnboardingStepKey } from '~/types'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type {
+ BillingProductV2Type,
+ BillingType,
+ OrganizationType,
+ PreflightStatus,
+ SidePanelTab,
+ TeamPublicType,
+ TeamType,
+ UserType,
+} from '../../../types'
import { onboardingEventUsageLogic } from '../onboardingEventUsageLogic'
import { arraysEqual, parseProductsParam, stepKeyToTitle } from './onboardingFlowUtils'
-import type { onboardingLogicType } from './onboardingLogicType'
import { appendSharedTrailingSteps } from './sharedSteps'
import { onboardingProviderRegistry } from './stepProviderRegistry'
import { type OnboardingFlowContext, type OnboardingStepDescriptor } from './types'
@@ -41,6 +51,183 @@ export interface OnboardingLogicProps {
onCompleteOnboarding?: (key: ProductKey) => void
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface onboardingLogicValues {
+ billing: BillingType | null // billingLogic
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ receivedFeatureFlags: boolean // featureFlagLogic
+ currentOrganization: OrganizationType | null // organizationLogic
+ isCloudOrDev: boolean | undefined // preflightLogic
+ preflight: PreflightStatus | null // preflightLogic
+ modalMode: boolean // sidePanelStateLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ user: UserType | null // userLogic
+ billingProduct: BillingProductV2Type | null
+ breadcrumbs: Breadcrumb[]
+ canInviteTeammates: boolean
+ currentFlowStep: OnboardingStepDescriptor | null
+ currentStepKey: OnboardingStepKey | null
+ currentStepProductKey: ProductKey | null
+ flow: OnboardingStepDescriptor[]
+ flowIndex: number
+ hasNextStep: boolean
+ hasPreviousStep: boolean
+ isCompleting: boolean
+ onCompleteOnboardingRedirectUrl: string
+ onCompleteOnboardingRedirectUrlOverride: string | null
+ onboardingFlowVariant: string
+ onboardingStepKeys: OnboardingStepKey[]
+ product: OnboardingProduct | null
+ productKey: ProductKey | null
+ secondaryProductKeys: ProductKey[]
+ shouldShowBillingStep: boolean
+ stepId: string
+ subscribedDuringOnboarding: boolean
+ totalOnboardingSteps: number
+ visitedStepIds: string[]
+ waitForBilling: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface onboardingLogicActions {
+ loadBillingSuccess: (
+ billing: BillingType,
+ payload?: any
+ ) => {
+ billing: BillingType
+ payload?: any
+ } // billingLogic
+ openGlobalSetup: () => {
+ value: true
+ } // globalSetupLogic
+ reportContextOnboardingCompleted: (productKey: string) => {
+ productKey: string
+ } // onboardingEventUsageLogic
+ openSidePanel: (
+ tab: SidePanelTab,
+ options?: string | undefined
+ ) => {
+ options: string | undefined
+ tab: SidePanelTab
+ } // sidePanelStateLogic
+ recordProductIntentOnboardingComplete: (args_0: { product_type: ProductKey }) => {
+ product_type: ProductKey
+ } // teamLogic
+ updateCurrentTeam: (payload: Partial<TeamType>) => Partial<TeamType> // teamLogic
+ updateCurrentTeamSuccess: (
+ currentTeam: TeamPublicType | TeamType,
+ payload?: Partial<TeamType> | undefined
+ ) => {
+ currentTeam: TeamPublicType | TeamType
+ payload?: Partial<TeamType>
+ } // teamLogic
+ clearProductKey: () => {
+ value: true
+ }
+ completeContextOnboarding: () => {
+ value: true
+ }
+ completeOnboarding: (options?: { redirectUrlOverride?: string }) => {
+ redirectUrlOverride: string | undefined
+ }
+ goToNextStep: () => {
+ value: true
+ }
+ goToPreviousStep: () => {
+ value: true
+ }
+ markStepsVisited: (stepIds: string[]) => {
+ stepIds: string[]
+ }
+ resetOnboardingFlowState: () => {
+ value: true
+ }
+ setIsCompleting: (isCompleting: boolean) => {
+ isCompleting: boolean
+ }
+ setOnCompleteOnboardingRedirectUrl: (url: string | null) => {
+ url: string | null
+ }
+ setProduct: (product: OnboardingProduct | null) => {
+ product: OnboardingProduct | null
+ }
+ setProductKey: (productKey: ProductKey | null) => {
+ productKey: ProductKey | null
+ }
+ setSecondaryProductKeys: (keys: ProductKey[]) => {
+ keys: ProductKey[]
+ }
+ setStepId: (stepId: string) => {
+ stepId: string
+ }
+ setSubscribedDuringOnboarding: (subscribedDuringOnboarding: boolean) => {
+ subscribedDuringOnboarding: boolean
+ }
+ setTeamPropertiesForProduct: (productKey: ProductKey) => {
+ productKey: ProductKey
+ }
+ setWaitForBilling: (waitForBilling: boolean) => {
+ waitForBilling: boolean
+ }
+ skipOnboarding: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface onboardingLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ onboardingFlowVariant: (featureFlags: FeatureFlagsSet) => string
+ canInviteTeammates: (currentOrganization: OrganizationType | null, user: UserType | null) => boolean
+ billingProduct: (billing: BillingType | null, productKey: ProductKey | null) => BillingProductV2Type | null
+ shouldShowBillingStep: (
+ subscribedDuringOnboarding: boolean,
+ isCloudOrDev: boolean | undefined,
+ billing: BillingType | null,
+ billingProduct: BillingProductV2Type | null,
+ stepId: string
+ ) => boolean
+ flow: (
+ productKey: ProductKey | null,
+ secondaryProductKeys: ProductKey[],
+ currentTeam: TeamPublicType | TeamType | null,
+ billing: BillingType | null,
+ billingProduct: BillingProductV2Type | null,
+ shouldShowBillingStep: boolean,
+ isCloudOrDev: boolean | undefined,
+ subscribedDuringOnboarding: boolean,
+ canInviteTeammates: boolean
+ ) => OnboardingStepDescriptor[]
+ onboardingStepKeys: (flow: OnboardingStepDescriptor[]) => OnboardingStepKey[]
+ currentFlowStep: (flow: OnboardingStepDescriptor[], stepId: string) => OnboardingStepDescriptor | null
+ flowIndex: (flow: OnboardingStepDescriptor[], currentFlowStep: OnboardingStepDescriptor | null) => number
+ currentStepKey: (currentFlowStep: OnboardingStepDescriptor | null) => OnboardingStepKey | null
+ currentStepProductKey: (
+ currentFlowStep: OnboardingStepDescriptor | null,
+ productKey: ProductKey | null
+ ) => ProductKey | null
+ totalOnboardingSteps: (flow: OnboardingStepDescriptor[]) => number
+ hasNextStep: (flow: OnboardingStepDescriptor[], flowIndex: number) => boolean
+ hasPreviousStep: (flowIndex: number) => boolean
+ breadcrumbs: (
+ productKey: ProductKey | null,
+ currentFlowStep: OnboardingStepDescriptor | null,
+ secondaryProductKeys: ProductKey[]
+ ) => Breadcrumb[]
+ onCompleteOnboardingRedirectUrl: (
+ productKey: ProductKey | null,
+ onCompleteOnboardingRedirectUrlOverride: string | null
+ ) => string
+ }
+}
+
+export type onboardingLogicType = MakeLogicType<
+ onboardingLogicValues,
+ onboardingLogicActions,
+ OnboardingLogicProps,
+ onboardingLogicMeta
+>
+
export const onboardingLogic = kea<onboardingLogicType>([
props({} as OnboardingLogicProps),
path(['scenes', 'onboarding', 'onboardingLogic']),
@@ -177,11 +364,15 @@ export const onboardingLogic = kea<onboardingLogicType>([
selectors({
onboardingFlowVariant: [
(s) => [s.featureFlags],
- (featureFlags): string => resolveOnboardingFlowVariant(featureFlags),
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet): string =>
+ resolveOnboardingFlowVariant(featureFlags),
],
canInviteTeammates: [
(s) => [s.currentOrganization, s.user],
- (currentOrganization, user): boolean => {
+ (
+ currentOrganization: null | import('~/types').OrganizationType,
+ user: null | import('~/types').UserType
+ ): boolean => {
if (currentOrganization?.members_can_invite) {
return true
}
@@ -191,11 +382,18 @@ export const onboardingLogic = kea<onboardingLogicType>([
],
billingProduct: [
(s) => [s.billing, s.productKey],
- (billing, productKey) => billing?.products?.find((p) => p.type === productKey) ?? null,
+ (billing: null | import('~/types').BillingType, productKey: ProductKey | null) =>
+ billing?.products?.find((p) => p.type === productKey) ?? null,
],
shouldShowBillingStep: [
(s) => [s.subscribedDuringOnboarding, s.isCloudOrDev, s.billing, s.billingProduct, s.stepId],
- (subscribedDuringOnboarding, isCloudOrDev, billing, billingProduct, stepId): boolean => {
+ (
+ subscribedDuringOnboarding: boolean,
+ isCloudOrDev: boolean | undefined,
+ billing: null | import('~/types').BillingType,
+ billingProduct: null | import('~/types').BillingProductV2Type,
+ stepId: string
+ ): boolean => {
if (!isCloudOrDev || !billing?.products || !billingProduct) {
return false
}
@@ -225,15 +423,15 @@ export const onboardingLogic = kea<onboardingLogicType>([
s.canInviteTeammates,
],
(
- primary,
- secondaries,
- currentTeam,
- billing,
- billingProduct,
- shouldShowBilling,
- isCloudOrDev,
- subscribedDuringOnboarding,
- canInviteTeammates
+ primary: ProductKey | null,
+ secondaries: ProductKey[],
+ currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType,
+ billing: null | import('~/types').BillingType,
+ billingProduct: null | import('~/types').BillingProductV2Type,
+ shouldShowBilling: boolean,
+ isCloudOrDev: boolean | undefined,
+ subscribedDuringOnboarding: boolean,
+ canInviteTeammates: boolean
): OnboardingStepDescriptor[] => {
if (!primary) {
return []
@@ -343,7 +541,7 @@ export const onboardingLogic = kea<onboardingLogicType>([
],
currentFlowStep: [
(s) => [s.flow, s.stepId],
- (flow: OnboardingStepDescriptor[], stepId): OnboardingStepDescriptor | null => {
+ (flow: OnboardingStepDescriptor[], stepId: string): OnboardingStepDescriptor | null => {
if (!flow.length) {
// If the user explicitly asked for a step (URL has `?step=...`) but the
// flow hasn't been built yet (billing/team still loading), we MUST NOT
@@ -377,26 +575,33 @@ export const onboardingLogic = kea<onboardingLogicType>([
],
flowIndex: [
(s) => [s.flow, s.currentFlowStep],
- (flow, currentFlowStep): number =>
+ (flow: OnboardingStepDescriptor[], currentFlowStep: OnboardingStepDescriptor | null): number =>
currentFlowStep ? flow.findIndex((step) => step.id === currentFlowStep.id) : -1,
],
currentStepKey: [
(s) => [s.currentFlowStep],
- (currentFlowStep): OnboardingStepKey | null => currentFlowStep?.stepKey ?? null,
+ (currentFlowStep: OnboardingStepDescriptor | null): OnboardingStepKey | null =>
+ currentFlowStep?.stepKey ?? null,
],
currentStepProductKey: [
(s) => [s.currentFlowStep, s.productKey],
- (currentFlowStep, productKey): ProductKey | null => currentFlowStep?.productKey ?? productKey,
+ (currentFlowStep: OnboardingStepDescriptor | null, productKey: ProductKey | null): ProductKey | null =>
+ currentFlowStep?.productKey ?? productKey,
],
- totalOnboardingSteps: [(s) => [s.flow], (flow) => flow.length],
+ totalOnboardingSteps: [(s) => [s.flow], (flow: OnboardingStepDescriptor[]) => flow.length],
hasNextStep: [
(s) => [s.flow, s.flowIndex],
- (flow, flowIndex): boolean => flowIndex >= 0 && flowIndex < flow.length - 1,
+ (flow: OnboardingStepDescriptor[], flowIndex: number): boolean =>
+ flowIndex >= 0 && flowIndex < flow.length - 1,
],
- hasPreviousStep: [(s) => [s.flowIndex], (flowIndex): boolean => flowIndex > 0],
+ hasPreviousStep: [(s) => [s.flowIndex], (flowIndex: number): boolean => flowIndex > 0],
breadcrumbs: [
(s) => [s.productKey, s.currentFlowStep, s.secondaryProductKeys],
- (productKey, currentFlowStep, secondaryProductKeys): Breadcrumb[] => {
+ (
+ productKey: ProductKey | null,
+ currentFlowStep: OnboardingStepDescriptor | null,
+ secondaryProductKeys: ProductKey[]
+ ): Breadcrumb[] => {
const stepName = stepKeyToTitle(currentFlowStep?.stepKey ?? undefined)
return [
{
diff --git a/frontend/src/scenes/onboarding/legacy/onboardingProductConfigurationLogic.ts b/frontend/src/scenes/onboarding/legacy/onboardingProductConfigurationLogic.ts
index 01e5c1ed582b..ad35ff9ff335 100644
--- a/frontend/src/scenes/onboarding/legacy/onboardingProductConfigurationLogic.ts
+++ b/frontend/src/scenes/onboarding/legacy/onboardingProductConfigurationLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers } from 'kea'
import { LemonSelectOptions } from '@posthog/lemon-ui'
@@ -6,8 +6,6 @@ import { teamLogic } from 'scenes/teamLogic'
import { TeamType } from '~/types'
-import type { onboardingProductConfigurationLogicType } from './onboardingProductConfigurationLogicType'
-
export interface ProductConfigOptionBase {
title: string
description: string
@@ -33,6 +31,27 @@ export interface ProductConfigurationSelect extends ProductConfigOptionBase {
export type ProductConfigOption = ProductConfigurationToggle | ProductConfigurationSelect
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface onboardingProductConfigurationLogicValues {
+ configOptions: any[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface onboardingProductConfigurationLogicActions {
+ updateCurrentTeam: (payload: Partial<TeamType>) => Partial<TeamType> // teamLogic
+ saveConfiguration: () => {
+ value: true
+ }
+ setConfigOptions: (configOptions: ProductConfigOption[]) => {
+ configOptions: ProductConfigOption[]
+ }
+}
+
+export type onboardingProductConfigurationLogicType = MakeLogicType<
+ onboardingProductConfigurationLogicValues,
+ onboardingProductConfigurationLogicActions
+>
+
export const onboardingProductConfigurationLogic = kea<onboardingProductConfigurationLogicType>([
path(() => ['scenes', 'onboarding', 'onboardingProductConfigurationLogic']),
connect(() => ({
diff --git a/frontend/src/scenes/onboarding/legacy/productSelection/productSelectionLogic.ts b/frontend/src/scenes/onboarding/legacy/productSelection/productSelectionLogic.ts
index 2771020f6a62..d6788adb6615 100644
--- a/frontend/src/scenes/onboarding/legacy/productSelection/productSelectionLogic.ts
+++ b/frontend/src/scenes/onboarding/legacy/productSelection/productSelectionLogic.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 { router } from 'kea-router'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
@@ -16,16 +16,139 @@ import { urls } from 'scenes/urls'
import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
import { OnboardingStepKey } from '~/types'
+import type { ProductIntentProperties } from '../../../../lib/utils/product-intents'
+import type { TeamPublicType, TeamType } from '../../../../types'
+import type { UseCaseDefinition } from '../productRecommendations'
import {
getBrowsingHistoryFromPostHog,
getBrowsingHistoryLabels,
mapBrowsingHistoryToProducts,
} from './browsingHistoryMapping'
-import type { productSelectionLogicType } from './productSelectionLogicType'
export type OnboardingStep = 'choose_path' | 'product_selection'
export type RecommendationSource = 'use_case' | 'browsing_history' | 'manual' | 'simplified' | 'multiproduct'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface productSelectionLogicValues {
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ browsingHistory: string[]
+ browsingHistoryLabels: string[]
+ browsingHistoryProducts: ProductKey[]
+ canContinue: boolean
+ currentStep: OnboardingStep
+ firstProductOnboarding: ProductKey | null
+ hasBrowsingHistory: boolean
+ otherProducts: ProductKey[]
+ recommendationSource: RecommendationSource
+ recommendationSourceLabel: string
+ recommendedProducts: ProductKey[]
+ selectedProducts: ProductKey[]
+ selectedUseCase: UseCaseOption | null
+ showAllProducts: boolean
+ useCaseProducts: ProductKey[]
+ useCases: readonly UseCaseDefinition[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface productSelectionLogicActions {
+ reportOnboardingProductSelectionPath: (
+ path: 'ai' | 'browsing_history' | 'manual' | 'use_case',
+ properties?:
+ | {
+ hasBrowsingHistory?: boolean
+ recommendedProducts?: string[]
+ useCase?: string
+ }
+ | undefined
+ ) => {
+ path: 'ai' | 'browsing_history' | 'manual' | 'use_case'
+ properties:
+ | {
+ hasBrowsingHistory?: boolean | undefined
+ recommendedProducts?: string[] | undefined
+ useCase?: string | undefined
+ }
+ | undefined
+ } // eventUsageLogic
+ reportOnboardingProductToggled: (
+ productKey: string,
+ selected: boolean,
+ recommendationSource: string
+ ) => {
+ productKey: string
+ recommendationSource: string
+ selected: boolean
+ } // eventUsageLogic
+ reportOnboardingStarted: (entrypoint: string) => {
+ entrypoint: string
+ } // eventUsageLogic
+ setOnCompleteOnboardingRedirectUrl: (url: string | null) => {
+ url: string | null
+ } // onboardingLogic
+ addProductIntent: (properties: ProductIntentProperties) => ProductIntentProperties // teamLogic
+ clearUseCase: () => {
+ value: true
+ }
+ handleStartOnboarding: () => {
+ value: true
+ }
+ selectPickMyself: () => {
+ value: true
+ }
+ selectSingleProduct: (productKey: ProductKey) => {
+ productKey: ProductKey
+ }
+ selectUseCase: (useCase: UseCaseOption) => {
+ useCase: UseCaseOption
+ }
+ setBrowsingHistory: (browsingHistory: string[]) => {
+ browsingHistory: string[]
+ }
+ setFirstProductOnboarding: (productKey: ProductKey | null) => {
+ productKey: ProductKey | null
+ }
+ setRecommendationSource: (source: RecommendationSource) => {
+ source: RecommendationSource
+ }
+ setSelectedProducts: (productKeys: ProductKey[]) => {
+ productKeys: ProductKey[]
+ }
+ setShowAllProducts: (show: boolean) => {
+ show: boolean
+ }
+ setStep: (step: OnboardingStep) => {
+ step: OnboardingStep
+ }
+ toggleProduct: (productKey: ProductKey) => {
+ productKey: ProductKey
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface productSelectionLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ browsingHistoryProducts: (browsingHistory: string[]) => ProductKey[]
+ browsingHistoryLabels: (browsingHistory: string[]) => string[]
+ hasBrowsingHistory: (browsingHistory: string[]) => boolean
+ useCaseProducts: (selectedUseCase: UseCaseOption | null) => ProductKey[]
+ recommendedProducts: (
+ recommendationSource: RecommendationSource,
+ browsingHistoryProducts: ProductKey[],
+ useCaseProducts: ProductKey[]
+ ) => ProductKey[]
+ otherProducts: (recommendedProducts: ProductKey[]) => ProductKey[]
+ canContinue: (selectedProducts: ProductKey[]) => boolean
+ recommendationSourceLabel: (recommendationSource: RecommendationSource) => string
+ }
+}
+
+export type productSelectionLogicType = MakeLogicType<
+ productSelectionLogicValues,
+ productSelectionLogicActions,
+ Record<string, any>,
+ productSelectionLogicMeta
+>
+
export const productSelectionLogic = kea<productSelectionLogicType>([
path(['scenes', 'onboarding', 'productSelection', 'productSelectionLogic']),
@@ -129,19 +252,22 @@ export const productSelectionLogic = kea<productSelectionLogicType>([
selectors({
browsingHistoryProducts: [
(s) => [s.browsingHistory],
- (browsingHistory): ProductKey[] => mapBrowsingHistoryToProducts(browsingHistory),
+ (browsingHistory: string[]): ProductKey[] => mapBrowsingHistoryToProducts(browsingHistory),
],
browsingHistoryLabels: [
(s) => [s.browsingHistory],
- (browsingHistory): string[] => getBrowsingHistoryLabels(browsingHistory),
+ (browsingHistory: string[]): string[] => getBrowsingHistoryLabels(browsingHistory),
],
- hasBrowsingHistory: [(s) => [s.browsingHistory], (browsingHistory): boolean => browsingHistory.length > 0],
+ hasBrowsingHistory: [
+ (s) => [s.browsingHistory],
+ (browsingHistory: string[]): boolean => browsingHistory.length > 0,
+ ],
useCaseProducts: [
(s) => [s.selectedUseCase],
- (selectedUseCase): ProductKey[] => {
+ (selectedUseCase: UseCaseOption | null): ProductKey[] => {
if (!selectedUseCase) {
return []
}
@@ -151,7 +277,11 @@ export const productSelectionLogic = kea<productSelectionLogicType>([
recommendedProducts: [
(s) => [s.recommendationSource, s.browsingHistoryProducts, s.useCaseProducts],
- (source, browsingProducts, useCaseProducts): ProductKey[] => {
+ (
+ source: RecommendationSource,
+ browsingProducts: ProductKey[],
+ useCaseProducts: ProductKey[]
+ ): ProductKey[] => {
switch (source) {
case 'use_case':
return [...new Set([...useCaseProducts, ...browsingProducts])]
@@ -165,7 +295,7 @@ export const productSelectionLogic = kea<productSelectionLogicType>([
otherProducts: [
(s) => [s.recommendedProducts],
- (recommendedProducts): ProductKey[] => {
+ (recommendedProducts: ProductKey[]): ProductKey[] => {
const allProducts = Object.keys(availableOnboardingProducts) as ProductKey[]
return allProducts.filter((p) => !recommendedProducts.includes(p))
},
@@ -173,11 +303,14 @@ export const productSelectionLogic = kea<productSelectionLogicType>([
useCases: [() => [], () => USE_CASE_OPTIONS],
- canContinue: [(s) => [s.selectedProducts], (selectedProducts): boolean => selectedProducts.length > 0],
+ canContinue: [
+ (s) => [s.selectedProducts],
+ (selectedProducts: ProductKey[]): boolean => selectedProducts.length > 0,
+ ],
recommendationSourceLabel: [
(s) => [s.recommendationSource],
- (source): string => {
+ (source: RecommendationSource): string => {
switch (source) {
case 'use_case':
return 'based on your goal'
diff --git a/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/wizardInstallStepLogic.ts b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/wizardInstallStepLogic.ts
index 1ba7379a59fa..b61eabf803a9 100644
--- a/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/wizardInstallStepLogic.ts
+++ b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/wizardInstallStepLogic.ts
@@ -1,6 +1,22 @@
-import { actions, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
-import type { wizardInstallStepLogicType } from './wizardInstallStepLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface wizardInstallStepLogicValues {
+ manualModalOpen: boolean
+ sdkInstructionsOpen: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface wizardInstallStepLogicActions {
+ setManualModalOpen: (open: boolean) => {
+ open: boolean
+ }
+ setSdkInstructionsOpen: (open: boolean) => {
+ open: boolean
+ }
+}
+
+export type wizardInstallStepLogicType = MakeLogicType<wizardInstallStepLogicValues, wizardInstallStepLogicActions>
export const wizardInstallStepLogic = kea<wizardInstallStepLogicType>([
path(['scenes', 'onboarding', 'wizardInstallStepLogic']),
diff --git a/frontend/src/scenes/onboarding/legacy/sdks/sdk-install-instructions/nextJsInstructionsLogic.ts b/frontend/src/scenes/onboarding/legacy/sdks/sdk-install-instructions/nextJsInstructionsLogic.ts
index a2a3eb62187d..21b19af15f07 100644
--- a/frontend/src/scenes/onboarding/legacy/sdks/sdk-install-instructions/nextJsInstructionsLogic.ts
+++ b/frontend/src/scenes/onboarding/legacy/sdks/sdk-install-instructions/nextJsInstructionsLogic.ts
@@ -1,6 +1,4 @@
-import { actions, kea, path, reducers } from 'kea'
-
-import type { nextJsInstructionsLogicType } from './nextJsInstructionsLogicType'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
export type NextJSRouter = 'instrumentation-client' | 'app' | 'pages'
@@ -8,6 +6,20 @@ export interface NextJsInstructionsLogicProps {
initialRouter?: NextJSRouter
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface nextJsInstructionsLogicValues {
+ nextJsRouter: NextJSRouter
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface nextJsInstructionsLogicActions {
+ setNextJsRouter: (router: any) => {
+ router: any
+ }
+}
+
+export type nextJsInstructionsLogicType = MakeLogicType<nextJsInstructionsLogicValues, nextJsInstructionsLogicActions>
+
export const nextJsInstructionsLogic = kea<nextJsInstructionsLogicType>([
path(['scenes', 'onboarding', 'sdks', 'nextJsInstructionsLogic']),
actions({
diff --git a/frontend/src/scenes/onboarding/legacy/sdks/sdksLogic.tsx b/frontend/src/scenes/onboarding/legacy/sdks/sdksLogic.tsx
index e59d39db05a9..05a3d7eadca5 100644
--- a/frontend/src/scenes/onboarding/legacy/sdks/sdksLogic.tsx
+++ b/frontend/src/scenes/onboarding/legacy/sdks/sdksLogic.tsx
@@ -1,6 +1,7 @@
-import { actions, afterMount, connect, events, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, events, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { urlToAction } from 'kea-router'
+import type { ComponentType } from 'react'
import api from 'lib/api'
import { LemonSelectOptions } from 'lib/lemon-ui/LemonSelect/LemonSelect'
@@ -14,9 +15,10 @@ import { ProductKey } from '~/queries/schema/schema-general'
import { hogql } from '~/queries/utils'
import { SDK, SDKInstructionsMap, SDKTag, SDKTagOverrides } from '~/types'
+import type { FeatureFlagsSet } from '../../../../lib/logic/featureFlagLogic'
+import type { SDKKey, UserType } from '../../../../types'
import { onboardingLogic } from '../onboardingLogic'
import { ALL_SDKS } from './allSDKs'
-import type { sdksLogicType } from './sdksLogicType'
/*
To add SDK instructions for your product:
@@ -41,6 +43,114 @@ Products that will often be installed in multiple places, eg. web and mobile
*/
export const multiInstallProducts = [ProductKey.PRODUCT_ANALYTICS, ProductKey.FEATURE_FLAGS]
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sdksLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ eventHosts: string[] // liveEventsLogic
+ productKey: ProductKey | null // onboardingLogic
+ isUserNonTechnical: boolean // userLogic
+ user: UserType | null // userLogic
+ availableSDKInstructionsMap: SDKInstructionsMap
+ combinedSnippetAndLiveEventsHosts: string[]
+ filteredSDKs: SDK[]
+ hasSnippetEvents: boolean | null
+ hasSnippetEventsLoading: boolean
+ panel: 'instructions' | 'options'
+ sdkTagOverrides: SDKTagOverrides
+ sdks: SDK[] | null
+ searchTerm: string
+ selectedSDK: SDK | null
+ selectedTag: SDKTag | null
+ showSideBySide: boolean | null
+ showSourceOptionsSelect: boolean
+ snippetHosts: string[]
+ sourceFilter: string | null
+ sourceOptions: LemonSelectOptions<string>
+ tags: string[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sdksLogicActions {
+ reportSDKSelected: (sdk: SDK) => {
+ sdk: SDK
+ } // eventUsageLogic
+ filterSDKs: () => {
+ value: true
+ }
+ loadSnippetEvents: () => any
+ loadSnippetEventsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSnippetEventsSuccess: (
+ hasSnippetEvents: boolean,
+ payload?: any
+ ) => {
+ hasSnippetEvents: boolean
+ payload?: any
+ }
+ resetSDKs: () => {
+ value: true
+ }
+ selectSDK: (sdk: SDK) => {
+ sdk: SDK
+ }
+ setAvailableSDKInstructionsMap: (sdkInstructionMap: SDKInstructionsMap) => {
+ sdkInstructionMap: Partial<Record<SDKKey, ComponentType<{}>>>
+ }
+ setHasSnippetEvents: (hasSnippetEvents: boolean) => {
+ hasSnippetEvents: boolean
+ }
+ setPanel: (panel: 'instructions' | 'options') => {
+ panel: 'instructions' | 'options'
+ }
+ setSDKTagOverrides: (sdkTagOverrides: SDKTagOverrides) => {
+ sdkTagOverrides: Partial<Record<SDKKey, SDKTag[]>>
+ }
+ setSDKs: (sdks: SDK[]) => {
+ sdks: SDK[]
+ }
+ setSearchTerm: (searchTerm: string) => {
+ searchTerm: string
+ }
+ setSelectedSDK: (sdk: SDK | null) => {
+ sdk: SDK | null
+ }
+ setSelectedTag: (selectedTag: SDKTag | null) => {
+ selectedTag: SDKTag | null
+ }
+ setShowSideBySide: (showSideBySide: boolean) => {
+ showSideBySide: boolean
+ }
+ setSnippetHosts: (snippetHosts: string[]) => {
+ snippetHosts: string[]
+ }
+ setSourceFilter: (sourceFilter: string | null) => {
+ sourceFilter: string | null
+ }
+ setSourceOptions: (sourceOptions: LemonSelectOptions<string>) => {
+ sourceOptions: LemonSelectOptions<string>
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sdksLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ showSourceOptionsSelect: (
+ sourceOptions: LemonSelectOptions<string>,
+ availableSDKInstructionsMap: Partial<Record<SDKKey, ComponentType<{}>>>
+ ) => boolean
+ combinedSnippetAndLiveEventsHosts: (snippetHosts: string[], eventHosts: string[]) => string[]
+ tags: (sdks: SDK[] | null) => string[]
+ filteredSDKs: (sdks: SDK[] | null, searchTerm: string, selectedTag: SDKTag | null) => SDK[]
+ }
+}
+
+export type sdksLogicType = MakeLogicType<sdksLogicValues, sdksLogicActions, Record<string, any>, sdksLogicMeta>
+
export const sdksLogic = kea<sdksLogicType>([
path(['scenes', 'onboarding', 'sdks', 'sdksLogic']),
connect(() => ({
diff --git a/frontend/src/scenes/onboarding/onboardingEventUsageLogic.ts b/frontend/src/scenes/onboarding/onboardingEventUsageLogic.ts
index 36a815ed6411..92f61388107b 100644
--- a/frontend/src/scenes/onboarding/onboardingEventUsageLogic.ts
+++ b/frontend/src/scenes/onboarding/onboardingEventUsageLogic.ts
@@ -1,10 +1,9 @@
-import { actions, connect, kea, listeners, path } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path } from 'kea'
import posthog from 'posthog-js'
import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic, type FeatureFlagsSet } from 'lib/logic/featureFlagLogic'
-import type { onboardingEventUsageLogicType } from './onboardingEventUsageLogicType'
import { resolveOnboardingFlowVariant } from './onboardingVariants'
/** Steps of the context-first onboarding flow (`ContextOnboarding.tsx`), in order. */
@@ -56,6 +55,125 @@ export function resetCloudRunExperimentExposureForTests(): void {
reportedDashboardCtaShownRuns.clear()
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface onboardingEventUsageLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface onboardingEventUsageLogicActions {
+ reportContextOnboardingCloudRunCompleted: (props: {
+ durationSeconds: number | null
+ prOpened: boolean
+ prUrl: string | null
+ runId: string
+ status: 'cancelled' | 'completed' | 'failed'
+ taskId: string
+ }) => {
+ durationSeconds: number | null
+ prOpened: boolean
+ prUrl: string | null
+ runId: string
+ status: 'cancelled' | 'completed' | 'failed'
+ taskId: string
+ }
+ reportContextOnboardingCloudRunQueued: (props: { repository: string; runId: string; taskId: string }) => {
+ repository: string
+ runId: string
+ taskId: string
+ }
+ reportContextOnboardingCompleted: (productKey: string) => {
+ productKey: string
+ }
+ reportContextOnboardingInstallModeSelected: (mode: 'cloud' | 'local') => {
+ mode: 'cloud' | 'local'
+ }
+ reportContextOnboardingPlanSelected: (plan: 'free' | 'pay_as_you_go') => {
+ plan: 'free' | 'pay_as_you_go'
+ }
+ reportContextOnboardingSourceToggled: (
+ productKey: string,
+ toggle: string,
+ enabled: boolean
+ ) => {
+ enabled: boolean
+ productKey: string
+ toggle: string
+ }
+ reportContextOnboardingStarted: () => {
+ value: true
+ }
+ reportContextOnboardingStepCompleted: (stepId: ContextOnboardingStepId) => {
+ stepId: ContextOnboardingStepId
+ }
+ reportContextOnboardingStepSkipped: (stepId: ContextOnboardingStepId) => {
+ stepId: ContextOnboardingStepId
+ }
+ reportContextOnboardingStepViewed: (stepId: ContextOnboardingStepId) => {
+ stepId: ContextOnboardingStepId
+ }
+ reportWizardSyncDashboardCtaClicked: (props: {
+ mode: 'cloud' | 'local'
+ runKey: string
+ surface: 'fab' | 'inline'
+ }) => {
+ mode: 'cloud' | 'local'
+ runKey: string
+ surface: 'fab' | 'inline'
+ }
+ reportWizardSyncDashboardCtaShown: (props: {
+ mode: 'cloud' | 'local'
+ runKey: string
+ surface: 'fab' | 'inline'
+ }) => {
+ mode: 'cloud' | 'local'
+ runKey: string
+ surface: 'fab' | 'inline'
+ }
+ reportWizardSyncExpanded: (props: { mode: 'cloud' | 'local'; phase: string; runKey: string }) => {
+ mode: 'cloud' | 'local'
+ phase: string
+ runKey: string
+ }
+ reportWizardSyncHandoffShown: (props: {
+ mode: 'cloud' | 'local'
+ prOpened: boolean
+ runKey: string
+ surface: 'fab' | 'inline'
+ }) => {
+ mode: 'cloud' | 'local'
+ prOpened: boolean
+ runKey: string
+ surface: 'fab' | 'inline'
+ }
+ reportWizardSyncMinimized: (props: { mode: 'cloud' | 'local'; phase: string; runKey: string }) => {
+ mode: 'cloud' | 'local'
+ phase: string
+ runKey: string
+ }
+ reportWizardSyncRestored: (props: { mode: 'cloud' | 'local'; phase: string; runKey: string }) => {
+ mode: 'cloud' | 'local'
+ phase: string
+ runKey: string
+ }
+ reportWizardSyncRunDismissed: (props: {
+ elapsedSeconds: number
+ mode: 'cloud' | 'local'
+ phase: string
+ runKey: string
+ }) => {
+ elapsedSeconds: number
+ mode: 'cloud' | 'local'
+ phase: string
+ runKey: string
+ }
+}
+
+export type onboardingEventUsageLogicType = MakeLogicType<
+ onboardingEventUsageLogicValues,
+ onboardingEventUsageLogicActions
+>
+
/**
* Funnel events for the context-first onboarding flow (v2) — a dedicated logic rather than more
* surface on the giant `eventUsageLogic`, following `sessionRecordingEventUsageLogic`'s split.
diff --git a/frontend/src/scenes/onboarding/shared/sdkHealth/sdkHealthLogic.tsx b/frontend/src/scenes/onboarding/shared/sdkHealth/sdkHealthLogic.tsx
index 28fb778afab8..dfe5b16167ce 100644
--- a/frontend/src/scenes/onboarding/shared/sdkHealth/sdkHealthLogic.tsx
+++ b/frontend/src/scenes/onboarding/shared/sdkHealth/sdkHealthLogic.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 { subscriptions } from 'kea-subscriptions'
@@ -10,8 +10,6 @@ import { teamLogic } from 'scenes/teamLogic'
import { sdkHealthReportRetrieve } from 'products/growth/frontend/generated/api'
import type { SdkAssessmentApi, SdkHealthReportApi } from 'products/growth/frontend/generated/api.schemas'
-import type { sdkHealthLogicType } from './sdkHealthLogicType'
-
export type SdkType = SdkAssessmentApi['lib']
// Small helper to define what our versions look like
@@ -64,6 +62,69 @@ export type AugmentedTeamSdkVersionsInfo = {
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sdkHealthLogicValues {
+ isCloudOrDev: boolean | undefined // preflightLogic
+ currentTeamId: number | null // teamLogic
+ augmentedData: AugmentedTeamSdkVersionsInfo
+ hasErrors: boolean
+ needsAttention: boolean
+ needsUpdatingCount: number
+ report: SdkHealthReportApi | null
+ reportLoading: boolean
+ sdkHealth: SdkHealthStatus
+ snoozedUntil: string | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sdkHealthLogicActions {
+ loadReport: (options?: { forceRefresh?: boolean }) => {
+ forceRefresh?: boolean
+ }
+ loadReportFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadReportSuccess: (
+ report: SdkHealthReportApi | null,
+ payload?: {
+ forceRefresh?: boolean
+ }
+ ) => {
+ report: SdkHealthReportApi | null
+ payload?: {
+ forceRefresh?: boolean
+ }
+ }
+ snoozeSdkHealth: () => {
+ value: true
+ }
+ unsnooze: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sdkHealthLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ augmentedData: (report: SdkHealthReportApi | null) => AugmentedTeamSdkVersionsInfo
+ needsUpdatingCount: (report: SdkHealthReportApi | null) => number
+ needsAttention: (report: SdkHealthReportApi | null, snoozedUntil: string | null) => boolean
+ sdkHealth: (report: SdkHealthReportApi | null) => SdkHealthStatus
+ hasErrors: (report: SdkHealthReportApi | null, reportLoading: boolean) => boolean
+ }
+}
+
+export type sdkHealthLogicType = MakeLogicType<
+ sdkHealthLogicValues,
+ sdkHealthLogicActions,
+ Record<string, any>,
+ sdkHealthLogicMeta
+>
+
/**
* SDK Health - PostHog SDK Health Monitoring
*
diff --git a/frontend/src/scenes/onboarding/shared/sdkHealth/sdkHealthSceneLogic.tsx b/frontend/src/scenes/onboarding/shared/sdkHealth/sdkHealthSceneLogic.tsx
index 42fd646be6e5..b7d1cbd44c94 100644
--- a/frontend/src/scenes/onboarding/shared/sdkHealth/sdkHealthSceneLogic.tsx
+++ b/frontend/src/scenes/onboarding/shared/sdkHealth/sdkHealthSceneLogic.tsx
@@ -1,4 +1,4 @@
-import { kea, path, selectors } from 'kea'
+import { MakeLogicType, kea, path, selectors } from 'kea'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene } from 'scenes/sceneTypes'
@@ -6,7 +6,12 @@ import { urls } from 'scenes/urls'
import { Breadcrumb } from '~/types'
-import type { sdkHealthSceneLogicType } from './sdkHealthSceneLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sdkHealthSceneLogicValues {
+ breadcrumbs: Breadcrumb[]
+}
+
+export type sdkHealthSceneLogicType = MakeLogicType<sdkHealthSceneLogicValues, {}>
export const sdkHealthSceneLogic = kea<sdkHealthSceneLogicType>([
path(['scenes', 'onboarding', 'shared', 'sdkHealth', 'sdkHealthSceneLogic']),
diff --git a/frontend/src/scenes/onboarding/shared/setupWizardStatusLogic.ts b/frontend/src/scenes/onboarding/shared/setupWizardStatusLogic.ts
index 1de14c3d6026..72cede8230f7 100644
--- a/frontend/src/scenes/onboarding/shared/setupWizardStatusLogic.ts
+++ b/frontend/src/scenes/onboarding/shared/setupWizardStatusLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, getContext, kea, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, getContext, kea, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { subscriptions } from 'kea-subscriptions'
@@ -9,8 +9,8 @@ import { isSharedView } from '~/exporter/exporterViewLogic'
import { tasksList, tasksRunsList } from 'products/tasks/frontend/generated/api'
import type { TaskRunDetailDTOApi } from 'products/tasks/frontend/generated/api.schemas'
-import type { setupWizardStatusLogicType } from './setupWizardStatusLogicType'
import { activeCloudRunLogic } from './wizard-sync/activeCloudRunLogic'
+import type { CloudRunHandle } from './wizard-sync/activeCloudRunLogic'
import {
InstallationMode,
InstallationProgress,
@@ -86,6 +86,64 @@ export function statusFromProgress(progress: InstallationProgress | null): Setup
return null
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface setupWizardStatusLogicValues {
+ activeCloudRun: CloudRunHandle | null // activeCloudRunLogic
+ currentTeamId: number | null // teamLogic
+ hasActiveSession: boolean // wizardActiveSessionDetectorLogic
+ discoveredRun: DiscoveredSetupRun | null
+ discoveredRunLoading: boolean
+ liveProgress: InstallationProgress | null
+ liveRunHandle: SetupRunHandle | null
+ setupStatus: SetupWizardStatus | null
+ setupStatusLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface setupWizardStatusLogicActions {
+ liveProgressUpdated: (progress: InstallationProgress | null) => {
+ progress: InstallationProgress | null
+ }
+ loadDiscoveredRun: () => any
+ loadDiscoveredRunFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadDiscoveredRunSuccess: (
+ discoveredRun: DiscoveredSetupRun | null,
+ payload?: any
+ ) => {
+ discoveredRun: DiscoveredSetupRun | null
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface setupWizardStatusLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ liveRunHandle: (
+ activeCloudRun: CloudRunHandle | null,
+ discoveredRun: DiscoveredSetupRun | null
+ ) => SetupRunHandle | null
+ setupStatus: (
+ liveProgress: InstallationProgress | null,
+ discoveredRun: DiscoveredSetupRun | null,
+ hasActiveSession: boolean
+ ) => SetupWizardStatus | null
+ setupStatusLoading: (discoveredRunLoading: boolean) => boolean
+ }
+}
+
+export type setupWizardStatusLogicType = MakeLogicType<
+ setupWizardStatusLogicValues,
+ setupWizardStatusLogicActions,
+ Record<string, any>,
+ setupWizardStatusLogicMeta
+>
+
/**
* App-wide status of the onboarding wizard's setup task run (the cloud run that installs PostHog
* in the user's codebase and opens a pull request).
@@ -198,7 +256,10 @@ export const setupWizardStatusLogic = kea<setupWizardStatusLogicType>([
selectors({
liveRunHandle: [
(s) => [s.activeCloudRun, s.discoveredRun],
- (activeCloudRun, discoveredRun): SetupRunHandle | null => {
+ (
+ activeCloudRun: null | import('./wizard-sync/activeCloudRunLogic').CloudRunHandle,
+ discoveredRun: DiscoveredSetupRun | null
+ ): SetupRunHandle | null => {
if (activeCloudRun) {
return { taskId: activeCloudRun.taskId, runId: activeCloudRun.runId }
}
@@ -208,7 +269,11 @@ export const setupWizardStatusLogic = kea<setupWizardStatusLogicType>([
],
setupStatus: [
(s) => [s.liveProgress, s.discoveredRun, s.hasActiveSession],
- (liveProgress, discoveredRun, hasActiveSession): SetupWizardStatus | null => {
+ (
+ liveProgress: InstallationProgress | null,
+ discoveredRun: DiscoveredSetupRun | null,
+ hasActiveSession: boolean
+ ): SetupWizardStatus | null => {
const live = statusFromProgress(liveProgress)
const discovered = discoveredRun?.status ?? null
if (live?.kind === 'pull_request') {
@@ -237,7 +302,10 @@ export const setupWizardStatusLogic = kea<setupWizardStatusLogicType>([
return hasActiveSession ? { kind: 'installing', mode: 'local' } : null
},
],
- setupStatusLoading: [(s) => [s.discoveredRunLoading], (discoveredRunLoading): boolean => discoveredRunLoading],
+ setupStatusLoading: [
+ (s) => [s.discoveredRunLoading],
+ (discoveredRunLoading: boolean): boolean => discoveredRunLoading,
+ ],
}),
subscriptions(({ actions, cache }) => ({
// The afterMount load no-ops when the logic mounts before the team is known; (re)load once
diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/activeCloudRunLogic.ts b/frontend/src/scenes/onboarding/shared/wizard-sync/activeCloudRunLogic.ts
index 09a57c5515d1..b18c0be38960 100644
--- a/frontend/src/scenes/onboarding/shared/wizard-sync/activeCloudRunLogic.ts
+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/activeCloudRunLogic.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 { subscriptions } from 'kea-subscriptions'
import { projectLogic } from 'scenes/projectLogic'
@@ -6,8 +6,6 @@ import { userLogic } from 'scenes/userLogic'
import { tasksActiveWizardRunRetrieve } from 'products/tasks/frontend/generated/api'
-import type { activeCloudRunLogicType } from './activeCloudRunLogicType'
-
export interface CloudRunHandle {
taskId: string
runId: string
@@ -25,6 +23,58 @@ export function scopedCloudRun(handle: CloudRunHandle | null, currentProjectId:
return handle?.projectId != null && handle.projectId === currentProjectId ? handle : null
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface activeCloudRunLogicValues {
+ currentProjectId: number | null // projectLogic
+ isProvisionedUser: boolean // userLogic
+ activeCloudRun: CloudRunHandle | null
+ canHydrateFromServer: boolean
+ panelMounted: boolean
+ persistedCloudRun: CloudRunHandle | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface activeCloudRunLogicActions {
+ clearActiveCloudRun: () => {
+ value: true
+ }
+ hydrateFromServer: () => {
+ value: true
+ }
+ setActiveCloudRun: (
+ taskId: string,
+ runId: string,
+ startedAt: string,
+ projectId: number
+ ) => {
+ projectId: number
+ runId: string
+ startedAt: string
+ taskId: string
+ }
+ setPanelMounted: (mounted: boolean) => {
+ mounted: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface activeCloudRunLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ activeCloudRun: (
+ persistedCloudRun: CloudRunHandle | null,
+ currentProjectId: number | null
+ ) => CloudRunHandle | null
+ canHydrateFromServer: (isProvisionedUser: boolean, currentProjectId: number | null) => boolean
+ }
+}
+
+export type activeCloudRunLogicType = MakeLogicType<
+ activeCloudRunLogicValues,
+ activeCloudRunLogicActions,
+ Record<string, any>,
+ activeCloudRunLogicMeta
+>
+
/**
* Holds the active cloud-run handle app-wide so the global progress FAB can keep showing a run after
* the user advances past (or unmounts) the install step. Persisted so it also survives a refresh during
@@ -81,7 +131,7 @@ export const activeCloudRunLogic = kea<activeCloudRunLogicType>([
selectors({
activeCloudRun: [
(s) => [s.persistedCloudRun, s.currentProjectId],
- (persistedCloudRun, currentProjectId): CloudRunHandle | null =>
+ (persistedCloudRun: CloudRunHandle | null, currentProjectId: number | null): CloudRunHandle | null =>
scopedCloudRun(persistedCloudRun, currentProjectId),
],
// The two inputs hydrateFromServer needs, both of which load asynchronously after mount.
@@ -89,7 +139,8 @@ export const activeCloudRunLogic = kea<activeCloudRunLogicType>([
// provisioned user before their user/project loaded still gets hydrated.
canHydrateFromServer: [
(s) => [s.isProvisionedUser, s.currentProjectId],
- (isProvisionedUser, currentProjectId): boolean => isProvisionedUser && currentProjectId != null,
+ (isProvisionedUser: boolean, currentProjectId: number | null): boolean =>
+ isProvisionedUser && currentProjectId != null,
],
}),
listeners(({ actions, values }) => ({
diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/finishedLocalRunLogic.ts b/frontend/src/scenes/onboarding/shared/wizard-sync/finishedLocalRunLogic.ts
index f6e62b474f64..e89a06553b2a 100644
--- a/frontend/src/scenes/onboarding/shared/wizard-sync/finishedLocalRunLogic.ts
+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/finishedLocalRunLogic.ts
@@ -1,10 +1,9 @@
-import { actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { projectLogic } from 'scenes/projectLogic'
import type { WizardSessionDTOApi } from 'products/wizard/frontend/generated/api.schemas'
-import type { finishedLocalRunLogicType } from './finishedLocalRunLogicType'
import { wizardDashboardLogic } from './wizardDashboardLogic'
/** A terminal local wizard run, snapshotted so its handoff outlives the session stream. */
@@ -19,6 +18,50 @@ export interface FinishedLocalRunHandle {
error: { message?: string } | null
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface finishedLocalRunLogicValues {
+ currentProjectId: number | null // projectLogic
+ dismissedSessionId: string | null
+ finishedLocalRun: FinishedLocalRunHandle | null
+ persistedFinishedLocalRun: FinishedLocalRunHandle | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface finishedLocalRunLogicActions {
+ detectWizardDashboard: (args_0: { startedAt: string }) => {
+ startedAt: string
+ } // wizardDashboardLogic
+ dismissLocalRun: (sessionId: string) => {
+ sessionId: string
+ }
+ recordFinishedLocalRun: (session: WizardSessionDTOApi) => {
+ session: WizardSessionDTOApi
+ }
+ setFinishedLocalRun: (handle: FinishedLocalRunHandle) => {
+ handle: FinishedLocalRunHandle
+ }
+ supersedeFinishedLocalRun: (sessionId: string) => {
+ sessionId: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface finishedLocalRunLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ finishedLocalRun: (
+ persistedFinishedLocalRun: FinishedLocalRunHandle | null,
+ currentProjectId: number | null
+ ) => FinishedLocalRunHandle | null
+ }
+}
+
+export type finishedLocalRunLogicType = MakeLogicType<
+ finishedLocalRunLogicValues,
+ finishedLocalRunLogicActions,
+ Record<string, any>,
+ finishedLocalRunLogicMeta
+>
+
/**
* Keeps a finished local wizard run on screen until the user dismisses it. The live session stream
* gates itself off shortly after a run goes terminal (INC-886), which used to take the FAB down with
@@ -65,7 +108,10 @@ export const finishedLocalRunLogic = kea<finishedLocalRunLogicType>([
selectors({
finishedLocalRun: [
(s) => [s.persistedFinishedLocalRun, s.currentProjectId],
- (persistedFinishedLocalRun, currentProjectId): FinishedLocalRunHandle | null =>
+ (
+ persistedFinishedLocalRun: FinishedLocalRunHandle | null,
+ currentProjectId: number | null
+ ): FinishedLocalRunHandle | null =>
persistedFinishedLocalRun && persistedFinishedLocalRun.projectId === currentProjectId
? persistedFinishedLocalRun
: null,
diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/installationProgressLogic.ts b/frontend/src/scenes/onboarding/shared/wizard-sync/installationProgressLogic.ts
index 4bf896507439..4b5a61e437ba 100644
--- a/frontend/src/scenes/onboarding/shared/wizard-sync/installationProgressLogic.ts
+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/installationProgressLogic.ts
@@ -1,4 +1,17 @@
-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 { elapsedSecondsFrom } from 'lib/utils/datetime'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
@@ -6,9 +19,10 @@ import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import type { WizardSessionDTOApi } from 'products/wizard/frontend/generated/api.schemas'
import { wizardSessionStreamLogic } from 'products/wizard/frontend/wizardSessionStreamLogic'
+import type { WizardConnectionStatus } from '../../../../../../products/wizard/frontend/wizardSessionStreamLogic'
import { activeCloudRunLogic } from './activeCloudRunLogic'
+import type { CloudRunHandle } from './activeCloudRunLogic'
import { finishedLocalRunLogic, FinishedLocalRunHandle } from './finishedLocalRunLogic'
-import type { installationProgressLogicType } from './installationProgressLogicType'
import {
taskRunPrMerged,
taskRunPrUrl,
@@ -16,6 +30,7 @@ import {
TaskRunProgressStep,
TaskRunStreamState,
} from './taskRunStreamLogic'
+import type { TaskRunConnectionStatus } from './taskRunStreamLogic'
import { isSessionActive, wizardActiveSessionDetectorLogic } from './wizardActiveSessionDetectorLogic'
import { wizardDashboardLogic } from './wizardDashboardLogic'
@@ -334,6 +349,105 @@ export function progressFromFinishedLocalRun(handle: FinishedLocalRunHandle): In
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface installationProgressLogicValues {
+ activeCloudRun: CloudRunHandle | null // activeCloudRunLogic
+ dismissedSessionId: string | null // finishedLocalRunLogic
+ isStalled: boolean // taskRunStreamLogic
+ progressSteps: TaskRunProgressStep[] // taskRunStreamLogic
+ taskConnectionStatus: TaskRunConnectionStatus // taskRunStreamLogic
+ taskRunState: TaskRunStreamState | null // taskRunStreamLogic
+ latestSession: WizardSessionDTOApi | null // wizardSessionStreamLogic
+ sessionConnectionStatus: WizardConnectionStatus // wizardSessionStreamLogic
+ installationProgress: InstallationProgress
+ sessionIsCurrent: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface installationProgressLogicActions {
+ reportWizardSyncSessionDetected: (props: {
+ runPhase: string
+ skillId: string
+ taskCount: number
+ workflowId: string
+ }) => {
+ runPhase: string
+ skillId: string
+ taskCount: number
+ workflowId: string
+ } // eventUsageLogic
+ reportWizardSyncSessionFinished: (props: {
+ completedTaskCount: number
+ elapsedSeconds: number
+ outcome: string
+ skillId: string
+ taskCount: number
+ workflowId: string
+ }) => {
+ completedTaskCount: number
+ elapsedSeconds: number
+ outcome: string
+ skillId: string
+ taskCount: number
+ workflowId: string
+ } // eventUsageLogic
+ recordFinishedLocalRun: (session: WizardSessionDTOApi) => {
+ session: WizardSessionDTOApi
+ } // finishedLocalRunLogic
+ supersedeFinishedLocalRun: (sessionId: string) => {
+ sessionId: string
+ } // finishedLocalRunLogic
+ connectTaskRun: () => {
+ value: true
+ } // taskRunStreamLogic
+ disconnectTaskRun: () => {
+ value: true
+ } // taskRunStreamLogic
+ taskRunStreamCompleted: () => {
+ value: true
+ } // taskRunStreamLogic
+ detectWizardDashboard: (args_0: { startedAt: string }) => {
+ startedAt: string
+ } // wizardDashboardLogic
+ connectSession: () => {
+ value: true
+ } // wizardSessionStreamLogic
+ disconnectSession: () => {
+ value: true
+ } // wizardSessionStreamLogic
+ sessionUpdated: (session: WizardSessionDTOApi) => {
+ session: WizardSessionDTOApi
+ } // wizardSessionStreamLogic
+ markSessionCurrent: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface installationProgressLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ installationProgress: (
+ taskRunState: TaskRunStreamState | null,
+ progressSteps: TaskRunProgressStep[],
+ taskConnectionStatus: TaskRunConnectionStatus,
+ latestSession: WizardSessionDTOApi | null,
+ sessionConnectionStatus: WizardConnectionStatus,
+ sessionIsCurrent: boolean,
+ isStalled: boolean,
+ dismissedSessionId: string | null,
+ arg: any
+ ) => InstallationProgress
+ }
+}
+
+export type installationProgressLogicType = MakeLogicType<
+ installationProgressLogicValues,
+ installationProgressLogicActions,
+ InstallationProgressLogicProps,
+ installationProgressLogicMeta
+>
+
/**
* The Installation layer: one normalized `InstallationProgress` the UI renders, hiding which underlying
* stream(s) feed it.
@@ -403,14 +517,14 @@ export const installationProgressLogic = kea<installationProgressLogicType>([
(_, props) => props.mode,
],
(
- taskRunState,
- progressSteps,
- taskConnectionStatus,
- latestSession,
- sessionConnectionStatus,
- sessionIsCurrent,
- isStalled,
- dismissedSessionId,
+ taskRunState: TaskRunStreamState | null,
+ progressSteps: TaskRunProgressStep[],
+ taskConnectionStatus: import('./taskRunStreamLogic').TaskRunConnectionStatus,
+ latestSession: WizardSessionDTOApi | null,
+ sessionConnectionStatus: import('products/wizard/frontend/wizardSessionStreamLogic').WizardConnectionStatus,
+ sessionIsCurrent: boolean,
+ isStalled: boolean,
+ dismissedSessionId: string | null,
mode
): InstallationProgress =>
mode === 'cloud'
diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/taskRunStreamLogic.ts b/frontend/src/scenes/onboarding/shared/wizard-sync/taskRunStreamLogic.ts
index f8b2d09e136a..c5b26b132e1d 100644
--- a/frontend/src/scenes/onboarding/shared/wizard-sync/taskRunStreamLogic.ts
+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/taskRunStreamLogic.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 { logSyncDebug } from 'lib/wizard-sync/wizardSyncDebugLogic'
import { projectLogic } from 'scenes/projectLogic'
@@ -8,7 +8,7 @@ import type { TaskRunDetailDTOApi } from 'products/tasks/frontend/generated/api.
import { onboardingEventUsageLogic } from '../../onboardingEventUsageLogic'
import { activeCloudRunLogic } from './activeCloudRunLogic'
-import type { taskRunStreamLogicType } from './taskRunStreamLogicType'
+import type { CloudRunHandle } from './activeCloudRunLogic'
export type TaskRunConnectionStatus = 'idle' | 'connecting' | 'open' | 'closed' | 'error'
@@ -172,6 +172,76 @@ export function cloudRunCompletionReport(
// wizard tracker's once-per-session report guards.
const reportedTerminalRuns = new Set<string>()
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface taskRunStreamLogicValues {
+ activeCloudRun: CloudRunHandle | null // activeCloudRunLogic
+ currentProjectId: number | null // projectLogic
+ connectionStatus: TaskRunConnectionStatus
+ isComplete: boolean
+ isStalled: boolean
+ lastError: string | null
+ progressSteps: TaskRunProgressStep[]
+ taskRunState: TaskRunStreamState | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface taskRunStreamLogicActions {
+ reportContextOnboardingCloudRunCompleted: (props: {
+ durationSeconds: number | null
+ prOpened: boolean
+ prUrl: string | null
+ runId: string
+ status: 'cancelled' | 'completed' | 'failed'
+ taskId: string
+ }) => {
+ durationSeconds: number | null
+ prOpened: boolean
+ prUrl: string | null
+ runId: string
+ status: 'cancelled' | 'completed' | 'failed'
+ taskId: string
+ } // onboardingEventUsageLogic
+ connect: () => {
+ value: true
+ }
+ connectionErrored: (error: string) => {
+ error: string
+ }
+ connectionOpened: () => {
+ value: true
+ }
+ connectionSkipped: () => {
+ value: true
+ }
+ disconnect: () => {
+ value: true
+ }
+ progressStepUpdated: (step: TaskRunProgressStep) => {
+ step: TaskRunProgressStep
+ }
+ runStalled: () => {
+ value: true
+ }
+ streamCompleted: () => {
+ value: true
+ }
+ taskRunStateUpdated: (state: TaskRunStreamState) => {
+ state: TaskRunStreamState
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface taskRunStreamLogicMeta {
+ key: string
+}
+
+export type taskRunStreamLogicType = MakeLogicType<
+ taskRunStreamLogicValues,
+ taskRunStreamLogicActions,
+ TaskRunStreamLogicProps,
+ taskRunStreamLogicMeta
+>
+
/**
* Raw SSE consumer for a single TaskRun (the cloud-run pipeline: provision → clone → wizard → agent →
* PR). A private source for the Installation layer — `installationProgressLogic` merges this with the
diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/wizardActiveSessionDetectorLogic.ts b/frontend/src/scenes/onboarding/shared/wizard-sync/wizardActiveSessionDetectorLogic.ts
index b555ccff6384..7b0ef98032b6 100644
--- a/frontend/src/scenes/onboarding/shared/wizard-sync/wizardActiveSessionDetectorLogic.ts
+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/wizardActiveSessionDetectorLogic.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 { subscriptions } from 'kea-subscriptions'
import posthog from 'posthog-js'
@@ -11,8 +11,6 @@ import { projectLogic } from 'scenes/projectLogic'
import { wizardSessionsLatestRetrieve } from 'products/wizard/frontend/generated/api'
import type { WizardSessionDTOApi } from 'products/wizard/frontend/generated/api.schemas'
-import type { wizardActiveSessionDetectorLogicType } from './wizardActiveSessionDetectorLogicType'
-
const WORKFLOW_ID = 'posthog-integration'
// Cheap REST repoll cadence used to surface a wizard run that was kicked off
@@ -65,6 +63,54 @@ export function isSessionActive(session: WizardSessionDTOApi | null | undefined)
return true
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface wizardActiveSessionDetectorLogicValues {
+ currentProjectId: number | null // projectLogic
+ hasActiveSession: boolean
+ lastError: string | null
+ permanentlyDisabled: boolean
+ shouldStream: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface wizardActiveSessionDetectorLogicActions {
+ cancelScheduledMarkInactive: () => {
+ value: true
+ }
+ check: () => {
+ value: true
+ }
+ markActive: () => {
+ value: true
+ }
+ markInactive: () => {
+ value: true
+ }
+ markPermanentlyDisabled: () => {
+ value: true
+ }
+ scheduleMarkInactive: () => {
+ value: true
+ }
+ setLastError: (error: string | null) => {
+ error: string | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface wizardActiveSessionDetectorLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ shouldStream: (hasActiveSession: boolean) => boolean
+ }
+}
+
+export type wizardActiveSessionDetectorLogicType = MakeLogicType<
+ wizardActiveSessionDetectorLogicValues,
+ wizardActiveSessionDetectorLogicActions,
+ Record<string, any>,
+ wizardActiveSessionDetectorLogicMeta
+>
+
/**
* Decides whether the global wizard FAB should subscribe to the SSE stream.
*
@@ -122,7 +168,7 @@ export const wizardActiveSessionDetectorLogic = kea<wizardActiveSessionDetectorL
],
}),
selectors({
- shouldStream: [(s) => [s.hasActiveSession], (hasActiveSession): boolean => hasActiveSession],
+ shouldStream: [(s) => [s.hasActiveSession], (hasActiveSession: boolean): boolean => hasActiveSession],
}),
listeners(({ actions, values, cache }) => ({
check: async () => {
diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/wizardCloudRunLogic.ts b/frontend/src/scenes/onboarding/shared/wizard-sync/wizardCloudRunLogic.ts
index 94ebefd0c338..5046a819f28d 100644
--- a/frontend/src/scenes/onboarding/shared/wizard-sync/wizardCloudRunLogic.ts
+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/wizardCloudRunLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { lemonToast } from '@posthog/lemon-ui'
@@ -9,6 +9,8 @@ import { urls } from 'scenes/urls'
import { IntegrationType, OnboardingStepKey } from '~/types'
+import type { ProductKey } from '../../../../queries/schema/schema-general'
+import type { SDK } from '../../../../types'
// Deliberate shared → legacy imports: onboardingLogic is the onboarding state machine both variants
// run on (step key for the GitHub-connect return URL), and sdksLogic carries the user's manual SDK
// pick (the cloud wizard's skill hint). Both no-op gracefully in flows that don't set them.
@@ -16,7 +18,6 @@ import { onboardingLogic } from '../../legacy/onboardingLogic'
import { sdksLogic } from '../../legacy/sdks/sdksLogic'
import { onboardingEventUsageLogic } from '../../onboardingEventUsageLogic'
import { activeCloudRunLogic } from './activeCloudRunLogic'
-import type { wizardCloudRunLogicType } from './wizardCloudRunLogicType'
export type CloudRunStatus =
| 'idle' // No request in flight — show connect / repo-pick / start UI.
@@ -30,6 +31,82 @@ export type CloudRunStatus =
// the user's machine.
export const WIZARD_CLOUD_RUN_WORKFLOW_ID = 'posthog-integration'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface wizardCloudRunLogicValues {
+ integrations: IntegrationType[] | null // integrationsLogic
+ currentStepProductKey: ProductKey | null // onboardingLogic
+ selectedSDK: SDK | null // sdksLogic
+ currentProjectId: number | string // teamLogic
+ cloudRunRunId: string | null
+ cloudRunStatus: CloudRunStatus
+ cloudRunTaskId: string | null
+ connectGitHubUrl: string
+ githubIntegration: IntegrationType | null
+ isGithubConnected: boolean
+ selectedRepository: string | null
+ skillId: string | undefined
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface wizardCloudRunLogicActions {
+ clearActiveCloudRun: () => {
+ value: true
+ } // activeCloudRunLogic
+ setActiveCloudRun: (
+ taskId: string,
+ runId: string,
+ startedAt: string,
+ projectId: number
+ ) => {
+ projectId: number
+ runId: string
+ startedAt: string
+ taskId: string
+ } // activeCloudRunLogic
+ loadIntegrations: () => any // integrationsLogic
+ reportContextOnboardingCloudRunQueued: (props: { repository: string; runId: string; taskId: string }) => {
+ repository: string
+ runId: string
+ taskId: string
+ } // onboardingEventUsageLogic
+ setCloudRunHandle: (
+ taskId: string,
+ runId: string
+ ) => {
+ runId: string
+ taskId: string
+ }
+ setSelectedRepository: (repository: string | null) => {
+ repository: string | null
+ }
+ startCloudRun: () => {
+ value: true
+ }
+ startCloudRunFailure: () => {
+ value: true
+ }
+ startCloudRunSuccess: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface wizardCloudRunLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ githubIntegration: (integrations: IntegrationType[] | null) => IntegrationType | null
+ isGithubConnected: (githubIntegration: IntegrationType | null) => boolean
+ connectGitHubUrl: (currentStepProductKey: ProductKey | null) => string
+ skillId: (selectedSDK: SDK | null) => string | undefined
+ }
+}
+
+export type wizardCloudRunLogicType = MakeLogicType<
+ wizardCloudRunLogicValues,
+ wizardCloudRunLogicActions,
+ Record<string, any>,
+ wizardCloudRunLogicMeta
+>
+
/**
* Drives the "open a PR for me" option on the install step:
* - resolves the team's GitHub integration (or the URL to connect one)
@@ -112,10 +189,13 @@ export const wizardCloudRunLogic = kea<wizardCloudRunLogicType>([
(integrations: IntegrationType[] | null): IntegrationType | null =>
integrations?.find((i) => i.kind === 'github') ?? null,
],
- isGithubConnected: [(s) => [s.githubIntegration], (githubIntegration): boolean => !!githubIntegration],
+ isGithubConnected: [
+ (s) => [s.githubIntegration],
+ (githubIntegration: IntegrationType | null): boolean => !!githubIntegration,
+ ],
connectGitHubUrl: [
(s) => [s.currentStepProductKey],
- (currentStepProductKey): string => {
+ (currentStepProductKey: null | import('../../../../queries/schema').ProductKey): string => {
// Full-page redirect to install/authorize the GitHub App, then back to
// the install step. integrationsLogic's callback appends the new
// integration id, and loadIntegrations() repopulates githubIntegration,
@@ -129,7 +209,10 @@ export const wizardCloudRunLogic = kea<wizardCloudRunLogicType>([
],
// The cloud wizard auto-detects the framework, so this is a hint rather than a
// requirement — only set when the user happens to have picked an SDK manually.
- skillId: [(s) => [s.selectedSDK], (selectedSDK): string | undefined => selectedSDK?.key],
+ skillId: [
+ (s) => [s.selectedSDK],
+ (selectedSDK: null | import('~/types').SDK): string | undefined => selectedSDK?.key,
+ ],
}),
listeners(({ values, actions }) => ({
startCloudRun: async () => {
diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/wizardDashboardLogic.ts b/frontend/src/scenes/onboarding/shared/wizard-sync/wizardDashboardLogic.ts
index 6a9b8b103abe..ed1239f14781 100644
--- a/frontend/src/scenes/onboarding/shared/wizard-sync/wizardDashboardLogic.ts
+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/wizardDashboardLogic.ts
@@ -1,4 +1,4 @@
-import { connect, kea, path } from 'kea'
+import { MakeLogicType, connect, kea, path } from 'kea'
import { loaders } from 'kea-loaders'
import { projectLogic } from 'scenes/projectLogic'
@@ -6,8 +6,6 @@ import { projectLogic } from 'scenes/projectLogic'
import { dashboardsList } from 'products/dashboards/frontend/generated/api'
import type { DashboardBasicApi } from 'products/dashboards/frontend/generated/api.schemas'
-import type { wizardDashboardLogicType } from './wizardDashboardLogicType'
-
// The wizard stamps started_at from its own clock (the user's machine or the sandbox), while
// dashboard created_at is server time — tolerate a skewed CLI clock so a dashboard created in the
// first seconds of a run isn't filtered out.
@@ -48,6 +46,40 @@ export function pickWizardDashboard(dashboards: DashboardCandidate[], startedAt:
return top ? { id: top.id, name: top.name ?? null } : null
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface wizardDashboardLogicValues {
+ currentProjectId: number | null // projectLogic
+ detectedDashboard: DetectedDashboard | null
+ detectedDashboardLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface wizardDashboardLogicActions {
+ detectWizardDashboard: ({ startedAt }: { startedAt: string }) => {
+ startedAt: string
+ }
+ detectWizardDashboardFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ detectWizardDashboardSuccess: (
+ detectedDashboard: DetectedDashboard | null,
+ payload?: {
+ startedAt: string
+ }
+ ) => {
+ detectedDashboard: DetectedDashboard | null
+ payload?: {
+ startedAt: string
+ }
+ }
+}
+
+export type wizardDashboardLogicType = MakeLogicType<wizardDashboardLogicValues, wizardDashboardLogicActions>
+
/**
* Detects the dashboard the wizard was instructed to build, so completed-run surfaces can hand the
* user straight to it. Fired by the Installation layer when a run (local or cloud) completes;
diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/wizardSyncUiLogic.ts b/frontend/src/scenes/onboarding/shared/wizard-sync/wizardSyncUiLogic.ts
index 3058929c06d4..1cc5153438a2 100644
--- a/frontend/src/scenes/onboarding/shared/wizard-sync/wizardSyncUiLogic.ts
+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/wizardSyncUiLogic.ts
@@ -1,6 +1,28 @@
-import { actions, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
-import type { wizardSyncUiLogicType } from './wizardSyncUiLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface wizardSyncUiLogicValues {
+ dialogOpen: boolean
+ dismissedKey: string | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface wizardSyncUiLogicActions {
+ closeDialog: () => {
+ value: true
+ }
+ dismiss: (key: string) => {
+ key: string
+ }
+ openDialog: () => {
+ value: true
+ }
+ restore: () => {
+ value: true
+ }
+}
+
+export type wizardSyncUiLogicType = MakeLogicType<wizardSyncUiLogicValues, wizardSyncUiLogicActions>
/**
* UI state for the detached wizard sync widget, shared app-wide (mounted by WizardSyncFab):
diff --git a/frontend/src/scenes/persons-management/personsManagementSceneLogic.tsx b/frontend/src/scenes/persons-management/personsManagementSceneLogic.tsx
index 3ff246972ca5..e0bdcc704660 100644
--- a/frontend/src/scenes/persons-management/personsManagementSceneLogic.tsx
+++ b/frontend/src/scenes/persons-management/personsManagementSceneLogic.tsx
@@ -1,4 +1,4 @@
-import { connect, kea, path, selectors } from 'kea'
+import { MakeLogicType, connect, kea, path, selectors } from 'kea'
import { FEATURE_FLAGS } from 'lib/constants'
import { GroupsAccessStatus } from 'lib/introductions/groupsAccessLogic'
@@ -9,7 +9,9 @@ import { urls } from 'scenes/urls'
import { groupsModel } from '~/models/groupsModel'
-import type { personsManagementSceneLogicType } from './personsManagementSceneLogicType'
+import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
+import type { Noun } from '../../models/groupsModel'
+import type { GroupType, GroupTypeIndex } from '../../types'
export type PersonsManagementTab = {
key: string
@@ -19,6 +21,40 @@ export type PersonsManagementTab = {
tooltipDocLink?: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface personsManagementSceneLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun // groupsModel
+ groupTypes: Map<GroupTypeIndex, GroupType> // groupsModel
+ groupTypesLoading: boolean // groupsModel
+ groupsAccessStatus: GroupsAccessStatus // groupsModel
+ crmFeatureFlag: boolean | string | undefined
+ groupTabs: PersonsManagementTab[]
+ lemonTabs: LemonTab<string>[]
+ tabs: PersonsManagementTab[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface personsManagementSceneLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ tabs: (groupTabs: PersonsManagementTab[]) => PersonsManagementTab[]
+ crmFeatureFlag: (featureFlags: FeatureFlagsSet) => boolean | string | undefined
+ groupTabs: (
+ groupTypes: Map<GroupTypeIndex, GroupType>,
+ groupsAccessStatus: GroupsAccessStatus,
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun
+ ) => PersonsManagementTab[]
+ lemonTabs: (tabs: PersonsManagementTab[]) => LemonTab<string>[]
+ }
+}
+
+export type personsManagementSceneLogicType = MakeLogicType<
+ personsManagementSceneLogicValues,
+ {},
+ Record<string, any>,
+ personsManagementSceneLogicMeta
+>
+
export const personsManagementSceneLogic = kea<personsManagementSceneLogicType>([
path(['scenes', 'persons-management', 'personsManagementSceneLogic']),
connect(() => ({
@@ -32,7 +68,7 @@ export const personsManagementSceneLogic = kea<personsManagementSceneLogicType>(
selectors({
tabs: [
(s) => [s.groupTabs],
- (groupTabs): PersonsManagementTab[] => {
+ (groupTabs: PersonsManagementTab[]): PersonsManagementTab[] => {
return [
{
key: 'persons',
@@ -50,10 +86,21 @@ export const personsManagementSceneLogic = kea<personsManagementSceneLogicType>(
]
},
],
- crmFeatureFlag: [(s) => [s.featureFlags], (featureFlags) => featureFlags[FEATURE_FLAGS.CRM_ITERATION_ONE]],
+ crmFeatureFlag: [
+ (s) => [s.featureFlags],
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet) =>
+ featureFlags[FEATURE_FLAGS.CRM_ITERATION_ONE],
+ ],
groupTabs: [
(s) => [s.groupTypes, s.groupsAccessStatus, s.aggregationLabel],
- (groupTypes, groupsAccessStatus, aggregationLabel): PersonsManagementTab[] => {
+ (
+ groupTypes: Map<import('../../types').GroupTypeIndex, import('../../types').GroupType>,
+ groupsAccessStatus: GroupsAccessStatus,
+ aggregationLabel: (
+ groupTypeIndex: number | null | undefined,
+ deferToUserWording?: boolean
+ ) => import('~/models/groupsModel').Noun
+ ): PersonsManagementTab[] => {
const showGroupsIntroductionPage = [
GroupsAccessStatus.HasAccess,
GroupsAccessStatus.HasGroupTypes,
@@ -80,7 +127,7 @@ export const personsManagementSceneLogic = kea<personsManagementSceneLogicType>(
lemonTabs: [
(s) => [s.tabs],
- (tabs): LemonTab<string>[] =>
+ (tabs: PersonsManagementTab[]): LemonTab<string>[] =>
tabs.map((tab) => ({
key: tab.key,
label: <span data-attr={`persons-management-${tab.key}-tab`}>{tab.label}</span>,
diff --git a/frontend/src/scenes/persons/relatedFeatureFlagsLogic.ts b/frontend/src/scenes/persons/relatedFeatureFlagsLogic.ts
index 12845c1904eb..c561b88e6beb 100644
--- a/frontend/src/scenes/persons/relatedFeatureFlagsLogic.ts
+++ b/frontend/src/scenes/persons/relatedFeatureFlagsLogic.ts
@@ -57,7 +57,7 @@ export interface relatedFeatureFlagsLogicActions {
loadFeatureFlags: () => any // featureFlagsLogic
setFeatureFlagsFilters: (
filters: Partial<FeatureFlagsFilters>,
- replace?: boolean
+ replace?: boolean | undefined
) => {
filters: Partial<FeatureFlagsFilters>
replace: boolean | undefined
diff --git a/frontend/src/scenes/project-homepage/ai-first/aiFirstHomepageLogic.ts b/frontend/src/scenes/project-homepage/ai-first/aiFirstHomepageLogic.ts
index 9bd2d6df212d..ba590ab2b379 100644
--- a/frontend/src/scenes/project-homepage/ai-first/aiFirstHomepageLogic.ts
+++ b/frontend/src/scenes/project-homepage/ai-first/aiFirstHomepageLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { actionToUrl, router, urlToAction } from 'kea-router'
import posthog from 'posthog-js'
@@ -26,7 +26,10 @@ import { emptySceneParams } from '~/scenes/scenes'
import { Scene, SceneTab } from '~/scenes/sceneTypes'
import { DashboardBasicType } from '~/types'
-import type { aiFirstHomepageLogicType } from './aiFirstHomepageLogicType'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { Node } from '../../../queries/schema/schema-general'
+import type { TeamPublicType, TeamType } from '../../../types'
+import type { DashboardType, QueryBasedInsightModel } from '../../../types'
import { HOMEPAGE_IDLE_DRAFT_KEY, HOMEPAGE_TAB_ID } from './constants'
export type HomepageMode = 'idle' | 'search' | 'ai'
@@ -79,6 +82,123 @@ function savePreviousHomepage(tab: SceneTab | null): void {
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface aiFirstHomepageLogicValues {
+ dashboardsLoading: boolean // dashboardsModel
+ pinnedDashboards: (DashboardBasicType | DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>)[] // dashboardsModel
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ conversationId: string | null // maxLogic
+ threadLogicKey: string // maxLogic
+ cachedStarred: FileSystemEntry[] // projectTreeDataLogic
+ shortcutDataHasLoaded: boolean // projectTreeDataLogic
+ cachedRecents: FileSystemEntry[] // recentItemsModel
+ recentsHasLoaded: boolean // recentItemsModel
+ homepage: SceneTab | null // sceneLogic
+ chatDraftFor: (tabId: string | undefined) => string // tabUiStateLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ animationPhase: AnimationPhase
+ capabilities: Capability[]
+ capabilityGrouping: CapabilityGrouping | null
+ fillInHint: string | null
+ gridItems: HomepageGridItem[]
+ layoutState: LayoutState
+ mode: HomepageMode
+ pinnedDashboardItems: HomepageGridItem[]
+ previousHomepage: SceneTab | null
+ query: string
+ recentItems: FileSystemEntry[]
+ recentItemsLoading: boolean
+ selectedCapability: string | null
+ starredItems: FileSystemEntry[]
+ starredItemsLoading: boolean
+ threadStarted: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface aiFirstHomepageLogicActions {
+ enterHandsFree: () => {
+ value: true
+ } // handsFreeLogic
+ openConversation: (conversationId: string) => {
+ conversationId: string
+ } // maxLogic
+ setQuestion: (question: string) => {
+ question: string
+ } // maxLogic
+ startNewConversation: () => {
+ value: true
+ } // maxLogic
+ setHomepage: (tab: SceneTab | null) => {
+ tab: SceneTab | null
+ } // sceneLogic
+ setChatDraftForTab: (
+ tabId: string | undefined,
+ draft: string
+ ) => {
+ draft: string
+ tabId: string
+ } // tabUiStateLogic
+ enterAiMode: (trigger: string) => {
+ trigger: string
+ }
+ returnToIdle: () => {
+ value: true
+ }
+ revertToPreviousHomepage: () => {
+ value: true
+ }
+ setAnimationPhase: (phase: AnimationPhase) => {
+ phase: AnimationPhase
+ }
+ setFillInHint: (hint: string | null) => {
+ hint: string | null
+ }
+ setPreviousHomepage: (tab: SceneTab | null) => {
+ tab: SceneTab | null
+ }
+ setQuery: (query: string) => {
+ query: string
+ }
+ setSelectedCapability: (key: string | null) => {
+ key: string | null
+ }
+ startHandsFreeChat: () => {
+ value: true
+ }
+ submitQuery: (mode: 'ai' | 'search') => {
+ mode: 'ai' | 'search'
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface aiFirstHomepageLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ recentItems: (cachedRecents: FileSystemEntry[]) => FileSystemEntry[]
+ recentItemsLoading: (recentsHasLoaded: boolean) => boolean
+ starredItems: (cachedStarred: FileSystemEntry[]) => FileSystemEntry[]
+ starredItemsLoading: (shortcutDataHasLoaded: boolean) => boolean
+ mode: (layoutState: LayoutState) => HomepageMode
+ animationPhase: (layoutState: LayoutState) => AnimationPhase
+ capabilityGrouping: (featureFlags: FeatureFlagsSet) => CapabilityGrouping | null
+ capabilities: (capabilityGrouping: CapabilityGrouping | null) => Capability[]
+ pinnedDashboardItems: (
+ pinnedDashboards: (DashboardBasicType | DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>)[]
+ ) => HomepageGridItem[]
+ gridItems: (
+ pinnedDashboardItems: HomepageGridItem[],
+ recentItems: FileSystemEntry[],
+ starredItems: FileSystemEntry[]
+ ) => HomepageGridItem[]
+ }
+}
+
+export type aiFirstHomepageLogicType = MakeLogicType<
+ aiFirstHomepageLogicValues,
+ aiFirstHomepageLogicActions,
+ Record<string, any>,
+ aiFirstHomepageLogicMeta
+>
+
export const aiFirstHomepageLogic = kea<aiFirstHomepageLogicType>([
path(['scenes', 'project-homepage', 'ai-first', 'aiFirstHomepageLogic']),
@@ -194,32 +314,45 @@ export const aiFirstHomepageLogic = kea<aiFirstHomepageLogicType>([
selectors({
recentItems: [
(s) => [s.cachedRecents],
- (cachedRecents): FileSystemEntry[] => cachedRecents.slice(0, GRID_LIMIT),
+ (cachedRecents: FileSystemEntry[]): FileSystemEntry[] => cachedRecents.slice(0, GRID_LIMIT),
],
- recentItemsLoading: [(s) => [s.recentsHasLoaded], (recentsHasLoaded): boolean => !recentsHasLoaded],
+ recentItemsLoading: [(s) => [s.recentsHasLoaded], (recentsHasLoaded: boolean): boolean => !recentsHasLoaded],
starredItems: [
(s) => [s.cachedStarred],
- (cachedStarred): FileSystemEntry[] => cachedStarred.filter((e) => e.type !== 'folder').slice(0, GRID_LIMIT),
+ (cachedStarred: FileSystemEntry[]): FileSystemEntry[] =>
+ cachedStarred.filter((e) => e.type !== 'folder').slice(0, GRID_LIMIT),
],
starredItemsLoading: [
(s) => [s.shortcutDataHasLoaded],
- (shortcutDataHasLoaded): boolean => !shortcutDataHasLoaded,
+ (shortcutDataHasLoaded: boolean): boolean => !shortcutDataHasLoaded,
+ ],
+ mode: [(s) => [s.layoutState], (layoutState: LayoutState): HomepageMode => layoutState.mode],
+ animationPhase: [
+ (s) => [s.layoutState],
+ (layoutState: LayoutState): AnimationPhase => layoutState.animationPhase,
],
- mode: [(s) => [s.layoutState], (layoutState): HomepageMode => layoutState.mode],
- animationPhase: [(s) => [s.layoutState], (layoutState): AnimationPhase => layoutState.animationPhase],
capabilityGrouping: [
(s) => [s.featureFlags],
- (featureFlags): CapabilityGrouping | null =>
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet): CapabilityGrouping | null =>
capabilityGroupingFromVariant(featureFlags[FEATURE_FLAGS.MAX_HOMEPAGE_CAPABILITIES]),
],
capabilities: [
(s) => [s.capabilityGrouping],
- (capabilityGrouping): Capability[] =>
+ (capabilityGrouping: CapabilityGrouping | null): Capability[] =>
capabilityGrouping ? capabilitiesForGrouping(capabilityGrouping) : [],
],
pinnedDashboardItems: [
(s) => [s.pinnedDashboards],
- (pinnedDashboards): HomepageGridItem[] =>
+ (
+ pinnedDashboards: (
+ | DashboardBasicType
+ | import('~/types').DashboardType<
+ import('~/types').QueryBasedInsightModel<
+ import('~/queries/schema/schema-general').Node<Record<string, any>>
+ >
+ >
+ )[]
+ ): HomepageGridItem[] =>
pinnedDashboards.slice(0, GRID_LIMIT).map(
(d: DashboardBasicType): HomepageGridItem => ({
id: `dashboard-${d.id}`,
@@ -232,7 +365,11 @@ export const aiFirstHomepageLogic = kea<aiFirstHomepageLogicType>([
],
gridItems: [
(s) => [s.pinnedDashboardItems, s.recentItems, s.starredItems],
- (pinnedDashboardItems, recentItems, starredItems): HomepageGridItem[] => {
+ (
+ pinnedDashboardItems: HomepageGridItem[],
+ recentItems: FileSystemEntry[],
+ starredItems: FileSystemEntry[]
+ ): HomepageGridItem[] => {
const toGridItem = (entry: FileSystemEntry, kind: HomepageGridItemKind): HomepageGridItem => {
const name = splitPath(entry.path).pop()
return {
diff --git a/frontend/src/scenes/project-homepage/projectHomepageLogic.tsx b/frontend/src/scenes/project-homepage/projectHomepageLogic.tsx
index b5a3d8bffabc..8a12bb1e18d9 100644
--- a/frontend/src/scenes/project-homepage/projectHomepageLogic.tsx
+++ b/frontend/src/scenes/project-homepage/projectHomepageLogic.tsx
@@ -1,4 +1,4 @@
-import { actions, connect, kea, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
@@ -13,7 +13,67 @@ export type RecentItem =
| (QueryBasedInsightModel & { itemType: 'insight' })
| (DashboardBasicType & { itemType: 'dashboard' })
-import type { projectHomepageLogicType } from './projectHomepageLogicType'
+import type { Node } from '../../queries/schema/schema-general'
+import type { DashboardType } from '../../types'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface projectHomepageLogicValues {
+ dashboardsLoading: boolean // dashboardsModel
+ rawDashboards: Record<string, DashboardBasicType | DashboardType<QueryBasedInsightModel>> // dashboardsModel
+ currentProjectId: number | null // projectLogic
+ breadcrumbs: Breadcrumb[]
+ expandedInsightIds: Set<string>
+ maxContext: MaxContextInput[]
+ recentDashboards: DashboardBasicType[]
+ recentInsights: QueryBasedInsightModel[]
+ recentInsightsLoading: boolean
+ recentItems: RecentItem[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface projectHomepageLogicActions {
+ loadRecentInsights: () => any
+ loadRecentInsightsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRecentInsightsSuccess: (
+ recentInsights: QueryBasedInsightModel<Node<Record<string, any>>>[],
+ payload?: any
+ ) => {
+ recentInsights: QueryBasedInsightModel<Node<Record<string, any>>>[]
+ payload?: any
+ }
+ toggleInsightExpanded: (insightShortId: string) => {
+ insightShortId: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface projectHomepageLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ recentItems: (
+ recentInsights: QueryBasedInsightModel<Node<Record<string, any>>>[],
+ recentDashboards: DashboardBasicType[]
+ ) => RecentItem[]
+ recentDashboards: (
+ rawDashboards: Record<
+ string,
+ DashboardBasicType | DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>
+ >
+ ) => DashboardBasicType[]
+ }
+}
+
+export type projectHomepageLogicType = MakeLogicType<
+ projectHomepageLogicValues,
+ projectHomepageLogicActions,
+ Record<string, any>,
+ projectHomepageLogicMeta
+>
export const projectHomepageLogic = kea<projectHomepageLogicType>([
path(['scenes', 'project-homepage', 'projectHomepageLogic']),
@@ -60,7 +120,7 @@ export const projectHomepageLogic = kea<projectHomepageLogicType>([
],
recentItems: [
(s) => [s.recentInsights, s.recentDashboards],
- (recentInsights, recentDashboards): RecentItem[] => {
+ (recentInsights: QueryBasedInsightModel[], recentDashboards: DashboardBasicType[]): RecentItem[] => {
return [
...recentInsights.map((i) => ({ ...i, itemType: 'insight' as const })),
...recentDashboards.map((d) => ({ ...d, itemType: 'dashboard' as const })),
@@ -73,7 +133,12 @@ export const projectHomepageLogic = kea<projectHomepageLogicType>([
],
recentDashboards: [
(s) => [s.rawDashboards],
- (rawDashboards): DashboardBasicType[] => {
+ (
+ rawDashboards: Record<
+ string,
+ DashboardBasicType | import('~/types').DashboardType<QueryBasedInsightModel>
+ >
+ ): DashboardBasicType[] => {
return Object.values(rawDashboards).filter((d) => d.last_viewed_at && !d.deleted)
},
],
diff --git a/frontend/src/scenes/projectLogic.ts b/frontend/src/scenes/projectLogic.ts
index 974196c7d2ca..07ae69af26aa 100644
--- a/frontend/src/scenes/projectLogic.ts
+++ b/frontend/src/scenes/projectLogic.ts
@@ -31,19 +31,19 @@ export interface projectLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface projectLogicActions {
loadCurrentOrganization: () => any // organizationLogic
- loadUser: (resetOnFailure?: boolean) => {
+ loadUser: (resetOnFailure?: boolean | undefined) => {
resetOnFailure: boolean | undefined
} // userLogic
switchTeam: (
teamId: number | string,
- destination?: string
+ destination?: string | undefined
) => {
destination: string | undefined
teamId: number | string
} // userLogic
updateCurrentOrganization: (
organizationId: string,
- destination?: string
+ destination?: string | undefined
) => {
destination: string | undefined
organizationId: string
diff --git a/frontend/src/scenes/saved-insights/savedInsightsLogic.ts b/frontend/src/scenes/saved-insights/savedInsightsLogic.ts
index bde6ebe1241b..ae6cdcb5692f 100644
--- a/frontend/src/scenes/saved-insights/savedInsightsLogic.ts
+++ b/frontend/src/scenes/saved-insights/savedInsightsLogic.ts
@@ -307,42 +307,6 @@ export interface savedInsightsLogicMeta {
}
pagination: (filters: SavedInsightFilters, count: number) => PaginationManual
}
- __keaTypeGenInternalReducerActions: {
- 'rename insight success (models.insightsModel)': (item: QueryBasedInsightModel) => {
- payload: {
- item: QueryBasedInsightModel<Node<Record<string, any>>>
- }
- type: 'rename insight success (models.insightsModel)'
- }
- 'update dashboard insight (models.dashboardsModel)': (
- insight: QueryBasedInsightModel,
- extraDashboardIds?: number[],
- sourceDashboardId?: number
- ) => {
- payload: {
- extraDashboardIds: number[] | undefined
- insight: QueryBasedInsightModel<Node<Record<string, any>>>
- sourceDashboardId: number | undefined
- }
- type: 'update dashboard insight (models.dashboardsModel)'
- }
- 'submit delete dashboard success (scenes.dashboard.deleteDashboardLogic)': (
- deleteDashboard: DeleteDashboardForm
- ) => {
- payload: {
- deleteDashboard: DeleteDashboardForm
- }
- type: 'submit delete dashboard success (scenes.dashboard.deleteDashboardLogic)'
- }
- 'submit duplicate dashboard success (scenes.dashboard.duplicateDashboardLogic)': (
- duplicateDashboard: DuplicateDashboardForm
- ) => {
- payload: {
- duplicateDashboard: DuplicateDashboardForm
- }
- type: 'submit duplicate dashboard success (scenes.dashboard.duplicateDashboardLogic)'
- }
- }
}
export type savedInsightsLogicType = MakeLogicType<
@@ -670,12 +634,20 @@ export const savedInsightsLogic = kea<savedInsightsLogicType>([
actions.addInsight(insight)
}
},
- [deleteDashboardLogic.actionTypes.submitDeleteDashboardSuccess]: ({ deleteDashboard }) => {
+ [deleteDashboardLogic.actionTypes.submitDeleteDashboardSuccess]: ({
+ deleteDashboard,
+ }: {
+ deleteDashboard: DeleteDashboardForm
+ }) => {
if (deleteDashboard.deleteInsights) {
actions.loadInsights()
}
},
- [duplicateDashboardLogic.actionTypes.submitDuplicateDashboardSuccess]: ({ duplicateDashboard }) => {
+ [duplicateDashboardLogic.actionTypes.submitDuplicateDashboardSuccess]: ({
+ duplicateDashboard,
+ }: {
+ duplicateDashboard: DuplicateDashboardForm
+ }) => {
if (duplicateDashboard.duplicateTiles) {
actions.loadInsights()
}
diff --git a/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts b/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts
index 9602e3ea2755..5bcf5346303b 100644
--- a/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts
@@ -638,17 +638,19 @@ export interface sessionRecordingPlayerLogicActions {
} // 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
- }
+ format?: ExporterFormat | undefined,
+ timestamp?: number | undefined,
+ duration?: number | undefined,
+ mode?: SessionRecordingPlayerMode | undefined,
+ options?:
+ | {
+ css_selector?: string
+ filename?: string
+ height?: number
+ skip_inactivity?: boolean
+ width?: number
+ }
+ | undefined
) => {
duration: number | undefined
format: ExporterFormat | undefined
diff --git a/frontend/src/scenes/sessions/sessionProfileLogic.ts b/frontend/src/scenes/sessions/sessionProfileLogic.ts
index cb6091c03824..1c1634249e5e 100644
--- a/frontend/src/scenes/sessions/sessionProfileLogic.ts
+++ b/frontend/src/scenes/sessions/sessionProfileLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
@@ -7,8 +7,8 @@ import { NodeKind } from '~/queries/schema/schema-general'
import { hogql } from '~/queries/utils'
import { SessionEventType } from '~/types'
+import type { TeamPublicType, TeamType } from '../../types'
import { teamLogic } from '../teamLogic'
-import type { sessionProfileLogicType } from './sessionProfileLogicType'
/**
* Extract the timestamp embedded in a UUIDv7.
@@ -55,6 +55,281 @@ export interface SessionData {
last_external_click_url: string | null
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionProfileLogicValues {
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ categorizedEventCount: number
+ eventDetails: Record<string, Record<string, any>>
+ eventDetailsLoading: boolean
+ eventsListFolded: boolean
+ eventsOffset: number
+ hasMoreEvents: boolean
+ hasRecording: boolean
+ hasRecordingLoading: boolean
+ isInitialLoading: boolean
+ isLoadingMore: boolean
+ otherEventCount: number
+ sessionData: SessionData | null
+ sessionDataLoading: boolean
+ sessionDuration: number | null
+ sessionEvents: SessionEventType[] | null
+ sessionEventsLoading: boolean
+ sessionId: any
+ sessionProperties: Record<string, any> | null
+ sortOrder: 'asc' | 'desc'
+ supportTicketEvents: SessionEventType[]
+ supportTicketEventsLoading: boolean
+ totalEventCount: number | null
+ totalEventCountLoading: boolean
+ uniqueUrlCount: number
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionProfileLogicActions {
+ loadEventDetails: (
+ eventId: string,
+ eventName: string
+ ) => {
+ eventId: string
+ eventName: string
+ }
+ loadEventDetailsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadEventDetailsSuccess: (
+ eventDetails: {
+ [x: number]: any
+ },
+ payload?: {
+ eventId: string
+ eventName: string
+ }
+ ) => {
+ eventDetails: {
+ [x: number]: any
+ }
+ payload?: {
+ eventId: string
+ eventName: string
+ }
+ }
+ loadMoreSessionEvents: () => {
+ value: true
+ }
+ loadMoreSessionEventsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadMoreSessionEventsSuccess: (
+ sessionEvents: SessionEventType[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ sessionEvents: SessionEventType[]
+ payload?: {
+ value: true
+ }
+ }
+ loadRecordingAvailability: () => {
+ value: true
+ }
+ loadRecordingAvailabilityFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRecordingAvailabilitySuccess: (
+ hasRecording: boolean,
+ payload?: {
+ value: true
+ }
+ ) => {
+ hasRecording: boolean
+ payload?: {
+ value: true
+ }
+ }
+ loadSessionData: () => {
+ value: true
+ }
+ loadSessionDataFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSessionDataSuccess: (
+ sessionData: {
+ autocapture_count: any
+ channel_type: any
+ distinct_id: any
+ end_current_url: any
+ end_timestamp: any
+ entry_current_url: any
+ entry_hostname: any
+ entry_pathname: any
+ entry_referring_domain: any
+ entry_utm_campaign: any
+ entry_utm_medium: any
+ entry_utm_source: any
+ is_bounce: any
+ last_external_click_url: any
+ num_uniq_urls: any
+ pageview_count: any
+ person_properties: Record<string, any> | null
+ screen_count: any
+ session_duration: any
+ session_id: any
+ start_timestamp: any
+ urls: any
+ } | null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ sessionData: {
+ autocapture_count: any
+ channel_type: any
+ distinct_id: any
+ end_current_url: any
+ end_timestamp: any
+ entry_current_url: any
+ entry_hostname: any
+ entry_pathname: any
+ entry_referring_domain: any
+ entry_utm_campaign: any
+ entry_utm_medium: any
+ entry_utm_source: any
+ is_bounce: any
+ last_external_click_url: any
+ num_uniq_urls: any
+ pageview_count: any
+ person_properties: Record<string, any> | null
+ screen_count: any
+ session_duration: any
+ session_id: any
+ start_timestamp: any
+ urls: any
+ } | null
+ payload?: {
+ value: true
+ }
+ }
+ loadSessionEvents: () => {
+ value: true
+ }
+ loadSessionEventsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSessionEventsSuccess: (
+ sessionEvents: SessionEventType[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ sessionEvents: SessionEventType[]
+ payload?: {
+ value: true
+ }
+ }
+ loadSupportTicketEvents: () => {
+ value: true
+ }
+ loadSupportTicketEventsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSupportTicketEventsSuccess: (
+ supportTicketEvents: SessionEventType[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ supportTicketEvents: SessionEventType[]
+ payload?: {
+ value: true
+ }
+ }
+ loadTotalEventCount: () => {
+ value: true
+ }
+ loadTotalEventCountFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadTotalEventCountSuccess: (
+ totalEventCount: number | null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ totalEventCount: number | null
+ payload?: {
+ value: true
+ }
+ }
+ setEventsListFolded: (isFolded: boolean) => {
+ isFolded: boolean
+ }
+ setHasMoreEvents: (hasMore: boolean) => {
+ hasMore: boolean
+ }
+ setSortOrder: (sortOrder: 'asc' | 'desc') => {
+ sortOrder: 'asc' | 'desc'
+ }
+ updateEventsOffset: (offset: number) => {
+ offset: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionProfileLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ sessionId: (arg: any) => any
+ sessionDuration: (sessionData: SessionData | null) => number | null
+ uniqueUrlCount: (sessionData: SessionData | null) => number
+ categorizedEventCount: (sessionData: SessionData | null) => number
+ otherEventCount: (totalEventCount: number | null, sessionData: SessionData | null) => number
+ isInitialLoading: (
+ sessionDataLoading: boolean,
+ sessionEventsLoading: boolean,
+ sessionData: SessionData | null,
+ sessionEvents: SessionEventType[] | null
+ ) => boolean
+ isLoadingMore: (sessionEventsLoading: boolean, sessionEvents: SessionEventType[] | null) => boolean
+ sessionProperties: (sessionData: SessionData | null) => Record<string, any> | null
+ }
+}
+
+export type sessionProfileLogicType = MakeLogicType<
+ sessionProfileLogicValues,
+ sessionProfileLogicActions,
+ SessionProfileLogicProps,
+ sessionProfileLogicMeta
+>
+
export const sessionProfileLogic = kea<sessionProfileLogicType>([
path(['scenes', 'sessions', 'sessionProfileLogic']),
props({} as SessionProfileLogicProps),
diff --git a/frontend/src/scenes/settings/environment/groupAnalyticsConfigLogic.ts b/frontend/src/scenes/settings/environment/groupAnalyticsConfigLogic.ts
index 93d1338bf96f..39bbfd91a8b7 100644
--- a/frontend/src/scenes/settings/environment/groupAnalyticsConfigLogic.ts
+++ b/frontend/src/scenes/settings/environment/groupAnalyticsConfigLogic.ts
@@ -17,7 +17,7 @@ export interface groupAnalyticsConfigLogicValues {
export interface groupAnalyticsConfigLogicActions {
deleteGroupType: (groupTypeIndex: number) => number // groupsModel
loadAllGroupTypes: () => any // groupsModel
- updateGroupTypesMetadata: (payload: Array<GroupType>) => Array<GroupType> // groupsModel
+ updateGroupTypesMetadata: (payload: GroupType[]) => GroupType[] // groupsModel
reset: () => {
value: true
}
diff --git a/frontend/src/scenes/settings/user/changePasswordLogic.ts b/frontend/src/scenes/settings/user/changePasswordLogic.ts
index 5461408796ca..b93efdc92e76 100644
--- a/frontend/src/scenes/settings/user/changePasswordLogic.ts
+++ b/frontend/src/scenes/settings/user/changePasswordLogic.ts
@@ -36,7 +36,7 @@ export interface changePasswordLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface changePasswordLogicActions {
- loadUser: (resetOnFailure?: boolean) => {
+ loadUser: (resetOnFailure?: boolean | undefined) => {
resetOnFailure: boolean | undefined
} // userLogic
resetChangePassword: (values?: ChangePasswordForm) => {
diff --git a/frontend/src/scenes/settings/user/passkeySettingsLogic.ts b/frontend/src/scenes/settings/user/passkeySettingsLogic.ts
index c8f26a849c11..1e362eb846be 100644
--- a/frontend/src/scenes/settings/user/passkeySettingsLogic.ts
+++ b/frontend/src/scenes/settings/user/passkeySettingsLogic.ts
@@ -69,7 +69,7 @@ export interface passkeySettingsLogicActions {
loadStatus: () => {
value: true
} // twoFactorLogic
- loadUser: (resetOnFailure?: boolean) => {
+ loadUser: (resetOnFailure?: boolean | undefined) => {
resetOnFailure: boolean | undefined
} // userLogic
beginRegistration: (label: string) => {
diff --git a/frontend/src/scenes/settings/user/userDangerZoneLogic.ts b/frontend/src/scenes/settings/user/userDangerZoneLogic.ts
index f29a34aea1d1..b753bf5a7d02 100644
--- a/frontend/src/scenes/settings/user/userDangerZoneLogic.ts
+++ b/frontend/src/scenes/settings/user/userDangerZoneLogic.ts
@@ -20,7 +20,7 @@ export interface userDangerZoneLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface userDangerZoneLogicActions {
- deleteOrganizationSuccess: ({ redirectPath }: { redirectPath?: string }) => {
+ deleteOrganizationSuccess: (args_0: { redirectPath?: string }) => {
redirectPath: string | undefined
} // organizationLogic
addDeletedOrganizationId: (id: string) => {
diff --git a/frontend/src/scenes/teamLogic.tsx b/frontend/src/scenes/teamLogic.tsx
index 523c52232c60..a369a3ebfbdb 100644
--- a/frontend/src/scenes/teamLogic.tsx
+++ b/frontend/src/scenes/teamLogic.tsx
@@ -89,12 +89,12 @@ export interface teamLogicActions {
currentProject: ProjectType | null
payload?: any
} // projectLogic
- loadUser: (resetOnFailure?: boolean) => {
+ loadUser: (resetOnFailure?: boolean | undefined) => {
resetOnFailure: boolean | undefined
} // userLogic
switchTeam: (
teamId: number | string,
- destination?: string
+ destination?: string | undefined
) => {
destination: string | undefined
teamId: number | string
diff --git a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic.ts b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic.ts
index e3d45b2b21a1..cadb70dc5744 100644
--- a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic.ts
+++ b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic.ts
@@ -323,9 +323,11 @@ export interface marketingAnalyticsLogicActions {
previous: null
results: never[]
},
- payload?: {
- value: true
- }
+ payload?:
+ | {
+ value: true
+ }
+ | undefined
) => {
dataWarehouseSources:
| PaginatedResponse<ExternalDataSource>
diff --git a/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx b/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx
index 42f8dab65693..e265fee6c69a 100644
--- a/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx
+++ b/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx
@@ -268,7 +268,7 @@ export interface webAnalyticsLogicActions {
cancelAllLoading: () => {} // dataNodeCollectionLogic
updateUser: (
user: Partial<UserType>,
- successCallback?: () => void
+ successCallback?: (() => void) | undefined
) => {
successCallback: (() => void) | undefined
user: Partial<UserType>
@@ -537,7 +537,7 @@ export interface webAnalyticsLogicMeta {
activeHoursTab: (_activeHoursTab: string | null) => string
isPathCleaningEnabled: (
_isPathCleaningEnabled: boolean,
- hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean // userLogic
) => boolean
currentFiltersConfig: (
rawWebAnalyticsFilters: WebAnalyticsPropertyFilters,
diff --git a/products/dashboards/frontend/logics/dashboardsFileSystemLogic.ts b/products/dashboards/frontend/logics/dashboardsFileSystemLogic.ts
index 763a2f429f72..f18cce55a77b 100644
--- a/products/dashboards/frontend/logics/dashboardsFileSystemLogic.ts
+++ b/products/dashboards/frontend/logics/dashboardsFileSystemLogic.ts
@@ -13,8 +13,6 @@ import { dashboardsModel } from '~/models/dashboardsModel'
import { FileSystemEntry } from '~/queries/schema/schema-general'
import { DashboardBasicType } from '~/types'
-import type { Node } from '../../../../frontend/src/queries/schema/schema-general'
-import type { DashboardType, QueryBasedInsightModel } from '../../../../frontend/src/types'
import {
buildEntryByRef,
buildFolderDashboardCounts,
@@ -187,28 +185,6 @@ export interface dashboardsFileSystemLogicMeta {
entryByRef: Record<string, FileSystemEntry>
) => Record<string, number>
}
- __keaTypeGenInternalReducerActions: {
- 'duplicate dashboard success (models.dashboardsModel)': (
- dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>,
- payload?: {
- duplicateTiles: boolean
- id: number
- name: string
- show: boolean
- }
- ) => {
- payload: {
- dashboard: DashboardType<QueryBasedInsightModel<Node<Record<string, any>>>>
- payload?: {
- duplicateTiles: boolean
- id: number
- name: string
- show: boolean
- }
- }
- type: 'duplicate dashboard success (models.dashboardsModel)'
- }
- }
}
export type dashboardsFileSystemLogicType = MakeLogicType<
diff --git a/products/dashboards/frontend/widgets/error_tracking/errorTrackingWidgetLogic.ts b/products/dashboards/frontend/widgets/error_tracking/errorTrackingWidgetLogic.ts
index 14761aa24a60..fe56f87b7c2f 100644
--- a/products/dashboards/frontend/widgets/error_tracking/errorTrackingWidgetLogic.ts
+++ b/products/dashboards/frontend/widgets/error_tracking/errorTrackingWidgetLogic.ts
@@ -3,7 +3,6 @@ import { MakeLogicType, connect, kea, key, listeners, path, props } from 'kea'
import { issueActionsLogic } from 'products/error_tracking/frontend/components/IssueActions/issueActionsLogic'
import type {
- ErrorTrackingIssue,
ErrorTrackingIssueAssignee,
ErrorTrackingIssueStatus,
} from '../../../../../frontend/src/queries/schema/schema-general'
@@ -28,14 +27,14 @@ export interface errorTrackingWidgetLogicActions {
} // issueActionsLogic
updateIssueAssignee: (
id: string,
- assignee: ErrorTrackingIssue['assignee']
+ assignee: ErrorTrackingIssueAssignee | null
) => {
assignee: ErrorTrackingIssueAssignee | null
id: string
} // issueActionsLogic
updateIssueStatus: (
id: string,
- status: ErrorTrackingIssue['status']
+ status: ErrorTrackingIssueStatus
) => {
id: string
status: ErrorTrackingIssueStatus
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/selfManagedSourceLogic.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/selfManagedSourceLogic.tsx
index 75733f571081..c2e2706250ac 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/selfManagedSourceLogic.tsx
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/selfManagedSourceLogic.tsx
@@ -95,7 +95,13 @@ export interface selfManagedSourceLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface selfManagedSourceLogicActions {
- loadDatabase: ({ force }?: { force?: boolean }) => {
+ loadDatabase: (
+ args_0?:
+ | {
+ force?: boolean
+ }
+ | undefined
+ ) => {
force?: boolean
} // databaseTableListLogic
addConditionSet: () => {
diff --git a/products/data_warehouse/frontend/shared/logics/sourceManagementLogic.ts b/products/data_warehouse/frontend/shared/logics/sourceManagementLogic.ts
index 9c6e6f8cd179..4d9ecd12e338 100644
--- a/products/data_warehouse/frontend/shared/logics/sourceManagementLogic.ts
+++ b/products/data_warehouse/frontend/shared/logics/sourceManagementLogic.ts
@@ -64,7 +64,13 @@ export interface sourceManagementLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface sourceManagementLogicActions {
- loadDatabase: ({ force }?: { force?: boolean }) => {
+ loadDatabase: (
+ args_0?:
+ | {
+ force?: boolean
+ }
+ | undefined
+ ) => {
force?: boolean
} // databaseTableListLogic
loadJoins: () => any // joinsLogic
diff --git a/products/error_tracking/frontend/components/ExceptionCard/Tabs/SessionTab/sessionTabLogic.ts b/products/error_tracking/frontend/components/ExceptionCard/Tabs/SessionTab/sessionTabLogic.ts
index 18c7b52870ab..e45bcb0dd9ac 100644
--- a/products/error_tracking/frontend/components/ExceptionCard/Tabs/SessionTab/sessionTabLogic.ts
+++ b/products/error_tracking/frontend/components/ExceptionCard/Tabs/SessionTab/sessionTabLogic.ts
@@ -61,7 +61,7 @@ export interface sessionTabLogicValues {
export interface sessionTabLogicActions {
seekToTimestamp: (
timestamp: number,
- forcePlay?: boolean
+ forcePlay?: boolean | undefined
) => {
forcePlay: boolean
timestamp: number
diff --git a/products/error_tracking/frontend/logics/issuesDataNodeLogic.tsx b/products/error_tracking/frontend/logics/issuesDataNodeLogic.tsx
index 810912198eab..13a7e136dc93 100644
--- a/products/error_tracking/frontend/logics/issuesDataNodeLogic.tsx
+++ b/products/error_tracking/frontend/logics/issuesDataNodeLogic.tsx
@@ -5,7 +5,6 @@ import { DataNodeLogicProps, dataNodeLogic } from '~/queries/nodes/DataNode/data
import { ErrorTrackingIssue, ErrorTrackingQuery } from '~/queries/schema/schema-general'
import type {
- AnyResponseType,
DataNode,
DateRange,
ErrorTrackingIssueAssignee,
@@ -114,9 +113,9 @@ export interface issuesDataNodeLogicActions {
value: true
} // nodeLogic
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
@@ -147,12 +146,14 @@ export interface issuesDataNodeLogicActions {
| 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
@@ -178,7 +179,23 @@ export interface issuesDataNodeLogicActions {
| undefined
} // nodeLogic
setResponse: (
- 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
diff --git a/products/logs/frontend/attributeBreakdownLogic.tsx b/products/logs/frontend/attributeBreakdownLogic.tsx
index 127e689389ba..784dd0d81e9b 100644
--- a/products/logs/frontend/attributeBreakdownLogic.tsx
+++ b/products/logs/frontend/attributeBreakdownLogic.tsx
@@ -1,9 +1,9 @@
-import { connect, kea, key, path, props, selectors } from 'kea'
+import { MakeLogicType, connect, kea, key, path, props, selectors } from 'kea'
import { PropertyFilterType } from '~/types'
-import type { attributeBreakdownLogicType } from './attributeBreakdownLogicType'
import { logsViewerDataLogic } from './components/LogsViewer/data/logsViewerDataLogic'
+import type { ParsedLogMessage } from './types'
export interface AttributeBreakdownLogicProps {
attribute: string
@@ -11,6 +11,35 @@ export interface AttributeBreakdownLogicProps {
id: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface attributeBreakdownLogicValues {
+ logs: ParsedLogMessage[] // logsViewerDataLogic
+ attributeValues: string[]
+ breakdowns: {
+ [key: string]: number
+ }
+ logCount: number
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface attributeBreakdownLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ logCount: (logs: ParsedLogMessage[]) => number
+ attributeValues: (logs: ParsedLogMessage[]) => string[]
+ breakdowns: (attributeValues: string[]) => {
+ [key: string]: number
+ }
+ }
+}
+
+export type attributeBreakdownLogicType = MakeLogicType<
+ attributeBreakdownLogicValues,
+ {},
+ AttributeBreakdownLogicProps,
+ attributeBreakdownLogicMeta
+>
+
export const attributeBreakdownLogic = kea<attributeBreakdownLogicType>([
props({} as AttributeBreakdownLogicProps),
key((props) => `${props.id}-${props.type}-${props.attribute}`),
@@ -21,10 +50,10 @@ export const attributeBreakdownLogic = kea<attributeBreakdownLogicType>([
})),
selectors(({ props }) => ({
- logCount: [(s) => [s.logs], (logs): number => logs.length],
+ logCount: [(s) => [s.logs], (logs: import('./types').ParsedLogMessage[]): number => logs.length],
attributeValues: [
(s) => [s.logs],
- (logs): string[] => {
+ (logs: import('./types').ParsedLogMessage[]): string[] => {
let attributesKey: 'attributes' | 'resource_attributes' = 'attributes'
if (props.type === PropertyFilterType.LogResourceAttribute) {
attributesKey = 'resource_attributes'
diff --git a/products/logs/frontend/components/LogsAlerting/logsAlertEventHistoryLogic.ts b/products/logs/frontend/components/LogsAlerting/logsAlertEventHistoryLogic.ts
index 97570ff0e686..f695dcc4eed6 100644
--- a/products/logs/frontend/components/LogsAlerting/logsAlertEventHistoryLogic.ts
+++ b/products/logs/frontend/components/LogsAlerting/logsAlertEventHistoryLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, key, path, props } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, key, path, props } from 'kea'
import { loaders } from 'kea-loaders'
import { teamLogic } from 'scenes/teamLogic'
@@ -6,8 +6,6 @@ import { teamLogic } from 'scenes/teamLogic'
import { logsAlertsEventsList } from 'products/logs/frontend/generated/api'
import { LogsAlertEventApi } from 'products/logs/frontend/generated/api.schemas'
-import type { logsAlertEventHistoryLogicType } from './logsAlertEventHistoryLogicType'
-
export interface LogsAlertEventHistoryLogicProps {
alertId: string
}
@@ -18,6 +16,73 @@ export interface EventsPage {
count: number
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsAlertEventHistoryLogicValues {
+ currentTeamId: number | null // teamLogic
+ eventsPage: EventsPage
+ eventsPageLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsAlertEventHistoryLogicActions {
+ loadEvents: () => any
+ loadEventsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadEventsSuccess: (
+ eventsPage: {
+ count: number
+ next: string | null
+ results: LogsAlertEventApi[]
+ },
+ payload?: any
+ ) => {
+ eventsPage: {
+ count: number
+ next: string | null
+ results: LogsAlertEventApi[]
+ }
+ payload?: any
+ }
+ loadMore: () => {
+ value: true
+ }
+ loadMoreFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadMoreSuccess: (
+ eventsPage: EventsPage,
+ payload?: {
+ value: true
+ }
+ ) => {
+ eventsPage: EventsPage
+ payload?: {
+ value: true
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsAlertEventHistoryLogicMeta {
+ key: string
+}
+
+export type logsAlertEventHistoryLogicType = MakeLogicType<
+ logsAlertEventHistoryLogicValues,
+ logsAlertEventHistoryLogicActions,
+ LogsAlertEventHistoryLogicProps,
+ logsAlertEventHistoryLogicMeta
+>
+
export const logsAlertEventHistoryLogic = kea<logsAlertEventHistoryLogicType>([
path((key) => ['products', 'logs', 'frontend', 'components', 'LogsAlerting', 'logsAlertEventHistoryLogic', key]),
props({} as LogsAlertEventHistoryLogicProps),
diff --git a/products/logs/frontend/components/LogsAlerting/logsAlertFormLogic.ts b/products/logs/frontend/components/LogsAlerting/logsAlertFormLogic.ts
index 0bcc0086cecd..f28f2101fdc5 100644
--- a/products/logs/frontend/components/LogsAlerting/logsAlertFormLogic.ts
+++ b/products/logs/frontend/components/LogsAlerting/logsAlertFormLogic.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 { loaders } from 'kea-loaders'
import { lemonToast } from '@posthog/lemon-ui'
@@ -21,10 +22,10 @@ import {
LogsAlertThresholdOperatorEnumApi,
} from 'products/logs/frontend/generated/api.schemas'
-import type { logsAlertFormLogicType } from './logsAlertFormLogicType'
import { logsAlertingLogic } from './logsAlertingLogic'
import { logsAlertNotificationLogic } from './logsAlertNotificationLogic'
import { buildAlertFilters, hasAnyFilter } from './logsAlertUtils'
+import type { PendingLogsAlertNotification } from './logsAlertUtils'
const EMPTY_FILTER_GROUP: UniversalFiltersGroup = {
type: FilterLogicalOperator.And,
@@ -76,6 +77,144 @@ export function buildFormDefaults(alert: LogsAlertConfigurationApi | null): Logs
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsAlertFormLogicValues {
+ pendingNotifications: PendingLogsAlertNotification[] // logsAlertNotificationLogic
+ currentTeamId: number | null // teamLogic
+ alertForm: LogsAlertFormType
+ alertFormAllErrors: Record<string, any>
+ alertFormChanged: boolean
+ alertFormErrors: DeepPartialMap<LogsAlertFormType, ValidationErrorType>
+ alertFormHasErrors: boolean
+ alertFormManualErrors: Record<string, any>
+ alertFormTouched: boolean
+ alertFormTouches: Record<string, boolean>
+ alertFormValidationErrors: DeepPartialMap<LogsAlertFormType, ValidationErrorType>
+ isAlertFormSubmitting: boolean
+ isAlertFormValid: boolean
+ isEditing: boolean
+ isSimulationPanelOpen: boolean
+ showAlertFormErrors: boolean
+ simulationDateFrom: string
+ simulationResult: LogsAlertSimulateResponseApi | null
+ simulationResultLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsAlertFormLogicActions {
+ createPendingHogFunctions: (alertId: string) => {
+ alertId: string
+ } // logsAlertNotificationLogic
+ loadAlerts: () => any // logsAlertingLogic
+ setEditingAlert: (alert: LogsAlertConfigurationApi | null) => {
+ alert: LogsAlertConfigurationApi | null
+ } // logsAlertingLogic
+ setIsCreating: (isCreating: boolean) => {
+ isCreating: boolean
+ } // logsAlertingLogic
+ clearSimulation: () => {
+ value: true
+ }
+ clearSimulationFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ clearSimulationSuccess: (
+ simulationResult: null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ simulationResult: null
+ payload?: {
+ value: true
+ }
+ }
+ closeSimulationPanel: () => {
+ value: true
+ }
+ openSimulationPanel: () => {
+ value: true
+ }
+ resetAlertForm: (values?: LogsAlertFormType) => {
+ values?: LogsAlertFormType
+ }
+ setAlertFormManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setAlertFormValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setAlertFormValues: (values: DeepPartial<LogsAlertFormType>) => {
+ values: DeepPartial<LogsAlertFormType>
+ }
+ setSimulationDateFrom: (dateFrom: string) => {
+ dateFrom: string
+ }
+ simulateAlert: () => {
+ value: true
+ }
+ simulateAlertFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ simulateAlertSuccess: (
+ simulationResult: LogsAlertSimulateResponseApi | null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ simulationResult: LogsAlertSimulateResponseApi | null
+ payload?: {
+ value: true
+ }
+ }
+ submitAlertForm: () => {
+ value: boolean
+ }
+ submitAlertFormFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitAlertFormRequest: (alertForm: LogsAlertFormType) => {
+ alertForm: LogsAlertFormType
+ }
+ submitAlertFormSuccess: (alertForm: LogsAlertFormType) => {
+ alertForm: LogsAlertFormType
+ }
+ touchAlertFormField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsAlertFormLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ isEditing: (arg: any) => boolean
+ }
+}
+
+export type logsAlertFormLogicType = MakeLogicType<
+ logsAlertFormLogicValues,
+ logsAlertFormLogicActions,
+ LogsAlertFormLogicProps,
+ logsAlertFormLogicMeta
+>
+
export const logsAlertFormLogic = kea<logsAlertFormLogicType>([
path(['products', 'logs', 'frontend', 'components', 'LogsAlerting', 'logsAlertFormLogic']),
props({} as LogsAlertFormLogicProps),
diff --git a/products/logs/frontend/components/LogsAlerting/logsAlertNotificationLogic.ts b/products/logs/frontend/components/LogsAlerting/logsAlertNotificationLogic.ts
index d2211028261c..e3b1c33537fc 100644
--- a/products/logs/frontend/components/LogsAlerting/logsAlertNotificationLogic.ts
+++ b/products/logs/frontend/components/LogsAlerting/logsAlertNotificationLogic.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'
@@ -10,7 +10,7 @@ import { HogFunctionType, IntegrationType } from '~/types'
import { logsAlertsDestinationsCreate, logsAlertsDestinationsDeleteCreate } from 'products/logs/frontend/generated/api'
-import type { logsAlertNotificationLogicType } from './logsAlertNotificationLogicType'
+import type { UserBasicType } from '../../../../../frontend/src/types'
import {
buildLogsAlertFilterConfig,
groupLogsAlertDestinations,
@@ -32,6 +32,186 @@ export interface LogsAlertNotificationLogicProps {
alertId?: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsAlertNotificationLogicValues {
+ slackIntegrations: IntegrationType[] | undefined // integrationsLogic
+ currentProjectId: number | null // projectLogic
+ destinationGroups: LogsAlertDestinationGroup[]
+ existingHogFunctions: HogFunctionType[]
+ existingHogFunctionsLoading: boolean
+ firstSlackIntegration: IntegrationType | undefined
+ pendingNotifications: PendingLogsAlertNotification[]
+ selectedType: LogsAlertNotificationType
+ slackChannelValue: string | null
+ webhookUrl: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsAlertNotificationLogicActions {
+ 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: PendingLogsAlertNotification) => {
+ notification: PendingLogsAlertNotification
+ }
+ clearPendingNotifications: () => {
+ value: true
+ }
+ createPendingHogFunctions: (alertId: string) => {
+ alertId: string
+ }
+ deleteExistingDestination: (group: LogsAlertDestinationGroup) => {
+ group: LogsAlertDestinationGroup
+ }
+ destinationsChanged: () => {
+ value: true
+ }
+ loadExistingHogFunctions: (alertId?: string) => string
+ loadExistingHogFunctionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadExistingHogFunctionsSuccess: (
+ existingHogFunctions: HogFunctionType[],
+ payload?: string
+ ) => {
+ existingHogFunctions: HogFunctionType[]
+ payload?: string
+ }
+ removePendingNotification: (index: number) => {
+ index: number
+ }
+ setPendingNotifications: (notifications: PendingLogsAlertNotification[]) => {
+ notifications: PendingLogsAlertNotification[]
+ }
+ setSelectedType: (selectedType: LogsAlertNotificationType) => {
+ selectedType: LogsAlertNotificationType
+ }
+ 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 logsAlertNotificationLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ firstSlackIntegration: (slackIntegrations: IntegrationType[] | undefined) => IntegrationType | undefined
+ destinationGroups: (existingHogFunctions: HogFunctionType[]) => LogsAlertDestinationGroup[]
+ }
+}
+
+export type logsAlertNotificationLogicType = MakeLogicType<
+ logsAlertNotificationLogicValues,
+ logsAlertNotificationLogicActions,
+ LogsAlertNotificationLogicProps,
+ logsAlertNotificationLogicMeta
+>
+
export const logsAlertNotificationLogic = kea<logsAlertNotificationLogicType>([
path(['products', 'logs', 'frontend', 'components', 'LogsAlerting', 'logsAlertNotificationLogic']),
props({} as LogsAlertNotificationLogicProps),
diff --git a/products/logs/frontend/components/LogsAlerting/logsAlertingLogic.ts b/products/logs/frontend/components/LogsAlerting/logsAlertingLogic.ts
index c2cc37c13f4b..0800ede1d0d1 100644
--- a/products/logs/frontend/components/LogsAlerting/logsAlertingLogic.ts
+++ b/products/logs/frontend/components/LogsAlerting/logsAlertingLogic.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 { router } from 'kea-router'
@@ -17,11 +17,84 @@ import {
} from 'products/logs/frontend/generated/api'
import { LogsAlertConfigurationApi } from 'products/logs/frontend/generated/api.schemas'
-import type { logsAlertingLogicType } from './logsAlertingLogicType'
import { alertFiltersForPreEnableCheck, dispatchPreEnableCheck, runPreEnableChecks } from './logsAlertUtils'
const ALERT_POLL_INTERVAL_MS = 30_000
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsAlertingLogicValues {
+ currentTeamId: number | null // teamLogic
+ alerts: LogsAlertConfigurationApi[]
+ alertsLoading: boolean
+ creatingAlert: boolean
+ editingAlert: LogsAlertConfigurationApi | null
+ isCreating: boolean
+ resettingAlertIds: Set<string>
+ viewingHistoryAlert: LogsAlertConfigurationApi | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsAlertingLogicActions {
+ createAlertAndOpen: () => {
+ value: true
+ }
+ deleteAlert: (id: string) => {
+ id: string
+ }
+ loadAlerts: () => any
+ loadAlertsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAlertsSuccess: (
+ alerts: LogsAlertConfigurationApi[],
+ payload?: any
+ ) => {
+ alerts: LogsAlertConfigurationApi[]
+ payload?: any
+ }
+ resetAlert: (id: string) => {
+ id: string
+ }
+ setCreatingAlert: (creating: boolean) => {
+ creating: boolean
+ }
+ setEditingAlert: (alert: LogsAlertConfigurationApi | null) => {
+ alert: LogsAlertConfigurationApi | null
+ }
+ setIsCreating: (isCreating: boolean) => {
+ isCreating: boolean
+ }
+ setResettingAlertId: (
+ id: string,
+ resetting: boolean
+ ) => {
+ id: string
+ resetting: boolean
+ }
+ setViewingHistoryAlert: (alert: LogsAlertConfigurationApi | null) => {
+ alert: LogsAlertConfigurationApi | null
+ }
+ snoozeAlert: (
+ alertId: string,
+ durationMinutes: number
+ ) => {
+ alertId: string
+ durationMinutes: number
+ }
+ toggleAlertEnabled: (alert: LogsAlertConfigurationApi) => {
+ alert: LogsAlertConfigurationApi
+ }
+ unsnoozeAlert: (alertId: string) => {
+ alertId: string
+ }
+}
+
+export type logsAlertingLogicType = MakeLogicType<logsAlertingLogicValues, logsAlertingLogicActions>
+
export const logsAlertingLogic = kea<logsAlertingLogicType>([
path(['products', 'logs', 'frontend', 'components', 'LogsAlerting', 'logsAlertingLogic']),
diff --git a/products/logs/frontend/components/LogsGroupBy/logsGroupByLogic.ts b/products/logs/frontend/components/LogsGroupBy/logsGroupByLogic.ts
index 934739802b69..766e23b0577f 100644
--- a/products/logs/frontend/components/LogsGroupBy/logsGroupByLogic.ts
+++ b/products/logs/frontend/components/LogsGroupBy/logsGroupByLogic.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'
@@ -13,7 +13,10 @@ import type {
OrderGroupsByEnumApi,
} from 'products/logs/frontend/generated/api.schemas'
-import type { logsGroupByLogicType } from './logsGroupByLogicType'
+import type { DateRange, LogSeverityLevel } from '../../../../../frontend/src/queries/schema/schema-general'
+import type { UniversalFiltersGroup } from '../../../../../frontend/src/types'
+import type { LogsViewerGroupBy } from '../LogsViewer/config/logsViewerConfigLogic'
+import type { LogsViewerFilters } from '../LogsViewer/config/types'
export interface LogsGroupByLogicProps {
id: string
@@ -26,6 +29,96 @@ const EMPTY_RESPONSE: _LogsGroupByResponseApi = {
truncated: false,
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsGroupByLogicValues {
+ groupBy: LogsViewerGroupBy | null // logsViewerConfigLogic
+ filters: LogsViewerFilters // logsViewerFiltersLogic
+ queryFilterGroup: UniversalFiltersGroup // logsViewerFiltersLogic
+ utcDateRange: {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ explicitDate: boolean | null | undefined
+ } // logsViewerFiltersLogic
+ currentTeamId: number | null // teamLogic
+ groupByError: string | null
+ groupByResponse: _LogsGroupByResponseApi
+ groupByResponseLoading: boolean
+ groups: _LogsGroupByGroupApi[]
+ orderGroupsBy: OrderGroupsByEnumApi
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsGroupByLogicActions {
+ setGroupBy: (groupBy: LogsViewerGroupBy | null) => {
+ groupBy: LogsViewerGroupBy | null
+ } // logsViewerConfigLogic
+ setDateRange: (dateRange: DateRange) => {
+ dateRange: DateRange
+ } // logsViewerFiltersLogic
+ setFilterGroup: (
+ filterGroup: UniversalFiltersGroup,
+ openFilterOnInsert?: boolean | undefined
+ ) => {
+ filterGroup: UniversalFiltersGroup
+ openFilterOnInsert: boolean
+ } // logsViewerFiltersLogic
+ setFilters: (
+ filters: Partial<LogsViewerFilters>,
+ pushToHistory?: boolean | undefined
+ ) => {
+ filters: Partial<LogsViewerFilters>
+ pushToHistory: boolean
+ } // logsViewerFiltersLogic
+ setPinnedFilters: (pinnedFilters: UniversalFiltersGroup | undefined) => {
+ pinnedFilters: UniversalFiltersGroup | undefined
+ } // logsViewerFiltersLogic
+ setSearchTerm: (searchTerm: string | undefined) => {
+ searchTerm: string | undefined
+ } // logsViewerFiltersLogic
+ setServiceNames: (serviceNames: string[]) => {
+ serviceNames: string[]
+ } // logsViewerFiltersLogic
+ setSeverityLevels: (severityLevels: LogSeverityLevel[]) => {
+ severityLevels: LogSeverityLevel[]
+ } // logsViewerFiltersLogic
+ zoomDateRange: (multiplier: number) => {
+ multiplier: number
+ } // logsViewerFiltersLogic
+ loadGroups: (debounceMs?: number) => number
+ loadGroupsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadGroupsSuccess: (
+ groupByResponse: _LogsGroupByResponseApi,
+ payload?: number
+ ) => {
+ groupByResponse: _LogsGroupByResponseApi
+ payload?: number
+ }
+ setOrderGroupsBy: (orderGroupsBy: OrderGroupsByEnumApi) => {
+ orderGroupsBy: OrderGroupsByEnumApi
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsGroupByLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ groups: (groupByResponse: _LogsGroupByResponseApi, groupByError: string | null) => _LogsGroupByGroupApi[]
+ }
+}
+
+export type logsGroupByLogicType = MakeLogicType<
+ logsGroupByLogicValues,
+ logsGroupByLogicActions,
+ LogsGroupByLogicProps,
+ logsGroupByLogicMeta
+>
+
// Keyed by the Viewer's `id`: the logic mounts only while a grouping key is active (the
// Viewer conditionally renders <LogsGroupByResults/>), so loading on mount + reloading on
// the shared filter actions never runs the aggregation while the user is in plain Logs mode.
diff --git a/products/logs/frontend/components/LogsPatterns/logsPatternsLogic.ts b/products/logs/frontend/components/LogsPatterns/logsPatternsLogic.ts
index 40f5caca0e40..0b70dc4cf474 100644
--- a/products/logs/frontend/components/LogsPatterns/logsPatternsLogic.ts
+++ b/products/logs/frontend/components/LogsPatterns/logsPatternsLogic.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 { dayjs } from 'lib/dayjs'
@@ -24,7 +24,9 @@ import type {
_LogsPatternsResponseApi,
} from 'products/logs/frontend/generated/api.schemas'
-import type { logsPatternsLogicType } from './logsPatternsLogicType'
+import type { DateRange, LogSeverityLevel } from '../../../../../frontend/src/queries/schema/schema-general'
+import type { LogsViewerViewMode, PatternsBaselineMode } from '../LogsViewer/config/logsViewerConfigLogic'
+import type { LogsViewerFilters } from '../LogsViewer/config/types'
export interface LogsPatternsLogicProps {
id: string
@@ -66,6 +68,155 @@ const EMPTY_RESPONSE: _LogsPatternsResponseApi = {
sparkline_buckets: [],
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsPatternsLogicValues {
+ baselineMode: PatternsBaselineMode // logsViewerConfigLogic
+ compareEnabled: boolean // logsViewerConfigLogic
+ viewMode: LogsViewerViewMode // logsViewerConfigLogic
+ filters: LogsViewerFilters // logsViewerFiltersLogic
+ queryFilterGroup: UniversalFiltersGroup // logsViewerFiltersLogic
+ utcDateRange: {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ explicitDate: boolean | null | undefined
+ } // logsViewerFiltersLogic
+ currentTeamId: number | null // teamLogic
+ diffError: string | null
+ diffResponse: _LogsPatternsDiffResponseApi | null
+ diffResponseLoading: boolean
+ mineError: string | null
+ patterns: _LogPatternApi[]
+ patternsError: string | null
+ patternsQueryBody: {
+ dateRange: {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ explicitDate: boolean | null | undefined
+ }
+ filterGroup: _LogPropertyFilterApi[]
+ searchTerm: string | undefined
+ serviceNames: string[]
+ severityLevels: LogSeverityLevel[]
+ }
+ patternsResponse: _LogsPatternsResponseApi
+ patternsResponseLoading: boolean
+ sparklineLabels: string[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsPatternsLogicActions {
+ setBaselineMode: (mode: PatternsBaselineMode) => {
+ mode: PatternsBaselineMode
+ } // logsViewerConfigLogic
+ setCompareEnabled: (enabled: boolean) => {
+ enabled: boolean
+ } // logsViewerConfigLogic
+ setViewMode: (viewMode: LogsViewerViewMode) => {
+ viewMode: LogsViewerViewMode
+ } // logsViewerConfigLogic
+ setDateRange: (dateRange: DateRange) => {
+ dateRange: DateRange
+ } // logsViewerFiltersLogic
+ setFilterGroup: (
+ filterGroup: UniversalFiltersGroup,
+ openFilterOnInsert?: boolean | undefined
+ ) => {
+ filterGroup: UniversalFiltersGroup
+ openFilterOnInsert: boolean
+ } // logsViewerFiltersLogic
+ setFilters: (
+ filters: Partial<LogsViewerFilters>,
+ pushToHistory?: boolean | undefined
+ ) => {
+ filters: Partial<LogsViewerFilters>
+ pushToHistory: boolean
+ } // logsViewerFiltersLogic
+ setPinnedFilters: (pinnedFilters: UniversalFiltersGroup | undefined) => {
+ pinnedFilters: UniversalFiltersGroup | undefined
+ } // logsViewerFiltersLogic
+ setSearchTerm: (searchTerm: string | undefined) => {
+ searchTerm: string | undefined
+ } // logsViewerFiltersLogic
+ setServiceNames: (serviceNames: string[]) => {
+ serviceNames: string[]
+ } // logsViewerFiltersLogic
+ setSeverityLevels: (severityLevels: LogSeverityLevel[]) => {
+ severityLevels: LogSeverityLevel[]
+ } // logsViewerFiltersLogic
+ zoomDateRange: (multiplier: number) => {
+ multiplier: number
+ } // logsViewerFiltersLogic
+ loadDiff: (debounceMs?: number) => number
+ loadDiffFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadDiffSuccess: (
+ diffResponse: _LogsPatternsDiffResponseApi,
+ payload?: number
+ ) => {
+ diffResponse: _LogsPatternsDiffResponseApi
+ payload?: number
+ }
+ loadPatterns: (debounceMs?: number) => number
+ loadPatternsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPatternsSuccess: (
+ patternsResponse: _LogsPatternsResponseApi,
+ payload?: number
+ ) => {
+ patternsResponse: _LogsPatternsResponseApi
+ payload?: number
+ }
+ viewMatchingLogs: (pattern: _LogPatternApi) => {
+ pattern: _LogPatternApi
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsPatternsLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ patternsError: (compareEnabled: boolean, mineError: string | null, diffError: string | null) => string | null
+ patternsQueryBody: (
+ filters: LogsViewerFilters,
+ utcDateRange: {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ explicitDate: boolean | null | undefined
+ },
+ queryFilterGroup: UniversalFiltersGroup
+ ) => {
+ dateRange: {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ explicitDate: boolean | null | undefined
+ }
+ filterGroup: _LogPropertyFilterApi[]
+ searchTerm: string | undefined
+ serviceNames: string[]
+ severityLevels: LogSeverityLevel[]
+ }
+ patterns: (patternsResponse: _LogsPatternsResponseApi) => _LogPatternApi[]
+ sparklineLabels: (patternsResponse: _LogsPatternsResponseApi) => string[]
+ }
+}
+
+export type logsPatternsLogicType = MakeLogicType<
+ logsPatternsLogicValues,
+ logsPatternsLogicActions,
+ LogsPatternsLogicProps,
+ logsPatternsLogicMeta
+>
+
// Keyed by the Viewer's `id`: the logic mounts only while the Patterns mode is active (the
// Viewer conditionally renders <LogsPatterns/>), so loading on mount + reloading on the
// shared filter actions never runs the heavier patterns query while the user is in Logs mode.
@@ -174,7 +325,15 @@ export const logsPatternsLogic = kea<logsPatternsLogicType>([
// silently answer a different question than the table next to it.
patternsQueryBody: [
(s) => [s.filters, s.utcDateRange, s.queryFilterGroup],
- (filters, utcDateRange, queryFilterGroup) => ({
+ (
+ filters: import('../LogsViewer/config/types').LogsViewerFilters,
+ utcDateRange: {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ explicitDate: boolean | null | undefined
+ },
+ queryFilterGroup: UniversalFiltersGroup
+ ) => ({
dateRange: utcDateRange,
severityLevels: filters.severityLevels,
serviceNames: filters.serviceNames,
diff --git a/products/logs/frontend/components/LogsSampling/logsSamplingFormLogic.ts b/products/logs/frontend/components/LogsSampling/logsSamplingFormLogic.ts
index 7c623cf0e195..45acb7bea27d 100644
--- a/products/logs/frontend/components/LogsSampling/logsSamplingFormLogic.ts
+++ b/products/logs/frontend/components/LogsSampling/logsSamplingFormLogic.ts
@@ -1,5 +1,6 @@
-import { actions, afterMount, connect, kea, key, listeners, path, props } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path, props } 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'
@@ -18,8 +19,6 @@ import {
} from 'products/logs/frontend/generated/api.schemas'
import { logsDropRulesSettingsUrl } from 'products/logs/frontend/logsDropRulesSettingsUrl'
-import type { logsSamplingFormLogicType } from './logsSamplingFormLogicType'
-
const EMPTY_FILTER_GROUP: UniversalFiltersGroup = {
type: FilterLogicalOperator.And,
values: [],
@@ -165,6 +164,115 @@ export interface LogsSamplingFormLogicProps {
rule: LogsSamplingRuleApi | null
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsSamplingFormLogicValues {
+ currentTeamId: number | null // teamLogic
+ filterPreview:
+ | {
+ bytes_uncompressed?: number
+ count: number
+ service: string
+ time: string
+ }[]
+ | null
+ filterPreviewLoading: boolean
+ isSamplingFormSubmitting: boolean
+ isSamplingFormValid: boolean
+ samplingForm: LogsSamplingFormType
+ samplingFormAllErrors: Record<string, any>
+ samplingFormChanged: boolean
+ samplingFormErrors: DeepPartialMap<LogsSamplingFormType, ValidationErrorType>
+ samplingFormHasErrors: boolean
+ samplingFormManualErrors: Record<string, any>
+ samplingFormTouched: boolean
+ samplingFormTouches: Record<string, boolean>
+ samplingFormValidationErrors: DeepPartialMap<LogsSamplingFormType, ValidationErrorType>
+ showSamplingFormErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsSamplingFormLogicActions {
+ loadFilterPreview: (_: any) => any
+ loadFilterPreviewFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadFilterPreviewSuccess: (
+ filterPreview:
+ | {
+ bytes_uncompressed?: number | undefined
+ count: number
+ service: string
+ time: string
+ }[]
+ | null,
+ payload?: any
+ ) => {
+ filterPreview:
+ | {
+ bytes_uncompressed?: number | undefined
+ count: number
+ service: string
+ time: string
+ }[]
+ | null
+ payload?: any
+ }
+ refreshFilterPreview: () => {
+ value: true
+ }
+ resetSamplingForm: (values?: LogsSamplingFormType) => {
+ values?: LogsSamplingFormType
+ }
+ setSamplingFormManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setSamplingFormValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setSamplingFormValues: (values: DeepPartial<LogsSamplingFormType>) => {
+ values: DeepPartial<LogsSamplingFormType>
+ }
+ submitSamplingForm: () => {
+ value: boolean
+ }
+ submitSamplingFormFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitSamplingFormRequest: (samplingForm: LogsSamplingFormType) => {
+ samplingForm: LogsSamplingFormType
+ }
+ submitSamplingFormSuccess: (samplingForm: LogsSamplingFormType) => {
+ samplingForm: LogsSamplingFormType
+ }
+ touchSamplingFormField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsSamplingFormLogicMeta {
+ key: string
+}
+
+export type logsSamplingFormLogicType = MakeLogicType<
+ logsSamplingFormLogicValues,
+ logsSamplingFormLogicActions,
+ LogsSamplingFormLogicProps,
+ logsSamplingFormLogicMeta
+>
+
export const logsSamplingFormLogic = kea<logsSamplingFormLogicType>([
path(['products', 'logs', 'frontend', 'components', 'LogsSampling', 'logsSamplingFormLogic']),
props({} as LogsSamplingFormLogicProps),
diff --git a/products/logs/frontend/components/LogsSampling/logsSamplingSectionLogic.ts b/products/logs/frontend/components/LogsSampling/logsSamplingSectionLogic.ts
index 464bfc362c25..b2454f4dcbba 100644
--- a/products/logs/frontend/components/LogsSampling/logsSamplingSectionLogic.ts
+++ b/products/logs/frontend/components/LogsSampling/logsSamplingSectionLogic.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 { lemonToast } from '@posthog/lemon-ui'
@@ -12,7 +12,6 @@ import {
} from 'products/logs/frontend/generated/api'
import { LogsSamplingRuleApi } from 'products/logs/frontend/generated/api.schemas'
-import type { logsSamplingSectionLogicType } from './logsSamplingSectionLogicType'
import { type SamplingRuleDropTotals, fetchSamplingRuleDropTotalsLast24h } from './samplingRuleDropImpact'
// Background refresh cadence for the per-rule 24h drop counts. The underlying
@@ -21,6 +20,87 @@ import { type SamplingRuleDropTotals, fetchSamplingRuleDropTotalsLast24h } from
// HogQL. The disposables plugin pauses the timer while the tab is hidden.
const IMPACT_POLL_INTERVAL_MS = 30_000
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsSamplingSectionLogicValues {
+ currentTeamId: number | null // teamLogic
+ ruleDropImpact: Record<string, SamplingRuleDropTotals>
+ ruleDropImpactCellState: 'error' | 'loading' | 'ok' | 'unknown'
+ ruleDropImpactLoading: boolean
+ ruleDropImpactStatus: 'error' | 'idle' | 'loading' | 'ok'
+ ruleEnabledTogglePendingId: string | null
+ rules: LogsSamplingRuleApi[]
+ rulesLoading: boolean
+ saveRulesOrderPending: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsSamplingSectionLogicActions {
+ loadRuleDropImpact: (_: any) => any
+ loadRuleDropImpactFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRuleDropImpactSuccess: (
+ ruleDropImpact: Record<string, SamplingRuleDropTotals>,
+ payload?: any
+ ) => {
+ ruleDropImpact: Record<string, SamplingRuleDropTotals>
+ payload?: any
+ }
+ loadRules: () => any
+ loadRulesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRulesSuccess: (
+ rules: LogsSamplingRuleApi[],
+ payload?: any
+ ) => {
+ rules: LogsSamplingRuleApi[]
+ payload?: any
+ }
+ saveRulesOrder: (orderedIds: string[]) => {
+ orderedIds: string[]
+ }
+ saveRulesOrderFinished: () => {
+ value: true
+ }
+ setRuleEnabled: (
+ ruleId: string,
+ enabled: boolean
+ ) => {
+ enabled: boolean
+ ruleId: string
+ }
+ setRuleEnabledFinished: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsSamplingSectionLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ ruleDropImpactCellState: (
+ ruleDropImpactStatus: 'error' | 'idle' | 'loading' | 'ok',
+ ruleDropImpactLoading: boolean,
+ rules: LogsSamplingRuleApi[]
+ ) => 'error' | 'loading' | 'ok' | 'unknown'
+ }
+}
+
+export type logsSamplingSectionLogicType = MakeLogicType<
+ logsSamplingSectionLogicValues,
+ logsSamplingSectionLogicActions,
+ Record<string, any>,
+ logsSamplingSectionLogicMeta
+>
+
export const logsSamplingSectionLogic = kea<logsSamplingSectionLogicType>([
path(['products', 'logs', 'frontend', 'components', 'LogsSampling', 'logsSamplingSectionLogic']),
diff --git a/products/logs/frontend/components/LogsServices/logsServicesLogic.ts b/products/logs/frontend/components/LogsServices/logsServicesLogic.ts
index 8c54a5c796dc..835a15fa68cc 100644
--- a/products/logs/frontend/components/LogsServices/logsServicesLogic.ts
+++ b/products/logs/frontend/components/LogsServices/logsServicesLogic.ts
@@ -1,12 +1,10 @@
-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 api from 'lib/api'
import { FilterLogicalOperator } from '~/types'
-import type { logsServicesLogicType } from './logsServicesLogicType'
-
export interface ServiceRow {
service_name: string
log_count: number
@@ -37,6 +35,144 @@ export interface ServicesResponse {
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsServicesLogicValues {
+ dateFrom: string
+ services: ServiceRow[]
+ servicesData: ServicesResponse
+ servicesDataLoading: boolean
+ servicesSummary:
+ | {
+ top_services_count: number
+ top_services_volume_share_pct: number
+ }
+ | undefined
+ sparklineByService: Record<
+ string,
+ {
+ labels: string[]
+ values: number[]
+ }
+ >
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsServicesLogicActions {
+ loadServicesData: () => any
+ loadServicesDataFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadServicesDataSuccess: (
+ servicesData: {
+ services: {
+ active_rules?:
+ | {
+ rule_id: string
+ rule_name: string
+ summary_string: string
+ }[]
+ | undefined
+ error_count: number
+ error_rate: number
+ log_count: number
+ service_name: string
+ severity_breakdown?:
+ | {
+ debug: number
+ error: number
+ info: number
+ warn: number
+ }
+ | undefined
+ volume_share_pct?: number | undefined
+ }[]
+ sparkline: {
+ count: number
+ service_name: string
+ time: string
+ }[]
+ summary?:
+ | {
+ top_services_count: number
+ top_services_volume_share_pct: number
+ }
+ | undefined
+ },
+ payload?: any
+ ) => {
+ servicesData: {
+ services: {
+ active_rules?:
+ | {
+ rule_id: string
+ rule_name: string
+ summary_string: string
+ }[]
+ | undefined
+ error_count: number
+ error_rate: number
+ log_count: number
+ service_name: string
+ severity_breakdown?:
+ | {
+ debug: number
+ error: number
+ info: number
+ warn: number
+ }
+ | undefined
+ volume_share_pct?: number | undefined
+ }[]
+ sparkline: {
+ count: number
+ service_name: string
+ time: string
+ }[]
+ summary?:
+ | {
+ top_services_count: number
+ top_services_volume_share_pct: number
+ }
+ | undefined
+ }
+ payload?: any
+ }
+ setDateFrom: (dateFrom: string) => {
+ dateFrom: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsServicesLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ services: (servicesData: ServicesResponse) => ServiceRow[]
+ servicesSummary: (servicesData: ServicesResponse) =>
+ | {
+ top_services_count: number
+ top_services_volume_share_pct: number
+ }
+ | undefined
+ sparklineByService: (servicesData: ServicesResponse) => Record<
+ string,
+ {
+ labels: string[]
+ values: number[]
+ }
+ >
+ }
+}
+
+export type logsServicesLogicType = MakeLogicType<
+ logsServicesLogicValues,
+ logsServicesLogicActions,
+ Record<string, any>,
+ logsServicesLogicMeta
+>
+
export const logsServicesLogic = kea<logsServicesLogicType>([
path(['products', 'logs', 'frontend', 'components', 'LogsServices', 'logsServicesLogic']),
diff --git a/products/logs/frontend/components/LogsSqlEditor/logsSqlEditorTrackingLogic.ts b/products/logs/frontend/components/LogsSqlEditor/logsSqlEditorTrackingLogic.ts
index 212a3861ec17..78613dbcdb6c 100644
--- a/products/logs/frontend/components/LogsSqlEditor/logsSqlEditorTrackingLogic.ts
+++ b/products/logs/frontend/components/LogsSqlEditor/logsSqlEditorTrackingLogic.ts
@@ -1,12 +1,10 @@
-import { connect, kea, key, listeners, path, props } from 'kea'
+import { MakeLogicType, connect, kea, key, listeners, path, props } from 'kea'
import posthog from 'posthog-js'
import { SaveAsMenuItem } from 'scenes/data-warehouse/editor/editorSceneLogic'
import { sqlEditorLogic } from 'scenes/data-warehouse/editor/sqlEditorLogic'
import { SQLEditorMode } from 'scenes/data-warehouse/editor/sqlEditorModes'
-import type { logsSqlEditorTrackingLogicType } from './logsSqlEditorTrackingLogicType'
-
export interface LogsSqlEditorTrackingLogicProps {
sqlEditorTabId: string
}
@@ -15,6 +13,64 @@ const captureSaved = (target: SaveAsMenuItem['action']): void => {
posthog.capture('logs sql query saved', { target })
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsSqlEditorTrackingLogicActions {
+ sqlEditorRunQuery: (
+ queryOverride?: string | undefined,
+ switchTab?: boolean | undefined
+ ) => {
+ queryOverride: string | undefined
+ switchTab: boolean | undefined
+ } // sqlEditorLogic
+ sqlEditorSaveAsEndpointSubmit: (
+ name: string,
+ description?: string | undefined,
+ queryOverride?: string | undefined,
+ dagId?: string | undefined
+ ) => {
+ dagId: string | undefined
+ description: string | undefined
+ name: string
+ queryOverride: string | undefined
+ } // sqlEditorLogic
+ sqlEditorSaveAsInsightSubmit: (
+ name: string,
+ queryOverride?: string | undefined
+ ) => {
+ name: string
+ queryOverride: string | undefined
+ } // sqlEditorLogic
+ sqlEditorSaveAsViewSubmit: (
+ name: string,
+ materializeAfterSave?: any,
+ fromDraft?: string | undefined,
+ dagId?: string | undefined,
+ folderId?: string | null | undefined,
+ isTest?: any,
+ queryOverride?: string | undefined
+ ) => {
+ dagId: string | undefined
+ folderId: string | null | undefined
+ fromDraft: string | undefined
+ isTest: any
+ materializeAfterSave: any
+ name: string
+ queryOverride: string | undefined
+ } // sqlEditorLogic
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsSqlEditorTrackingLogicMeta {
+ key: string
+}
+
+export type logsSqlEditorTrackingLogicType = MakeLogicType<
+ {},
+ logsSqlEditorTrackingLogicActions,
+ LogsSqlEditorTrackingLogicProps,
+ logsSqlEditorTrackingLogicMeta
+>
+
export const logsSqlEditorTrackingLogic = kea<logsSqlEditorTrackingLogicType>([
path(['products', 'logs', 'frontend', 'components', 'LogsSqlEditor', 'logsSqlEditorTrackingLogic']),
props({} as LogsSqlEditorTrackingLogicProps),
diff --git a/products/logs/frontend/components/LogsViewer/FacetRail/facetCountsLogic.ts b/products/logs/frontend/components/LogsViewer/FacetRail/facetCountsLogic.ts
index b1e397bcb28f..f70ce55dcf06 100644
--- a/products/logs/frontend/components/LogsViewer/FacetRail/facetCountsLogic.ts
+++ b/products/logs/frontend/components/LogsViewer/FacetRail/facetCountsLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { subscriptions } from 'kea-subscriptions'
@@ -10,7 +10,7 @@ import { logsViewerFiltersLogic } from 'products/logs/frontend/components/LogsVi
import { logsAttributesRetrieve, logsFacetValuesCreate } from '../../../generated/api'
import { _LogFacetValueApi, _LogPropertyFilterApi, _LogsFacetValuesBodyApi } from '../../../generated/api.schemas'
-import type { facetCountsLogicType } from './facetCountsLogicType'
+import type { LogsViewerFilters } from '../config/types'
import { FACETS, FacetConfig } from './facets'
// Broad, filter-independent window for the "which resource attributes does this tenant emit" probe.
@@ -21,6 +21,100 @@ export interface FacetCountsLogicProps {
id: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface facetCountsLogicValues {
+ filters: LogsViewerFilters // logsViewerFiltersLogic
+ queryFilterGroup: UniversalFiltersGroup // logsViewerFiltersLogic
+ utcDateRange: {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ explicitDate: boolean | null | undefined
+ } // logsViewerFiltersLogic
+ currentTeamId: number | null // teamLogic
+ facetSearch: Record<string, string>
+ facetValues: Record<string, _LogFacetValueApi[]>
+ facetValuesLoading: boolean
+ loadingFacetKeys: string[]
+ loadingReloadKeys: string[]
+ loadingSearchKey: string | null
+ presenceLoaded: boolean
+ presentResourceKeys: string[]
+ presentResourceKeysLoading: boolean
+ visibleFacets: FacetConfig[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface facetCountsLogicActions {
+ loadFacetValues: (facetKeys: string[] | null) => string[] | null
+ loadFacetValuesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadFacetValuesForKey: (facetKey: string) => string
+ loadFacetValuesForKeyFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadFacetValuesForKeySuccess: (
+ facetValues: Record<string, _LogFacetValueApi[]>,
+ payload?: string
+ ) => {
+ facetValues: Record<string, _LogFacetValueApi[]>
+ payload?: string
+ }
+ loadFacetValuesSuccess: (
+ facetValues: Record<string, _LogFacetValueApi[]>,
+ payload?: string[] | null
+ ) => {
+ facetValues: Record<string, _LogFacetValueApi[]>
+ payload?: string[] | null
+ }
+ loadPresentResourceKeys: () => any
+ loadPresentResourceKeysFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPresentResourceKeysSuccess: (
+ presentResourceKeys: string[],
+ payload?: any
+ ) => {
+ presentResourceKeys: string[]
+ payload?: any
+ }
+ setFacetSearch: (
+ facetKey: string,
+ search: string
+ ) => {
+ facetKey: string
+ search: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface facetCountsLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ visibleFacets: (presentResourceKeys: string[]) => FacetConfig[]
+ loadingFacetKeys: (loadingReloadKeys: string[], loadingSearchKey: string | null) => string[]
+ }
+}
+
+export type facetCountsLogicType = MakeLogicType<
+ facetCountsLogicValues,
+ facetCountsLogicActions,
+ FacetCountsLogicProps,
+ facetCountsLogicMeta
+>
+
/**
* Per-facet values + counts, cross-filtered server-side: each facet's results reflect every active
* filter except its own selection (the backend excludes the facet's own column or resource-attribute
@@ -174,7 +268,7 @@ export const facetCountsLogic = kea<facetCountsLogicType>([
// Column facets always render; resource-attribute facets only when the tenant emits the key.
visibleFacets: [
(s) => [s.presentResourceKeys],
- (presentResourceKeys): FacetConfig[] =>
+ (presentResourceKeys: string[]): FacetConfig[] =>
FACETS.filter((f) => f.source.type === 'column' || presentResourceKeys.includes(f.source.key)),
],
// Per-facet loading state. A filter-change reload and a per-facet search have independent
diff --git a/products/logs/frontend/components/LogsViewer/FacetRail/facetRailLogic.ts b/products/logs/frontend/components/LogsViewer/FacetRail/facetRailLogic.ts
index 49c0af06a3a3..1ea4c656c4a4 100644
--- a/products/logs/frontend/components/LogsViewer/FacetRail/facetRailLogic.ts
+++ b/products/logs/frontend/components/LogsViewer/FacetRail/facetRailLogic.ts
@@ -1,10 +1,10 @@
-import { actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
import { LogSeverityLevel } from '~/queries/schema/schema-general'
import { logsViewerFiltersLogic } from 'products/logs/frontend/components/LogsViewer/Filters/logsViewerFiltersLogic'
-import type { facetRailLogicType } from './facetRailLogicType'
+import type { UniversalFiltersGroup } from '../../../../../../frontend/src/types'
import { FacetSource, toggleResourceAttributeFilter } from './facets'
export interface FacetRailLogicProps {
@@ -16,6 +16,54 @@ function toggleMembership<T>(values: readonly T[] | undefined | null, value: T):
return current.includes(value) ? current.filter((v) => v !== value) : [...current, value]
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface facetRailLogicValues {
+ collapsedFacets: string[]
+ facetNameSearch: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface facetRailLogicActions {
+ setFilterGroup: (
+ filterGroup: UniversalFiltersGroup,
+ openFilterOnInsert?: boolean | undefined
+ ) => {
+ filterGroup: UniversalFiltersGroup
+ openFilterOnInsert: boolean
+ } // logsViewerFiltersLogic
+ setServiceNames: (serviceNames: string[]) => {
+ serviceNames: string[]
+ } // logsViewerFiltersLogic
+ setSeverityLevels: (severityLevels: LogSeverityLevel[]) => {
+ severityLevels: LogSeverityLevel[]
+ } // logsViewerFiltersLogic
+ setFacetNameSearch: (search: string) => {
+ search: string
+ }
+ toggleFacetCollapsed: (facetKey: string) => {
+ facetKey: string
+ }
+ toggleFacetValue: (
+ source: FacetSource,
+ value: string
+ ) => {
+ source: FacetSource
+ value: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface facetRailLogicMeta {
+ key: string
+}
+
+export type facetRailLogicType = MakeLogicType<
+ facetRailLogicValues,
+ facetRailLogicActions,
+ FacetRailLogicProps,
+ facetRailLogicMeta
+>
+
// The rail is a lens over the existing filter model — facet toggles write straight back to
// logsViewerFiltersLogic's reducers, so URL sync, saved views, and the chips bar stay in step.
export const facetRailLogic = kea<facetRailLogicType>([
diff --git a/products/logs/frontend/components/LogsViewer/Filters/logsFilterHistoryLogic.ts b/products/logs/frontend/components/LogsViewer/Filters/logsFilterHistoryLogic.ts
index 44e9f18493b9..04351a7f4385 100644
--- a/products/logs/frontend/components/LogsViewer/Filters/logsFilterHistoryLogic.ts
+++ b/products/logs/frontend/components/LogsViewer/Filters/logsFilterHistoryLogic.ts
@@ -1,17 +1,57 @@
import { deepEqual as equal } from 'fast-equals'
-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 { LogsViewerFilters } from 'products/logs/frontend/components/LogsViewer/config/types'
import { logsViewerFiltersLogic } from 'products/logs/frontend/components/LogsViewer/Filters/logsViewerFiltersLogic'
import { LogsFiltersHistoryEntry } from '../../../types'
-import type { logsFilterHistoryLogicType } from './logsFilterHistoryLogicType'
export interface LogsFilterHistoryLogicProps {
id: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsFilterHistoryLogicValues {
+ filterHistory: LogsFiltersHistoryEntry[]
+ hasFilterHistory: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsFilterHistoryLogicActions {
+ setFilters: (
+ filters: Partial<LogsViewerFilters>,
+ pushToHistory?: boolean | undefined
+ ) => {
+ filters: Partial<LogsViewerFilters>
+ pushToHistory: boolean
+ } // logsViewerFiltersLogic
+ clearFilterHistory: () => {
+ value: true
+ }
+ pushToFilterHistory: (filters: LogsViewerFilters) => {
+ filters: LogsViewerFilters
+ }
+ restoreFiltersFromHistory: (index: number) => {
+ index: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsFilterHistoryLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ hasFilterHistory: (filterHistory: LogsFiltersHistoryEntry[]) => boolean
+ }
+}
+
+export type logsFilterHistoryLogicType = MakeLogicType<
+ logsFilterHistoryLogicValues,
+ logsFilterHistoryLogicActions,
+ LogsFilterHistoryLogicProps,
+ logsFilterHistoryLogicMeta
+>
+
export const logsFilterHistoryLogic = kea<logsFilterHistoryLogicType>([
path(['products', 'logs', 'frontend', 'components', 'LogsViewer', 'Filters', 'logsFilterHistoryLogic']),
props({} as LogsFilterHistoryLogicProps),
diff --git a/products/logs/frontend/components/LogsViewer/Filters/logsViewerFiltersLogic.ts b/products/logs/frontend/components/LogsViewer/Filters/logsViewerFiltersLogic.ts
index 8ce7f1fede41..5cdf162ef8cc 100644
--- a/products/logs/frontend/components/LogsViewer/Filters/logsViewerFiltersLogic.ts
+++ b/products/logs/frontend/components/LogsViewer/Filters/logsViewerFiltersLogic.ts
@@ -1,5 +1,17 @@
import { deepEqual as equal } from 'fast-equals'
-import { actions, afterMount, kea, key, listeners, path, propsChanged, props, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ kea,
+ key,
+ listeners,
+ path,
+ propsChanged,
+ props,
+ reducers,
+ selectors,
+} from 'kea'
import posthog from 'posthog-js'
import { zoomDateRange } from 'lib/components/DateFilter/DateRangePicker'
@@ -17,8 +29,6 @@ import {
import { LogsViewerFilters } from 'products/logs/frontend/components/LogsViewer/config/types'
-import type { logsViewerFiltersLogicType } from './logsViewerFiltersLogicType'
-
export const DEFAULT_DATE_RANGE = { date_from: '-1h', date_to: null }
const VALID_SEVERITY_LEVELS: readonly LogSeverityLevel[] = ['trace', 'debug', 'info', 'warn', 'error', 'fatal']
export const DEFAULT_SEVERITY_LEVELS = [] as LogsQuery['severityLevels']
@@ -64,6 +74,103 @@ export function combineWithPinnedFilters(
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewerFiltersLogicValues {
+ dateRange: DateRange
+ filterGroup: UniversalFiltersGroup
+ filters: LogsViewerFilters
+ id: string
+ openFilterOnInsert: boolean
+ pinnedFilters: UniversalFiltersGroup | undefined
+ queryFilterGroup: UniversalFiltersGroup
+ searchTerm: LogsQuery['searchTerm']
+ serviceNames: LogsQuery['serviceNames']
+ severityLevels: LogsQuery['severityLevels']
+ utcDateRange: {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ explicitDate: boolean | null | undefined
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewerFiltersLogicActions {
+ addFilter: (
+ key: string,
+ value: string,
+ operator?: PropertyOperator,
+ propertyType?: PropertyFilterType
+ ) => {
+ key: string
+ operator: PropertyOperator
+ propertyType: PropertyFilterType
+ value: string
+ }
+ setDateRange: (dateRange: DateRange) => {
+ dateRange: DateRange
+ }
+ setFilterGroup: (
+ filterGroup: UniversalFiltersGroup,
+ openFilterOnInsert?: boolean
+ ) => {
+ filterGroup: UniversalFiltersGroup
+ openFilterOnInsert: boolean
+ }
+ setFilters: (
+ filters: Partial<LogsViewerFilters>,
+ pushToHistory?: boolean
+ ) => {
+ filters: Partial<LogsViewerFilters>
+ pushToHistory: boolean
+ }
+ setPinnedFilters: (pinnedFilters: UniversalFiltersGroup | undefined) => {
+ pinnedFilters: UniversalFiltersGroup | undefined
+ }
+ setSearchTerm: (searchTerm: LogsQuery['searchTerm']) => {
+ searchTerm: string | undefined
+ }
+ setServiceNames: (serviceNames: LogsQuery['serviceNames']) => {
+ serviceNames: string[]
+ }
+ setSeverityLevels: (severityLevels: LogsQuery['severityLevels']) => {
+ severityLevels: LogSeverityLevel[]
+ }
+ zoomDateRange: (multiplier: number) => {
+ multiplier: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewerFiltersLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ id: (id: string) => string
+ filters: (
+ dateRange: DateRange,
+ searchTerm: string | undefined,
+ severityLevels: LogSeverityLevel[],
+ serviceNames: string[],
+ filterGroup: UniversalFiltersGroup
+ ) => LogsViewerFilters
+ queryFilterGroup: (
+ filterGroup: UniversalFiltersGroup,
+ pinnedFilters: UniversalFiltersGroup | undefined
+ ) => UniversalFiltersGroup
+ utcDateRange: (dateRange: DateRange) => {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ explicitDate: boolean | null | undefined
+ }
+ }
+}
+
+export type logsViewerFiltersLogicType = MakeLogicType<
+ logsViewerFiltersLogicValues,
+ logsViewerFiltersLogicActions,
+ LogsViewerFiltersLogicProps,
+ logsViewerFiltersLogicMeta
+>
+
export const logsViewerFiltersLogic = kea<logsViewerFiltersLogicType>([
path(['products', 'logs', 'frontend', 'components', 'LogsViewer', 'Filters', 'logsViewerFiltersLogic']),
props({ id: 'default' } as LogsViewerFiltersLogicProps),
diff --git a/products/logs/frontend/components/LogsViewer/Filters/serviceFilterLogic.ts b/products/logs/frontend/components/LogsViewer/Filters/serviceFilterLogic.ts
index d4629afe9a04..ee7253950887 100644
--- a/products/logs/frontend/components/LogsViewer/Filters/serviceFilterLogic.ts
+++ b/products/logs/frontend/components/LogsViewer/Filters/serviceFilterLogic.ts
@@ -1,4 +1,17 @@
-import { actions, afterMount, connect, kea, key, listeners, path, props, propsChanged, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ connect,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ propsChanged,
+ reducers,
+ selectors,
+} from 'kea'
import { loaders } from 'kea-loaders'
import { combineUrl } from 'kea-router'
@@ -7,12 +20,56 @@ import { teamLogic } from 'scenes/teamLogic'
import { DateRange } from '~/queries/schema/schema-general'
-import type { serviceFilterLogicType } from './serviceFilterLogicType'
-
export interface ServiceFilterLogicProps {
dateRange?: DateRange
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface serviceFilterLogicValues {
+ currentTeamId: number | null // teamLogic
+ allServiceNames: string[]
+ allServiceNamesLoading: boolean
+ search: string
+ serviceNames: string[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface serviceFilterLogicActions {
+ loadServiceNames: () => any
+ loadServiceNamesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadServiceNamesSuccess: (
+ allServiceNames: string[],
+ payload?: any
+ ) => {
+ allServiceNames: string[]
+ payload?: any
+ }
+ setSearch: (search: string) => {
+ search: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface serviceFilterLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ serviceNames: (allServiceNames: string[]) => string[]
+ }
+}
+
+export type serviceFilterLogicType = MakeLogicType<
+ serviceFilterLogicValues,
+ serviceFilterLogicActions,
+ ServiceFilterLogicProps,
+ serviceFilterLogicMeta
+>
+
export const serviceFilterLogic = kea<serviceFilterLogicType>([
path(['products', 'logs', 'frontend', 'components', 'LogsViewer', 'Filters', 'serviceFilterLogic']),
props({} as ServiceFilterLogicProps),
@@ -51,7 +108,7 @@ export const serviceFilterLogic = kea<serviceFilterLogicType>([
})),
selectors({
- serviceNames: [(s) => [s.allServiceNames], (allServiceNames): string[] => allServiceNames],
+ serviceNames: [(s) => [s.allServiceNames], (allServiceNames: string[]): string[] => allServiceNames],
}),
listeners(({ actions }) => ({
diff --git a/products/logs/frontend/components/LogsViewer/LogDetailsModal/Tabs/ExploreWithAI/logExploreAILogic.ts b/products/logs/frontend/components/LogsViewer/LogDetailsModal/Tabs/ExploreWithAI/logExploreAILogic.ts
index 45f82fb8e576..5a3288ab1d06 100644
--- a/products/logs/frontend/components/LogsViewer/LogDetailsModal/Tabs/ExploreWithAI/logExploreAILogic.ts
+++ b/products/logs/frontend/components/LogsViewer/LogDetailsModal/Tabs/ExploreWithAI/logExploreAILogic.ts
@@ -1,11 +1,10 @@
-import { kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import posthog from 'posthog-js'
import api from 'lib/api'
import { organizationLogic } from 'scenes/organizationLogic'
-import type { logExploreAILogicType } from './logExploreAILogicType'
import { LogExplanation } from './types'
export interface LogExploreAILogicProps {
@@ -13,6 +12,48 @@ export interface LogExploreAILogicProps {
logTimestamp: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logExploreAILogicValues {
+ dataProcessingAccepted: boolean
+ explanation: LogExplanation | null
+ explanationError: string | null
+ explanationLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logExploreAILogicActions {
+ loadExplanation: () => any
+ loadExplanationFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadExplanationSuccess: (
+ explanation: LogExplanation,
+ payload?: any
+ ) => {
+ explanation: LogExplanation
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logExploreAILogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ dataProcessingAccepted: (currentOrganization: null | import('~/types').OrganizationType) => boolean
+ }
+}
+
+export type logExploreAILogicType = MakeLogicType<
+ logExploreAILogicValues,
+ logExploreAILogicActions,
+ LogExploreAILogicProps,
+ logExploreAILogicMeta
+>
+
export const logExploreAILogic = kea<logExploreAILogicType>([
props({} as LogExploreAILogicProps),
key((props) => props.logUuid),
@@ -30,7 +71,8 @@ export const logExploreAILogic = kea<logExploreAILogicType>([
selectors({
dataProcessingAccepted: [
() => [organizationLogic.selectors.currentOrganization],
- (currentOrganization): boolean => !!currentOrganization?.is_ai_data_processing_approved,
+ (currentOrganization: null | import('~/types').OrganizationType): boolean =>
+ !!currentOrganization?.is_ai_data_processing_approved,
],
}),
diff --git a/products/logs/frontend/components/LogsViewer/LogDetailsModal/Tabs/RelatedErrors/relatedErrorsLogic.ts b/products/logs/frontend/components/LogsViewer/LogDetailsModal/Tabs/RelatedErrors/relatedErrorsLogic.ts
index 36537be2fab4..83f741868b22 100644
--- a/products/logs/frontend/components/LogsViewer/LogDetailsModal/Tabs/RelatedErrors/relatedErrorsLogic.ts
+++ b/products/logs/frontend/components/LogsViewer/LogDetailsModal/Tabs/RelatedErrors/relatedErrorsLogic.ts
@@ -1,4 +1,4 @@
-import { afterMount, kea, key, path, props, reducers } from 'kea'
+import { MakeLogicType, afterMount, kea, key, path, props, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
@@ -8,14 +8,50 @@ import { MaxErrorTrackingIssuePreview } from '~/queries/schema/schema-assistant-
import { ErrorTrackingIssue, ErrorTrackingQuery, NodeKind } from '~/queries/schema/schema-general'
import { FilterLogicalOperator, PropertyFilterType, PropertyOperator } from '~/types'
-import type { relatedErrorsLogicType } from './relatedErrorsLogicType'
-
export interface RelatedErrorsLogicProps {
logUuid: string
logTimestamp: string
sessionId: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface relatedErrorsLogicValues {
+ relatedIssues: MaxErrorTrackingIssuePreview[]
+ relatedIssuesError: string | null
+ relatedIssuesLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface relatedErrorsLogicActions {
+ loadRelatedIssues: () => any
+ loadRelatedIssuesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRelatedIssuesSuccess: (
+ relatedIssues: MaxErrorTrackingIssuePreview[],
+ payload?: any
+ ) => {
+ relatedIssues: MaxErrorTrackingIssuePreview[]
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface relatedErrorsLogicMeta {
+ key: string
+}
+
+export type relatedErrorsLogicType = MakeLogicType<
+ relatedErrorsLogicValues,
+ relatedErrorsLogicActions,
+ RelatedErrorsLogicProps,
+ relatedErrorsLogicMeta
+>
+
export const relatedErrorsLogic = kea<relatedErrorsLogicType>([
props({} as RelatedErrorsLogicProps),
key((props) => props.logUuid),
diff --git a/products/logs/frontend/components/LogsViewer/LogDetailsModal/logDetailsModalLogic.ts b/products/logs/frontend/components/LogsViewer/LogDetailsModal/logDetailsModalLogic.ts
index 159d8431c95d..ec73347b5b26 100644
--- a/products/logs/frontend/components/LogsViewer/LogDetailsModal/logDetailsModalLogic.ts
+++ b/products/logs/frontend/components/LogsViewer/LogDetailsModal/logDetailsModalLogic.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 { subscriptions } from 'kea-subscriptions'
import posthog from 'posthog-js'
@@ -6,14 +6,58 @@ import { logsConfigLogic } from 'products/logs/frontend/logsConfigLogic'
import { ParsedLogMessage } from 'products/logs/frontend/types'
import { getSessionIdFromLogAttributes } from 'products/logs/frontend/utils'
-import type { logDetailsModalLogicType } from './logDetailsModalLogicType'
-
export type LogDetailsTab = 'details' | 'raw' | 'explore-ai' | 'comments' | 'related-errors'
export interface LogDetailsModalProps {
id: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logDetailsModalLogicValues {
+ configuredSessionIdKeys: string[] | undefined // logsConfigLogic
+ activeTab: LogDetailsTab
+ hasSessionId: boolean
+ isLogDetailsOpen: boolean
+ jsonParseAllFields: boolean
+ selectedLog: ParsedLogMessage | null
+ sessionId: string | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logDetailsModalLogicActions {
+ closeLogDetails: () => {
+ value: true
+ }
+ openLogDetails: (log: ParsedLogMessage) => {
+ log: ParsedLogMessage
+ }
+ setActiveTab: (tab: LogDetailsTab) => {
+ tab: LogDetailsTab
+ }
+ setJsonParseAllFields: (enabled: boolean) => {
+ enabled: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logDetailsModalLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ sessionId: (
+ selectedLog: ParsedLogMessage | null,
+ configuredSessionIdKeys: string[] | undefined
+ ) => string | null
+ hasSessionId: (sessionId: string | null) => boolean
+ }
+}
+
+export type logDetailsModalLogicType = MakeLogicType<
+ logDetailsModalLogicValues,
+ logDetailsModalLogicActions,
+ LogDetailsModalProps,
+ logDetailsModalLogicMeta
+>
+
export const logDetailsModalLogic = kea<logDetailsModalLogicType>([
path(['products', 'logs', 'frontend', 'components', 'LogsViewer', 'LogDetailsModal', 'logDetailsModalLogic']),
props({} as LogDetailsModalProps),
@@ -75,7 +119,7 @@ export const logDetailsModalLogic = kea<logDetailsModalLogicType>([
selectors({
sessionId: [
(s) => [s.selectedLog, s.configuredSessionIdKeys],
- (selectedLog, configuredSessionIdKeys): string | null =>
+ (selectedLog: ParsedLogMessage | null, configuredSessionIdKeys: string[] | undefined): string | null =>
selectedLog
? getSessionIdFromLogAttributes(
selectedLog.attributes,
@@ -84,6 +128,6 @@ export const logDetailsModalLogic = kea<logDetailsModalLogicType>([
)
: null,
],
- hasSessionId: [(s) => [s.sessionId], (sessionId): boolean => sessionId !== null],
+ hasSessionId: [(s) => [s.sessionId], (sessionId: string | null): boolean => sessionId !== null],
}),
])
diff --git a/products/logs/frontend/components/LogsViewer/LogsViewerModal/logsViewerModalLogic.ts b/products/logs/frontend/components/LogsViewer/LogsViewerModal/logsViewerModalLogic.ts
index 4fca6c7ddc38..496938e5e495 100644
--- a/products/logs/frontend/components/LogsViewer/LogsViewerModal/logsViewerModalLogic.ts
+++ b/products/logs/frontend/components/LogsViewer/LogsViewerModal/logsViewerModalLogic.ts
@@ -1,16 +1,58 @@
-import { actions, afterMount, connect, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers } from 'kea'
import { router } from 'kea-router'
+import type { LocationChangedPayload } from 'kea-router/lib/types'
import { LogsViewerFilters } from 'products/logs/frontend/components/LogsViewer/config/types'
-import type { logsViewerModalLogicType } from './logsViewerModalLogicType'
-
export interface OpenLogsViewerModalOptions {
id?: string
fullScreen?: boolean
initialFilters?: Partial<LogsViewerFilters>
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewerModalLogicValues {
+ fullScreen: boolean
+ initialFilters: Partial<LogsViewerFilters> | null
+ isOpen: boolean
+ viewerId: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewerModalLogicActions {
+ locationChanged: ({
+ method,
+ pathname,
+ search,
+ searchParams,
+ hash,
+ hashParams,
+ initial,
+ url,
+ routerState,
+ }: LocationChangedPayload) => {
+ hash: string
+ hashParams: Record<string, any>
+ initial: boolean
+ method: 'POP' | 'PUSH' | 'REPLACE'
+ pathname: string
+ routerState: Record<string, any>
+ search: string
+ searchParams: Record<string, any>
+ url: string
+ } // router
+ closeLogsViewerModal: () => {
+ value: true
+ }
+ openLogsViewerModal: (options?: OpenLogsViewerModalOptions) => {
+ fullScreen: boolean
+ id: string
+ initialFilters: Partial<LogsViewerFilters> | null
+ }
+}
+
+export type logsViewerModalLogicType = MakeLogicType<logsViewerModalLogicValues, logsViewerModalLogicActions>
+
export const logsViewerModalLogic = kea<logsViewerModalLogicType>([
path(['products', 'logs', 'frontend', 'components', 'LogsViewer', 'LogsViewerModal', 'logsViewerModalLogic']),
connect(() => ({
diff --git a/products/logs/frontend/components/LogsViewer/config/logsColumnConfiguratorLogic.ts b/products/logs/frontend/components/LogsViewer/config/logsColumnConfiguratorLogic.ts
index 2624ce613d42..54f9697d28c5 100644
--- a/products/logs/frontend/components/LogsViewer/config/logsColumnConfiguratorLogic.ts
+++ b/products/logs/frontend/components/LogsViewer/config/logsColumnConfiguratorLogic.ts
@@ -1,16 +1,103 @@
-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 { uuid } from 'lib/utils/dom'
import { logsViewerConfigLogic } from 'products/logs/frontend/components/LogsViewer/config/logsViewerConfigLogic'
import { customColumnExpressionError, LogsColumnConfig, LogsColumnType, normalizeColumns } from './columns'
-import type { logsColumnConfiguratorLogicType } from './logsColumnConfiguratorLogicType'
export interface LogsColumnConfiguratorLogicProps {
id: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsColumnConfiguratorLogicValues {
+ columns: LogsColumnConfig[] // logsViewerConfigLogic
+ draft: LogsColumnConfig[]
+ draftErrors: string | null
+ editingColumnId: string | null
+ isOpen: boolean
+ newColumn: {
+ expression: string
+ name: string
+ type: LogsColumnType
+ }
+ newColumnError: string | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsColumnConfiguratorLogicActions {
+ setColumns: (columns: LogsColumnConfig[]) => {
+ columns: LogsColumnConfig[]
+ } // logsViewerConfigLogic
+ addDraftColumn: (column: Omit<LogsColumnConfig, 'id'>) => {
+ column: Omit<LogsColumnConfig, 'id'>
+ }
+ applyDraft: () => {
+ value: true
+ }
+ closeConfigurator: () => {
+ value: true
+ }
+ moveDraftColumn: (
+ fromIndex: number,
+ toIndex: number
+ ) => {
+ fromIndex: number
+ toIndex: number
+ }
+ openConfigurator: () => {
+ value: true
+ }
+ removeDraftColumn: (id: string) => {
+ id: string
+ }
+ resetNewColumn: () => {
+ value: true
+ }
+ setDraft: (draft: LogsColumnConfig[]) => {
+ draft: LogsColumnConfig[]
+ }
+ setEditingColumnId: (id: string | null) => {
+ id: string | null
+ }
+ setNewColumnExpression: (expression: string) => {
+ expression: string
+ }
+ setNewColumnName: (name: string) => {
+ name: string
+ }
+ setNewColumnType: (columnType: LogsColumnType) => {
+ columnType: LogsColumnType
+ }
+ submitNewColumn: () => {
+ value: true
+ }
+ updateDraftColumn: (
+ id: string,
+ patch: Partial<Omit<LogsColumnConfig, 'id'>>
+ ) => {
+ id: string
+ patch: Partial<Omit<LogsColumnConfig, 'id'>>
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsColumnConfiguratorLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ newColumnError: (newColumn: { expression: string; name: string; type: LogsColumnType }) => string | null
+ draftErrors: (draft: LogsColumnConfig[]) => string | null
+ }
+}
+
+export type logsColumnConfiguratorLogicType = MakeLogicType<
+ logsColumnConfiguratorLogicValues,
+ logsColumnConfiguratorLogicActions,
+ LogsColumnConfiguratorLogicProps,
+ logsColumnConfiguratorLogicMeta
+>
+
/**
* Draft-based editor state for the column configurator modal. Edits accumulate in a local
* draft and only hit logsViewerConfigLogic (and thus the query) on an explicit apply — typing
diff --git a/products/logs/frontend/components/LogsViewer/config/logsViewerConfigLogic.ts b/products/logs/frontend/components/LogsViewer/config/logsViewerConfigLogic.ts
index 07295a581e01..1d81ffe591ec 100644
--- a/products/logs/frontend/components/LogsViewer/config/logsViewerConfigLogic.ts
+++ b/products/logs/frontend/components/LogsViewer/config/logsViewerConfigLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, kea, key, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, kea, key, path, props, reducers, selectors } from 'kea'
import { LogsSparklineBreakdownBy } from '~/queries/schema/schema-general'
import { FilterLogicalOperator } from '~/types'
@@ -14,7 +14,8 @@ import { LogsViewerConfig, LogsViewerFilters } from 'products/logs/frontend/comp
import type { GroupBySourceEnumApi } from 'products/logs/frontend/generated/api.schemas'
import { AttributeColumnConfig, LogsOrderBy } from 'products/logs/frontend/types'
-import type { logsViewerConfigLogicType } from './logsViewerConfigLogicType'
+import type { DateRange, LogSeverityLevel } from '../../../../../../frontend/src/queries/schema/schema-general'
+import type { UniversalFiltersGroup } from '../../../../../../frontend/src/types'
export const DEFAULT_LOGS_VIEWER_CONFIG: LogsViewerConfig = {
filters: {
@@ -49,6 +50,103 @@ export interface LogsViewerConfigProps {
id: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewerConfigLogicValues {
+ baselineMode: PatternsBaselineMode
+ columns: LogsColumnConfig[]
+ compareEnabled: boolean
+ config: LogsViewerConfig
+ customColumns: string[] | undefined
+ facetRailCollapsed: boolean
+ filters: LogsViewerFilters
+ groupBy: LogsViewerGroupBy | null
+ orderBy: LogsOrderBy
+ sparklineBreakdownBy: LogsSparklineBreakdownBy
+ sparklineCollapsed: boolean
+ viewMode: LogsViewerViewMode
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewerConfigLogicActions {
+ addColumn: (column: LogsColumnConfig) => {
+ column: LogsColumnConfig
+ }
+ moveColumn: (
+ id: string,
+ direction: 'left' | 'right'
+ ) => {
+ direction: 'left' | 'right'
+ id: string
+ }
+ removeColumn: (id: string) => {
+ id: string
+ }
+ setBaselineMode: (mode: PatternsBaselineMode) => {
+ mode: PatternsBaselineMode
+ }
+ setColumnWidth: (
+ id: string,
+ width: number
+ ) => {
+ id: string
+ width: number
+ }
+ setColumns: (columns: LogsColumnConfig[]) => {
+ columns: LogsColumnConfig[]
+ }
+ setCompareEnabled: (enabled: boolean) => {
+ enabled: boolean
+ }
+ setFacetRailCollapsed: (facetRailCollapsed: boolean) => {
+ facetRailCollapsed: boolean
+ }
+ setFilter: (
+ filter: keyof LogsViewerFilters,
+ value: LogsViewerFilters[keyof LogsViewerFilters]
+ ) => {
+ filter: keyof LogsViewerFilters
+ value: string | DateRange | UniversalFiltersGroup | string[] | LogSeverityLevel[] | undefined
+ }
+ setFilters: (filters: LogsViewerFilters) => {
+ filters: LogsViewerFilters
+ }
+ setGroupBy: (groupBy: LogsViewerGroupBy | null) => {
+ groupBy: LogsViewerGroupBy | null
+ }
+ setOrderBy: (
+ orderBy: LogsOrderBy,
+ source?: 'header' | 'toolbar'
+ ) => {
+ orderBy: LogsOrderBy
+ source: 'header' | 'toolbar'
+ }
+ setSparklineBreakdownBy: (sparklineBreakdownBy: LogsSparklineBreakdownBy) => {
+ sparklineBreakdownBy: LogsSparklineBreakdownBy
+ }
+ setViewMode: (viewMode: LogsViewerViewMode) => {
+ viewMode: LogsViewerViewMode
+ }
+ toggleSparklineCollapsed: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewerConfigLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ config: (filters: LogsViewerFilters) => LogsViewerConfig
+ customColumns: (columns: LogsColumnConfig[]) => string[] | undefined
+ }
+}
+
+export type logsViewerConfigLogicType = MakeLogicType<
+ logsViewerConfigLogicValues,
+ logsViewerConfigLogicActions,
+ LogsViewerConfigProps,
+ logsViewerConfigLogicMeta
+>
+
export const logsViewerConfigLogic = kea<logsViewerConfigLogicType>([
path(['products', 'logs', 'frontend', 'components', 'LogsViewer', 'config', 'logsViewerConfigLogic']),
props({ id: 'default' } as LogsViewerConfigProps),
diff --git a/products/logs/frontend/components/LogsViewer/data/logsViewerDataLogic.ts b/products/logs/frontend/components/LogsViewer/data/logsViewerDataLogic.ts
index 41ccacf05ef8..dac1a99efa92 100644
--- a/products/logs/frontend/components/LogsViewer/data/logsViewerDataLogic.ts
+++ b/products/logs/frontend/components/LogsViewer/data/logsViewerDataLogic.ts
@@ -1,6 +1,19 @@
import colors from 'ansi-colors'
import { deepEqual as equal } from 'fast-equals'
-import { actions, afterMount, connect, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ connect,
+ events,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ reducers,
+ selectors,
+} from 'kea'
import { loaders } from 'kea-loaders'
import { subscriptions } from 'kea-subscriptions'
import posthog from 'posthog-js'
@@ -28,9 +41,12 @@ import { logsViewerConfigLogic } from 'products/logs/frontend/components/LogsVie
import { LogsViewerFilters } from 'products/logs/frontend/components/LogsViewer/config/types'
import { logsViewerFiltersLogic } from 'products/logs/frontend/components/LogsViewer/Filters/logsViewerFiltersLogic'
+import type { ProductIntentProperties } from '../../../../../../frontend/src/lib/utils/product-intents'
+import type { DateRange, LogSeverityLevel } from '../../../../../../frontend/src/queries/schema/schema-general'
// TODO: Move to ./types.ts
import { ParsedLogMessage } from '../../../types'
-import type { logsViewerDataLogicType } from './logsViewerDataLogicType'
+import type { LogsOrderBy } from '../../../types'
+import type { LogsColumnConfig } from '../config/columns'
const DEFAULT_LIVE_TAIL_POLL_INTERVAL_MS = 1000
const DEFAULT_LOGS_PAGE_SIZE: number = 250
@@ -121,6 +137,349 @@ export function shouldSkipFilterGroupChange(
return lastFilter ? hasIncompleteValue(lastFilter) : false
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewerDataLogicValues {
+ customColumns: string[] | undefined // logsViewerConfigLogic
+ orderBy: LogsOrderBy // logsViewerConfigLogic
+ sparklineBreakdownBy: LogsSparklineBreakdownBy // logsViewerConfigLogic
+ filterGroup: UniversalFiltersGroup // logsViewerFiltersLogic
+ filters: LogsViewerFilters // logsViewerFiltersLogic
+ queryFilterGroup: UniversalFiltersGroup // logsViewerFiltersLogic
+ utcDateRange: {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ explicitDate: boolean | null | undefined
+ } // logsViewerFiltersLogic
+ customColumnAliases: Record<string, string> | null
+ hasMoreLogsToLoad: boolean
+ hasRunQuery: boolean
+ initialLogsLimit: number | null
+ liveLogsCheckpoint: string | null
+ liveTailAbortController: AbortController | null
+ liveTailDisabledReason: string | undefined
+ liveTailExpired: boolean
+ liveTailPollInterval: number
+ liveTailRunning: boolean
+ logs: LogMessage[]
+ logsAbortController: AbortController | null
+ logsLoading: boolean
+ logsRemainingToLoad: number
+ maxExportableLogs: number
+ newLogUuids: Set<string>
+ nextCursor: string | null
+ parsedLogs: ParsedLogMessage[]
+ sparkline: any[]
+ sparklineAbortController: AbortController | null
+ sparklineData: {
+ data: {
+ color: string | undefined
+ name: string
+ values: number[]
+ }[]
+ dates: string[]
+ labels: string[]
+ }
+ sparklineIncompleteBarIndices: number[]
+ sparklineLoading: boolean
+ totalLogsMatchingFilters: number
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewerDataLogicActions {
+ addColumn: (column: LogsColumnConfig) => {
+ column: LogsColumnConfig
+ } // logsViewerConfigLogic
+ removeColumn: (id: string) => {
+ id: string
+ } // logsViewerConfigLogic
+ setColumns: (columns: LogsColumnConfig[]) => {
+ columns: LogsColumnConfig[]
+ } // logsViewerConfigLogic
+ setOrderBy: (
+ orderBy: LogsOrderBy,
+ source?: 'header' | 'toolbar' | undefined
+ ) => {
+ orderBy: LogsOrderBy
+ source: 'header' | 'toolbar'
+ } // logsViewerConfigLogic
+ setSparklineBreakdownBy: (sparklineBreakdownBy: LogsSparklineBreakdownBy) => {
+ sparklineBreakdownBy: LogsSparklineBreakdownBy
+ } // logsViewerConfigLogic
+ setDateRange: (dateRange: DateRange) => {
+ dateRange: DateRange
+ } // logsViewerFiltersLogic
+ setFilterGroup: (
+ filterGroup: UniversalFiltersGroup,
+ openFilterOnInsert?: boolean | undefined
+ ) => {
+ filterGroup: UniversalFiltersGroup
+ openFilterOnInsert: boolean
+ } // logsViewerFiltersLogic
+ setFilters: (
+ filters: Partial<LogsViewerFilters>,
+ pushToHistory?: boolean | undefined
+ ) => {
+ filters: Partial<LogsViewerFilters>
+ pushToHistory: boolean
+ } // logsViewerFiltersLogic
+ setSearchTerm: (searchTerm: string | undefined) => {
+ searchTerm: string | undefined
+ } // logsViewerFiltersLogic
+ setServiceNames: (serviceNames: string[]) => {
+ serviceNames: string[]
+ } // logsViewerFiltersLogic
+ setSeverityLevels: (severityLevels: LogSeverityLevel[]) => {
+ severityLevels: LogSeverityLevel[]
+ } // logsViewerFiltersLogic
+ addProductIntent: (properties: ProductIntentProperties) => ProductIntentProperties // teamLogic
+ addLogsToSparkline: (logs: LogMessage[]) => LogMessage[]
+ cancelInProgressLiveTail: (liveTailAbortController: AbortController | null) => {
+ liveTailAbortController: AbortController | null
+ }
+ cancelInProgressLogs: (logsAbortController: AbortController | null) => {
+ logsAbortController: AbortController | null
+ }
+ cancelInProgressSparkline: (sparklineAbortController: AbortController | null) => {
+ sparklineAbortController: AbortController | null
+ }
+ clearLogs: () => {
+ value: true
+ }
+ clearLogsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ clearLogsSuccess: (
+ logs: never[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ logs: never[]
+ payload?: {
+ value: true
+ }
+ }
+ expireLiveTail: () => boolean
+ fetchLogs: () => any
+ fetchLogsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ fetchLogsSuccess: (
+ logs: LogMessage[],
+ payload?: any
+ ) => {
+ logs: LogMessage[]
+ payload?: any
+ }
+ fetchNextLogsPage: (limit?: number) => {
+ limit: number | undefined
+ }
+ fetchNextLogsPageFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ fetchNextLogsPageSuccess: (
+ logs: LogMessage[],
+ payload?: {
+ limit: number | undefined
+ }
+ ) => {
+ logs: LogMessage[]
+ payload?: {
+ limit: number | undefined
+ }
+ }
+ fetchSparkline: () => any
+ fetchSparklineFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ fetchSparklineSuccess: (
+ sparkline: any[],
+ payload?: any
+ ) => {
+ sparkline: any[]
+ payload?: any
+ }
+ handleQueryChange: (
+ filterType: string,
+ extraProps?: Record<string, unknown>
+ ) => {
+ extraProps: Record<string, unknown> | undefined
+ filterType: string
+ }
+ pollForNewLogs: () => {
+ value: true
+ }
+ runQuery: (debounce?: integer) => {
+ debounce: number | undefined
+ }
+ setCustomColumnAliases: (customColumnAliases: Record<string, string> | null) => {
+ customColumnAliases: Record<string, string> | null
+ }
+ setHasMoreLogsToLoad: (hasMoreLogsToLoad: boolean) => {
+ hasMoreLogsToLoad: boolean
+ }
+ setInitialLogsLimit: (initialLogsLimit: number | null) => {
+ initialLogsLimit: number | null
+ }
+ setLiveLogsCheckpoint: (liveLogsCheckpoint: string | null) => {
+ liveLogsCheckpoint: string | null
+ }
+ setLiveTailAbortController: (liveTailAbortController: AbortController | null) => {
+ liveTailAbortController: AbortController | null
+ }
+ setLiveTailExpired: (liveTailExpired: boolean) => {
+ liveTailExpired: boolean
+ }
+ setLiveTailInterval: (interval: number) => {
+ interval: number
+ }
+ setLiveTailRunning: (enabled: boolean) => {
+ enabled: boolean
+ }
+ setLogs: (logs: LogMessage[]) => {
+ logs: LogMessage[]
+ }
+ setLogsAbortController: (logsAbortController: AbortController | null) => {
+ logsAbortController: AbortController | null
+ }
+ setLogsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ setLogsSuccess: (
+ logs: LogMessage[],
+ payload?: {
+ logs: LogMessage[]
+ }
+ ) => {
+ logs: LogMessage[]
+ payload?: {
+ logs: LogMessage[]
+ }
+ }
+ setMaxExportableLogs: (maxExportableLogs: number) => {
+ maxExportableLogs: number
+ }
+ setNewLogUuids: (newLogUuids: string[]) => {
+ newLogUuids: string[]
+ }
+ setNextCursor: (nextCursor: string | null) => {
+ nextCursor: string | null
+ }
+ setSparkline: (sparkline: any[] | null) => {
+ sparkline: any[] | null
+ }
+ setSparklineAbortController: (sparklineAbortController: AbortController | null) => {
+ sparklineAbortController: AbortController | null
+ }
+ setSparklineFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ setSparklineSuccess: (
+ sparkline: any[],
+ payload?: {
+ sparkline: any[] | null
+ }
+ ) => {
+ sparkline: any[]
+ payload?: {
+ sparkline: any[] | null
+ }
+ }
+ truncateLogs: (limit: number) => {
+ limit: number
+ }
+ truncateLogsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ truncateLogsSuccess: (
+ logs: LogMessage[],
+ payload?: {
+ limit: number
+ }
+ ) => {
+ logs: LogMessage[]
+ payload?: {
+ limit: number
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewerDataLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ liveTailDisabledReason: (
+ orderBy: LogsOrderBy,
+ filters: LogsViewerFilters,
+ logsLoading: boolean,
+ liveTailExpired: boolean
+ ) => string | undefined
+ parsedLogs: (logs: LogMessage[]) => ParsedLogMessage[]
+ sparklineData: (
+ sparkline: any[],
+ sparklineBreakdownBy: LogsSparklineBreakdownBy
+ ) => {
+ data: {
+ color: string | undefined
+ name: string
+ values: number[]
+ }[]
+ dates: string[]
+ labels: string[]
+ }
+ sparklineIncompleteBarIndices: (
+ sparklineData: {
+ data: {
+ color: string | undefined
+ name: string
+ values: number[]
+ }[]
+ dates: string[]
+ labels: string[]
+ },
+ liveLogsCheckpoint: string | null,
+ sparklineLoading: boolean
+ ) => number[]
+ totalLogsMatchingFilters: (sparkline: any[]) => number
+ logsRemainingToLoad: (totalLogsMatchingFilters: number, logs: LogMessage[]) => number
+ }
+}
+
+export type logsViewerDataLogicType = MakeLogicType<
+ logsViewerDataLogicValues,
+ logsViewerDataLogicActions,
+ LogsViewerDataLogicProps,
+ logsViewerDataLogicMeta
+>
+
export const logsViewerDataLogic = kea<logsViewerDataLogicType>([
props({ id: 'default', autoLoad: true } as LogsViewerDataLogicProps),
path(['products', 'logs', 'frontend', 'components', 'LogsViewer', 'data', 'logsViewerDataLogic']),
@@ -591,11 +950,11 @@ export const logsViewerDataLogic = kea<logsViewerDataLogicType>([
],
totalLogsMatchingFilters: [
(s) => [s.sparkline],
- (sparkline): number => sparkline?.reduce((sum: number, item: any) => sum + item.count, 0) ?? 0,
+ (sparkline: any[]): number => sparkline?.reduce((sum: number, item: any) => sum + item.count, 0) ?? 0,
],
logsRemainingToLoad: [
(s) => [s.totalLogsMatchingFilters, s.logs],
- (totalLogsMatchingFilters, logs): number => totalLogsMatchingFilters - logs.length,
+ (totalLogsMatchingFilters: number, logs: LogMessage[]): number => totalLogsMatchingFilters - logs.length,
],
}),
diff --git a/products/logs/frontend/components/LogsViewer/logsExportLogic.ts b/products/logs/frontend/components/LogsViewer/logsExportLogic.ts
index 2c85cebaf242..2eeec95c7fa5 100644
--- a/products/logs/frontend/components/LogsViewer/logsExportLogic.ts
+++ b/products/logs/frontend/components/LogsViewer/logsExportLogic.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 Papa from 'papaparse'
import posthog from 'posthog-js'
@@ -12,9 +12,10 @@ import { PropertyGroupFilter, SidePanelTab } from '~/types'
import { logsViewerConfigLogic } from 'products/logs/frontend/components/LogsViewer/config/logsViewerConfigLogic'
import { ParsedLogMessage } from '../../types'
+import type { LogsOrderBy } from '../../types'
+import type { LogsViewerFilters } from './config/types'
import { logsViewerDataLogic } from './data/logsViewerDataLogic'
import { logsViewerFiltersLogic } from './Filters/logsViewerFiltersLogic'
-import type { logsExportLogicType } from './logsExportLogicType'
import { logsViewerLogic } from './logsViewerLogic'
function triggerBlobDownload(blob: Blob, filename: string): void {
@@ -45,6 +46,52 @@ export interface LogsExportLogicProps {
id: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsExportLogicValues {
+ orderBy: LogsOrderBy // logsViewerConfigLogic
+ maxExportableLogs: number // logsViewerDataLogic
+ filters: LogsViewerFilters // logsViewerFiltersLogic
+ utcDateRange: {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ explicitDate: boolean | null | undefined
+ } // logsViewerFiltersLogic
+ attributeColumns: string[] // logsViewerLogic
+ selectedLogsArray: ParsedLogMessage[] // logsViewerLogic
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsExportLogicActions {
+ openSidePanel: (
+ tab: SidePanelTab,
+ options?: string | undefined
+ ) => {
+ options: string | undefined
+ tab: SidePanelTab
+ } // sidePanelStateLogic
+ copySelectedLogs: () => {
+ value: true
+ }
+ exportSelectedAsCsv: () => {
+ value: true
+ }
+ exportServerSide: (totalLogsCount?: number) => {
+ totalLogsCount: number | undefined
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsExportLogicMeta {
+ key: string
+}
+
+export type logsExportLogicType = MakeLogicType<
+ logsExportLogicValues,
+ logsExportLogicActions,
+ LogsExportLogicProps,
+ logsExportLogicMeta
+>
+
export const logsExportLogic = kea<logsExportLogicType>([
path((id) => ['products', 'logs', 'frontend', 'components', 'LogsViewer', 'logsExportLogic', id]),
props({} as LogsExportLogicProps),
diff --git a/products/logs/frontend/components/LogsViewer/logsViewerLogic.ts b/products/logs/frontend/components/LogsViewer/logsViewerLogic.ts
index eecf61e0c4ce..baa0e7f86330 100644
--- a/products/logs/frontend/components/LogsViewer/logsViewerLogic.ts
+++ b/products/logs/frontend/components/LogsViewer/logsViewerLogic.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 { subscriptions } from 'kea-subscriptions'
import posthog from 'posthog-js'
@@ -12,10 +12,11 @@ import { logsViewerConfigLogic } from 'products/logs/frontend/components/LogsVie
import { logsViewerDataLogic } from 'products/logs/frontend/components/LogsViewer/data/logsViewerDataLogic'
import { logsViewerFiltersLogic } from 'products/logs/frontend/components/LogsViewer/Filters/logsViewerFiltersLogic'
+import type { LogMessage } from '../../../../../frontend/src/queries/schema/schema-general'
+import type { PropertyFilterType, PropertyOperator } from '../../../../../frontend/src/types'
import { LogsOrderBy, ParsedLogMessage } from '../../types'
import { attributeLookupExpression, LogsColumnConfig } from './config/columns'
import { logDetailsModalLogic } from './LogDetailsModal/logDetailsModalLogic'
-import type { logsViewerLogicType } from './logsViewerLogicType'
import { logsViewerSettingsLogic } from './logsViewerSettingsLogic'
export interface VisibleLogsTimeRange {
@@ -61,6 +62,216 @@ function tryOpenLinkedLog(
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewerLogicValues {
+ isLogDetailsOpen: boolean // logDetailsModalLogic
+ columns: LogsColumnConfig[] // logsViewerConfigLogic
+ customColumns: string[] | undefined // logsViewerConfigLogic
+ orderBy: LogsOrderBy // logsViewerConfigLogic
+ logs: ParsedLogMessage[] // logsViewerDataLogic
+ logsLoading: boolean // logsViewerDataLogic
+ prettifyJson: boolean // logsViewerSettingsLogic
+ timezone: string // logsViewerSettingsLogic
+ wrapBody: boolean // logsViewerSettingsLogic
+ attributeColumns: string[]
+ cursor: LogCursor
+ cursorIndex: number | null
+ cursorLogId: string | null
+ expandedAttributeBreakdowns: Record<string, string[]>
+ expandedLogIds: Record<string, boolean>
+ id: string
+ isAttributeColumn: (attributeKey: string) => boolean
+ isFocused: boolean
+ isSelectionActive: boolean
+ keyboardNavEnabled: boolean
+ linkToLogId: string | null
+ logsCount: number
+ pinnedLogs: Record<string, ParsedLogMessage>
+ pinnedLogsArray: ParsedLogMessage[]
+ prettifiedLogIds: Set<string>
+ recomputeRowHeightsRequest: {
+ logIds?: string[]
+ timestamp: number
+ } | null
+ scrollToCursorRequest: number
+ selectedCount: number
+ selectedLogIds: Record<string, boolean>
+ selectedLogsArray: ParsedLogMessage[]
+ visibleLogsTimeRange: VisibleLogsTimeRange | null
+ visibleRowDateRange: VisibleLogsTimeRange | null
+ visibleRowRange: VisibleRowRange | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewerLogicActions {
+ closeLogDetails: () => {
+ value: true
+ } // logDetailsModalLogic
+ openLogDetails: (log: ParsedLogMessage) => {
+ log: ParsedLogMessage
+ } // logDetailsModalLogic
+ addColumn: (column: LogsColumnConfig) => {
+ column: LogsColumnConfig
+ } // logsViewerConfigLogic
+ moveColumn: (
+ id: string,
+ direction: 'left' | 'right'
+ ) => {
+ direction: 'left' | 'right'
+ id: string
+ } // logsViewerConfigLogic
+ removeColumn: (id: string) => {
+ id: string
+ } // logsViewerConfigLogic
+ setColumnWidth: (
+ id: string,
+ width: number
+ ) => {
+ id: string
+ width: number
+ } // logsViewerConfigLogic
+ setColumns: (columns: LogsColumnConfig[]) => {
+ columns: LogsColumnConfig[]
+ } // logsViewerConfigLogic
+ clearLogs: () => {
+ value: true
+ } // logsViewerDataLogic
+ setLogs: (logs: LogMessage[]) => {
+ logs: LogMessage[]
+ } // logsViewerDataLogic
+ addFilter: (
+ key: string,
+ value: string,
+ operator?: PropertyOperator | undefined,
+ propertyType?: PropertyFilterType | undefined
+ ) => {
+ key: string
+ operator: PropertyOperator
+ propertyType: PropertyFilterType
+ value: string
+ } // logsViewerFiltersLogic
+ setPrettifyJson: (prettifyJson: boolean) => {
+ prettifyJson: boolean
+ } // logsViewerSettingsLogic
+ setTimezone: (timezone: string) => {
+ timezone: string
+ } // logsViewerSettingsLogic
+ setWrapBody: (wrapBody: boolean) => {
+ wrapBody: boolean
+ } // logsViewerSettingsLogic
+ clearLinkToLogId: () => {
+ value: true
+ }
+ clearSelection: () => {
+ value: true
+ }
+ copyLinkToLog: (logId: string) => {
+ logId: string
+ }
+ moveCursorDown: (shiftSelect?: boolean) => {
+ shiftSelect: boolean
+ }
+ moveCursorUp: (shiftSelect?: boolean) => {
+ shiftSelect: boolean
+ }
+ recomputeRowHeights: (logIds?: string[]) => {
+ logIds: string[] | undefined
+ }
+ requestScrollToCursor: () => {
+ value: true
+ }
+ resetCursor: () => {
+ value: true
+ }
+ selectAll: (logsToSelect?: ParsedLogMessage[]) => {
+ logsToSelect: ParsedLogMessage[] | undefined
+ }
+ selectLogRange: (
+ fromIndex: number,
+ toIndex: number
+ ) => {
+ fromIndex: number
+ toIndex: number
+ }
+ setCursor: (cursor: LogCursor) => {
+ cursor: LogCursor
+ }
+ setCursorIndex: (index: number | null) => {
+ index: number | null
+ }
+ setFocused: (isFocused: boolean) => {
+ isFocused: boolean
+ }
+ setLinkToLogId: (linkToLogId: string | null) => {
+ linkToLogId: string | null
+ }
+ setSelectedLogIds: (selectedLogIds: Record<string, boolean>) => {
+ selectedLogIds: Record<string, boolean>
+ }
+ setVisibleRowRange: (
+ startIndex: number,
+ stopIndex: number
+ ) => {
+ startIndex: number
+ stopIndex: number
+ }
+ toggleAttributeBreakdown: (
+ logId: string,
+ attributeKey: string
+ ) => {
+ attributeKey: string
+ logId: string
+ }
+ toggleAttributeColumn: (attributeKey: string) => {
+ attributeKey: string
+ }
+ toggleExpandLog: (logId: string) => {
+ logId: string
+ }
+ togglePinLog: (log: ParsedLogMessage) => {
+ log: ParsedLogMessage
+ }
+ togglePrettifyLog: (logId: string) => {
+ logId: string
+ }
+ toggleSelectLog: (logId: string) => {
+ logId: string
+ }
+ userSetCursorIndex: (index: number | null) => {
+ index: number | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewerLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ id: (id: string) => string
+ pinnedLogsArray: (pinnedLogs: Record<string, ParsedLogMessage>) => ParsedLogMessage[]
+ cursorIndex: (cursor: LogCursor) => number | null
+ cursorLogId: (cursor: LogCursor, logs: ParsedLogMessage[]) => string | null
+ keyboardNavEnabled: (isFocused: boolean, isLogDetailsOpen: boolean) => boolean
+ visibleLogsTimeRange: (logs: ParsedLogMessage[], orderBy: LogsOrderBy) => VisibleLogsTimeRange | null
+ visibleRowDateRange: (
+ visibleRowRange: VisibleRowRange | null,
+ logs: ParsedLogMessage[]
+ ) => VisibleLogsTimeRange | null
+ logsCount: (logs: ParsedLogMessage[]) => number
+ attributeColumns: (columns: LogsColumnConfig[]) => string[]
+ isAttributeColumn: (columns: LogsColumnConfig[]) => (attributeKey: string) => boolean
+ isSelectionActive: (selectedLogIds: Record<string, boolean>) => boolean
+ selectedCount: (selectedLogIds: Record<string, boolean>) => number
+ selectedLogsArray: (selectedLogIds: Record<string, boolean>, logs: ParsedLogMessage[]) => ParsedLogMessage[]
+ }
+}
+
+export type logsViewerLogicType = MakeLogicType<
+ logsViewerLogicValues,
+ logsViewerLogicActions,
+ LogsViewerLogicProps,
+ logsViewerLogicMeta
+>
+
export const logsViewerLogic = kea<logsViewerLogicType>([
path((id) => ['products', 'logs', 'frontend', 'components', 'LogsViewer', 'logsViewerLogic', id]),
props({} as LogsViewerLogicProps),
@@ -282,10 +493,13 @@ export const logsViewerLogic = kea<logsViewerLogicType>([
selectors({
id: [(_, p) => [p.id], (id: string): string => id],
- pinnedLogsArray: [(s) => [s.pinnedLogs], (pinnedLogs): ParsedLogMessage[] => Object.values(pinnedLogs)],
+ pinnedLogsArray: [
+ (s) => [s.pinnedLogs],
+ (pinnedLogs: Record<string, ParsedLogMessage>): ParsedLogMessage[] => Object.values(pinnedLogs),
+ ],
// Convenience selectors for cursor components
- cursorIndex: [(s) => [s.cursor], (cursor): number | null => cursor],
+ cursorIndex: [(s) => [s.cursor], (cursor: LogCursor): number | null => cursor],
cursorLogId: [
(s) => [s.cursor, s.logs],
@@ -370,12 +584,16 @@ export const logsViewerLogic = kea<logsViewerLogicType>([
// Selection selectors
isSelectionActive: [
(s) => [s.selectedLogIds],
- (selectedLogIds): boolean => Object.keys(selectedLogIds).length > 0,
+ (selectedLogIds: Record<string, boolean>): boolean => Object.keys(selectedLogIds).length > 0,
+ ],
+ selectedCount: [
+ (s) => [s.selectedLogIds],
+ (selectedLogIds: Record<string, boolean>): number => Object.keys(selectedLogIds).length,
],
- selectedCount: [(s) => [s.selectedLogIds], (selectedLogIds): number => Object.keys(selectedLogIds).length],
selectedLogsArray: [
(s) => [s.selectedLogIds, s.logs],
- (selectedLogIds, logs): ParsedLogMessage[] => logs.filter((log) => selectedLogIds[log.uuid]),
+ (selectedLogIds: Record<string, boolean>, logs: ParsedLogMessage[]): ParsedLogMessage[] =>
+ logs.filter((log) => selectedLogIds[log.uuid]),
],
}),
diff --git a/products/logs/frontend/components/LogsViewer/logsViewerSettingsLogic.ts b/products/logs/frontend/components/LogsViewer/logsViewerSettingsLogic.ts
index f38c069eceba..7a86d7317fac 100644
--- a/products/logs/frontend/components/LogsViewer/logsViewerSettingsLogic.ts
+++ b/products/logs/frontend/components/LogsViewer/logsViewerSettingsLogic.ts
@@ -1,7 +1,27 @@
-import { actions, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, listeners, path, reducers } from 'kea'
import posthog from 'posthog-js'
-import type { logsViewerSettingsLogicType } from './logsViewerSettingsLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewerSettingsLogicValues {
+ prettifyJson: boolean
+ timezone: string
+ wrapBody: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewerSettingsLogicActions {
+ setPrettifyJson: (prettifyJson: boolean) => {
+ prettifyJson: boolean
+ }
+ setTimezone: (timezone: string) => {
+ timezone: string
+ }
+ setWrapBody: (wrapBody: boolean) => {
+ wrapBody: boolean
+ }
+}
+
+export type logsViewerSettingsLogicType = MakeLogicType<logsViewerSettingsLogicValues, logsViewerSettingsLogicActions>
// Shared logic for user preferences which should be used across all tabs+windows
export const logsViewerSettingsLogic = kea<logsViewerSettingsLogicType>([
diff --git a/products/logs/frontend/components/LogsViews/logsViewsListLogic.ts b/products/logs/frontend/components/LogsViews/logsViewsListLogic.ts
index 7c2f1e6efe80..58559db2e90b 100644
--- a/products/logs/frontend/components/LogsViews/logsViewsListLogic.ts
+++ b/products/logs/frontend/components/LogsViews/logsViewsListLogic.ts
@@ -1,10 +1,76 @@
-import { actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
import { logsViewerFiltersLogic } from 'products/logs/frontend/components/LogsViewer/Filters/logsViewerFiltersLogic'
-import type { logsViewsListLogicType } from './logsViewsListLogicType'
+import type { LogsViewApi, LogsViewApiFilters } from '../../generated/api.schemas'
+import type { LogsViewerFilters } from '../LogsViewer/config/types'
import { LogsViewsLogicProps, logsViewsLogic } from './logsViewsLogic'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewsListLogicValues {
+ filters: LogsViewerFilters // logsViewerFiltersLogic
+ isModalOpen: boolean
+ isSaveModalOpen: boolean
+ viewName: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewsListLogicActions {
+ createView: (args_0: { filters: LogsViewApiFilters; name: string }) => {
+ filters: LogsViewApiFilters
+ name: string
+ } // logsViewsLogic
+ createViewSuccess: (
+ views: LogsViewApi[],
+ payload?:
+ | {
+ filters: LogsViewApiFilters
+ name: string
+ }
+ | undefined
+ ) => {
+ payload?: {
+ filters: LogsViewApiFilters
+ name: string
+ }
+ views: LogsViewApi[]
+ } // logsViewsLogic
+ loadView: (view: LogsViewApi) => {
+ view: LogsViewApi
+ } // logsViewsLogic
+ loadViews: () => any // logsViewsLogic
+ closeModal: () => {
+ value: true
+ }
+ closeSaveModal: () => {
+ value: true
+ }
+ openModal: () => {
+ value: true
+ }
+ openSaveModal: () => {
+ value: true
+ }
+ saveView: () => {
+ value: true
+ }
+ setViewName: (viewName: string) => {
+ viewName: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewsListLogicMeta {
+ key: string
+}
+
+export type logsViewsListLogicType = MakeLogicType<
+ logsViewsListLogicValues,
+ logsViewsListLogicActions,
+ LogsViewsLogicProps,
+ logsViewsListLogicMeta
+>
+
export const logsViewsListLogic = kea<logsViewsListLogicType>([
props({} as LogsViewsLogicProps),
key((props) => props.id),
diff --git a/products/logs/frontend/components/LogsViews/logsViewsLogic.ts b/products/logs/frontend/components/LogsViews/logsViewsLogic.ts
index 4cfc85a7b1a4..8817ff494018 100644
--- a/products/logs/frontend/components/LogsViews/logsViewsLogic.ts
+++ b/products/logs/frontend/components/LogsViews/logsViewsLogic.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 { loaders } from 'kea-loaders'
import { lemonToast } from '@posthog/lemon-ui'
@@ -10,7 +10,8 @@ import { logsViewerFiltersLogic } from 'products/logs/frontend/components/LogsVi
import { LogsViewApi, LogsViewApiFilters } from 'products/logs/frontend/generated/api.schemas'
import { DEFAULT_ACTIVE_TAB, logsSceneLogic } from 'products/logs/frontend/logsSceneLogic'
-import type { logsViewsLogicType } from './logsViewsLogicType'
+import type { LogsSceneActiveTab } from '../../logsSceneLogic'
+import type { LogsViewerFilters } from '../LogsViewer/config/types'
export type LogsView = LogsViewApi
@@ -20,6 +21,84 @@ export interface LogsViewsLogicProps {
const logsViewsUrl = (teamId: number | null): string => `api/environments/${teamId}/logs/views`
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewsLogicValues {
+ currentTeamId: number | null // teamLogic
+ views: LogsView[]
+ viewsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewsLogicActions {
+ setActiveTab: (activeTab: LogsSceneActiveTab) => {
+ activeTab: LogsSceneActiveTab
+ } // logsSceneLogic
+ setFilters: (
+ filters: Partial<LogsViewerFilters>,
+ pushToHistory?: boolean | undefined
+ ) => {
+ filters: Partial<LogsViewerFilters>
+ pushToHistory: boolean
+ } // logsViewerFiltersLogic
+ createView: ({ name, filters }: { filters: LogsViewApiFilters; name: string }) => {
+ name: string
+ filters: LogsViewApiFilters
+ }
+ createViewFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ createViewSuccess: (
+ views: LogsViewApi[],
+ payload?: {
+ name: string
+ filters: LogsViewApiFilters
+ }
+ ) => {
+ views: LogsViewApi[]
+ payload?: {
+ name: string
+ filters: LogsViewApiFilters
+ }
+ }
+ deleteView: (shortId: string) => {
+ shortId: string
+ }
+ loadView: (view: LogsView) => {
+ view: LogsViewApi
+ }
+ loadViews: () => any
+ loadViewsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadViewsSuccess: (
+ views: LogsView[],
+ payload?: any
+ ) => {
+ views: LogsView[]
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewsLogicMeta {
+ key: string
+}
+
+export type logsViewsLogicType = MakeLogicType<
+ logsViewsLogicValues,
+ logsViewsLogicActions,
+ LogsViewsLogicProps,
+ logsViewsLogicMeta
+>
+
export const logsViewsLogic = kea<logsViewsLogicType>([
props({} as LogsViewsLogicProps),
key((props) => props.id),
diff --git a/products/logs/frontend/components/SetupPrompt/logsIngestionLogic.tsx b/products/logs/frontend/components/SetupPrompt/logsIngestionLogic.tsx
index 90da7a24859d..e6e47bcee381 100644
--- a/products/logs/frontend/components/SetupPrompt/logsIngestionLogic.tsx
+++ b/products/logs/frontend/components/SetupPrompt/logsIngestionLogic.tsx
@@ -1,13 +1,53 @@
-import { afterMount, kea, path, reducers, selectors } from 'kea'
+import { MakeLogicType, afterMount, kea, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
import { retryWithBackoff } from 'lib/utils/async'
-import type { logsIngestionLogicType } from './logsIngestionLogicType'
-
const teamId = window.POSTHOG_APP_CONTEXT?.current_team?.id
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsIngestionLogicValues {
+ cachedTeamHasLogs: boolean | null
+ hasLogs: boolean | undefined
+ teamHasLogs: boolean | undefined
+ teamHasLogsCheckFailed: boolean
+ teamHasLogsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsIngestionLogicActions {
+ loadTeamHasLogs: () => any
+ loadTeamHasLogsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadTeamHasLogsSuccess: (
+ teamHasLogs: boolean,
+ payload?: any
+ ) => {
+ teamHasLogs: boolean
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsIngestionLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ hasLogs: (teamHasLogs: boolean | undefined, cachedTeamHasLogs: boolean | null) => boolean | undefined
+ }
+}
+
+export type logsIngestionLogicType = MakeLogicType<
+ logsIngestionLogicValues,
+ logsIngestionLogicActions,
+ Record<string, any>,
+ logsIngestionLogicMeta
+>
+
export const logsIngestionLogic = kea<logsIngestionLogicType>([
path(['products', 'logs', 'components', 'SetupPrompt', 'logsIngestionLogic']),
loaders({
@@ -41,7 +81,8 @@ export const logsIngestionLogic = kea<logsIngestionLogicType>([
selectors({
hasLogs: [
(s) => [s.teamHasLogs, s.cachedTeamHasLogs],
- (teamHasLogs, cachedTeamHasLogs): boolean | undefined => teamHasLogs ?? cachedTeamHasLogs ?? undefined,
+ (teamHasLogs: boolean | undefined, cachedTeamHasLogs: boolean | null): boolean | undefined =>
+ teamHasLogs ?? cachedTeamHasLogs ?? undefined,
],
}),
diff --git a/products/logs/frontend/components/VirtualizedLogsList/virtualizedLogsListLogic.ts b/products/logs/frontend/components/VirtualizedLogsList/virtualizedLogsListLogic.ts
index a799b4e7295e..f60902ccb9c5 100644
--- a/products/logs/frontend/components/VirtualizedLogsList/virtualizedLogsListLogic.ts
+++ b/products/logs/frontend/components/VirtualizedLogsList/virtualizedLogsListLogic.ts
@@ -1,6 +1,4 @@
-import { actions, kea, key, path, props, reducers, selectors } from 'kea'
-
-import type { virtualizedLogsListLogicType } from './virtualizedLogsListLogicType'
+import { MakeLogicType, actions, kea, key, path, props, reducers, selectors } from 'kea'
export interface VirtualizedLogsListLogicProps {
id: string
@@ -9,6 +7,44 @@ export interface VirtualizedLogsListLogicProps {
const DEFAULT_SCROLL_THRESHOLD = 100
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface virtualizedLogsListLogicValues {
+ cellScrollLefts: Record<string, number>
+ containerWidth: number
+ shouldLoadMore: (stopIndex: number, dataSourceLength: number, hasMore: boolean, isLoading: boolean) => boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface virtualizedLogsListLogicActions {
+ setCellScrollLeft: (
+ cellKey: string,
+ scrollLeft: number
+ ) => {
+ cellKey: string
+ scrollLeft: number
+ }
+ setContainerWidth: (width: number) => {
+ width: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface virtualizedLogsListLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ shouldLoadMore: (
+ arg: any
+ ) => (stopIndex: number, dataSourceLength: number, hasMore: boolean, isLoading: boolean) => boolean
+ }
+}
+
+export type virtualizedLogsListLogicType = MakeLogicType<
+ virtualizedLogsListLogicValues,
+ virtualizedLogsListLogicActions,
+ VirtualizedLogsListLogicProps,
+ virtualizedLogsListLogicMeta
+>
+
export const virtualizedLogsListLogic = kea<virtualizedLogsListLogicType>([
props({ scrollThreshold: DEFAULT_SCROLL_THRESHOLD } as VirtualizedLogsListLogicProps),
key((props) => props.id),
diff --git a/products/logs/frontend/logsConfigLogic.ts b/products/logs/frontend/logsConfigLogic.ts
index d9d16485a77d..5bdf0687ea4e 100644
--- a/products/logs/frontend/logsConfigLogic.ts
+++ b/products/logs/frontend/logsConfigLogic.ts
@@ -1,11 +1,9 @@
-import { afterMount, connect, kea, path, selectors } from 'kea'
+import { MakeLogicType, afterMount, connect, kea, path, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
import { teamLogic } from 'scenes/teamLogic'
-import type { logsConfigLogicType } from './logsConfigLogicType'
-
// Mirrors the backend default in products/logs/backend/models.py — the convention
// documented at https://posthog.com/docs/logs/link-session-replay. Used as the
// pre-load fallback in `PersonLogsTab` so the initial pinned filter matches the
@@ -21,6 +19,62 @@ export interface LogsConfig {
logs_session_id_attribute_keys: string[]
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsConfigLogicValues {
+ currentTeamId: number | null // teamLogic
+ configuredSessionIdKeys: string[] | undefined
+ logsConfig: LogsConfig | null
+ logsConfigLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsConfigLogicActions {
+ loadLogsConfig: () => any
+ loadLogsConfigFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadLogsConfigSuccess: (
+ logsConfig: LogsConfig,
+ payload?: any
+ ) => {
+ logsConfig: LogsConfig
+ payload?: any
+ }
+ updateLogsConfig: (patch: Partial<LogsConfig>) => Partial<LogsConfig>
+ updateLogsConfigFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateLogsConfigSuccess: (
+ logsConfig: LogsConfig,
+ payload?: Partial<LogsConfig>
+ ) => {
+ logsConfig: LogsConfig
+ payload?: Partial<LogsConfig>
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsConfigLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ configuredSessionIdKeys: (logsConfig: LogsConfig | null) => string[] | undefined
+ }
+}
+
+export type logsConfigLogicType = MakeLogicType<
+ logsConfigLogicValues,
+ logsConfigLogicActions,
+ Record<string, any>,
+ logsConfigLogicMeta
+>
+
export const logsConfigLogic = kea<logsConfigLogicType>([
path(['products', 'logs', 'frontend', 'logsConfigLogic']),
connect({ values: [teamLogic, ['currentTeamId']] }),
@@ -44,7 +98,7 @@ export const logsConfigLogic = kea<logsConfigLogicType>([
// built-in convention list (which contains the default) in the meantime.
configuredSessionIdKeys: [
(s) => [s.logsConfig],
- (logsConfig): string[] | undefined => logsConfig?.logs_session_id_attribute_keys,
+ (logsConfig: LogsConfig | null): string[] | undefined => logsConfig?.logs_session_id_attribute_keys,
],
}),
afterMount(({ actions }) => {
diff --git a/products/logs/frontend/logsSceneLogic.tsx b/products/logs/frontend/logsSceneLogic.tsx
index 5d35bb614fb3..5bcfe05b0f1e 100644
--- a/products/logs/frontend/logsSceneLogic.tsx
+++ b/products/logs/frontend/logsSceneLogic.tsx
@@ -1,5 +1,5 @@
import { deepEqual as equal } from 'fast-equals'
-import { actions, connect, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers } from 'kea'
import { router, urlToAction } from 'kea-router'
import { syncSearchParams, updateSearchParams } from '@posthog/products-error-tracking/frontend/utils'
@@ -34,7 +34,8 @@ import {
import { logDetailsModalLogic } from 'products/logs/frontend/components/LogsViewer/LogDetailsModal/logDetailsModalLogic'
import { logsViewerLogic } from 'products/logs/frontend/components/LogsViewer/logsViewerLogic'
-import type { logsSceneLogicType } from './logsSceneLogicType'
+import type { LogMessage } from '../../../frontend/src/queries/schema/schema-general'
+import type { LogsOrderBy } from './types'
export const getLogsSqlEditorTabId = (id: string): string => `logs-sql-editor-${id}`
@@ -58,6 +59,93 @@ const resolveActiveTabFromParams = (params: Params): LogsSceneActiveTab | null =
return null
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsSceneLogicValues {
+ facetNameSearch: string // facetRailLogic
+ orderBy: LogsOrderBy // logsViewerConfigLogic
+ viewMode: LogsViewerViewMode // logsViewerConfigLogic
+ initialLogsLimit: number | null // logsViewerDataLogic
+ filters: LogsViewerFilters // logsViewerFiltersLogic
+ utcDateRange: {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ explicitDate: boolean | null | undefined
+ } // logsViewerFiltersLogic
+ linkToLogId: string | null // logsViewerLogic
+ activeTab: LogsSceneActiveTab
+ expandedAttributeBreaksdowns: string[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsSceneLogicActions {
+ setFacetNameSearch: (search: string) => {
+ search: string
+ } // facetRailLogic
+ closeLogDetails: () => {
+ value: true
+ } // logDetailsModalLogic
+ pushToFilterHistory: (filters: LogsViewerFilters) => {
+ filters: LogsViewerFilters
+ } // logsFilterHistoryLogic
+ setOrderBy: (
+ orderBy: LogsOrderBy,
+ source?: 'header' | 'toolbar' | undefined
+ ) => {
+ orderBy: LogsOrderBy
+ source: 'header' | 'toolbar'
+ } // logsViewerConfigLogic
+ setViewMode: (viewMode: LogsViewerViewMode) => {
+ viewMode: LogsViewerViewMode
+ } // logsViewerConfigLogic
+ fetchLogsSuccess: (
+ logs: LogMessage[],
+ payload?: any
+ ) => {
+ logs: LogMessage[]
+ payload?: any
+ } // logsViewerDataLogic
+ handleQueryChange: (
+ filterType: string,
+ extraProps?: Record<string, unknown> | undefined
+ ) => {
+ extraProps: Record<string, unknown> | undefined
+ filterType: string
+ } // logsViewerDataLogic
+ setInitialLogsLimit: (initialLogsLimit: number | null) => {
+ initialLogsLimit: number | null
+ } // logsViewerDataLogic
+ setFilters: (
+ filters: Partial<LogsViewerFilters>,
+ pushToHistory?: boolean | undefined
+ ) => {
+ filters: Partial<LogsViewerFilters>
+ pushToHistory: boolean
+ } // logsViewerFiltersLogic
+ clearLinkToLogId: () => {
+ value: true
+ } // logsViewerLogic
+ setLinkToLogId: (linkToLogId: string | null) => {
+ linkToLogId: string | null
+ } // logsViewerLogic
+ keepSqlEditorMounted: (editorTabId: string) => {
+ editorTabId: string
+ }
+ setActiveTab: (activeTab: LogsSceneActiveTab) => {
+ activeTab: LogsSceneActiveTab
+ }
+ setExpandedAttributeBreaksdowns: (expandedAttributeBreaksdowns: string[]) => {
+ expandedAttributeBreaksdowns: string[]
+ }
+ syncUrl: () => {
+ value: true
+ }
+ toggleAttributeBreakdown: (key: string) => {
+ key: string
+ }
+}
+
+export type logsSceneLogicType = MakeLogicType<logsSceneLogicValues, logsSceneLogicActions>
+
export const logsSceneLogic = kea<logsSceneLogicType>([
path(['products', 'logs', 'frontend', 'logsSceneLogic']),
connect(() => ({
diff --git a/products/logs/frontend/scenes/LogsAlertDetailScene/logsAlertDetailSceneLogic.ts b/products/logs/frontend/scenes/LogsAlertDetailScene/logsAlertDetailSceneLogic.ts
index 6e8d45f1a4b8..16ea85b033bf 100644
--- a/products/logs/frontend/scenes/LogsAlertDetailScene/logsAlertDetailSceneLogic.ts
+++ b/products/logs/frontend/scenes/LogsAlertDetailScene/logsAlertDetailSceneLogic.ts
@@ -1,4 +1,5 @@
-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 type { FieldName } from 'kea-forms/lib/index'
import { loaders } from 'kea-loaders'
import { actionToUrl, router, urlToAction } from 'kea-router'
@@ -34,7 +35,7 @@ import {
} from 'products/logs/frontend/generated/api'
import { LogsAlertConfigurationApi } from 'products/logs/frontend/generated/api.schemas'
-import type { logsAlertDetailSceneLogicType } from './logsAlertDetailSceneLogicType'
+import type { LogsAlertFormType } from '../../components/LogsAlerting/logsAlertFormLogic'
export type LogsAlertDetailTab = 'configuration' | 'notifications' | 'history' | 'logs'
const VALID_TABS: LogsAlertDetailTab[] = ['configuration', 'notifications', 'history', 'logs']
@@ -46,6 +47,142 @@ export interface LogsAlertDetailSceneLogicProps {
id: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsAlertDetailSceneLogicValues {
+ alertForm: LogsAlertFormType // logsAlertFormLogic
+ alertFormChanged: boolean // logsAlertFormLogic
+ currentTeamId: number | null // teamLogic
+ activeTab: LogsAlertDetailTab
+ alert: LogsAlertConfigurationApi | null
+ alertId: string
+ alertLoading: boolean
+ breadcrumbs: Breadcrumb[]
+ isDraft: boolean
+ logsViewerUrl: string
+ pendingEnableAfterSave: boolean
+ sparkline7d: any[]
+ sparkline7dFetched: boolean
+ sparkline7dLoading: boolean
+ sparkline7dSeries: {
+ labels: string[]
+ series: SparklineTimeSeries[]
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsAlertDetailSceneLogicActions {
+ loadEvents: () => any // logsAlertEventHistoryLogic
+ resetAlertForm: (values?: LogsAlertFormType | undefined) => {
+ values?: LogsAlertFormType
+ } // logsAlertFormLogic
+ setAlertFormValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ } // logsAlertFormLogic
+ submitAlertForm: () => {
+ value: boolean
+ } // logsAlertFormLogic
+ submitAlertFormFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ } // logsAlertFormLogic
+ submitAlertFormSuccess: (alertForm: LogsAlertFormType) => {
+ alertForm: LogsAlertFormType
+ } // logsAlertFormLogic
+ destinationsChanged: () => {
+ value: true
+ } // logsAlertNotificationLogic
+ loadAlerts: () => any // logsAlertingLogic
+ applyEnabledChange: (enabled: boolean) => {
+ enabled: boolean
+ }
+ deleteAlert: () => {
+ value: true
+ }
+ enableAlert: () => {
+ value: true
+ }
+ loadAlert: () => any
+ loadAlertFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAlertSuccess: (
+ alert: LogsAlertConfigurationApi,
+ payload?: any
+ ) => {
+ alert: LogsAlertConfigurationApi
+ payload?: any
+ }
+ loadSparkline7d: () => any
+ loadSparkline7dFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSparkline7dSuccess: (
+ sparkline7d: any[],
+ payload?: any
+ ) => {
+ sparkline7d: any[]
+ payload?: any
+ }
+ markPendingEnable: () => {
+ value: true
+ }
+ patchAlertLocally: (patch: Partial<LogsAlertConfigurationApi>) => {
+ patch: Partial<LogsAlertConfigurationApi>
+ }
+ resetAlert: () => {
+ value: true
+ }
+ setActiveTab: (tab: LogsAlertDetailTab) => {
+ tab: LogsAlertDetailTab
+ }
+ snoozeAlert: (durationMinutes: number) => {
+ durationMinutes: number
+ }
+ toggleEnabled: () => {
+ value: true
+ }
+ unsnoozeAlert: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsAlertDetailSceneLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ alertId: (arg: any) => string
+ isDraft: (alert: LogsAlertConfigurationApi | null) => boolean
+ breadcrumbs: (alert: LogsAlertConfigurationApi | null) => Breadcrumb[]
+ sparkline7dSeries: (sparkline7d: any[]) => {
+ labels: string[]
+ series: SparklineTimeSeries[]
+ }
+ logsViewerUrl: (alert: LogsAlertConfigurationApi | null) => string
+ }
+}
+
+export type logsAlertDetailSceneLogicType = MakeLogicType<
+ logsAlertDetailSceneLogicValues,
+ logsAlertDetailSceneLogicActions,
+ LogsAlertDetailSceneLogicProps,
+ logsAlertDetailSceneLogicMeta
+>
+
export const logsAlertDetailSceneLogic = kea<logsAlertDetailSceneLogicType>([
path((key) => ['products', 'logs', 'frontend', 'scenes', 'LogsAlertDetailScene', 'logsAlertDetailSceneLogic', key]),
props({} as LogsAlertDetailSceneLogicProps),
diff --git a/products/logs/frontend/scenes/LogsAlertNotificationDetailScene/logsAlertNotificationDetailSceneLogic.ts b/products/logs/frontend/scenes/LogsAlertNotificationDetailScene/logsAlertNotificationDetailSceneLogic.ts
index d16c4e11fba4..aacfd5026fa0 100644
--- a/products/logs/frontend/scenes/LogsAlertNotificationDetailScene/logsAlertNotificationDetailSceneLogic.ts
+++ b/products/logs/frontend/scenes/LogsAlertNotificationDetailScene/logsAlertNotificationDetailSceneLogic.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'
import { subscriptions } from 'kea-subscriptions'
@@ -22,13 +22,100 @@ import {
import { logsAlertsDestinationsDeleteCreate, logsAlertsRetrieve } from 'products/logs/frontend/generated/api'
import { LogsAlertConfigurationApi } from 'products/logs/frontend/generated/api.schemas'
-import type { logsAlertNotificationDetailSceneLogicType } from './logsAlertNotificationDetailSceneLogicType'
-
export interface LogsAlertNotificationDetailSceneLogicProps {
alertId: string
hogFunctionId: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsAlertNotificationDetailSceneLogicValues {
+ slackIntegrations: IntegrationType[] | undefined // integrationsLogic
+ currentTeamId: number | null // teamLogic
+ alert: LogsAlertConfigurationApi | null
+ alertId: string
+ alertLoading: boolean
+ breadcrumbs: Breadcrumb[]
+ destinationGroup: LogsAlertDestinationGroup | null
+ firstSlackIntegration: IntegrationType | undefined
+ hasLoaded: boolean
+ hogFunctionId: string
+ hogFunctions: HogFunctionType[]
+ hogFunctionsError: string | null
+ hogFunctionsLoading: boolean
+ isDeleting: boolean
+ togglingHogFunctionIds: string[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsAlertNotificationDetailSceneLogicActions {
+ deleteDestination: (displayLabel: string) => {
+ displayLabel: string
+ }
+ deleteDestinationDone: () => {
+ value: true
+ }
+ loadAlert: () => any
+ loadAlertFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAlertSuccess: (
+ alert: LogsAlertConfigurationApi | null,
+ payload?: any
+ ) => {
+ alert: LogsAlertConfigurationApi | null
+ payload?: any
+ }
+ loadHogFunctions: () => any
+ loadHogFunctionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadHogFunctionsSuccess: (
+ hogFunctions: HogFunctionType[],
+ payload?: any
+ ) => {
+ hogFunctions: HogFunctionType[]
+ payload?: any
+ }
+ setHogFunctionEnabled: (
+ hogFunctionId: string,
+ enabled: boolean
+ ) => {
+ enabled: boolean
+ hogFunctionId: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsAlertNotificationDetailSceneLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ alertId: (arg: any) => string
+ hogFunctionId: (arg: any) => string
+ firstSlackIntegration: (slackIntegrations: IntegrationType[] | undefined) => IntegrationType | undefined
+ destinationGroup: (hogFunctions: HogFunctionType[], hogFunctionId: string) => LogsAlertDestinationGroup | null
+ breadcrumbs: (
+ alert: LogsAlertConfigurationApi | null,
+ destinationGroup: LogsAlertDestinationGroup | null,
+ alertId: string
+ ) => Breadcrumb[]
+ }
+}
+
+export type logsAlertNotificationDetailSceneLogicType = MakeLogicType<
+ logsAlertNotificationDetailSceneLogicValues,
+ logsAlertNotificationDetailSceneLogicActions,
+ LogsAlertNotificationDetailSceneLogicProps,
+ logsAlertNotificationDetailSceneLogicMeta
+>
+
export const logsAlertNotificationDetailSceneLogic = kea<logsAlertNotificationDetailSceneLogicType>([
path((key) => [
'products',
diff --git a/products/logs/frontend/scenes/LogsSamplingDetailScene/logsSamplingDetailSceneLogic.ts b/products/logs/frontend/scenes/LogsSamplingDetailScene/logsSamplingDetailSceneLogic.ts
index 4d06da9eee8e..49458a41e61d 100644
--- a/products/logs/frontend/scenes/LogsSamplingDetailScene/logsSamplingDetailSceneLogic.ts
+++ b/products/logs/frontend/scenes/LogsSamplingDetailScene/logsSamplingDetailSceneLogic.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 { router } from 'kea-router'
@@ -21,12 +21,74 @@ import { logsSamplingRulesDestroy, logsSamplingRulesRetrieve } from 'products/lo
import { LogsSamplingRuleApi } from 'products/logs/frontend/generated/api.schemas'
import { logsDropRulesSettingsUrl } from 'products/logs/frontend/logsDropRulesSettingsUrl'
-import type { logsSamplingDetailSceneLogicType } from './logsSamplingDetailSceneLogicType'
+import type { LogsSamplingFormType } from '../../components/LogsSampling/logsSamplingFormLogic'
export interface LogsSamplingDetailSceneLogicProps {
id: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsSamplingDetailSceneLogicValues {
+ currentTeamId: number | null // teamLogic
+ breadcrumbs: Breadcrumb[]
+ rule: LogsSamplingRuleApi | null
+ ruleDropImpact24h: SamplingRuleDropTotals | null
+ ruleDropImpact24hLoading: boolean
+ ruleLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsSamplingDetailSceneLogicActions {
+ resetSamplingForm: (values?: LogsSamplingFormType | undefined) => {
+ values?: LogsSamplingFormType
+ } // logsSamplingFormLogic
+ deleteRule: () => {
+ value: true
+ }
+ loadRule: () => any
+ loadRuleDropImpact24h: (_: any) => any
+ loadRuleDropImpact24hFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRuleDropImpact24hSuccess: (
+ ruleDropImpact24h: SamplingRuleDropTotals,
+ payload?: any
+ ) => {
+ ruleDropImpact24h: SamplingRuleDropTotals
+ payload?: any
+ }
+ loadRuleFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRuleSuccess: (
+ rule: LogsSamplingRuleApi,
+ payload?: any
+ ) => {
+ rule: LogsSamplingRuleApi
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsSamplingDetailSceneLogicMeta {
+ key: string
+}
+
+export type logsSamplingDetailSceneLogicType = MakeLogicType<
+ logsSamplingDetailSceneLogicValues,
+ logsSamplingDetailSceneLogicActions,
+ LogsSamplingDetailSceneLogicProps,
+ logsSamplingDetailSceneLogicMeta
+>
+
export const logsSamplingDetailSceneLogic = kea<logsSamplingDetailSceneLogicType>([
path((key) => [
'products',
diff --git a/products/logs/frontend/scenes/LogsSamplingNewScene/logsSamplingNewSceneLogic.ts b/products/logs/frontend/scenes/LogsSamplingNewScene/logsSamplingNewSceneLogic.ts
index e40a9fa634c4..2534208851e4 100644
--- a/products/logs/frontend/scenes/LogsSamplingNewScene/logsSamplingNewSceneLogic.ts
+++ b/products/logs/frontend/scenes/LogsSamplingNewScene/logsSamplingNewSceneLogic.ts
@@ -1,4 +1,4 @@
-import { kea, path, selectors } from 'kea'
+import { MakeLogicType, kea, path, selectors } from 'kea'
import { Scene } from 'scenes/sceneTypes'
@@ -6,7 +6,12 @@ import { Breadcrumb } from '~/types'
import { logsDropRulesSettingsUrl } from 'products/logs/frontend/logsDropRulesSettingsUrl'
-import type { logsSamplingNewSceneLogicType } from './logsSamplingNewSceneLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsSamplingNewSceneLogicValues {
+ breadcrumbs: Breadcrumb[]
+}
+
+export type logsSamplingNewSceneLogicType = MakeLogicType<logsSamplingNewSceneLogicValues, {}>
export const logsSamplingNewSceneLogic = kea<logsSamplingNewSceneLogicType>([
path(['products', 'logs', 'frontend', 'scenes', 'LogsSamplingNewScene', 'logsSamplingNewSceneLogic']),
diff --git a/products/mcp_analytics/frontend/firstLook/mcpFirstLookLogic.ts b/products/mcp_analytics/frontend/firstLook/mcpFirstLookLogic.ts
index 7ee807786e54..4c6742d98e04 100644
--- a/products/mcp_analytics/frontend/firstLook/mcpFirstLookLogic.ts
+++ b/products/mcp_analytics/frontend/firstLook/mcpFirstLookLogic.ts
@@ -44,7 +44,7 @@ export interface mcpFirstLookLogicValues {
export interface mcpFirstLookLogicActions {
updateHasSeenProductIntroFor: (
productKey: ProductKey,
- value?: boolean
+ value?: boolean | undefined
) => {
productKey: ProductKey
value: boolean
diff --git a/products/revenue_analytics/frontend/nodes/modals/mrrBreakdownModalLogic.ts b/products/revenue_analytics/frontend/nodes/modals/mrrBreakdownModalLogic.ts
index 19fa3332a2b5..15e078c1c4c3 100644
--- a/products/revenue_analytics/frontend/nodes/modals/mrrBreakdownModalLogic.ts
+++ b/products/revenue_analytics/frontend/nodes/modals/mrrBreakdownModalLogic.ts
@@ -1,18 +1,53 @@
-import { actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { RevenueAnalyticsMRRQueryResultItem } from '~/queries/schema/schema-general'
import { GraphDataset } from '~/types'
-import type { mrrBreakdownModalLogicType } from './mrrBreakdownModalLogicType'
-
const includeKey =
(key: `revenue-analytics-${keyof RevenueAnalyticsMRRQueryResultItem}`) => (dataset: GraphDataset) => ({
...dataset,
status: key,
})
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mrrBreakdownModalLogicValues {
+ churnDatasets: GraphDataset[]
+ contractionDatasets: GraphDataset[]
+ data: RevenueAnalyticsMRRQueryResultItem[] | null
+ expansionDatasets: GraphDataset[]
+ isModalOpen: boolean
+ newDatasets: GraphDataset[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mrrBreakdownModalLogicActions {
+ reportRevenueAnalyticsMRRBreakdownModalOpened: () => {} // eventUsageLogic
+ closeModal: () => {
+ value: true
+ }
+ openModal: (data: RevenueAnalyticsMRRQueryResultItem[]) => RevenueAnalyticsMRRQueryResultItem[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mrrBreakdownModalLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ isModalOpen: (data: RevenueAnalyticsMRRQueryResultItem[] | null) => boolean
+ newDatasets: (data: RevenueAnalyticsMRRQueryResultItem[] | null) => GraphDataset[]
+ expansionDatasets: (data: RevenueAnalyticsMRRQueryResultItem[] | null) => GraphDataset[]
+ contractionDatasets: (data: RevenueAnalyticsMRRQueryResultItem[] | null) => GraphDataset[]
+ churnDatasets: (data: RevenueAnalyticsMRRQueryResultItem[] | null) => GraphDataset[]
+ }
+}
+
+export type mrrBreakdownModalLogicType = MakeLogicType<
+ mrrBreakdownModalLogicValues,
+ mrrBreakdownModalLogicActions,
+ Record<string, any>,
+ mrrBreakdownModalLogicMeta
+>
+
export const mrrBreakdownModalLogic = kea<mrrBreakdownModalLogicType>([
path(['products', 'revenueAnalytics', 'mrrBreakdownModalLogic']),
connect(() => ({
@@ -35,29 +70,29 @@ export const mrrBreakdownModalLogic = kea<mrrBreakdownModalLogicType>([
}),
selectors({
- isModalOpen: [(s) => [s.data], (data): boolean => !!data],
+ isModalOpen: [(s) => [s.data], (data: RevenueAnalyticsMRRQueryResultItem[] | null): boolean => !!data],
newDatasets: [
(s) => [s.data],
- (data): GraphDataset[] =>
+ (data: RevenueAnalyticsMRRQueryResultItem[] | null): GraphDataset[] =>
(data?.map((item) => item.new as GraphDataset) ?? []).map(includeKey('revenue-analytics-new')),
],
expansionDatasets: [
(s) => [s.data],
- (data): GraphDataset[] =>
+ (data: RevenueAnalyticsMRRQueryResultItem[] | null): GraphDataset[] =>
(data?.map((item) => item.expansion as GraphDataset) ?? []).map(
includeKey('revenue-analytics-expansion')
),
],
contractionDatasets: [
(s) => [s.data],
- (data): GraphDataset[] =>
+ (data: RevenueAnalyticsMRRQueryResultItem[] | null): GraphDataset[] =>
(data?.map((item) => item.contraction as GraphDataset) ?? []).map(
includeKey('revenue-analytics-contraction')
),
],
churnDatasets: [
(s) => [s.data],
- (data): GraphDataset[] =>
+ (data: RevenueAnalyticsMRRQueryResultItem[] | null): GraphDataset[] =>
(data?.map((item) => item.churn as GraphDataset) ?? []).map(includeKey('revenue-analytics-churn')),
],
}),
diff --git a/products/revenue_analytics/frontend/revenueAnalyticsLogic.ts b/products/revenue_analytics/frontend/revenueAnalyticsLogic.ts
index 82c3f610165a..5e0abc1fb460 100644
--- a/products/revenue_analytics/frontend/revenueAnalyticsLogic.ts
+++ b/products/revenue_analytics/frontend/revenueAnalyticsLogic.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 { router, urlToAction } from 'kea-router'
import { lemonToast } from '@posthog/lemon-ui'
@@ -27,7 +27,13 @@ import { Breadcrumb, DataWarehouseSavedQuery, InsightLogicProps, InsightShortId,
import { sourceManagementLogic } from 'products/data_warehouse/frontend/shared/logics/sourceManagementLogic'
-import type { revenueAnalyticsLogicType } from './revenueAnalyticsLogicType'
+import type { PaginatedResponse } from '../../../frontend/src/lib/api'
+import type {
+ CurrencyCode,
+ RevenueAnalyticsEventItem,
+ RevenueAnalyticsGoal,
+} from '../../../frontend/src/queries/schema/schema-general'
+import type { ExternalDataSource } from '../../../frontend/src/types'
import { revenueAnalyticsSettingsLogic } from './settings/revenueAnalyticsSettingsLogic'
export enum RevenueAnalyticsQuery {
@@ -111,6 +117,174 @@ const setQueryParams = (params: Record<string, string>): string => {
export type MRRMode = 'mrr' | 'arr'
export type DisplayMode = 'line' | 'area' | 'bar' | 'table'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface revenueAnalyticsLogicValues {
+ dataWarehouseSavedQueries: DataWarehouseSavedQuery[] // dataWarehouseViewsLogic
+ dataWarehouseSources: PaginatedResponse<ExternalDataSource> | null // revenueAnalyticsSettingsLogic
+ events: RevenueAnalyticsEventItem[] // revenueAnalyticsSettingsLogic
+ revenueGoals: RevenueAnalyticsGoal[] // revenueAnalyticsSettingsLogic
+ baseCurrency: CurrencyCode // teamLogic
+ allRevenueAnalyticsViews: DataWarehouseSavedQuery[]
+ breadcrumbs: Breadcrumb[]
+ breakdownProperties: RevenueAnalyticsBreakdown[]
+ dateFilter: {
+ dateFrom: string | null
+ dateTo: string | null
+ interval: SimpleIntervalType
+ }
+ disabledGrowthModeSelection: boolean
+ disabledTopCustomersModeSelection: boolean
+ hasRevenueAnalyticsViewsWithIssues: boolean
+ hasRevenueEvents: boolean
+ hasRevenueTables: boolean | null
+ insightsDisplayMode: DisplayMode
+ isRevenueAnalyticsEnabled: boolean
+ maxContext: MaxContextInput[]
+ mrrMode: MRRMode
+ pausedRevenueViews: DataWarehouseSavedQuery[]
+ queries: Record<RevenueAnalyticsQuery, QuerySchema>
+ resumingSchedules: boolean
+ resumingViewSchedule: Record<string, boolean>
+ revenueAnalyticsFilter: RevenueAnalyticsPropertyFilters
+ revenueEnabledDataWarehouseSources: ExternalDataSource[] | null
+ revenueEnabledEvents: RevenueAnalyticsEventItem[]
+ topCustomersDisplayMode: DisplayMode
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface revenueAnalyticsLogicActions {
+ loadDataWarehouseSavedQueries: () => any // dataWarehouseViewsLogic
+ reportRevenueAnalyticsBreakdownAdded: (
+ breakdownProperty: string,
+ breakdownType: string
+ ) => {
+ breakdownProperty: string
+ breakdownType: string
+ } // eventUsageLogic
+ reportRevenueAnalyticsBreakdownRemoved: (
+ breakdownProperty: string,
+ breakdownType: string
+ ) => {
+ breakdownProperty: string
+ breakdownType: string
+ } // eventUsageLogic
+ reportRevenueAnalyticsDateRangeChanged: (
+ dateFrom: string | null,
+ dateTo: string | null
+ ) => {
+ dateFrom: string | null
+ dateTo: string | null
+ } // eventUsageLogic
+ reportRevenueAnalyticsFilterApplied: (filterCount: number) => {
+ filterCount: number
+ } // eventUsageLogic
+ reportRevenueAnalyticsMRRModeChanged: (mrrMode: string) => {
+ mrrMode: string
+ } // eventUsageLogic
+ loadSourcesSuccess: (
+ dataWarehouseSources:
+ | PaginatedResponse<ExternalDataSource>
+ | {
+ count: number
+ next: null
+ previous: null
+ results: never[]
+ },
+ payload?:
+ | {
+ value: true
+ }
+ | undefined
+ ) => {
+ dataWarehouseSources:
+ | PaginatedResponse<ExternalDataSource>
+ | {
+ count: number
+ next: null
+ previous: null
+ results: never[]
+ }
+ payload?: {
+ value: true
+ }
+ } // sourceManagementLogic
+ addBreakdown: (breakdown: RevenueAnalyticsBreakdown) => {
+ breakdown: RevenueAnalyticsBreakdown
+ }
+ removeBreakdown: (breakdown: RevenueAnalyticsBreakdown) => {
+ breakdown: RevenueAnalyticsBreakdown
+ }
+ resumeViewSchedule: (viewId: string) => {
+ viewId: string
+ }
+ setBreakdownProperties: (breakdownProperties: RevenueAnalyticsBreakdown[]) => {
+ breakdownProperties: RevenueAnalyticsBreakdown[]
+ }
+ setDates: (
+ dateFrom: string | null,
+ dateTo: string | null
+ ) => {
+ dateFrom: string | null
+ dateTo: string | null
+ }
+ setInsightsDisplayMode: (displayMode: DisplayMode) => {
+ displayMode: DisplayMode
+ }
+ setMRRMode: (mrrMode: MRRMode) => {
+ mrrMode: MRRMode
+ }
+ setRevenueAnalyticsFilters: (revenueAnalyticsFilters: RevenueAnalyticsPropertyFilters) => {
+ revenueAnalyticsFilters: RevenueAnalyticsPropertyFilters
+ }
+ setTopCustomersDisplayMode: (displayMode: DisplayMode) => {
+ displayMode: DisplayMode
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface revenueAnalyticsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ revenueEnabledEvents: (events: RevenueAnalyticsEventItem[]) => RevenueAnalyticsEventItem[]
+ revenueEnabledDataWarehouseSources: (
+ dataWarehouseSources: PaginatedResponse<ExternalDataSource> | null
+ ) => ExternalDataSource[] | null
+ disabledGrowthModeSelection: (dateFilter: {
+ dateFrom: string | null
+ dateTo: string | null
+ interval: SimpleIntervalType
+ }) => boolean
+ disabledTopCustomersModeSelection: (dateFilter: {
+ dateFrom: string | null
+ dateTo: string | null
+ interval: SimpleIntervalType
+ }) => boolean
+ hasRevenueEvents: (revenueEnabledEvents: RevenueAnalyticsEventItem[]) => boolean
+ hasRevenueTables: (revenueEnabledDataWarehouseSources: ExternalDataSource[] | null) => boolean | null
+ isRevenueAnalyticsEnabled: (hasRevenueTables: boolean | null, hasRevenueEvents: boolean) => boolean
+ allRevenueAnalyticsViews: (dataWarehouseSavedQueries: DataWarehouseSavedQuery[]) => DataWarehouseSavedQuery[]
+ pausedRevenueViews: (allRevenueAnalyticsViews: DataWarehouseSavedQuery[]) => DataWarehouseSavedQuery[]
+ hasRevenueAnalyticsViewsWithIssues: (allRevenueAnalyticsViews: DataWarehouseSavedQuery[]) => boolean
+ queries: (
+ dateFilter: {
+ dateFrom: string | null
+ dateTo: string | null
+ interval: SimpleIntervalType
+ },
+ revenueAnalyticsFilter: RevenueAnalyticsPropertyFilters,
+ topCustomersDisplayMode: DisplayMode,
+ breakdownProperties: RevenueAnalyticsBreakdown[]
+ ) => Record<RevenueAnalyticsQuery, QuerySchema>
+ maxContext: (queries: Record<RevenueAnalyticsQuery, QuerySchema>) => MaxContextInput[]
+ }
+}
+
+export type revenueAnalyticsLogicType = MakeLogicType<
+ revenueAnalyticsLogicValues,
+ revenueAnalyticsLogicActions,
+ Record<string, any>,
+ revenueAnalyticsLogicMeta
+>
+
export const revenueAnalyticsLogic = kea<revenueAnalyticsLogicType>([
path(['products', 'revenueAnalytics', 'frontend', 'revenueAnalyticsLogic']),
connect(() => ({
@@ -245,33 +419,41 @@ export const revenueAnalyticsLogic = kea<revenueAnalyticsLogicType>([
],
],
- revenueEnabledEvents: [(s) => [s.events], (events) => events],
+ revenueEnabledEvents: [
+ (s) => [s.events],
+ (events: import('~/queries/schema').RevenueAnalyticsEventItem[]) => events,
+ ],
revenueEnabledDataWarehouseSources: [
(s) => [s.dataWarehouseSources],
- (dataWarehouseSources) =>
+ (dataWarehouseSources: null | import('lib/api').PaginatedResponse<import('~/types').ExternalDataSource>) =>
dataWarehouseSources === null
? null
: dataWarehouseSources.results.filter((source) => source.revenue_analytics_config.enabled),
],
- disabledGrowthModeSelection: [(s) => [s.dateFilter], (dateFilter): boolean => dateFilter.interval !== 'month'],
+ disabledGrowthModeSelection: [
+ (s) => [s.dateFilter],
+ (dateFilter: { dateFrom: string | null; dateTo: string | null; interval: SimpleIntervalType }): boolean =>
+ dateFilter.interval !== 'month',
+ ],
disabledTopCustomersModeSelection: [
(s) => [s.dateFilter],
- (dateFilter): boolean => dateFilter.interval !== 'month',
+ (dateFilter: { dateFrom: string | null; dateTo: string | null; interval: SimpleIntervalType }): boolean =>
+ dateFilter.interval !== 'month',
],
hasRevenueEvents: [
(s) => [s.revenueEnabledEvents],
- (events): boolean => {
+ (events: import('~/queries/schema').RevenueAnalyticsEventItem[]): boolean => {
return events.length > 0
},
],
hasRevenueTables: [
(s) => [s.revenueEnabledDataWarehouseSources],
- (dataWarehouseSources): boolean | null => {
+ (dataWarehouseSources: import('~/types').ExternalDataSource[] | null): boolean | null => {
// Indicate loading state with `null` if we haven't loaded this yet
if (dataWarehouseSources === null) {
return null
@@ -283,14 +465,14 @@ export const revenueAnalyticsLogic = kea<revenueAnalyticsLogicType>([
isRevenueAnalyticsEnabled: [
(s) => [s.hasRevenueTables, s.hasRevenueEvents],
- (hasRevenueTables, hasRevenueEvents): boolean => {
+ (hasRevenueTables: boolean | null, hasRevenueEvents: boolean): boolean => {
return hasRevenueTables || hasRevenueEvents
},
],
allRevenueAnalyticsViews: [
(s) => [s.dataWarehouseSavedQueries],
- (savedQueries): DataWarehouseSavedQuery[] => {
+ (savedQueries: DataWarehouseSavedQuery[]): DataWarehouseSavedQuery[] => {
if (!savedQueries) {
return []
}
@@ -300,7 +482,7 @@ export const revenueAnalyticsLogic = kea<revenueAnalyticsLogicType>([
pausedRevenueViews: [
(s) => [s.allRevenueAnalyticsViews],
- (allRevenueAnalyticsViews): DataWarehouseSavedQuery[] => {
+ (allRevenueAnalyticsViews: DataWarehouseSavedQuery[]): DataWarehouseSavedQuery[] => {
if (!allRevenueAnalyticsViews) {
return []
}
@@ -315,7 +497,7 @@ export const revenueAnalyticsLogic = kea<revenueAnalyticsLogicType>([
hasRevenueAnalyticsViewsWithIssues: [
(s) => [s.allRevenueAnalyticsViews],
- (allRevenueAnalyticsViews): boolean => {
+ (allRevenueAnalyticsViews: DataWarehouseSavedQuery[]): boolean => {
return allRevenueAnalyticsViews.some((view) => view.status === 'Failed' || view.latest_error)
},
],
@@ -323,10 +505,14 @@ export const revenueAnalyticsLogic = kea<revenueAnalyticsLogicType>([
queries: [
(s) => [s.dateFilter, s.revenueAnalyticsFilter, s.topCustomersDisplayMode, s.breakdownProperties],
(
- dateFilter,
- revenueAnalyticsFilter,
- topCustomersDisplayMode,
- breakdown
+ dateFilter: {
+ dateFrom: string | null
+ dateTo: string | null
+ interval: SimpleIntervalType
+ },
+ revenueAnalyticsFilter: RevenueAnalyticsPropertyFilters,
+ topCustomersDisplayMode: DisplayMode,
+ breakdown: RevenueAnalyticsBreakdown[]
): Record<RevenueAnalyticsQuery, QuerySchema> => {
const { dateFrom, dateTo, interval } = dateFilter
const dateRange = { date_from: dateFrom, date_to: dateTo }
@@ -377,7 +563,7 @@ export const revenueAnalyticsLogic = kea<revenueAnalyticsLogicType>([
maxContext: [
(s) => [s.queries],
- (queries): MaxContextInput[] => {
+ (queries: Record<RevenueAnalyticsQuery, QuerySchema>): MaxContextInput[] => {
return [
createMaxContextHelpers.insight(
{
diff --git a/products/revenue_analytics/frontend/settings/deleteRevenueEventModalLogic.ts b/products/revenue_analytics/frontend/settings/deleteRevenueEventModalLogic.ts
index 4626375ba64a..1d885e0b7264 100644
--- a/products/revenue_analytics/frontend/settings/deleteRevenueEventModalLogic.ts
+++ b/products/revenue_analytics/frontend/settings/deleteRevenueEventModalLogic.ts
@@ -1,11 +1,46 @@
-import { actions, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
import { DataWarehouseManagedViewsetSavedQuery } from '~/types'
-import type { deleteRevenueEventModalLogicType } from './deleteRevenueEventModalLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface deleteRevenueEventModalLogicValues {
+ eventName: string | null
+ views: DataWarehouseManagedViewsetSavedQuery[]
+ viewsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface deleteRevenueEventModalLogicActions {
+ setEventName: (eventName: string | null) => {
+ eventName: string | null
+ }
+ setEventNameFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ setEventNameSuccess: (
+ views: DataWarehouseManagedViewsetSavedQuery[],
+ payload?: {
+ eventName: string | null
+ }
+ ) => {
+ views: DataWarehouseManagedViewsetSavedQuery[]
+ payload?: {
+ eventName: string | null
+ }
+ }
+}
+
+export type deleteRevenueEventModalLogicType = MakeLogicType<
+ deleteRevenueEventModalLogicValues,
+ deleteRevenueEventModalLogicActions
+>
export const deleteRevenueEventModalLogic = kea<deleteRevenueEventModalLogicType>([
path(['products', 'revenue_analytics', 'settings', 'deleteRevenueEventModalLogic']),
diff --git a/products/revenue_analytics/frontend/settings/disableRevenueSourceModalLogic.ts b/products/revenue_analytics/frontend/settings/disableRevenueSourceModalLogic.ts
index 8ca425baf37e..f6d44845da3a 100644
--- a/products/revenue_analytics/frontend/settings/disableRevenueSourceModalLogic.ts
+++ b/products/revenue_analytics/frontend/settings/disableRevenueSourceModalLogic.ts
@@ -1,11 +1,46 @@
-import { actions, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
import { DataWarehouseManagedViewsetSavedQuery, ExternalDataSource } from '~/types'
-import type { disableRevenueSourceModalLogicType } from './disableRevenueSourceModalLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface disableRevenueSourceModalLogicValues {
+ source: ExternalDataSource | null
+ views: DataWarehouseManagedViewsetSavedQuery[]
+ viewsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface disableRevenueSourceModalLogicActions {
+ setSource: (source: ExternalDataSource | null) => {
+ source: ExternalDataSource | null
+ }
+ setSourceFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ setSourceSuccess: (
+ views: DataWarehouseManagedViewsetSavedQuery[],
+ payload?: {
+ source: ExternalDataSource | null
+ }
+ ) => {
+ views: DataWarehouseManagedViewsetSavedQuery[]
+ payload?: {
+ source: ExternalDataSource | null
+ }
+ }
+}
+
+export type disableRevenueSourceModalLogicType = MakeLogicType<
+ disableRevenueSourceModalLogicValues,
+ disableRevenueSourceModalLogicActions
+>
export const disableRevenueSourceModalLogic = kea<disableRevenueSourceModalLogicType>([
path(['products', 'revenue_analytics', 'settings', 'disableRevenueSourceModalLogic']),
diff --git a/products/revenue_analytics/frontend/settings/revenueAnalyticsSettingsLogic.ts b/products/revenue_analytics/frontend/settings/revenueAnalyticsSettingsLogic.ts
index 9f77bceb5f6f..600c58f80014 100644
--- a/products/revenue_analytics/frontend/settings/revenueAnalyticsSettingsLogic.ts
+++ b/products/revenue_analytics/frontend/settings/revenueAnalyticsSettingsLogic.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 { beforeUnload } from 'kea-router'
@@ -25,7 +25,14 @@ import { ExternalDataSource } from '~/types'
import { sourceManagementLogic } from 'products/data_warehouse/frontend/shared/logics/sourceManagementLogic'
-import type { revenueAnalyticsSettingsLogicType } from './revenueAnalyticsSettingsLogicType'
+import type { PaginatedResponse } from '../../../../frontend/src/lib/api'
+import type { DatabaseSchemaQueryResponse } from '../../../../frontend/src/queries/schema/schema-general'
+import type {
+ DataWarehouseViewLink,
+ ExternalDataSourceRevenueAnalyticsConfig,
+ TeamPublicType,
+ TeamType,
+} from '../../../../frontend/src/types'
const createEmptyConfig = (): RevenueAnalyticsConfig => ({
events: [],
@@ -60,6 +67,187 @@ const updatePropertyReducerBuilder =
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface revenueAnalyticsSettingsLogicValues {
+ database: Required<DatabaseSchemaQueryResponse> | null // databaseTableListLogic
+ dataWarehouseSources: PaginatedResponse<ExternalDataSource> | null // sourceManagementLogic
+ dataWarehouseSourcesLoading: boolean // sourceManagementLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ currentTeamId: number | null // teamLogic
+ changesMadeToEvents: boolean
+ enabledDataWarehouseSources: ExternalDataSource[]
+ events: RevenueAnalyticsEventItem[]
+ exampleDataWarehouseTablesQuery: DataTableNode | null
+ exampleEventsQuery: DataTableNode | null
+ filterTestAccounts: boolean
+ goals: RevenueAnalyticsGoal[]
+ joins: DataWarehouseViewLink[]
+ revenueAnalyticsConfig: RevenueAnalyticsConfig | null
+ revenueAnalyticsConfigLoading: boolean
+ saveEventsDisabledReason: string | null
+ savedRevenueAnalyticsConfig: RevenueAnalyticsConfig
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface revenueAnalyticsSettingsLogicActions {
+ reportRevenueAnalyticsDataSourceDisabled: (sourceType: string) => {
+ sourceType: string
+ } // eventUsageLogic
+ reportRevenueAnalyticsDataSourceEnabled: (sourceType: string) => {
+ sourceType: string
+ } // eventUsageLogic
+ reportRevenueAnalyticsEventDeleted: (eventName: string) => {
+ eventName: string
+ } // eventUsageLogic
+ reportRevenueAnalyticsTestAccountFilterUpdated: (filterTestAccounts: boolean) => {
+ filterTestAccounts: boolean
+ } // eventUsageLogic
+ deleteJoin: (join: DataWarehouseViewLink) => {
+ join: DataWarehouseViewLink
+ } // sourceManagementLogic
+ updateSourceRevenueAnalyticsConfig: (args_0: {
+ config: Partial<ExternalDataSourceRevenueAnalyticsConfig>
+ source: ExternalDataSource
+ }) => {
+ config: Partial<ExternalDataSourceRevenueAnalyticsConfig>
+ source: ExternalDataSource
+ } // sourceManagementLogic
+ updateCurrentTeam: (payload: Partial<TeamType>) => Partial<TeamType> // teamLogic
+ addEvent: (
+ eventName: string,
+ revenueCurrency: CurrencyCode
+ ) => {
+ eventName: string
+ revenueCurrency: CurrencyCode
+ }
+ addGoal: (goal: RevenueAnalyticsGoal) => {
+ goal: RevenueAnalyticsGoal
+ }
+ deleteEvent: (eventName: string) => {
+ eventName: string
+ }
+ deleteGoal: (index: number) => {
+ index: number
+ }
+ loadRevenueAnalyticsConfig: () => any
+ loadRevenueAnalyticsConfigFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRevenueAnalyticsConfigSuccess: (
+ revenueAnalyticsConfig: RevenueAnalyticsConfig | null,
+ payload?: any
+ ) => {
+ revenueAnalyticsConfig: RevenueAnalyticsConfig | null
+ payload?: any
+ }
+ resetConfig: () => {
+ value: true
+ }
+ save: () => {
+ value: true
+ }
+ updateEventCouponProperty: (
+ eventName: string,
+ property: string
+ ) => {
+ eventName: string
+ property: string
+ }
+ updateEventCurrencyAwareDecimalProperty: (
+ eventName: string,
+ property: boolean
+ ) => {
+ eventName: string
+ property: boolean
+ }
+ updateEventCurrencyProperty: (
+ eventName: string,
+ property: RevenueCurrencyPropertyConfig
+ ) => {
+ eventName: string
+ property: RevenueCurrencyPropertyConfig
+ }
+ updateEventProductProperty: (
+ eventName: string,
+ property: string
+ ) => {
+ eventName: string
+ property: string
+ }
+ updateEventRevenueProperty: (
+ eventName: string,
+ property: string
+ ) => {
+ eventName: string
+ property: string
+ }
+ updateEventSubscriptionDropoffDays: (
+ eventName: string,
+ property: number
+ ) => {
+ eventName: string
+ property: number
+ }
+ updateEventSubscriptionDropoffMode: (
+ eventName: string,
+ property: SubscriptionDropoffMode
+ ) => {
+ eventName: string
+ property: SubscriptionDropoffMode
+ }
+ updateEventSubscriptionProperty: (
+ eventName: string,
+ property: string
+ ) => {
+ eventName: string
+ property: string
+ }
+ updateFilterTestAccounts: (filterTestAccounts: boolean) => {
+ filterTestAccounts: boolean
+ }
+ updateGoal: (
+ index: number,
+ goal: RevenueAnalyticsGoal
+ ) => {
+ goal: RevenueAnalyticsGoal
+ index: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface revenueAnalyticsSettingsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ filterTestAccounts: (revenueAnalyticsConfig: RevenueAnalyticsConfig | null) => boolean
+ goals: (revenueAnalyticsConfig: RevenueAnalyticsConfig | null) => RevenueAnalyticsGoal[]
+ events: (revenueAnalyticsConfig: RevenueAnalyticsConfig | null) => RevenueAnalyticsEventItem[]
+ changesMadeToEvents: (
+ revenueAnalyticsConfig: RevenueAnalyticsConfig | null,
+ savedRevenueAnalyticsConfig: RevenueAnalyticsConfig
+ ) => boolean
+ saveEventsDisabledReason: (
+ revenueAnalyticsConfig: RevenueAnalyticsConfig | null,
+ changesMadeToEvents: boolean
+ ) => string | null
+ enabledDataWarehouseSources: (
+ dataWarehouseSources: PaginatedResponse<ExternalDataSource> | null
+ ) => ExternalDataSource[]
+ exampleEventsQuery: (savedRevenueAnalyticsConfig: RevenueAnalyticsConfig) => DataTableNode | null
+ exampleDataWarehouseTablesQuery: (savedRevenueAnalyticsConfig: RevenueAnalyticsConfig) => DataTableNode | null
+ joins: (database: Required<DatabaseSchemaQueryResponse> | null) => DataWarehouseViewLink[]
+ }
+}
+
+export type revenueAnalyticsSettingsLogicType = MakeLogicType<
+ revenueAnalyticsSettingsLogicValues,
+ revenueAnalyticsSettingsLogicActions,
+ Record<string, any>,
+ revenueAnalyticsSettingsLogicMeta
+>
+
export const revenueAnalyticsSettingsLogic = kea<revenueAnalyticsSettingsLogicType>([
path(['scenes', 'data-management', 'revenue', 'revenueAnalyticsSettingsLogic']),
connect(() => ({
@@ -235,13 +423,13 @@ export const revenueAnalyticsSettingsLogic = kea<revenueAnalyticsSettingsLogicTy
],
changesMadeToEvents: [
(s) => [s.revenueAnalyticsConfig, s.savedRevenueAnalyticsConfig],
- (config, savedConfig): boolean => {
+ (config: RevenueAnalyticsConfig | null, savedConfig: RevenueAnalyticsConfig): boolean => {
return !!config && !objectsEqual(config.events, savedConfig.events)
},
],
saveEventsDisabledReason: [
(s) => [s.revenueAnalyticsConfig, s.changesMadeToEvents],
- (config, changesMade): string | null => {
+ (config: RevenueAnalyticsConfig | null, changesMade: boolean): string | null => {
if (!config) {
return 'Loading...'
}
@@ -259,7 +447,9 @@ export const revenueAnalyticsSettingsLogic = kea<revenueAnalyticsSettingsLogicTy
enabledDataWarehouseSources: [
(s) => [s.dataWarehouseSources],
- (dataWarehouseSources): ExternalDataSource[] => {
+ (
+ dataWarehouseSources: null | import('lib/api').PaginatedResponse<ExternalDataSource>
+ ): ExternalDataSource[] => {
return dataWarehouseSources?.results?.filter((source) => source.revenue_analytics_config.enabled) ?? []
},
],
@@ -305,7 +495,7 @@ export const revenueAnalyticsSettingsLogic = kea<revenueAnalyticsSettingsLogicTy
joins: [
(s) => [s.database],
- (database) => {
+ (database: Required<import('~/queries/schema').DatabaseSchemaQueryResponse> | null) => {
return database?.joins || []
},
],
diff --git a/products/review_hog/frontend/reviewHogSettingsLogic.ts b/products/review_hog/frontend/reviewHogSettingsLogic.ts
index 06b3c4fa254f..0516461ee7be 100644
--- a/products/review_hog/frontend/reviewHogSettingsLogic.ts
+++ b/products/review_hog/frontend/reviewHogSettingsLogic.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 { actionToUrl, router, urlToAction } from 'kea-router'
@@ -37,8 +37,6 @@ import type {
} from 'products/review_hog/frontend/generated/api.schemas'
import { ReviewHogReviewsListScope } from 'products/review_hog/frontend/generated/api.schemas'
-import type { reviewHogSettingsLogicType } from './reviewHogSettingsLogicType'
-
export type ReviewSkillKind = 'perspective' | 'blind_spots' | 'validator'
export type ReviewDrawerTab = 'published' | 'below_threshold' | 'dismissed' | 'chunks' | 'review'
@@ -119,6 +117,254 @@ function currentProjectId(): string {
return String(teamLogic.values.currentTeamId)
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface reviewHogSettingsLogicValues {
+ blindSpots: ReviewBlindSpotsConfigApi[] | null
+ blindSpotsLoading: boolean
+ creatingSkillKind: ReviewSkillKind | null
+ expandedReviewIds: string[]
+ hasUserChosenReviewsScope: boolean
+ initialLoadFailed: boolean
+ moreReviewsAvailable: boolean
+ openedReview: ReviewRecentReviewApi | null
+ perspectiveScoreboard: PerspectiveScore[] | null
+ perspectiveStats: ReviewPerspectiveStatsApi | null
+ perspectiveStatsLoading: boolean
+ perspectives: ReviewPerspectiveConfigApi[] | null
+ perspectivesLoading: boolean
+ recentReviews: ReviewRecentReviewApi[] | null
+ recentReviewsPage: ReviewRecentReviewsPageApi | null
+ recentReviewsPageLoading: boolean
+ reviewDetail: ReviewDetailApi | null
+ reviewDetailLoading: boolean
+ reviewDrawerOpen: boolean
+ reviewDrawerTab: ReviewDrawerTab
+ reviewFindingsSplit: ReviewFindingsSplit | null
+ reviewsExpanding: boolean
+ reviewsLimit: number
+ reviewsScope: ReviewHogReviewsListScope
+ savingSkillNames: string[]
+ settings: ReviewUserSettingsApi | null
+ settingsLoading: boolean
+ skillDrawerOpen: boolean
+ validators: ReviewValidatorConfigApi[] | null
+ validatorsLoading: boolean
+ viewedSkill: ViewedSkill | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface reviewHogSettingsLogicActions {
+ applyDefaultReviewsScope: (scope: ReviewHogReviewsListScope) => {
+ scope: ReviewHogReviewsListScope
+ }
+ blockSingleActiveDeactivation: (kindLabel: string) => {
+ kindLabel: string
+ }
+ closeReviewDrawer: () => {
+ value: true
+ }
+ closeSkillDrawer: () => {
+ value: true
+ }
+ loadAll: () => {
+ value: true
+ }
+ loadBlindSpots: () => any
+ loadBlindSpotsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadBlindSpotsSuccess: (
+ blindSpots: ReviewBlindSpotsConfigApi[],
+ payload?: any
+ ) => {
+ blindSpots: ReviewBlindSpotsConfigApi[]
+ payload?: any
+ }
+ loadPerspectiveStats: () => any
+ loadPerspectiveStatsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPerspectiveStatsSuccess: (
+ perspectiveStats: ReviewPerspectiveStatsApi,
+ payload?: any
+ ) => {
+ perspectiveStats: ReviewPerspectiveStatsApi
+ payload?: any
+ }
+ loadPerspectives: () => any
+ loadPerspectivesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPerspectivesSuccess: (
+ perspectives: ReviewPerspectiveConfigApi[],
+ payload?: any
+ ) => {
+ perspectives: ReviewPerspectiveConfigApi[]
+ payload?: any
+ }
+ loadRecentReviews: (_?: any) => any
+ loadRecentReviewsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRecentReviewsSuccess: (
+ recentReviewsPage: ReviewRecentReviewsPageApi,
+ payload?: any
+ ) => {
+ recentReviewsPage: ReviewRecentReviewsPageApi
+ payload?: any
+ }
+ loadReviewDetail: (reviewId: string) => string
+ loadReviewDetailFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadReviewDetailSuccess: (
+ reviewDetail: ReviewDetailApi,
+ payload?: string
+ ) => {
+ reviewDetail: ReviewDetailApi
+ payload?: string
+ }
+ loadSettings: () => any
+ loadSettingsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSettingsSuccess: (
+ settings: ReviewUserSettingsApi,
+ payload?: any
+ ) => {
+ settings: ReviewUserSettingsApi
+ payload?: any
+ }
+ loadValidators: () => any
+ loadValidatorsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadValidatorsSuccess: (
+ validators: ReviewValidatorConfigApi[],
+ payload?: any
+ ) => {
+ validators: ReviewValidatorConfigApi[]
+ payload?: any
+ }
+ openReviewDetail: (review: ReviewRecentReviewApi) => {
+ review: ReviewRecentReviewApi
+ }
+ patchPerspectiveLocally: (
+ skillName: string,
+ enabled: boolean
+ ) => {
+ enabled: boolean
+ skillName: string
+ }
+ selectBlindSpots: (skillName: string) => {
+ skillName: string
+ }
+ selectValidator: (skillName: string) => {
+ skillName: string
+ }
+ setReviewDrawerTab: (tab: ReviewDrawerTab) => {
+ tab: ReviewDrawerTab
+ }
+ setReviewsScope: (scope: ReviewHogReviewsListScope) => {
+ scope: ReviewHogReviewsListScope
+ }
+ setSkillSaving: (
+ skillName: string,
+ saving: boolean
+ ) => {
+ saving: boolean
+ skillName: string
+ }
+ showFewerReviews: () => {
+ value: true
+ }
+ showMoreReviews: () => {
+ value: true
+ }
+ startSkillAuthorTask: (kind: ReviewSkillKind) => {
+ kind: ReviewSkillKind
+ }
+ startSkillAuthorTaskFinished: () => {
+ value: true
+ }
+ togglePerspective: (
+ skillName: string,
+ enabled: boolean
+ ) => {
+ enabled: boolean
+ skillName: string
+ }
+ toggleReviewRowExpanded: (reviewId: string) => {
+ reviewId: string
+ }
+ updateSettings: (patch: PatchedReviewUserSettingsApi) => PatchedReviewUserSettingsApi
+ updateSettingsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateSettingsSuccess: (
+ settings: ReviewUserSettingsApi,
+ payload?: PatchedReviewUserSettingsApi
+ ) => {
+ settings: ReviewUserSettingsApi
+ payload?: PatchedReviewUserSettingsApi
+ }
+ viewSkill: (skill: ViewedSkill) => {
+ skill: ViewedSkill
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface reviewHogSettingsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ recentReviews: (recentReviewsPage: ReviewRecentReviewsPageApi | null) => ReviewRecentReviewApi[] | null
+ moreReviewsAvailable: (recentReviewsPage: ReviewRecentReviewsPageApi | null, reviewsLimit: number) => boolean
+ reviewFindingsSplit: (
+ reviewDetail: ReviewDetailApi | null,
+ settings: ReviewUserSettingsApi | null
+ ) => ReviewFindingsSplit | null
+ perspectiveScoreboard: (reviewDetail: ReviewDetailApi | null) => PerspectiveScore[] | null
+ }
+}
+
+export type reviewHogSettingsLogicType = MakeLogicType<
+ reviewHogSettingsLogicValues,
+ reviewHogSettingsLogicActions,
+ Record<string, any>,
+ reviewHogSettingsLogicMeta
+>
+
/**
* State for the "Code review" scene: the user's ReviewHog settings (triggers + urgency
* threshold) and the three skill lists (perspectives / blind-spot check / validation criteria)
@@ -368,11 +614,12 @@ export const reviewHogSettingsLogic = kea<reviewHogSettingsLogicType>([
selectors({
recentReviews: [
(s) => [s.recentReviewsPage],
- (recentReviewsPage): ReviewRecentReviewApi[] | null => recentReviewsPage?.results ?? null,
+ (recentReviewsPage: ReviewRecentReviewsPageApi | null): ReviewRecentReviewApi[] | null =>
+ recentReviewsPage?.results ?? null,
],
moreReviewsAvailable: [
(s) => [s.recentReviewsPage, s.reviewsLimit],
- (recentReviewsPage, reviewsLimit): boolean =>
+ (recentReviewsPage: ReviewRecentReviewsPageApi | null, reviewsLimit: number): boolean =>
// At the API's ceiling the button must go away even though more rows exist —
// offering it would send a limit the server rejects.
(recentReviewsPage?.has_more ?? false) && reviewsLimit < MAX_REVIEWS_LIMIT,
@@ -381,7 +628,10 @@ export const reviewHogSettingsLogic = kea<reviewHogSettingsLogicType>([
// what the run published (the run's own threshold snapshot isn't stored).
reviewFindingsSplit: [
(s) => [s.reviewDetail, s.settings],
- (reviewDetail, settings): ReviewFindingsSplit | null => {
+ (
+ reviewDetail: ReviewDetailApi | null,
+ settings: ReviewUserSettingsApi | null
+ ): ReviewFindingsSplit | null => {
if (!reviewDetail) {
return null
}
@@ -398,7 +648,7 @@ export const reviewHogSettingsLogic = kea<reviewHogSettingsLogicType>([
],
perspectiveScoreboard: [
(s) => [s.reviewDetail],
- (reviewDetail): PerspectiveScore[] | null => {
+ (reviewDetail: ReviewDetailApi | null): PerspectiveScore[] | null => {
if (!reviewDetail?.findings.length) {
return null
}