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 8 (#71462)

Marius Andra27f4f5514a0f
diff --git a/.kearc b/.kearc
index 412ceb6fcdb6..206d08973eab 100644
--- a/.kearc
+++ b/.kearc
@@ -99,19 +99,19 @@
"./products/tasks",
"./.kea-inline-separator-07",
"./.kea-inline-separator-07-b",
- "./.kea-inline-batch-08-slot-01",
- "./.kea-inline-batch-08-slot-02",
- "./.kea-inline-batch-08-slot-03",
- "./.kea-inline-batch-08-slot-04",
- "./.kea-inline-batch-08-slot-05",
- "./.kea-inline-batch-08-slot-06",
- "./.kea-inline-batch-08-slot-07",
- "./.kea-inline-batch-08-slot-08",
- "./.kea-inline-batch-08-slot-09",
- "./.kea-inline-batch-08-slot-10",
- "./.kea-inline-batch-08-slot-11",
- "./.kea-inline-batch-08-slot-12",
- "./.kea-inline-batch-08-slot-13",
+ "./frontend/src/layout",
+ "./frontend/src/scenes/activity",
+ "./frontend/src/scenes/agentic",
+ "./frontend/src/scenes/experiments",
+ "./frontend/src/scenes/hog-functions",
+ "./frontend/src/scenes/models",
+ "./frontend/src/scenes/oauth",
+ "./frontend/src/scenes/retention",
+ "./frontend/src/scenes/startups",
+ "./products/dashboards",
+ "./products/managed_migrations",
+ "./products/mcp_analytics",
+ "./products/user_interviews",
"./.kea-inline-separator-08",
"./.kea-inline-separator-08-b",
"./frontend/src/scenes/Unsubscribe",
diff --git a/frontend/src/layout/FeaturePreviews/featurePreviewsLogic.tsx b/frontend/src/layout/FeaturePreviews/featurePreviewsLogic.tsx
index 067d8a6b3b35..d953bd941ee1 100644
--- a/frontend/src/layout/FeaturePreviews/featurePreviewsLogic.tsx
+++ b/frontend/src/layout/FeaturePreviews/featurePreviewsLogic.tsx
@@ -1,4 +1,4 @@
-import { actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { EarlyAccessFeature, posthog } from 'posthog-js'
@@ -14,7 +14,10 @@ import { userLogic } from 'scenes/userLogic'
import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
-import type { featurePreviewsLogicType } from './featurePreviewsLogicType'
+import type { SupportFormFields } from '../../lib/components/Support/supportLogic'
+import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
+import type { ProductCrossSellProperties } from '../../lib/utils/product-intents'
+import type { UserType } from '../../types'
export interface EnrichedEarlyAccessFeature extends Omit<EarlyAccessFeature, 'flagKey'> {
flagKey: string
@@ -24,6 +27,105 @@ export interface EnrichedEarlyAccessFeature extends Omit<EarlyAccessFeature, 'fl
const search = createFeaturePreviewSearch<EnrichedEarlyAccessFeature>()
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featurePreviewsLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ user: UserType | null // userLogic
+ activeFeedbackFlagKey: string | null
+ activeFeedbackFlagKeyLoading: boolean
+ conceptEnrollments: Record<string, boolean>
+ earlyAccessFeatures: EnrichedEarlyAccessFeature[]
+ filteredEarlyAccessFeatures: EnrichedEarlyAccessFeature[]
+ rawEarlyAccessFeatures: EarlyAccessFeature[]
+ rawEarlyAccessFeaturesLoading: boolean
+ searchTerm: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featurePreviewsLogicActions {
+ submitSupportTicket: (form: SupportFormFields) => SupportFormFields // supportLogic
+ addProductIntentForCrossSell: (properties: ProductCrossSellProperties) => ProductCrossSellProperties // teamLogic
+ beginEarlyAccessFeatureFeedback: (flagKey: string) => {
+ flagKey: string
+ }
+ cancelEarlyAccessFeatureFeedback: () => {
+ value: true
+ }
+ copyExternalFeaturePreviewLink: (flagKey: string) => {
+ flagKey: string
+ }
+ loadEarlyAccessFeatures: () => any
+ loadEarlyAccessFeaturesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadEarlyAccessFeaturesSuccess: (
+ rawEarlyAccessFeatures: EarlyAccessFeature[],
+ payload?: any
+ ) => {
+ rawEarlyAccessFeatures: EarlyAccessFeature[]
+ payload?: any
+ }
+ setSearchTerm: (searchTerm: string) => {
+ searchTerm: string
+ }
+ submitEarlyAccessFeatureFeedback: (message: string) => {
+ message: string
+ }
+ submitEarlyAccessFeatureFeedbackFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ submitEarlyAccessFeatureFeedbackSuccess: (
+ activeFeedbackFlagKey: string | null,
+ payload?: {
+ message: string
+ }
+ ) => {
+ activeFeedbackFlagKey: string | null
+ payload?: {
+ message: string
+ }
+ }
+ updateEarlyAccessFeatureEnrollment: (
+ flagKey: string,
+ enabled: boolean,
+ stage?: string
+ ) => {
+ enabled: boolean
+ flagKey: string
+ stage: string | undefined
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface featurePreviewsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ earlyAccessFeatures: (
+ rawEarlyAccessFeatures: EarlyAccessFeature[],
+ featureFlags: FeatureFlagsSet,
+ conceptEnrollments: Record<string, boolean>
+ ) => EnrichedEarlyAccessFeature[]
+ filteredEarlyAccessFeatures: (
+ earlyAccessFeatures: EnrichedEarlyAccessFeature[],
+ searchTerm: string
+ ) => EnrichedEarlyAccessFeature[]
+ }
+}
+
+export type featurePreviewsLogicType = MakeLogicType<
+ featurePreviewsLogicValues,
+ featurePreviewsLogicActions,
+ Record<string, any>,
+ featurePreviewsLogicMeta
+>
+
export const featurePreviewsLogic = kea<featurePreviewsLogicType>([
path(['layout', 'FeaturePreviews', 'featurePreviewsLogic']),
connect(() => ({
@@ -154,7 +256,11 @@ export const featurePreviewsLogic = kea<featurePreviewsLogicType>([
selectors({
earlyAccessFeatures: [
(s) => [s.rawEarlyAccessFeatures, s.featureFlags, s.conceptEnrollments],
- (rawEarlyAccessFeatures, featureFlags, conceptEnrollments): EnrichedEarlyAccessFeature[] => {
+ (
+ rawEarlyAccessFeatures: EarlyAccessFeature[],
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet,
+ conceptEnrollments: Record<string, boolean>
+ ): EnrichedEarlyAccessFeature[] => {
// posthog-js persists enrollment as person properties in localStorage,
// which survives page reloads even though concept-stage flags evaluate
// to false on the server.
diff --git a/frontend/src/layout/globalModalsLogic.ts b/frontend/src/layout/globalModalsLogic.ts
index 3f026a48b0d2..d6443d1e4f30 100644
--- a/frontend/src/layout/globalModalsLogic.ts
+++ b/frontend/src/layout/globalModalsLogic.ts
@@ -1,8 +1,30 @@
-import { actions, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
import { bindModalToUrl } from 'lib/logic/bindModalToUrl'
-import type { globalModalsLogicType } from './globalModalsLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface globalModalsLogicValues {
+ isCreateOrganizationModalShown: boolean
+ isCreateProjectModalShown: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface globalModalsLogicActions {
+ hideCreateOrganizationModal: () => {
+ value: true
+ }
+ hideCreateProjectModal: () => {
+ value: true
+ }
+ showCreateOrganizationModal: () => {
+ value: true
+ }
+ showCreateProjectModal: () => {
+ value: true
+ }
+}
+
+export type globalModalsLogicType = MakeLogicType<globalModalsLogicValues, globalModalsLogicActions>
export const globalModalsLogic = kea<globalModalsLogicType>([
path(['layout', 'navigation', 'globalModalsLogic']),
diff --git a/frontend/src/layout/navigation-3000/navigationLogic.tsx b/frontend/src/layout/navigation-3000/navigationLogic.tsx
index 6279ec57b750..da23f1ce524d 100644
--- a/frontend/src/layout/navigation-3000/navigationLogic.tsx
+++ b/frontend/src/layout/navigation-3000/navigationLogic.tsx
@@ -1,4 +1,4 @@
-import { actions, connect, events, kea, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, events, kea, listeners, path, props, reducers, selectors } from 'kea'
import { combineUrl, router } from 'kea-router'
import { subscriptions } from 'kea-subscriptions'
import posthog from 'posthog-js'
@@ -48,8 +48,10 @@ import { dashboardsModel } from '~/models/dashboardsModel'
import { groupsModel } from '~/models/groupsModel'
import { AccessControlLevel, AccessControlResourceType, ReplayTabs } from '~/types'
+import type { GroupsAccessStatus } from '../../lib/introductions/groupsAccessLogic'
+import type { SceneConfig, SceneExport, SceneParams, SceneProps } from '../../scenes/sceneTypes'
+import type { GroupType, GroupTypeIndex, SavedSessionRecordingPlaylistsResult } from '../../types'
import { navigationLogic } from '../navigation/navigationLogic'
-import type { navigation3000LogicType } from './navigationLogicType'
import { BasicListItem, ExtendedListItem, NavbarItem, SidebarNavbarItem } from './types'
/** Multi-segment item keys are joined using this separator for easy comparisons. */
@@ -64,6 +66,217 @@ const DEFAULT_SIDEBAR_WIDTH_PX: number = 288
const MAXIMUM_SIDEBAR_WIDTH_PX: number = 1024
const MAXIMUM_SIDEBAR_WIDTH_PERCENTAGE: number = 50
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface navigation3000LogicValues {
+ groupTypes: Map<GroupTypeIndex, GroupType> // groupsModel
+ groupsAccessStatus: GroupsAccessStatus // groupsModel
+ mobileLayout: boolean // navigationLogic
+ isCurrentOrganizationUnavailable: boolean // organizationLogic
+ activeSceneId: string | null // sceneLogic
+ sceneConfig: SceneConfig | null // sceneLogic
+ savedFilters: SavedSessionRecordingPlaylistsResult // sessionRecordingSavedFiltersLogic
+ savedFiltersLoading: boolean // sessionRecordingSavedFiltersLogic
+ accordionCollapseMapping: Record<string, boolean>
+ activeNavbarItem: SidebarNavbarItem | null
+ activeNavbarItemId: string | null
+ activeNavbarItemIdRaw: string
+ internalSearchTerm: string
+ isListItemVisible: (key: string) => boolean
+ isNavCollapsed: boolean
+ isNavCollapsedDesktop: boolean
+ isNavShown: boolean
+ isNavShownMobile: boolean
+ isResizeInProgress: boolean
+ isSearchShown: boolean
+ isSidebarKeyboardShortcutAcknowledged: boolean
+ isSidebarShown: boolean
+ lastFocusedItemIndex: number
+ listItemAccordionCollapseMapping: Record<string, boolean>
+ mode: Navigation3000Mode
+ navbarItemIdMapping: Record<string, NavbarItem>
+ navbarItems: NavbarItem[][]
+ newItemCategory: string | null
+ newItemInlineCategory: string | null
+ normalizedActiveListItemKey: number | string | string[] | null
+ savingNewItem: boolean
+ searchTerm: string
+ sidebarContentsFlattened: BasicListItem[] | ExtendedListItem[]
+ sidebarOverslide: number
+ sidebarOverslideDirection: 'max' | 'min' | null
+ sidebarWidth: number
+ zenMode: boolean
+ zenModeFromUrl: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface navigation3000LogicActions {
+ setScene: (
+ sceneId: string,
+ sceneKey: string | undefined,
+ params: SceneParams,
+ scrollToTop?: boolean,
+ exportedScene?: SceneExport
+ ) => {
+ exportedScene: SceneExport<SceneProps> | undefined
+ params: SceneParams
+ sceneId: string
+ sceneKey: string | undefined
+ scrollToTop: boolean
+ } // sceneLogic
+ acknowledgeSidebarKeyboardShortcut: () => {
+ value: true
+ }
+ beginResize: () => {
+ value: true
+ }
+ cancelNewItem: () => {
+ value: true
+ }
+ endResize: () => {
+ value: true
+ }
+ focusNextItem: () => {
+ value: true
+ }
+ focusPreviousItem: () => {
+ value: true
+ }
+ hideNavOnMobile: () => {
+ value: true
+ }
+ hideSidebar: () => {
+ value: true
+ }
+ initiateNewItemInCategory: (category: string) => {
+ category: string
+ }
+ initiateNewItemInlineInCategory: (category: string) => {
+ category: string
+ }
+ saveNewItem: (itemName: string) => {
+ itemName: string
+ }
+ saveNewItemComplete: () => {
+ value: true
+ }
+ setIsSearchShown: (isSearchShown: boolean) => {
+ isSearchShown: boolean
+ }
+ setLastFocusedItemByKey: (key: number | string) => {
+ key: number | string
+ }
+ setLastFocusedItemIndex: (index: number) => {
+ index: number
+ }
+ setSearchTerm: (searchTerm: string) => {
+ searchTerm: string
+ }
+ setSidebarOverslide: (overslide: number) => {
+ overslide: number
+ }
+ setSidebarWidth: (width: number) => {
+ width: number
+ }
+ setZenMode: (
+ zenMode: boolean,
+ trigger: ZenModeTrigger
+ ) => {
+ trigger: ZenModeTrigger
+ zenMode: boolean
+ }
+ showNavOnMobile: () => {
+ value: true
+ }
+ showSidebar: (newNavbarItemId?: string) => {
+ newNavbarItemId: string | undefined
+ }
+ syncSidebarWidthWithMouseMove: (delta: number) => {
+ delta: number
+ }
+ syncSidebarWidthWithViewport: () => {
+ value: true
+ }
+ toggleAccordion: (key: string) => {
+ key: string
+ }
+ toggleListItemAccordion: (key: string) => {
+ key: string
+ }
+ toggleNavCollapsed: (override?: boolean) => {
+ override: boolean | undefined
+ }
+ toggleSidebar: () => {
+ value: true
+ }
+ toggleZenMode: (trigger: ZenModeTrigger) => {
+ trigger: ZenModeTrigger
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface navigation3000LogicProps {
+ inputElement?: HTMLInputElement | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface navigation3000LogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ zenModeFromUrl: (searchParams: Record<string, any>) => boolean
+ mode: (
+ sceneConfig: SceneConfig | null,
+ isCurrentOrganizationUnavailable: boolean,
+ zenMode: boolean,
+ activeSceneId: string | null,
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet
+ ) => Navigation3000Mode
+ isNavShown: (isNavShownMobile: boolean, mobileLayout: boolean) => boolean
+ isNavCollapsed: (isNavCollapsedDesktop: boolean, mobileLayout: boolean) => boolean
+ navbarItems: (
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet,
+ dashboardsLoading: boolean,
+ pinnedDashboards: (
+ | import('~/types').DashboardBasicType
+ | import('~/types').DashboardType<
+ import('~/types').QueryBasedInsightModel<import('../../queries/schema').Node<Record<string, any>>>
+ >
+ )[],
+ savedFilters: SavedSessionRecordingPlaylistsResult,
+ savedFiltersLoading: boolean
+ ) => NavbarItem[][]
+ navbarItemIdMapping: (navbarItems: NavbarItem[][]) => Record<string, NavbarItem>
+ sidebarOverslideDirection: (sidebarOverslide: number) => 'max' | 'min' | null
+ activeNavbarItem: (
+ activeNavbarItemId: string | null,
+ navbarItemIdMapping: Record<string, NavbarItem>
+ ) => SidebarNavbarItem | null
+ searchTerm: (internalSearchTerm: string, isSearchShown: boolean) => string
+ sidebarContentsFlattened: (
+ arg: import('./types').SidebarCategory[] | null
+ ) => BasicListItem[] | ExtendedListItem[]
+ normalizedActiveListItemKey: (
+ arg: number | string | [string, number | string] | null
+ ) => number | string | string[] | null
+ isListItemVisible: (listItemAccordionCollapseMapping: Record<string, boolean>) => (key: string) => boolean
+ activeNavbarItemId: (activeNavbarItemIdRaw: string) => string | null
+ newItemCategory: (
+ arg: import('./types').SidebarCategory[] | null,
+ newItemInlineCategory: string | null,
+ location: {
+ hash: string
+ pathname: string
+ search: string
+ }
+ ) => string | null
+ }
+}
+
+export type navigation3000LogicType = MakeLogicType<
+ navigation3000LogicValues,
+ navigation3000LogicActions,
+ navigation3000LogicProps,
+ navigation3000LogicMeta
+>
+
export const navigation3000Logic = kea<navigation3000LogicType>([
path(['layout', 'navigation-3000', 'navigationLogic']),
props({} as { inputElement?: HTMLInputElement | null }),
@@ -356,7 +569,7 @@ export const navigation3000Logic = kea<navigation3000LogicType>([
selectors({
zenModeFromUrl: [
() => [router.selectors.searchParams],
- (searchParams): boolean => {
+ (searchParams: Record<string, any>): boolean => {
// Enable zen mode via ?zen or ?zen=true or ?zen=1
const zenParam = searchParams?.zen
return zenParam !== undefined && zenParam !== 'false' && zenParam !== '0'
@@ -371,11 +584,11 @@ export const navigation3000Logic = kea<navigation3000LogicType>([
featureFlagLogic.selectors.featureFlags,
],
(
- sceneConfig,
- isCurrentOrganizationUnavailable,
- zenMode,
- activeSceneId,
- featureFlags
+ sceneConfig: null | import('scenes/sceneTypes').SceneConfig,
+ isCurrentOrganizationUnavailable: boolean,
+ zenMode: boolean,
+ activeSceneId: string | null,
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet
): Navigation3000Mode => {
if (zenMode) {
return 'zen'
@@ -400,11 +613,11 @@ export const navigation3000Logic = kea<navigation3000LogicType>([
],
isNavShown: [
(s) => [s.isNavShownMobile, s.mobileLayout],
- (isNavShownMobile, mobileLayout): boolean => !mobileLayout || isNavShownMobile,
+ (isNavShownMobile: boolean, mobileLayout: boolean): boolean => !mobileLayout || isNavShownMobile,
],
isNavCollapsed: [
(s) => [s.isNavCollapsedDesktop, s.mobileLayout],
- (isNavCollapsedDesktop, mobileLayout): boolean => !mobileLayout && isNavCollapsedDesktop,
+ (isNavCollapsedDesktop: boolean, mobileLayout: boolean): boolean => !mobileLayout && isNavCollapsedDesktop,
],
navbarItems: [
(s) => [
@@ -414,7 +627,20 @@ export const navigation3000Logic = kea<navigation3000LogicType>([
s.savedFilters,
s.savedFiltersLoading,
],
- (featureFlags, dashboardsLoading, pinnedDashboards, savedFilters, savedFiltersLoading): NavbarItem[][] => {
+ (
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet,
+ dashboardsLoading: boolean,
+ pinnedDashboards: (
+ | import('~/types').DashboardBasicType
+ | import('~/types').DashboardType<
+ import('~/types').QueryBasedInsightModel<
+ import('../../queries/schema').Node<Record<string, any>>
+ >
+ >
+ )[],
+ savedFilters: import('~/types').SavedSessionRecordingPlaylistsResult,
+ savedFiltersLoading: boolean
+ ): NavbarItem[][] => {
return [
[
{
@@ -692,13 +918,13 @@ export const navigation3000Logic = kea<navigation3000LogicType>([
],
navbarItemIdMapping: [
(s) => [s.navbarItems],
- (navbarItems): Record<string, NavbarItem> => {
+ (navbarItems: NavbarItem[][]): Record<string, NavbarItem> => {
return Object.fromEntries(navbarItems.flat().map((item) => [item.identifier, item]))
},
],
sidebarOverslideDirection: [
(s) => [s.sidebarOverslide],
- (sidebarOverslide): 'min' | 'max' | null => {
+ (sidebarOverslide: number): 'min' | 'max' | null => {
if (sidebarOverslide < 0) {
return 'min'
} else if (sidebarOverslide > 0) {
@@ -709,20 +935,23 @@ export const navigation3000Logic = kea<navigation3000LogicType>([
],
activeNavbarItem: [
(s) => [s.activeNavbarItemId, s.navbarItemIdMapping],
- (activeNavbarItemId, navbarItemIdMapping): SidebarNavbarItem | null => {
+ (
+ activeNavbarItemId: string | null,
+ navbarItemIdMapping: Record<string, NavbarItem>
+ ): SidebarNavbarItem | null => {
const item = activeNavbarItemId ? navbarItemIdMapping[activeNavbarItemId] : null
return item && 'logic' in item ? (item as SidebarNavbarItem) : null
},
],
searchTerm: [
(s) => [s.internalSearchTerm, s.isSearchShown],
- (internalSearchTerm, isSearchShown): string => {
+ (internalSearchTerm: string, isSearchShown: boolean): string => {
return isSearchShown ? internalSearchTerm : ''
},
],
sidebarContentsFlattened: [
(s) => [(state) => s.activeNavbarItem(state)?.logic?.findMounted()?.selectors.contents(state) || null],
- (sidebarContents): BasicListItem[] | ExtendedListItem[] => {
+ (sidebarContents: import('./types').SidebarCategory[] | null): BasicListItem[] | ExtendedListItem[] => {
const flattenItems = (items: any[]): (BasicListItem | ExtendedListItem)[] => {
return items.flatMap((item) => {
if ('items' in item) {
@@ -739,7 +968,9 @@ export const navigation3000Logic = kea<navigation3000LogicType>([
(state) =>
s.activeNavbarItem(state)?.logic?.findMounted()?.selectors.activeListItemKey?.(state) || null,
],
- (activeListItemKey): string | number | string[] | null =>
+ (
+ activeListItemKey: number | string | [string, number | string] | null
+ ): string | number | string[] | null =>
activeListItemKey
? Array.isArray(activeListItemKey)
? activeListItemKey.join(ITEM_KEY_PART_SEPARATOR)
@@ -748,7 +979,7 @@ export const navigation3000Logic = kea<navigation3000LogicType>([
],
isListItemVisible: [
(s) => [s.listItemAccordionCollapseMapping],
- (listItemAccordionCollapseMapping) => {
+ (listItemAccordionCollapseMapping: Record<string, boolean>) => {
return (key: string): boolean => {
// Split the key into parts to check each parent's visibility
const parts = key.split(ITEM_KEY_PART_SEPARATOR)
@@ -765,7 +996,7 @@ export const navigation3000Logic = kea<navigation3000LogicType>([
],
activeNavbarItemId: [
(s) => [s.activeNavbarItemIdRaw],
- (activeNavbarItemIdRaw): string | null => {
+ (activeNavbarItemIdRaw: string): string | null => {
if (activeNavbarItemIdRaw === Scene.SQLEditor) {
return Scene.SQLEditor
}
@@ -778,7 +1009,15 @@ export const navigation3000Logic = kea<navigation3000LogicType>([
s.newItemInlineCategory,
router.selectors.location,
],
- (sidebarContents, newItemInlineCategory, location): string | null => {
+ (
+ sidebarContents: import('./types').SidebarCategory[] | null,
+ newItemInlineCategory: string | null,
+ location: {
+ hash: string
+ pathname: string
+ search: string
+ }
+ ): string | null => {
if (!sidebarContents) {
return null
}
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/accessControlsLogic.ts b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/accessControlsLogic.ts
index 85fbef163684..5493674073e3 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/accessControlsLogic.ts
+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/accessControlsLogic.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 { urlToAction } from 'kea-router'
@@ -20,10 +20,12 @@ import {
OrganizationMemberType,
} from '~/types'
+import type { FeatureFlagsSet } from '../../../../../../lib/logic/featureFlagLogic'
+import type { AccessControlUIVersion } from '../../../../../../lib/utils/accessControlUtils'
+import type { AccessControlResponseType, AccessControlUpdateType, RoleType } from '../../../../../../types'
import { accessControlLogic } from '../accessControlLogic'
import { isResourceRolledOut, resourcesAccessControlLogic } from '../resourcesAccessControlLogic'
import { roleAccessControlLogic } from '../roleAccessControlLogic'
-import type { accessControlsLogicType } from './accessControlsLogicType'
import {
AccessControlFilters,
AccessControlMemberEntry,
@@ -84,6 +86,725 @@ function matchesFilters(
return true
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accessControlsLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ sortedMembers: OrganizationMemberType[] | null // membersLogic
+ resources: APIScopeObject[] // resourcesAccessControlLogic
+ roles: RoleType[] // roleAccessControlLogic
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean // userLogic
+ activeTab: AccessControlsTab
+ allMembers: OrganizationMemberType[]
+ availableProjectLevels: AccessControlLevel[]
+ availableResourceLevels: AccessControlLevel[]
+ canEdit: boolean
+ canUseRoles: boolean
+ defaults: AccessControlDefaultsResponse | null
+ defaultsLoading: boolean
+ filteredMembers: AccessControlMemberEntry[]
+ filteredRoles: AccessControlRoleEntry[]
+ filters: AccessControlFilters
+ loading: boolean
+ membersData: AccessControlMembersResponse | null
+ membersDataLoading: boolean
+ resourceKeys: {
+ key: APIScopeObject
+ label: string
+ }[]
+ resourcesWithProject: {
+ key: APIScopeObject
+ label: string
+ }[]
+ rolesData: AccessControlRolesResponse | null
+ rolesDataLoading: boolean
+ ruleModalState: GroupedAccessControlRuleModalLogicProps | null
+ ruleOptions: {
+ key: AccessControlLevel
+ label: string
+ }[]
+ searchText: string
+ visibleResourceKeySet: Set<APIScopeObject>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accessControlsLogicActions {
+ updateAccessControlDefault: (
+ level: AccessControlLevel,
+ source?: AccessControlUIVersion | undefined
+ ) => {
+ level: AccessControlLevel
+ source: AccessControlUIVersion
+ } // accessControlLogic
+ updateAccessControlDefaultSuccess: (
+ accessControls: AccessControlResponseType | null,
+ payload?:
+ | {
+ level: AccessControlLevel
+ source: AccessControlUIVersion
+ }
+ | undefined
+ ) => {
+ accessControls: AccessControlResponseType | null
+ payload?: {
+ level: AccessControlLevel
+ source: AccessControlUIVersion
+ }
+ } // accessControlLogic
+ updateAccessControlMembers: (
+ accessControls: {
+ level: AccessControlLevel | null
+ member: OrganizationMemberType['id']
+ }[],
+ source?: AccessControlUIVersion | undefined
+ ) => {
+ accessControls: {
+ level: AccessControlLevel | null
+ member: string
+ }[]
+ source: AccessControlUIVersion
+ } // accessControlLogic
+ updateAccessControlMembersSuccess: (
+ accessControls: AccessControlResponseType | null,
+ payload?:
+ | {
+ accessControls: {
+ level: AccessControlLevel | null
+ member: string
+ }[]
+ source: AccessControlUIVersion
+ }
+ | undefined
+ ) => {
+ accessControls: AccessControlResponseType | null
+ payload?: {
+ accessControls: {
+ level: AccessControlLevel | null
+ member: string
+ }[]
+ source: AccessControlUIVersion
+ }
+ } // accessControlLogic
+ updateAccessControlRoles: (
+ accessControls: {
+ level: AccessControlLevel | null
+ role: RoleType['id']
+ }[],
+ source?: AccessControlUIVersion | undefined
+ ) => {
+ accessControls: {
+ level: AccessControlLevel | null
+ role: string
+ }[]
+ source: AccessControlUIVersion
+ } // accessControlLogic
+ updateAccessControlRolesSuccess: (
+ accessControls: AccessControlResponseType | null,
+ payload?:
+ | {
+ accessControls: {
+ level: AccessControlLevel | null
+ role: string
+ }[]
+ source: AccessControlUIVersion
+ }
+ | undefined
+ ) => {
+ accessControls: AccessControlResponseType | null
+ payload?: {
+ accessControls: {
+ level: AccessControlLevel | null
+ role: string
+ }[]
+ source: AccessControlUIVersion
+ }
+ } // accessControlLogic
+ updateResourceAccessControls: (
+ accessControls: Pick<AccessControlUpdateType, 'access_level' | 'organization_member' | 'resource' | 'role'>[],
+ saveType: 'default' | 'member' | 'role'
+ ) => {
+ accessControls: Pick<AccessControlUpdateType, 'access_level' | 'organization_member' | 'resource' | 'role'>[]
+ saveType: 'default' | 'member' | 'role'
+ } // resourcesAccessControlLogic
+ updateResourceAccessControlsSuccess: (
+ resourceAccessControls: AccessControlResponseType | null,
+ payload?:
+ | {
+ accessControls: Pick<
+ AccessControlUpdateType,
+ 'access_level' | 'organization_member' | 'resource' | 'role'
+ >[]
+ saveType: 'default' | 'member' | 'role'
+ }
+ | undefined
+ ) => {
+ payload?: {
+ accessControls: Pick<
+ AccessControlUpdateType,
+ 'access_level' | 'organization_member' | 'resource' | 'role'
+ >[]
+ saveType: 'default' | 'member' | 'role'
+ }
+ resourceAccessControls: AccessControlResponseType | null
+ } // resourcesAccessControlLogic
+ closeRuleModal: () => {
+ value: true
+ }
+ loadDefaults: () => any
+ loadDefaultsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadDefaultsSuccess: (
+ defaults: AccessControlDefaultsResponse,
+ payload?: any
+ ) => {
+ defaults: AccessControlDefaultsResponse
+ payload?: any
+ }
+ loadMembers: () => any
+ loadMembersFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadMembersSuccess: (
+ membersData: AccessControlMembersResponse,
+ payload?: any
+ ) => {
+ membersData: AccessControlMembersResponse
+ payload?: any
+ }
+ loadRoles: () => any
+ loadRolesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRolesSuccess: (
+ rolesData: AccessControlRolesResponse,
+ payload?: any
+ ) => {
+ rolesData: AccessControlRolesResponse
+ payload?: any
+ }
+ openRuleModal: (state: GroupedAccessControlRuleModalLogicProps) => {
+ state: GroupedAccessControlRuleModalLogicProps
+ }
+ saveGroupedRules: (params: {
+ projectLevel: AccessControlLevel | null
+ resourceLevels: Record<APIScopeObject, AccessControlLevel | null>
+ scopeId: string
+ scopeType: ScopeType
+ }) => {
+ projectLevel: AccessControlLevel | null
+ resourceLevels: Record<
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session',
+ AccessControlLevel | null
+ >
+ scopeId: string
+ scopeType: ScopeType
+ }
+ setActiveTab: (activeTab: AccessControlsTab) => {
+ activeTab: AccessControlsTab
+ }
+ setFilters: (filters: Partial<AccessControlFilters>) => {
+ filters: Partial<AccessControlFilters>
+ }
+ setSearchText: (searchText: string) => {
+ searchText: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accessControlsLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ allMembers: (sortedMembers: OrganizationMemberType[] | null) => OrganizationMemberType[]
+ canUseRoles: (
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean
+ ) => boolean
+ canEdit: (defaults: AccessControlDefaultsResponse | null) => boolean
+ availableProjectLevels: (defaults: AccessControlDefaultsResponse | null) => AccessControlLevel[]
+ availableResourceLevels: (defaults: AccessControlDefaultsResponse | null) => AccessControlLevel[]
+ resourceKeys: (
+ defaults: AccessControlDefaultsResponse | null,
+ resources: (
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session'
+ )[],
+ featureFlags: FeatureFlagsSet
+ ) => {
+ key: APIScopeObject
+ label: string
+ }[]
+ resourcesWithProject: (
+ resourceKeys: {
+ key: APIScopeObject
+ label: string
+ }[]
+ ) => {
+ key: APIScopeObject
+ label: string
+ }[]
+ visibleResourceKeySet: (
+ resourceKeys: {
+ key: APIScopeObject
+ label: string
+ }[]
+ ) => Set<APIScopeObject>
+ ruleOptions: (
+ availableProjectLevels: AccessControlLevel[],
+ availableResourceLevels: AccessControlLevel[]
+ ) => {
+ key: AccessControlLevel
+ label: string
+ }[]
+ filteredRoles: (
+ rolesData: AccessControlRolesResponse | null,
+ searchText: string,
+ filters: AccessControlFilters,
+ canUseRoles: boolean,
+ visibleResourceKeySet: Set<
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session'
+ >
+ ) => AccessControlRoleEntry[]
+ filteredMembers: (
+ membersData: AccessControlMembersResponse | null,
+ searchText: string,
+ filters: AccessControlFilters,
+ visibleResourceKeySet: Set<
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session'
+ >
+ ) => AccessControlMemberEntry[]
+ loading: (defaultsLoading: boolean, rolesDataLoading: boolean, membersDataLoading: boolean) => boolean
+ }
+}
+
+export type accessControlsLogicType = MakeLogicType<
+ accessControlsLogicValues,
+ accessControlsLogicActions,
+ AccessControlsLogicProps,
+ accessControlsLogicMeta
+>
+
export const accessControlsLogic = kea<accessControlsLogicType>([
path([
'layout',
@@ -199,28 +920,41 @@ export const accessControlsLogic = kea<accessControlsLogicType>([
}),
selectors({
- allMembers: [(s) => [s.sortedMembers], (sortedMembers): OrganizationMemberType[] => sortedMembers ?? []],
+ allMembers: [
+ (s) => [s.sortedMembers],
+ (sortedMembers: OrganizationMemberType[] | null): OrganizationMemberType[] => sortedMembers ?? [],
+ ],
canUseRoles: [
(s) => [s.hasAvailableFeature],
- (hasAvailableFeature): boolean => hasAvailableFeature(AvailableFeature.ROLE_BASED_ACCESS),
+ (hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean): boolean =>
+ hasAvailableFeature(AvailableFeature.ROLE_BASED_ACCESS),
],
- canEdit: [(s) => [s.defaults], (defaults): boolean => defaults?.can_edit ?? false],
+ canEdit: [
+ (s) => [s.defaults],
+ (defaults: AccessControlDefaultsResponse | null): boolean => defaults?.can_edit ?? false,
+ ],
availableProjectLevels: [
(s) => [s.defaults],
- (defaults): AccessControlLevel[] => defaults?.available_project_levels ?? [],
+ (defaults: AccessControlDefaultsResponse | null): AccessControlLevel[] =>
+ defaults?.available_project_levels ?? [],
],
availableResourceLevels: [
(s) => [s.defaults],
- (defaults): AccessControlLevel[] => defaults?.available_resource_levels ?? [],
+ (defaults: AccessControlDefaultsResponse | null): AccessControlLevel[] =>
+ defaults?.available_resource_levels ?? [],
],
resourceKeys: [
(s) => [s.defaults, s.resources, s.featureFlags],
- (defaults, resources, featureFlags): { key: APIScopeObject; label: string }[] => {
+ (
+ defaults: AccessControlDefaultsResponse | null,
+ resources: APIScopeObject[],
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet
+ ): { key: APIScopeObject; label: string }[] => {
if (defaults) {
return Object.keys(defaults.resource_access_levels)
.filter((resource) => isResourceRolledOut(resource as AccessControlResourceType, featureFlags))
@@ -239,19 +973,32 @@ export const accessControlsLogic = kea<accessControlsLogicType>([
resourcesWithProject: [
(s) => [s.resourceKeys],
- (resourceKeys): { key: APIScopeObject; label: string }[] => {
+ (
+ resourceKeys: {
+ key: APIScopeObject
+ label: string
+ }[]
+ ): { key: APIScopeObject; label: string }[] => {
return [{ key: 'project' as APIScopeObject, label: 'Project' }, ...resourceKeys]
},
],
visibleResourceKeySet: [
(s) => [s.resourceKeys],
- (resourceKeys): Set<APIScopeObject> => new Set(resourceKeys.map((r) => r.key)),
+ (
+ resourceKeys: {
+ key: APIScopeObject
+ label: string
+ }[]
+ ): Set<APIScopeObject> => new Set(resourceKeys.map((r) => r.key)),
],
ruleOptions: [
(s) => [s.availableProjectLevels, s.availableResourceLevels],
- (projectLevels, resourceLevels): { key: AccessControlLevel; label: string }[] => {
+ (
+ projectLevels: AccessControlLevel[],
+ resourceLevels: AccessControlLevel[]
+ ): { key: AccessControlLevel; label: string }[] => {
const levelSet = new Set<AccessControlLevel>()
for (const level of projectLevels) {
levelSet.add(level)
@@ -271,7 +1018,13 @@ export const accessControlsLogic = kea<accessControlsLogicType>([
filteredRoles: [
(s) => [s.rolesData, s.searchText, s.filters, s.canUseRoles, s.visibleResourceKeySet],
- (rolesData, searchText, filters, canUseRoles, visibleResourceKeySet): AccessControlRoleEntry[] => {
+ (
+ rolesData: AccessControlRolesResponse | null,
+ searchText: string,
+ filters: AccessControlFilters,
+ canUseRoles: boolean,
+ visibleResourceKeySet: Set<APIScopeObject>
+ ): AccessControlRoleEntry[] => {
if (!canUseRoles || !rolesData) {
return []
}
@@ -290,7 +1043,12 @@ export const accessControlsLogic = kea<accessControlsLogicType>([
filteredMembers: [
(s) => [s.membersData, s.searchText, s.filters, s.visibleResourceKeySet],
- (membersData, searchText, filters, visibleResourceKeySet): AccessControlMemberEntry[] => {
+ (
+ membersData: AccessControlMembersResponse | null,
+ searchText: string,
+ filters: AccessControlFilters,
+ visibleResourceKeySet: Set<APIScopeObject>
+ ): AccessControlMemberEntry[] => {
if (!membersData) {
return []
}
@@ -317,7 +1075,7 @@ export const accessControlsLogic = kea<accessControlsLogicType>([
loading: [
(s) => [s.defaultsLoading, s.rolesDataLoading, s.membersDataLoading],
- (defaultsLoading, rolesLoading, membersLoading): boolean =>
+ (defaultsLoading: boolean, rolesLoading: boolean, membersLoading: boolean): boolean =>
defaultsLoading || rolesLoading || membersLoading,
],
}),
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/groupedAccessControlRuleModalLogic.ts b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/groupedAccessControlRuleModalLogic.ts
index 2704f0c65da0..821cfbac90c3 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/groupedAccessControlRuleModalLogic.ts
+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/groupedAccessControlRuleModalLogic.ts
@@ -1,11 +1,1756 @@
-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 { APIScopeObject, AccessControlLevel, EffectiveAccessControlEntry } from '~/types'
import { accessControlsLogic } from './accessControlsLogic'
-import type { groupedAccessControlRuleModalLogicType } from './groupedAccessControlRuleModalLogicType'
import { getEntryId, getInheritedReasonTooltip, getLevelOptionsForResource } from './helpers'
import { FormAccessLevel, GroupedAccessControlRuleModalLogicProps } from './types'
+import type { AccessControlSettingsEntry, ScopeType } from './types'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface groupedAccessControlRuleModalLogicValues {
+ availableProjectLevels: AccessControlLevel[] // accessControlsLogic
+ availableResourceLevels: AccessControlLevel[] // accessControlsLogic
+ canEdit: boolean // accessControlsLogic
+ loading: boolean // accessControlsLogic
+ entry: AccessControlSettingsEntry
+ entryId: string
+ featuresDisabledReason:
+ | 'Cannot edit'
+ | 'Loading...'
+ | 'User is an organization admin and has access to all features'
+ | undefined
+ formProjectLevel: FormAccessLevel
+ formResourceLevels: Record<APIScopeObject, FormAccessLevel>
+ isOrgAdmin: boolean
+ isProjectLevelShowingInherited: boolean
+ isResourceLevelShowingInherited: (
+ resource:
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session'
+ ) => boolean
+ modalTitle: 'Update default access' | 'Update member access' | 'Update role access'
+ projectDisabledReason: 'Cannot edit' | 'Loading...' | 'User is an organization admin' | undefined
+ projectInheritedReasonTooltip: string | undefined
+ projectLevelOptions: {
+ disabledReason?: string | undefined
+ label: string
+ value: AccessControlLevel
+ }[]
+ resourceInheritedReasonTooltip: (
+ resource:
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session'
+ ) => string | undefined
+ resourceLevelOptions: (
+ resource:
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session',
+ resourceLabel: string
+ ) => (
+ | {
+ disabledReason?: string | undefined
+ label: string
+ value: AccessControlLevel
+ }
+ | {
+ disabledReason: undefined
+ label: string
+ value: AccessControlLevel | null
+ }
+ )[]
+ scopeType: ScopeType
+ showResourceAddOverrideButton: (
+ resource:
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session'
+ ) => boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface groupedAccessControlRuleModalLogicActions {
+ closeRuleModal: () => {
+ value: true
+ } // accessControlsLogic
+ saveGroupedRules: (params: {
+ projectLevel: AccessControlLevel | null
+ resourceLevels: Record<APIScopeObject, AccessControlLevel | null>
+ scopeId: string
+ scopeType: ScopeType
+ }) => {
+ projectLevel: AccessControlLevel | null
+ resourceLevels: Record<
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session',
+ AccessControlLevel | null
+ >
+ scopeId: string
+ scopeType: ScopeType
+ } // accessControlsLogic
+ clearResourceOverrides: () => {
+ value: true
+ }
+ close: () => {
+ value: true
+ }
+ save: () => {
+ value: true
+ }
+ setProjectLevel: (level: AccessControlLevel | null) => {
+ level: AccessControlLevel | null
+ }
+ setResourceLevel: (
+ resource: APIScopeObject,
+ level: AccessControlLevel | null
+ ) => {
+ level: AccessControlLevel | null
+ resource:
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session'
+ }
+ setResourceLevels: (levels: Record<APIScopeObject, FormAccessLevel>) => {
+ levels: Record<
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session',
+ FormAccessLevel
+ >
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface groupedAccessControlRuleModalLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ entry: (entry: AccessControlSettingsEntry) => AccessControlSettingsEntry
+ scopeType: (scopeType: ScopeType) => ScopeType
+ entryId: (entry: AccessControlSettingsEntry) => string
+ modalTitle: (scopeType: ScopeType) => 'Update default access' | 'Update member access' | 'Update role access'
+ isOrgAdmin: (entry: AccessControlSettingsEntry) => boolean
+ featuresDisabledReason: (
+ loading: boolean,
+ canEdit: boolean,
+ isOrgAdmin: boolean
+ ) => 'Cannot edit' | 'Loading...' | 'User is an organization admin and has access to all features' | undefined
+ isProjectLevelShowingInherited: (
+ formProjectLevel: FormAccessLevel,
+ entry: AccessControlSettingsEntry
+ ) => boolean
+ projectInheritedReasonTooltip: (
+ isProjectLevelShowingInherited: boolean,
+ entry: AccessControlSettingsEntry
+ ) => string | undefined
+ projectLevelOptions: (
+ availableProjectLevels: AccessControlLevel[],
+ entry: AccessControlSettingsEntry
+ ) => {
+ disabledReason?: string | undefined
+ label: string
+ value: AccessControlLevel
+ }[]
+ projectDisabledReason: (
+ loading: boolean,
+ canEdit: boolean,
+ isOrgAdmin: boolean
+ ) => 'Cannot edit' | 'Loading...' | 'User is an organization admin' | undefined
+ isResourceLevelShowingInherited: (
+ formResourceLevels: Record<
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session',
+ FormAccessLevel
+ >,
+ entry: AccessControlSettingsEntry
+ ) => (
+ resource:
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session'
+ ) => boolean
+ resourceInheritedReasonTooltip: (
+ isResourceLevelShowingInherited: (
+ resource:
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session'
+ ) => boolean,
+ entry: AccessControlSettingsEntry
+ ) => (
+ resource:
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session'
+ ) => string | undefined
+ resourceLevelOptions: (
+ availableResourceLevels: AccessControlLevel[],
+ entry: AccessControlSettingsEntry,
+ formResourceLevels: Record<
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session',
+ FormAccessLevel
+ >
+ ) => (
+ resource:
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session',
+ resourceLabel: string
+ ) => (
+ | {
+ disabledReason?: string | undefined
+ label: string
+ value: AccessControlLevel
+ }
+ | {
+ disabledReason: undefined
+ label: string
+ value: AccessControlLevel | null
+ }
+ )[]
+ showResourceAddOverrideButton: (
+ formResourceLevels: Record<
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session',
+ FormAccessLevel
+ >
+ ) => (
+ resource:
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session'
+ ) => boolean
+ }
+}
+
+export type groupedAccessControlRuleModalLogicType = MakeLogicType<
+ groupedAccessControlRuleModalLogicValues,
+ groupedAccessControlRuleModalLogicActions,
+ GroupedAccessControlRuleModalLogicProps,
+ groupedAccessControlRuleModalLogicMeta
+>
export const groupedAccessControlRuleModalLogic = kea<groupedAccessControlRuleModalLogicType>([
path((key) => ['scenes', 'access_control', 'groupedAccessControlRuleModalLogic', key]),
@@ -51,13 +1796,13 @@ export const groupedAccessControlRuleModalLogic = kea<groupedAccessControlRuleMo
})),
selectors({
- entry: [(_, p) => [p.entry], (entry) => entry],
- scopeType: [(_, p) => [p.scopeType], (scopeType) => scopeType],
- entryId: [(_, p) => [p.entry], (entry) => getEntryId(entry)],
+ entry: [(_, p) => [p.entry], (entry: import('./types').AccessControlSettingsEntry) => entry],
+ scopeType: [(_, p) => [p.scopeType], (scopeType: import('./types').ScopeType) => scopeType],
+ entryId: [(_, p) => [p.entry], (entry: import('./types').AccessControlSettingsEntry) => getEntryId(entry)],
modalTitle: [
(s) => [s.scopeType],
- (scopeType) => {
+ (scopeType: import('./types').ScopeType) => {
switch (scopeType) {
case 'default':
return 'Update default access'
@@ -68,10 +1813,14 @@ export const groupedAccessControlRuleModalLogic = kea<groupedAccessControlRuleMo
}
},
],
- isOrgAdmin: [(s) => [s.entry], (entry) => entry.project.inherited_access_level_reason === 'organization_admin'],
+ isOrgAdmin: [
+ (s) => [s.entry],
+ (entry: import('./types').AccessControlSettingsEntry) =>
+ entry.project.inherited_access_level_reason === 'organization_admin',
+ ],
featuresDisabledReason: [
(s) => [s.loading, s.canEdit, s.isOrgAdmin],
- (loading, canEdit, isOrgAdmin) => {
+ (loading: boolean, canEdit: boolean, isOrgAdmin: boolean) => {
if (loading) {
return 'Loading...'
}
@@ -88,20 +1837,20 @@ export const groupedAccessControlRuleModalLogic = kea<groupedAccessControlRuleMo
// Project access level
isProjectLevelShowingInherited: [
(s) => [s.formProjectLevel, s.entry],
- (formProjectLevel, entry) =>
+ (formProjectLevel: FormAccessLevel, entry: import('./types').AccessControlSettingsEntry) =>
formProjectLevel === entry.project.inherited_access_level &&
entry.project.inherited_access_level !== null,
],
projectInheritedReasonTooltip: [
(s) => [s.isProjectLevelShowingInherited, s.entry],
- (isProjectLevelShowingInherited, entry) =>
+ (isProjectLevelShowingInherited: boolean, entry: import('./types').AccessControlSettingsEntry) =>
isProjectLevelShowingInherited
? getInheritedReasonTooltip(entry.project.inherited_access_level_reason)
: undefined,
],
projectLevelOptions: [
(s) => [s.availableProjectLevels, s.entry],
- (availableProjectLevels, entry) => {
+ (availableProjectLevels: AccessControlLevel[], entry: import('./types').AccessControlSettingsEntry) => {
const { inherited_access_level, inherited_access_level_reason, minimum, maximum } = entry.project
return getLevelOptionsForResource(availableProjectLevels, {
minimum,
@@ -114,7 +1863,7 @@ export const groupedAccessControlRuleModalLogic = kea<groupedAccessControlRuleMo
],
projectDisabledReason: [
(s) => [s.loading, s.canEdit, s.isOrgAdmin],
- (loading, canEdit, isOrgAdmin) => {
+ (loading: boolean, canEdit: boolean, isOrgAdmin: boolean) => {
if (loading) {
return 'Loading...'
}
@@ -131,26 +1880,144 @@ export const groupedAccessControlRuleModalLogic = kea<groupedAccessControlRuleMo
// Resource access level
isResourceLevelShowingInherited: [
(s) => [s.formResourceLevels, s.entry],
- (formResourceLevels, entry) => (resource: APIScopeObject) => {
- const resourceEntry = entry.resources[resource] as EffectiveAccessControlEntry
- return (
- formResourceLevels[resource] === resourceEntry.inherited_access_level &&
- resourceEntry.inherited_access_level !== null
- )
- },
+ (
+ formResourceLevels: Record<APIScopeObject, FormAccessLevel>,
+ entry: import('./types').AccessControlSettingsEntry
+ ) =>
+ (resource: APIScopeObject) => {
+ const resourceEntry = entry.resources[resource] as EffectiveAccessControlEntry
+ return (
+ formResourceLevels[resource] === resourceEntry.inherited_access_level &&
+ resourceEntry.inherited_access_level !== null
+ )
+ },
],
resourceInheritedReasonTooltip: [
(s) => [s.isResourceLevelShowingInherited, s.entry],
- (isResourceLevelShowingInherited, entry) => (resource: APIScopeObject) =>
- isResourceLevelShowingInherited(resource)
- ? getInheritedReasonTooltip(
- (entry.resources[resource] as EffectiveAccessControlEntry).inherited_access_level_reason
- )
- : undefined,
+ (
+ isResourceLevelShowingInherited: (
+ resource:
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session'
+ ) => boolean,
+ entry: import('./types').AccessControlSettingsEntry
+ ) =>
+ (resource: APIScopeObject) =>
+ isResourceLevelShowingInherited(resource)
+ ? getInheritedReasonTooltip(
+ (entry.resources[resource] as EffectiveAccessControlEntry).inherited_access_level_reason
+ )
+ : undefined,
],
resourceLevelOptions: [
(s) => [s.availableResourceLevels, s.entry, s.formResourceLevels],
- (availableResourceLevels, entry, formResourceLevels) =>
+ (
+ availableResourceLevels: AccessControlLevel[],
+ entry: import('./types').AccessControlSettingsEntry,
+ formResourceLevels: Record<APIScopeObject, FormAccessLevel>
+ ) =>
(resource: APIScopeObject, resourceLabel: string) => {
const { access_level, inherited_access_level, inherited_access_level_reason, minimum, maximum } =
entry.resources[resource] as EffectiveAccessControlEntry
@@ -179,7 +2046,8 @@ export const groupedAccessControlRuleModalLogic = kea<groupedAccessControlRuleMo
],
showResourceAddOverrideButton: [
(s) => [s.formResourceLevels],
- (formResourceLevels) => (resource: APIScopeObject) => formResourceLevels[resource] === null,
+ (formResourceLevels: Record<APIScopeObject, FormAccessLevel>) => (resource: APIScopeObject) =>
+ formResourceLevels[resource] === null,
],
}),
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/accessControlLogic.ts b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/accessControlLogic.ts
index 161194d85e10..762aa1eaf20c 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/accessControlLogic.ts
+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/accessControlLogic.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 { LemonSelectOption } from '@posthog/lemon-ui'
@@ -25,7 +25,7 @@ import {
RoleType,
} from '~/types'
-import type { accessControlLogicType } from './accessControlLogicType'
+import type { GuardAvailableFeatureFn } from '../../../../../lib/components/UpgradeModal/upgradeModalLogic'
import { roleAccessControlLogic } from './roleAccessControlLogic'
export type AccessControlLogicProps = {
@@ -35,6 +35,738 @@ export type AccessControlLogicProps = {
description: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accessControlLogicValues {
+ sortedMembers: OrganizationMemberType[] | null // membersLogic
+ roles: RoleType[] // roleAccessControlLogic
+ currentProjectId: number | string // teamLogic
+ guardAvailableFeature: GuardAvailableFeatureFn // upgradeModalLogic
+ accessControlDefault: AccessControlTypeProject
+ accessControlDefaultLevel: string | null
+ accessControlDefaultOptions: LemonSelectOption<string>[]
+ accessControlMembers: (AccessControlTypeMember | AccessControlTypeOrganizationAdmins)[]
+ accessControlRoles: AccessControlTypeRole[]
+ accessControls: AccessControlResponseType | null
+ accessControlsLoading: boolean
+ addableMembers: any[]
+ addableRoles: RoleType[]
+ availableLevels: AccessControlLevel[]
+ availableLevelsWithNone: AccessControlLevel[]
+ canEditAccessControls: boolean | null
+ endpoint: string
+ humanReadableResource: string
+ membersById: Record<string, OrganizationMemberType>
+ minimumAccessLevel: AccessControlLevel | null
+ organizationAdmins: OrganizationMemberType[]
+ organizationAdminsAsAccessControlMember: AccessControlTypeOrganizationAdmins
+ resource:
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session'
+ rolesById: Record<string, RoleType>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accessControlLogicActions {
+ ensureAllMembersLoaded: () => {
+ value: true
+ } // membersLogic
+ loadAccessControls: () => any
+ loadAccessControlsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAccessControlsSuccess: (
+ accessControls: AccessControlResponseType,
+ payload?: any
+ ) => {
+ accessControls: AccessControlResponseType
+ payload?: any
+ }
+ updateAccessControl: (accessControl: Pick<AccessControlType, 'access_level' | 'organization_member' | 'role'>) => {
+ accessControl: Pick<AccessControlType, 'access_level' | 'organization_member' | 'role'>
+ }
+ updateAccessControlDefault: (
+ level: AccessControlLevel,
+ source?: AccessControlUIVersion
+ ) => {
+ level: AccessControlLevel
+ source: AccessControlUIVersion
+ }
+ updateAccessControlDefaultFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateAccessControlDefaultSuccess: (
+ accessControls: AccessControlResponseType | null,
+ payload?: {
+ level: AccessControlLevel
+ source: AccessControlUIVersion
+ }
+ ) => {
+ accessControls: AccessControlResponseType | null
+ payload?: {
+ level: AccessControlLevel
+ source: AccessControlUIVersion
+ }
+ }
+ updateAccessControlMembers: (
+ accessControls: {
+ level: AccessControlLevel | null
+ member: OrganizationMemberType['id']
+ }[],
+ source?: AccessControlUIVersion
+ ) => {
+ accessControls: {
+ level: AccessControlLevel | null
+ member: string
+ }[]
+ source: AccessControlUIVersion
+ }
+ updateAccessControlMembersFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateAccessControlMembersSuccess: (
+ accessControls: AccessControlResponseType | null,
+ payload?: {
+ accessControls: {
+ level: AccessControlLevel | null
+ member: string
+ }[]
+ source: AccessControlUIVersion
+ }
+ ) => {
+ accessControls: AccessControlResponseType | null
+ payload?: {
+ accessControls: {
+ level: AccessControlLevel | null
+ member: string
+ }[]
+ source: AccessControlUIVersion
+ }
+ }
+ updateAccessControlRoles: (
+ accessControls: {
+ level: AccessControlLevel | null
+ role: RoleType['id']
+ }[],
+ source?: AccessControlUIVersion
+ ) => {
+ accessControls: {
+ level: AccessControlLevel | null
+ role: string
+ }[]
+ source: AccessControlUIVersion
+ }
+ updateAccessControlRolesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateAccessControlRolesSuccess: (
+ accessControls: AccessControlResponseType | null,
+ payload?: {
+ accessControls: {
+ level: AccessControlLevel | null
+ role: string
+ }[]
+ source: AccessControlUIVersion
+ }
+ ) => {
+ accessControls: AccessControlResponseType | null
+ payload?: {
+ accessControls: {
+ level: AccessControlLevel | null
+ role: string
+ }[]
+ source: AccessControlUIVersion
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accessControlLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ resource: (
+ resource:
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session'
+ ) =>
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session'
+ endpoint: (
+ currentProjectId: number | string,
+ resource:
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session',
+ resource_id: string
+ ) => string
+ humanReadableResource: (
+ resource:
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'stamphog'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session'
+ ) => string
+ minimumAccessLevel: (accessControls: AccessControlResponseType | null) => AccessControlLevel | null
+ availableLevelsWithNone: (accessControls: AccessControlResponseType | null) => AccessControlLevel[]
+ availableLevels: (availableLevelsWithNone: AccessControlLevel[]) => AccessControlLevel[]
+ canEditAccessControls: (accessControls: AccessControlResponseType | null) => boolean | null
+ accessControlDefaultLevel: (accessControls: AccessControlResponseType | null) => string | null
+ accessControlDefaultOptions: (
+ availableLevelsWithNone: AccessControlLevel[],
+ minimumAccessLevel: AccessControlLevel | null,
+ arg: any
+ ) => LemonSelectOption<string>[]
+ accessControlDefault: (
+ accessControls: AccessControlResponseType | null,
+ accessControlDefaultLevel: string | null
+ ) => AccessControlTypeProject
+ organizationAdmins: (sortedMembers: OrganizationMemberType[] | null) => OrganizationMemberType[]
+ organizationAdminsAsAccessControlMember: (
+ organizationAdmins: OrganizationMemberType[]
+ ) => AccessControlTypeOrganizationAdmins
+ accessControlMembers: (
+ accessControls: AccessControlResponseType | null,
+ organizationAdminsAsAccessControlMember: AccessControlTypeOrganizationAdmins
+ ) => (AccessControlTypeMember | AccessControlTypeOrganizationAdmins)[]
+ accessControlRoles: (accessControls: AccessControlResponseType | null) => AccessControlTypeRole[]
+ rolesById: (roles: RoleType[]) => Record<string, RoleType>
+ addableRoles: (roles: RoleType[], accessControlRoles: AccessControlTypeRole[]) => RoleType[]
+ membersById: (sortedMembers: OrganizationMemberType[] | null) => Record<string, OrganizationMemberType>
+ addableMembers: (
+ sortedMembers: OrganizationMemberType[] | null,
+ accessControlMembers: (AccessControlTypeMember | AccessControlTypeOrganizationAdmins)[],
+ organizationAdmins: OrganizationMemberType[]
+ ) => any[]
+ }
+}
+
+export type accessControlLogicType = MakeLogicType<
+ accessControlLogicValues,
+ accessControlLogicActions,
+ AccessControlLogicProps,
+ accessControlLogicMeta
+>
+
export const accessControlLogic = kea<accessControlLogicType>([
props({} as AccessControlLogicProps),
key((props) => `${props.resource}-${props.resource_id}`),
@@ -167,11 +899,226 @@ export const accessControlLogic = kea<accessControlLogicType>([
updateAccessControlMembersSuccess: () => actions.loadAccessControls(),
})),
selectors({
- resource: [(_, p) => [p.resource], (resource) => resource],
+ resource: [
+ (_, p) => [p.resource],
+ (
+ resource:
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session'
+ ) => resource,
+ ],
endpoint: [
(s, p) => [s.currentProjectId, p.resource, p.resource_id],
- (currentProjectId, resource, resource_id): string => {
+ (
+ currentProjectId: number | string,
+ resource:
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session',
+ resource_id: string
+ ): string => {
// TODO: This is far from perfect... but it's a start
if (resource === 'project') {
return `api/projects/${currentProjectId}/access_controls`
@@ -186,46 +1133,157 @@ export const accessControlLogic = kea<accessControlLogicType>([
},
],
- humanReadableResource: [(_, p) => [p.resource], (resource) => resource.replace(/_/g, ' ')],
+ humanReadableResource: [
+ (_, p) => [p.resource],
+ (
+ resource:
+ | 'access_control'
+ | 'account'
+ | 'action'
+ | 'activity_log'
+ | 'agent_approvals'
+ | 'agents'
+ | 'alert'
+ | 'annotation'
+ | 'approvals'
+ | 'batch_export'
+ | 'batch_import'
+ | 'business_knowledge'
+ | 'clickhouse_test_cluster_perf'
+ | 'cohort'
+ | 'comment'
+ | 'conversation'
+ | 'customer_analytics'
+ | 'customer_journey'
+ | 'customer_profile_config'
+ | 'dashboard'
+ | 'dashboard_template'
+ | 'data_catalog'
+ | 'data_catalog_approval'
+ | 'dataset'
+ | 'early_access_feature'
+ | 'element'
+ | 'endpoint'
+ | 'engineering_analytics'
+ | 'error_tracking'
+ | 'evaluation'
+ | 'event_definition'
+ | 'event_filter'
+ | 'experiment'
+ | 'experiment_holdout'
+ | 'experiment_saved_metric'
+ | 'export'
+ | 'external_data_schema'
+ | 'external_data_source'
+ | 'feature_flag'
+ | 'field_note'
+ | 'file_system'
+ | 'file_system_shortcut'
+ | 'group'
+ | 'health_issue'
+ | 'heatmap'
+ | 'hog_flow'
+ | 'hog_function'
+ | 'ingestion_warning'
+ | 'insight'
+ | 'insight_variable'
+ | 'integration'
+ | 'internal_run'
+ | 'legal_document'
+ | 'link'
+ | 'live_debugger'
+ | 'llm_analytics'
+ | 'llm_gateway'
+ | 'llm_prompt'
+ | 'llm_provider_key'
+ | 'llm_skill'
+ | 'logs'
+ | 'marketing_analytics'
+ | 'mcp_analytics'
+ | 'metrics'
+ | 'notebook'
+ | 'organization'
+ | 'organization_integration'
+ | 'organization_member'
+ | 'person'
+ | 'plugin'
+ | 'product_enablement'
+ | 'product_tour'
+ | 'project'
+ | 'property_definition'
+ | 'query'
+ | 'query_performance'
+ | 'replay_scanner'
+ | 'revenue_analytics'
+ | 'session_recording'
+ | 'session_recording_playlist'
+ | 'sharing_configuration'
+ | 'signal_scout'
+ | 'signal_scout_internal'
+ | 'signal_scout_report'
+ | 'streamlit_app'
+ | 'subscription'
+ | 'survey'
+ | 'tagger'
+ | 'task'
+ | 'ticket'
+ | 'tracing'
+ | 'uploaded_media'
+ | 'usage_metric'
+ | 'user'
+ | 'user_interview'
+ | 'vision_action'
+ | 'visual_review'
+ | 'warehouse_objects'
+ | 'warehouse_table'
+ | 'warehouse_view'
+ | 'web_analytics'
+ | 'webhook'
+ | 'wizard_session'
+ ) => resource.replace(/_/g, ' '),
+ ],
minimumAccessLevel: [
(s) => [s.accessControls],
- (accessControls): AccessControlLevel | null => {
+ (accessControls: AccessControlResponseType | null): AccessControlLevel | null => {
return accessControls?.minimum_access_level ?? null
},
],
availableLevelsWithNone: [
(s) => [s.accessControls],
- (accessControls): AccessControlLevel[] => {
+ (accessControls: AccessControlResponseType | null): AccessControlLevel[] => {
return accessControls?.available_access_levels ?? []
},
],
availableLevels: [
(s) => [s.availableLevelsWithNone],
- (availableLevelsWithNone): AccessControlLevel[] => {
+ (availableLevelsWithNone: AccessControlLevel[]): AccessControlLevel[] => {
return availableLevelsWithNone.filter((level) => level !== 'none')
},
],
canEditAccessControls: [
(s) => [s.accessControls],
- (accessControls): boolean | null => {
+ (accessControls: AccessControlResponseType | null): boolean | null => {
return accessControls?.user_can_edit_access_levels ?? null
},
],
accessControlDefaultLevel: [
(s) => [s.accessControls],
- (accessControls): string | null => {
+ (accessControls: AccessControlResponseType | null): string | null => {
return accessControls?.default_access_level ?? null
},
],
accessControlDefaultOptions: [
(s) => [s.availableLevelsWithNone, s.minimumAccessLevel, (_, props) => props.resource],
- (availableLevelsWithNone, minimumAccessLevel): LemonSelectOption<string>[] => {
+ (
+ availableLevelsWithNone: AccessControlLevel[],
+ minimumAccessLevel: AccessControlLevel | null
+ ): LemonSelectOption<string>[] => {
const options = availableLevelsWithNone.map((level) => {
const isDisabled = minimumAccessLevel
? availableLevelsWithNone.indexOf(level) < availableLevelsWithNone.indexOf(minimumAccessLevel)
@@ -244,7 +1302,10 @@ export const accessControlLogic = kea<accessControlLogicType>([
accessControlDefault: [
(s) => [s.accessControls, s.accessControlDefaultLevel],
- (accessControls, accessControlDefaultLevel): AccessControlTypeProject => {
+ (
+ accessControls: AccessControlResponseType | null,
+ accessControlDefaultLevel: string | null
+ ): AccessControlTypeProject => {
const found = accessControls?.access_controls?.find(
(accessControl) => !accessControl.organization_member && !accessControl.role
) as AccessControlTypeProject
@@ -258,14 +1319,14 @@ export const accessControlLogic = kea<accessControlLogicType>([
organizationAdmins: [
(s) => [s.sortedMembers],
- (members): OrganizationMemberType[] => {
+ (members: OrganizationMemberType[] | null): OrganizationMemberType[] => {
return members?.filter((member) => member.level >= OrganizationMembershipLevel.Admin) ?? []
},
],
organizationAdminsAsAccessControlMember: [
(s) => [s.organizationAdmins],
- (organizationAdmins): AccessControlTypeOrganizationAdmins => {
+ (organizationAdmins: OrganizationMemberType[]): AccessControlTypeOrganizationAdmins => {
return {
organization_admin_members: organizationAdmins.map((member) => member.id),
access_level: AccessControlLevel.Admin,
@@ -280,8 +1341,8 @@ export const accessControlLogic = kea<accessControlLogicType>([
accessControlMembers: [
(s) => [s.accessControls, s.organizationAdminsAsAccessControlMember],
(
- accessControls,
- organizationAdminsAsAccessControlMember
+ accessControls: AccessControlResponseType | null,
+ organizationAdminsAsAccessControlMember: AccessControlTypeOrganizationAdmins
): (AccessControlTypeMember | AccessControlTypeOrganizationAdmins)[] => {
const members = (accessControls?.access_controls || [])
.filter((accessControl) => !!accessControl.organization_member)
@@ -297,7 +1358,7 @@ export const accessControlLogic = kea<accessControlLogicType>([
accessControlRoles: [
(s) => [s.accessControls],
- (accessControls): AccessControlTypeRole[] => {
+ (accessControls: AccessControlResponseType | null): AccessControlTypeRole[] => {
return (accessControls?.access_controls || []).filter(
(accessControl) => !!accessControl.role
) as AccessControlTypeRole[]
@@ -306,28 +1367,32 @@ export const accessControlLogic = kea<accessControlLogicType>([
rolesById: [
(s) => [s.roles],
- (roles): Record<string, RoleType> => {
+ (roles: RoleType[]): Record<string, RoleType> => {
return Object.fromEntries((roles || []).map((role) => [role.id, role]))
},
],
addableRoles: [
(s) => [s.roles, s.accessControlRoles],
- (roles, accessControlRoles): RoleType[] => {
+ (roles: RoleType[], accessControlRoles: AccessControlTypeRole[]): RoleType[] => {
return roles ? roles.filter((role) => !accessControlRoles.find((ac) => ac.role === role.id)) : []
},
],
membersById: [
(s) => [s.sortedMembers],
- (members): Record<string, OrganizationMemberType> => {
+ (members: OrganizationMemberType[] | null): Record<string, OrganizationMemberType> => {
return Object.fromEntries((members || []).map((member) => [member.id, member]))
},
],
addableMembers: [
(s) => [s.sortedMembers, s.accessControlMembers, s.organizationAdmins],
- (members, accessControlMembers, organizationAdmins): any[] => {
+ (
+ members: OrganizationMemberType[] | null,
+ accessControlMembers: (AccessControlTypeMember | AccessControlTypeOrganizationAdmins)[],
+ organizationAdmins: OrganizationMemberType[]
+ ): any[] => {
return members
? members.filter(
(member) =>
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/resourcesAccessControlLogic.ts b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/resourcesAccessControlLogic.ts
index 64e9bff291b0..3353abe1f092 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/resourcesAccessControlLogic.ts
+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/resourcesAccessControlLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, listeners, path, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { lemonToast } from '@posthog/lemon-ui'
@@ -19,7 +19,7 @@ import {
AvailableFeature,
} from '~/types'
-import type { resourcesAccessControlLogicType } from './resourcesAccessControlLogicType'
+import type { FeatureFlagsSet } from '../../../../../lib/logic/featureFlagLogic'
const RESOURCE_FEATURE_REQUIREMENTS: Partial<Record<AccessControlResourceType, AvailableFeature>> = {
[AccessControlResourceType.ActivityLog]: AvailableFeature.AUDIT_LOGS,
@@ -43,6 +43,70 @@ export function isResourceRolledOut(
return !requiredFlag || !!featureFlags[requiredFlag]
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface resourcesAccessControlLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ currentProjectId: number | string // teamLogic
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean // userLogic
+ resourceAccessControls: AccessControlResponseType | null
+ resourceAccessControlsLoading: boolean
+ resources: APIScopeObject[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface resourcesAccessControlLogicActions {
+ updateResourceAccessControls: (
+ accessControls: Pick<AccessControlUpdateType, 'access_level' | 'organization_member' | 'resource' | 'role'>[],
+ saveType: 'default' | 'member' | 'role'
+ ) => {
+ accessControls: Pick<AccessControlUpdateType, 'access_level' | 'organization_member' | 'resource' | 'role'>[]
+ saveType: 'default' | 'member' | 'role'
+ }
+ updateResourceAccessControlsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateResourceAccessControlsSuccess: (
+ resourceAccessControls: AccessControlResponseType | null,
+ payload?: {
+ accessControls: Pick<
+ AccessControlUpdateType,
+ 'access_level' | 'organization_member' | 'resource' | 'role'
+ >[]
+ saveType: 'default' | 'member' | 'role'
+ }
+ ) => {
+ resourceAccessControls: AccessControlResponseType | null
+ payload?: {
+ accessControls: Pick<
+ AccessControlUpdateType,
+ 'access_level' | 'organization_member' | 'resource' | 'role'
+ >[]
+ saveType: 'default' | 'member' | 'role'
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface resourcesAccessControlLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ resources: (
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean,
+ featureFlags: FeatureFlagsSet
+ ) => APIScopeObject[]
+ }
+}
+
+export type resourcesAccessControlLogicType = MakeLogicType<
+ resourcesAccessControlLogicValues,
+ resourcesAccessControlLogicActions,
+ Record<string, any>,
+ resourcesAccessControlLogicMeta
+>
+
export const resourcesAccessControlLogic = kea<resourcesAccessControlLogicType>([
path(['scenes', 'accessControl', 'resourcesAccessControlLogic']),
connect(() => ({
@@ -98,7 +162,10 @@ export const resourcesAccessControlLogic = kea<resourcesAccessControlLogicType>(
selectors({
resources: [
(s) => [s.hasAvailableFeature, s.featureFlags],
- (hasAvailableFeature, featureFlags): APIScopeObject[] => {
+ (
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean,
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet
+ ): APIScopeObject[] => {
const allResources = [
AccessControlResourceType.Action,
AccessControlResourceType.ActivityLog,
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/roleAccessControlLogic.ts b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/roleAccessControlLogic.ts
index fe090ba09283..2acf30f99c42 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/roleAccessControlLogic.ts
+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/roleAccessControlLogic.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 { actionToUrl, router } from 'kea-router'
@@ -13,7 +14,227 @@ import { userLogic } from 'scenes/userLogic'
import { AccessControlResponseType, RoleType } from '~/types'
-import type { roleAccessControlLogicType } from './roleAccessControlLogicType'
+import type { AvailableFeature, OrganizationMemberType } from '../../../../../types'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface roleAccessControlLogicValues {
+ sortedMembers: OrganizationMemberType[] | null // membersLogic
+ currentProjectId: number | string // teamLogic
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean // userLogic
+ canEditRoles: boolean | null
+ editingRole: {
+ name: string
+ }
+ editingRoleAllErrors: Record<string, any>
+ editingRoleChanged: boolean
+ editingRoleErrors: DeepPartialMap<
+ {
+ name: string
+ },
+ ValidationErrorType
+ >
+ editingRoleHasErrors: boolean
+ editingRoleId: string | null
+ editingRoleManualErrors: Record<string, any>
+ editingRoleTouched: boolean
+ editingRoleTouches: Record<string, boolean>
+ editingRoleValidationErrors: DeepPartialMap<
+ {
+ name: string
+ },
+ ValidationErrorType
+ >
+ isEditingRoleSubmitting: boolean
+ isEditingRoleValid: boolean
+ resourceAccessControls: AccessControlResponseType | null
+ resourceAccessControlsLoading: boolean
+ roles: RoleType[]
+ rolesLoading: boolean
+ selectedRoleId: string | null
+ showEditingRoleErrors: boolean
+ sortedRoles: RoleType[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface roleAccessControlLogicActions {
+ ensureAllMembersLoaded: () => {
+ value: true
+ } // membersLogic
+ loadCurrentOrganization: () => any // organizationLogic
+ addMembersToRole: (
+ role: RoleType,
+ members: string[]
+ ) => {
+ members: string[]
+ role: RoleType
+ }
+ addMembersToRoleFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ addMembersToRoleSuccess: (
+ roles: RoleType[],
+ payload?: {
+ members: string[]
+ role: RoleType
+ }
+ ) => {
+ roles: RoleType[]
+ payload?: {
+ members: string[]
+ role: RoleType
+ }
+ }
+ deleteRole: (roleId: RoleType['id']) => {
+ roleId: string
+ }
+ deleteRoleFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deleteRoleSuccess: (
+ roles: RoleType[],
+ payload?: {
+ roleId: string
+ }
+ ) => {
+ roles: RoleType[]
+ payload?: {
+ roleId: string
+ }
+ }
+ loadResourceAccessControls: () => any
+ loadResourceAccessControlsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadResourceAccessControlsSuccess: (
+ resourceAccessControls: AccessControlResponseType,
+ payload?: any
+ ) => {
+ resourceAccessControls: AccessControlResponseType
+ payload?: any
+ }
+ loadRoles: () => any
+ loadRolesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRolesSuccess: (
+ roles: RoleType[],
+ payload?: any
+ ) => {
+ roles: RoleType[]
+ payload?: any
+ }
+ removeMemberFromRole: (
+ role: RoleType,
+ roleMemberId: string
+ ) => {
+ role: RoleType
+ roleMemberId: string
+ }
+ removeMemberFromRoleFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ removeMemberFromRoleSuccess: (
+ roles: RoleType[],
+ payload?: {
+ role: RoleType
+ roleMemberId: string
+ }
+ ) => {
+ roles: RoleType[]
+ payload?: {
+ role: RoleType
+ roleMemberId: string
+ }
+ }
+ resetEditingRole: (values?: { name: string }) => {
+ values?: {
+ name: string
+ }
+ }
+ selectRoleId: (roleId: RoleType['id'] | null) => {
+ roleId: string | null
+ }
+ setEditingRoleId: (roleId: string | null) => {
+ roleId: string | null
+ }
+ setEditingRoleManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setEditingRoleValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setEditingRoleValues: (
+ values: DeepPartial<{
+ name: string
+ }>
+ ) => {
+ values: DeepPartial<{
+ name: string
+ }>
+ }
+ submitEditingRole: () => {
+ value: boolean
+ }
+ submitEditingRoleFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitEditingRoleRequest: (editingRole: { name: string }) => {
+ editingRole: {
+ name: string
+ }
+ }
+ submitEditingRoleSuccess: (editingRole: { name: string }) => {
+ editingRole: {
+ name: string
+ }
+ }
+ touchEditingRoleField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface roleAccessControlLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ sortedRoles: (roles: RoleType[]) => RoleType[]
+ canEditRoles: (resourceAccessControls: AccessControlResponseType | null) => boolean | null
+ }
+}
+
+export type roleAccessControlLogicType = MakeLogicType<
+ roleAccessControlLogicValues,
+ roleAccessControlLogicActions,
+ Record<string, any>,
+ roleAccessControlLogicMeta
+>
export const roleAccessControlLogic = kea<roleAccessControlLogicType>([
path(['scenes', 'accessControl', 'roleAccessControlLogic']),
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/activity/sidePanelActivityLogic.tsx b/frontend/src/layout/navigation-3000/sidepanel/panels/activity/sidePanelActivityLogic.tsx
index feface92f0b7..8364f11510a6 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/panels/activity/sidePanelActivityLogic.tsx
+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/activity/sidePanelActivityLogic.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 { lazyLoaders } from 'kea-loaders'
import { subscriptions } from 'kea-subscriptions'
@@ -13,10 +13,10 @@ import { projectLogic } from 'scenes/projectLogic'
import { ActivityScope, UserBasicType } from '~/types'
+import type { SidePanelTab } from '../../../../../types'
import { sidePanelContextLogic } from '../../sidePanelContextLogic'
import { sidePanelStateLogic } from '../../sidePanelStateLogic'
import { SidePanelSceneContext } from '../../types'
-import type { sidePanelActivityLogicType } from './sidePanelActivityLogicType'
// ActivityScope values that should not appear in dropdowns
const HIDDEN_ACTIVITY_SCOPES: ActivityScope[] = [
@@ -48,6 +48,101 @@ export enum SidePanelActivityTab {
Metalytics = 'metalytics',
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelActivityLogicValues {
+ currentProjectId: number | null // projectLogic
+ sceneSidePanelContext: SidePanelSceneContext // sidePanelContextLogic
+ selectedTabOptions: string | null // sidePanelStateLogic
+ activeFilters: ActivityFilters | null
+ activeTab: SidePanelActivityTab
+ allActivity: HumanizedActivityLogItem[]
+ allActivityHasNext: boolean
+ allActivityResponse: PaginatedResponse<ActivityLogItem> | null
+ allActivityResponseLoading: boolean
+ contextFromPage: ActivityFilters | null
+ visibleActivityScopes: ActivityScope[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelActivityLogicActions {
+ openSidePanel: (
+ tab: SidePanelTab,
+ options?: string | undefined
+ ) => {
+ options: string | undefined
+ tab: SidePanelTab
+ } // sidePanelStateLogic
+ loadAllActivity: () => {
+ value: true
+ }
+ loadAllActivityFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAllActivitySuccess: (
+ allActivityResponse: PaginatedResponse<ActivityLogItem>,
+ payload?: {
+ value: true
+ }
+ ) => {
+ allActivityResponse: PaginatedResponse<ActivityLogItem>
+ payload?: {
+ value: true
+ }
+ }
+ loadOlderActivity: () => {
+ value: true
+ }
+ loadOlderActivityFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadOlderActivitySuccess: (
+ allActivityResponse: PaginatedResponse<ActivityLogItem> | null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ allActivityResponse: PaginatedResponse<ActivityLogItem> | null
+ payload?: {
+ value: true
+ }
+ }
+ maybeLoadOlderActivity: () => {
+ value: true
+ }
+ setActiveFilters: (filters: ActivityFilters | null) => {
+ filters: ActivityFilters | null
+ }
+ setActiveTab: (tab: SidePanelActivityTab) => {
+ tab: SidePanelActivityTab
+ }
+ setContextFromPage: (filters: ActivityFilters | null) => {
+ filters: ActivityFilters | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelActivityLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ allActivity: (allActivityResponse: PaginatedResponse<ActivityLogItem> | null) => HumanizedActivityLogItem[]
+ allActivityHasNext: (allActivityResponse: PaginatedResponse<ActivityLogItem> | null) => boolean
+ }
+}
+
+export type sidePanelActivityLogicType = MakeLogicType<
+ sidePanelActivityLogicValues,
+ sidePanelActivityLogicActions,
+ Record<string, any>,
+ sidePanelActivityLogicMeta
+>
+
export const sidePanelActivityLogic = kea<sidePanelActivityLogicType>([
path(['scenes', 'navigation', 'sidepanel', 'sidePanelActivityLogic']),
connect(() => ({
@@ -142,11 +237,14 @@ export const sidePanelActivityLogic = kea<sidePanelActivityLogicType>([
selectors({
allActivity: [
(s) => [s.allActivityResponse],
- (allActivityResponse): HumanizedActivityLogItem[] => {
+ (allActivityResponse: PaginatedResponse<ActivityLogItem> | null): HumanizedActivityLogItem[] => {
return humanize(allActivityResponse?.results || [], describerFor, true)
},
],
- allActivityHasNext: [(s) => [s.allActivityResponse], (allActivityResponse) => !!allActivityResponse?.next],
+ allActivityHasNext: [
+ (s) => [s.allActivityResponse],
+ (allActivityResponse: PaginatedResponse<ActivityLogItem> | null) => !!allActivityResponse?.next,
+ ],
visibleActivityScopes: [
() => [],
(): ActivityScope[] => {
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/activity/sidePanelNotificationsLogic.tsx b/frontend/src/layout/navigation-3000/sidepanel/panels/activity/sidePanelNotificationsLogic.tsx
index 5a8cc4937dd0..1f5c84a173e5 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/panels/activity/sidePanelNotificationsLogic.tsx
+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/activity/sidePanelNotificationsLogic.tsx
@@ -1,4 +1,15 @@
-import { actions, afterMount, beforeUnmount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ beforeUnmount,
+ connect,
+ kea,
+ listeners,
+ path,
+ reducers,
+ selectors,
+} from 'kea'
import { lazyLoaders } from 'kea-loaders'
import { router } from 'kea-router'
import posthog, { JsonRecord } from 'posthog-js'
@@ -41,8 +52,11 @@ import {
} from 'products/notifications/frontend/generated/api.schemas'
import { RESOURCE_EDITED_EVENT_TYPE, resourceEditedLogic } from 'products/notifications/frontend/resourceEditedLogic'
+import type { FeatureFlagsSet } from '../../../../../lib/logic/featureFlagLogic'
+import type { OrganizationType } from '../../../../../types'
+import type { TeamPublicType, TeamType } from '../../../../../types'
import { sidePanelContextLogic } from '../../sidePanelContextLogic'
-import type { sidePanelNotificationsLogicType } from './sidePanelNotificationsLogicType'
+import type { SidePanelSceneContext } from '../../types'
const LEGACY_POLL_TIMEOUT = 5 * 60 * 1000
const SSE_RETRY_ATTEMPTS = 3
@@ -152,6 +166,263 @@ export interface ChangelogFlagPayload {
email?: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelNotificationsLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ currentOrganization: OrganizationType | null // organizationLogic
+ currentProjectId: number | null // projectLogic
+ sceneSidePanelContext: SidePanelSceneContext // sidePanelContextLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ currentTeamId: number | null // teamLogic
+ archivedGroups: NotificationGroup[]
+ archivedListOffset: number
+ archivedLoaded: boolean
+ archivedNotifications: InAppNotification[]
+ archivingEnabled: boolean
+ errorCounter: number
+ expandedGroupKeys: Set<string>
+ groups: NotificationGroup[]
+ hasArchivableNotifications: boolean
+ hasMoreArchived: boolean
+ hasMoreNotifications: boolean
+ hasNotifications: boolean
+ hasUnread: boolean
+ importantChanges: ChangesResponse | null
+ importantChangesLoading: boolean
+ inAppNotifications: InAppNotification[]
+ inAppUnreadCount: number
+ isInitialLoadComplete: boolean
+ isLoadingMore: boolean
+ isLoadingMoreArchived: boolean
+ legacyNotifications: HumanizedActivityLogItem[]
+ loadedGroupKeys: Set<string>
+ loadedUnreadCount: number
+ loadingGroupKeys: Set<string>
+ mainListOffset: number
+ manuallyToggledIds: Set<string>
+ notifications: HumanizedActivityLogItem[] | InAppNotification[]
+ projectNameForNotification: (notification: InAppNotification) => string | null
+ realTimeNotificationsEnabled: boolean
+ sourcePathForNotification: (notification: InAppNotification) => string | null
+ unreadCount: number
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelNotificationsLogicActions {
+ resourceEdited: (event: ResourceEditedEvent) => {
+ event: ResourceEditedEvent
+ } // resourceEditedLogic
+ loadCurrentTeamSuccess: (
+ currentTeam: TeamPublicType | null,
+ payload?: any
+ ) => {
+ currentTeam: TeamPublicType | null
+ payload?: any
+ } // teamLogic
+ appendArchivedNotifications: (
+ notifications: InAppNotification[],
+ hasMore: boolean
+ ) => {
+ hasMore: boolean
+ notifications: InAppNotification[]
+ }
+ appendInAppNotifications: (
+ notifications: InAppNotification[],
+ hasMore: boolean
+ ) => {
+ hasMore: boolean
+ notifications: InAppNotification[]
+ }
+ archiveAll: () => {
+ value: true
+ }
+ archiveGroup: (group: NotificationGroup) => {
+ group: NotificationGroup
+ }
+ archiveNotification: (id: string) => {
+ id: string
+ }
+ clearErrorCount: () => {
+ value: true
+ }
+ incrementErrorCount: () => {
+ value: true
+ }
+ initialLoadDone: () => {
+ value: true
+ }
+ loadArchivedGroupChildren: (group: NotificationGroup) => {
+ group: NotificationGroup
+ }
+ loadArchivedNotifications: () => {
+ value: true
+ }
+ loadGroupChildren: (group: NotificationGroup) => {
+ group: NotificationGroup
+ }
+ loadImportantChanges: (onlyUnread?: any) => {
+ onlyUnread: any
+ }
+ loadImportantChangesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadImportantChangesSuccess: (
+ importantChanges: ChangesResponse | null,
+ payload?: {
+ onlyUnread: any
+ }
+ ) => {
+ importantChanges: ChangesResponse | null
+ payload?: {
+ onlyUnread: any
+ }
+ }
+ loadMoreArchived: () => {
+ value: true
+ }
+ loadMoreArchivedSuccess: (count: number) => {
+ count: number
+ }
+ loadMoreNotifications: () => {
+ value: true
+ }
+ loadMoreNotificationsSuccess: (count: number) => {
+ count: number
+ }
+ markAllAsRead: () => {
+ value: true
+ }
+ markAllAsReadFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ markAllAsReadSuccess: (
+ importantChanges: ChangesResponse | null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ importantChanges: ChangesResponse | null
+ payload?: {
+ value: true
+ }
+ }
+ markAsRead: (id: string) => {
+ id: string
+ }
+ markGroupChildrenLoaded: (groupKey: string) => {
+ groupKey: string
+ }
+ navigateToNotification: (notification: InAppNotification) => {
+ notification: InAppNotification
+ }
+ notificationReceived: (notification: InAppNotification) => {
+ notification: InAppNotification
+ }
+ refreshInAppUnreadCount: () => {
+ value: true
+ }
+ removeNotifications: (ids: string[]) => {
+ ids: string[]
+ }
+ setArchivedNotifications: (
+ notifications: InAppNotification[],
+ hasMore: boolean
+ ) => {
+ hasMore: boolean
+ notifications: InAppNotification[]
+ }
+ setGroupChildrenRead: (
+ groupKey: string,
+ read: boolean
+ ) => {
+ groupKey: string
+ read: boolean
+ }
+ setGroupLoading: (
+ groupKey: string,
+ loading: boolean
+ ) => {
+ groupKey: string
+ loading: boolean
+ }
+ setInAppNotifications: (
+ notifications: InAppNotification[],
+ hasMore: boolean
+ ) => {
+ hasMore: boolean
+ notifications: InAppNotification[]
+ }
+ setInAppUnreadCount: (count: number) => {
+ count: number
+ }
+ startSSE: () => {
+ value: true
+ }
+ stopSSE: () => {
+ value: true
+ }
+ toggleGroupExpanded: (groupKey: string) => {
+ groupKey: string
+ }
+ toggleGroupRead: (group: NotificationGroup) => {
+ group: NotificationGroup
+ }
+ togglePolling: (pageIsVisible: boolean) => {
+ pageIsVisible: boolean
+ }
+ toggleRead: (id: string) => {
+ id: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelNotificationsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ realTimeNotificationsEnabled: (featureFlags: FeatureFlagsSet) => boolean
+ archivingEnabled: (featureFlags: FeatureFlagsSet) => boolean
+ legacyNotifications: (importantChanges: ChangesResponse | null) => HumanizedActivityLogItem[]
+ notifications: (
+ realTimeNotificationsEnabled: boolean,
+ legacyNotifications: HumanizedActivityLogItem[],
+ inAppNotifications: InAppNotification[]
+ ) => HumanizedActivityLogItem[] | InAppNotification[]
+ hasNotifications: (notifications: HumanizedActivityLogItem[] | InAppNotification[]) => boolean
+ hasArchivableNotifications: (inAppNotifications: InAppNotification[]) => boolean
+ unreadCount: (
+ realTimeNotificationsEnabled: boolean,
+ legacyNotifications: HumanizedActivityLogItem[],
+ inAppUnreadCount: number
+ ) => number
+ hasUnread: (unreadCount: number) => boolean
+ loadedUnreadCount: (inAppNotifications: InAppNotification[]) => number
+ projectNameForNotification: (
+ currentTeamId: number | null,
+ currentOrganization: OrganizationType | null
+ ) => (notification: InAppNotification) => string | null
+ sourcePathForNotification: (featureFlags: FeatureFlagsSet) => (notification: InAppNotification) => string | null
+ groups: (inAppNotifications: InAppNotification[], loadedGroupKeys: Set<string>) => NotificationGroup[]
+ archivedGroups: (
+ archivedNotifications: InAppNotification[],
+ loadedGroupKeys: Set<string>
+ ) => NotificationGroup[]
+ }
+}
+
+export type sidePanelNotificationsLogicType = MakeLogicType<
+ sidePanelNotificationsLogicValues,
+ sidePanelNotificationsLogicActions,
+ Record<string, any>,
+ sidePanelNotificationsLogicMeta
+>
+
export const sidePanelNotificationsLogic = kea<sidePanelNotificationsLogicType>([
path(['layout', 'navigation-3000', 'sidepanel', 'panels', 'activity', 'sidePanelNotificationsLogic']),
connect(() => ({
@@ -895,15 +1166,17 @@ export const sidePanelNotificationsLogic = kea<sidePanelNotificationsLogicType>(
selectors({
realTimeNotificationsEnabled: [
(s) => [s.featureFlags],
- (featureFlags): boolean => !!featureFlags[FEATURE_FLAGS.REAL_TIME_NOTIFICATIONS],
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet): boolean =>
+ !!featureFlags[FEATURE_FLAGS.REAL_TIME_NOTIFICATIONS],
],
archivingEnabled: [
(s) => [s.featureFlags],
- (featureFlags): boolean => !!featureFlags[FEATURE_FLAGS.CLEARABLE_NOTIFICATIONS],
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet): boolean =>
+ !!featureFlags[FEATURE_FLAGS.CLEARABLE_NOTIFICATIONS],
],
legacyNotifications: [
(s) => [s.importantChanges],
- (importantChanges): HumanizedActivityLogItem[] => {
+ (importantChanges: ChangesResponse | null): HumanizedActivityLogItem[] => {
try {
let importantChangesHumanized = humanize(importantChanges?.results || [], describerFor, true)
@@ -961,39 +1234,46 @@ export const sidePanelNotificationsLogic = kea<sidePanelNotificationsLogicType>(
notifications: [
(s) => [s.realTimeNotificationsEnabled, s.legacyNotifications, s.inAppNotifications],
(
- realTimeEnabled,
- legacyNotifications,
- inAppNotifications
+ realTimeEnabled: boolean,
+ legacyNotifications: HumanizedActivityLogItem[],
+ inAppNotifications: InAppNotification[]
): HumanizedActivityLogItem[] | InAppNotification[] => {
return realTimeEnabled ? inAppNotifications : legacyNotifications
},
],
- hasNotifications: [(s) => [s.notifications], (notifications) => !!notifications.length],
+ hasNotifications: [
+ (s) => [s.notifications],
+ (notifications: HumanizedActivityLogItem[] | InAppNotification[]) => !!notifications.length,
+ ],
hasArchivableNotifications: [
(s) => [s.inAppNotifications],
- (inAppNotifications): boolean => inAppNotifications.some((n) => n.archivable),
+ (inAppNotifications: InAppNotification[]): boolean => inAppNotifications.some((n) => n.archivable),
],
unreadCount: [
(s) => [s.realTimeNotificationsEnabled, s.legacyNotifications, s.inAppUnreadCount],
- (realTimeEnabled, legacyNotifications, inAppUnreadCount): number => {
+ (
+ realTimeEnabled: boolean,
+ legacyNotifications: HumanizedActivityLogItem[],
+ inAppUnreadCount: number
+ ): number => {
if (realTimeEnabled) {
return inAppUnreadCount
}
return legacyNotifications.filter((ic) => ic.unread).length
},
],
- hasUnread: [(s) => [s.unreadCount], (unreadCount) => unreadCount > 0],
+ hasUnread: [(s) => [s.unreadCount], (unreadCount: number) => unreadCount > 0],
// Unread among the rows actually loaded into the panel. The panel's "Mark all as read"
// button and Unread tab key off this — not `inAppUnreadCount`, a separately-fetched server
// total that's hand-patched at several call sites — so they can never drift from the
// visible rows. `inAppUnreadCount` stays the source for the global bell badge.
loadedUnreadCount: [
(s) => [s.inAppNotifications],
- (inAppNotifications): number => inAppNotifications.filter((n) => !n.read).length,
+ (inAppNotifications: InAppNotification[]): number => inAppNotifications.filter((n) => !n.read).length,
],
projectNameForNotification: [
(s) => [s.currentTeamId, s.currentOrganization],
- (currentTeamId, currentOrganization) => {
+ (currentTeamId: number | null, currentOrganization: null | import('~/types').OrganizationType) => {
return (notification: InAppNotification): string | null => {
if (notification.team_id === null || notification.team_id === currentTeamId) {
return null
@@ -1004,7 +1284,7 @@ export const sidePanelNotificationsLogic = kea<sidePanelNotificationsLogicType>(
],
sourcePathForNotification: [
(s) => [s.featureFlags],
- (featureFlags) =>
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet) =>
(notification: InAppNotification): string | null => {
// When the recap flag is on, the digest links to the recap page instead of the raw dashboard
const recapEnabled = !!featureFlags[FEATURE_FLAGS.WEB_ANALYTICS_RECAP]
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/discussion/sidePanelDiscussionLogic.ts b/frontend/src/layout/navigation-3000/sidepanel/panels/discussion/sidePanelDiscussionLogic.ts
index 52783c43d2c3..1c66cf70844b 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/panels/discussion/sidePanelDiscussionLogic.ts
+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/discussion/sidePanelDiscussionLogic.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 { subscriptions } from 'kea-subscriptions'
@@ -6,8 +6,100 @@ import api from 'lib/api'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { CommentsLogicProps } from 'scenes/comments/commentsLogic'
+import type { FeatureFlagsSet } from '../../../../../lib/logic/featureFlagLogic'
import { sidePanelContextLogic } from '../../sidePanelContextLogic'
-import type { sidePanelDiscussionLogicType } from './sidePanelDiscussionLogicType'
+import type { SidePanelSceneContext } from '../../types'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelDiscussionLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ sceneSidePanelContext: SidePanelSceneContext // sidePanelContextLogic
+ commentCount: number
+ commentCountLoading: boolean
+ commentsListRef: HTMLDivElement | null
+ commentsLogicProps: CommentsLogicProps | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelDiscussionLogicActions {
+ incrementCommentCount: () => any
+ incrementCommentCountFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ incrementCommentCountSuccess: (
+ commentCount: number,
+ payload?: any
+ ) => {
+ commentCount: number
+ payload?: any
+ }
+ loadCommentCount: () => {
+ value: true
+ }
+ loadCommentCountFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadCommentCountSuccess: (
+ commentCount: number,
+ payload?: {
+ value: true
+ }
+ ) => {
+ commentCount: number
+ payload?: {
+ value: true
+ }
+ }
+ resetCommentCount: () => {
+ value: true
+ }
+ resetCommentCountFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ resetCommentCountSuccess: (
+ commentCount: number,
+ payload?: {
+ value: true
+ }
+ ) => {
+ commentCount: number
+ payload?: {
+ value: true
+ }
+ }
+ scrollToLastComment: () => {
+ value: true
+ }
+ setCommentsListRef: (ref: HTMLDivElement) => {
+ ref: HTMLDivElement
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelDiscussionLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ commentsLogicProps: (sceneSidePanelContext: SidePanelSceneContext) => CommentsLogicProps | null
+ }
+}
+
+export type sidePanelDiscussionLogicType = MakeLogicType<
+ sidePanelDiscussionLogicValues,
+ sidePanelDiscussionLogicActions,
+ Record<string, any>,
+ sidePanelDiscussionLogicMeta
+>
export const sidePanelDiscussionLogic = kea<sidePanelDiscussionLogicType>([
path(['scenes', 'navigation', 'sidepanel', 'sidePanelDiscussionLogic']),
@@ -69,7 +161,7 @@ export const sidePanelDiscussionLogic = kea<sidePanelDiscussionLogicType>([
selectors({
commentsLogicProps: [
(s) => [s.sceneSidePanelContext],
- (sceneSidePanelContext): CommentsLogicProps | null => {
+ (sceneSidePanelContext: import('../../types').SidePanelSceneContext): CommentsLogicProps | null => {
return sceneSidePanelContext.activity_scope
? {
scope: sceneSidePanelContext.activity_scope,
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/exports/sidePanelExportsLogic.ts b/frontend/src/layout/navigation-3000/sidepanel/panels/exports/sidePanelExportsLogic.ts
index 08b970a56d1b..0f569ceb4fa1 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/panels/exports/sidePanelExportsLogic.ts
+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/exports/sidePanelExportsLogic.ts
@@ -1,9 +1,39 @@
-import { afterMount, connect, kea, path } from 'kea'
+import { MakeLogicType, afterMount, connect, kea, path } from 'kea'
import { exportsLogic } from 'lib/components/ExportButton/exportsLogic'
+import type { ExportedAssetType, ExporterFormat, SidePanelTab } from '../../../../../types'
import { sidePanelStateLogic } from '../../sidePanelStateLogic'
-import type { sidePanelExportsLogicType } from './sidePanelExportsLogicType'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelExportsLogicValues {
+ assetFormat: ExporterFormat | null // exportsLogic
+ exports: ExportedAssetType[] // exportsLogic
+ exportsLoading: boolean // exportsLogic
+ freshUndownloadedExports: ExportedAssetType[] // exportsLogic
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelExportsLogicActions {
+ loadExports: () => {
+ value: true
+ } // exportsLogic
+ removeFresh: (exportedAsset: ExportedAssetType) => {
+ exportedAsset: ExportedAssetType
+ } // exportsLogic
+ setAssetFormat: (format: ExporterFormat | null) => {
+ format: ExporterFormat | null
+ } // exportsLogic
+ openSidePanel: (
+ tab: SidePanelTab,
+ options?: string | undefined
+ ) => {
+ options: string | undefined
+ tab: SidePanelTab
+ } // sidePanelStateLogic
+}
+
+export type sidePanelExportsLogicType = MakeLogicType<sidePanelExportsLogicValues, sidePanelExportsLogicActions>
export const sidePanelExportsLogic = kea<sidePanelExportsLogicType>([
path(['scenes', 'navigation', 'sidepanel', 'sidePanelExportsLogic']),
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/max/sidePanelMaxAILogic.ts b/frontend/src/layout/navigation-3000/sidepanel/panels/max/sidePanelMaxAILogic.ts
index 58a113adcd32..3faca2d3065f 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/panels/max/sidePanelMaxAILogic.ts
+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/max/sidePanelMaxAILogic.ts
@@ -1,7 +1,6 @@
-import { actions, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, listeners, path, reducers } from 'kea'
import { loaders } from 'kea-loaders'
-import type { sidePanelMaxAILogicType } from './sidePanelMaxAILogicType'
import { sidePanelMaxAPI } from './sidePanelMaxAPI'
interface RateLimit {
@@ -43,6 +42,74 @@ interface RateLimitAction {
limitType?: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelMaxAILogicValues {
+ assistantResponse: string | null
+ assistantResponseLoading: boolean
+ currentMessages: ChatMessage[]
+ hasServerError: boolean
+ isRateLimited: boolean
+ isSearchingThinking: boolean
+ rateLimitType: string | null
+ retryAfter: number | null
+ retryAttempts: number
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelMaxAILogicActions {
+ appendAssistantMessage: (content: string) => {
+ content: string
+ }
+ clearChatHistory: () => {
+ value: true
+ }
+ retryAfter: (
+ message: string,
+ retryAfter: number,
+ limitType?: string
+ ) => {
+ limitType: string | undefined
+ message: string
+ retryAfter: number
+ }
+ setRateLimited: (
+ isLimited: boolean,
+ limitType?: string
+ ) => {
+ isLimited: boolean
+ limitType: string | undefined
+ }
+ setSearchingThinking: (isSearching: boolean) => {
+ isSearching: boolean
+ }
+ setServerError: (isError: boolean) => {
+ isError: boolean
+ }
+ submitMessage: (message: string) => {
+ message: string
+ }
+ submitMessageFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ submitMessageSuccess: (
+ assistantResponse: string | null,
+ payload?: {
+ message: string
+ }
+ ) => {
+ assistantResponse: string | null
+ payload?: {
+ message: string
+ }
+ }
+}
+
+export type sidePanelMaxAILogicType = MakeLogicType<sidePanelMaxAILogicValues, sidePanelMaxAILogicActions>
+
export const sidePanelMaxAILogic = kea<sidePanelMaxAILogicType>([
path(['scenes', 'navigation', 'sidepanel', 'sidePanelMaxAILogic']),
diff --git a/frontend/src/layout/navigation-3000/sidepanel/sidePanelContextLogic.ts b/frontend/src/layout/navigation-3000/sidepanel/sidePanelContextLogic.ts
index 83364fe8f571..3a4b3c697494 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/sidePanelContextLogic.ts
+++ b/frontend/src/layout/navigation-3000/sidepanel/sidePanelContextLogic.ts
@@ -1,4 +1,4 @@
-import { connect, kea, path, selectors } from 'kea'
+import { MakeLogicType, connect, kea, path, selectors } from 'kea'
import { router } from 'kea-router'
import { objectsEqual } from 'kea-test-utils'
@@ -6,7 +6,6 @@ import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
import { sceneLogic } from 'scenes/sceneLogic'
import { SceneConfig } from 'scenes/sceneTypes'
-import type { sidePanelContextLogicType } from './sidePanelContextLogicType'
import { SidePanelSceneContext } from './types'
import { SIDE_PANEL_CONTEXT_KEY } from './types'
@@ -26,6 +25,26 @@ export const activityFiltersForScene = (sceneConfig: SceneConfig | null): SidePa
return null
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelContextLogicValues {
+ sceneConfig: SceneConfig | null // sceneLogic
+ sceneSidePanelContext: SidePanelSceneContext
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelContextLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ sceneSidePanelContext: (sceneConfig: SceneConfig | null, arg: any) => SidePanelSceneContext
+ }
+}
+
+export type sidePanelContextLogicType = MakeLogicType<
+ sidePanelContextLogicValues,
+ {},
+ Record<string, any>,
+ sidePanelContextLogicMeta
+>
+
export const sidePanelContextLogic = kea<sidePanelContextLogicType>([
path(['scenes', 'navigation', 'sidepanel', 'sidePanelContextLogic']),
connect(() => ({
@@ -54,7 +73,7 @@ export const sidePanelContextLogic = kea<sidePanelContextLogicType>([
return null
},
],
- (sceneConfig, context): SidePanelSceneContext => {
+ (sceneConfig: SceneConfig | null, context): SidePanelSceneContext => {
return {
...context,
...(!context?.activity_scope ? activityFiltersForScene(sceneConfig) : {}),
diff --git a/frontend/src/layout/navigation-3000/sidepanel/sidePanelLogic.tsx b/frontend/src/layout/navigation-3000/sidepanel/sidePanelLogic.tsx
index c31f6205d9b0..f14da97ae7e8 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/sidePanelLogic.tsx
+++ b/frontend/src/layout/navigation-3000/sidepanel/sidePanelLogic.tsx
@@ -1,4 +1,4 @@
-import { connect, kea, path, selectors } from 'kea'
+import { MakeLogicType, connect, kea, path, selectors } from 'kea'
import { combineUrl, router, urlToAction } from 'kea-router'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
@@ -9,9 +9,10 @@ import { userLogic } from 'scenes/userLogic'
import { sceneLayoutLogic } from '~/layout/scenes/sceneLayoutLogic'
import { AvailableFeature, SidePanelTab } from '~/types'
+import type { TeamPublicType, TeamType } from '../../../types'
import { sidePanelContextLogic } from './sidePanelContextLogic'
-import type { sidePanelLogicType } from './sidePanelLogicType'
import { sidePanelStateLogic } from './sidePanelStateLogic'
+import type { SidePanelSceneContext } from './types'
const TABS_REQUIRING_A_TEAM = [
SidePanelTab.Max,
@@ -22,6 +23,54 @@ const TABS_REQUIRING_A_TEAM = [
SidePanelTab.Exports,
]
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelLogicValues {
+ isCloudOrDev: boolean | undefined // preflightLogic
+ scenePanelIsPresent: boolean // sceneLayoutLogic
+ sceneSidePanelContext: SidePanelSceneContext // sidePanelContextLogic
+ selectedTab: SidePanelTab | null // sidePanelStateLogic
+ sidePanelOpen: boolean // sidePanelStateLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean // userLogic
+ enabledTabs: SidePanelTab[]
+ visibleTabs: SidePanelTab[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelLogicActions {
+ closeSidePanel: (tab?: SidePanelTab | undefined) => {
+ tab: SidePanelTab | undefined
+ } // sidePanelStateLogic
+ openSidePanel: (
+ tab: SidePanelTab,
+ options?: string | undefined
+ ) => {
+ options: string | undefined
+ tab: SidePanelTab
+ } // sidePanelStateLogic
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ enabledTabs: (
+ sceneSidePanelContext: SidePanelSceneContext,
+ currentTeam: TeamPublicType | TeamType | null,
+ scenePanelIsPresent: boolean,
+ isCloudOrDev: boolean | undefined,
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean
+ ) => SidePanelTab[]
+ visibleTabs: (enabledTabs: SidePanelTab[]) => SidePanelTab[]
+ }
+}
+
+export type sidePanelLogicType = MakeLogicType<
+ sidePanelLogicValues,
+ sidePanelLogicActions,
+ Record<string, any>,
+ sidePanelLogicMeta
+>
+
export const sidePanelLogic = kea<sidePanelLogicType>([
path(['scenes', 'navigation', 'sidepanel', 'sidePanelLogic']),
connect(() => ({
@@ -51,7 +100,13 @@ export const sidePanelLogic = kea<sidePanelLogicType>([
s.isCloudOrDev,
s.hasAvailableFeature,
],
- (sceneSidePanelContext, currentTeam, scenePanelIsPresent, isCloudOrDev, hasAvailableFeature) => {
+ (
+ sceneSidePanelContext: import('./types').SidePanelSceneContext,
+ currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType,
+ scenePanelIsPresent: boolean,
+ isCloudOrDev: boolean | undefined,
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean
+ ) => {
const tabs: SidePanelTab[] = []
if (scenePanelIsPresent) {
@@ -88,7 +143,7 @@ export const sidePanelLogic = kea<sidePanelLogicType>([
/** Tabs shown in the navigation bar */
visibleTabs: [
(s) => [s.enabledTabs],
- (enabledTabs): SidePanelTab[] => {
+ (enabledTabs: SidePanelTab[]): SidePanelTab[] => {
// Some tabs are openable programmatically but not shown in the nav bar
const hiddenTabs: SidePanelTab[] = [SidePanelTab.Exports]
return enabledTabs.filter((tab) => !hiddenTabs.includes(tab))
diff --git a/frontend/src/layout/navigation-3000/sidepanel/sidePanelStateLogic.tsx b/frontend/src/layout/navigation-3000/sidepanel/sidePanelStateLogic.tsx
index 20df423b775a..82c4d70e80a6 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/sidePanelStateLogic.tsx
+++ b/frontend/src/layout/navigation-3000/sidepanel/sidePanelStateLogic.tsx
@@ -1,11 +1,43 @@
-import { actions, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, listeners, path, reducers } from 'kea'
import { actionToUrl, router, urlToAction } from 'kea-router'
import { windowValues } from 'kea-window-values'
import posthog from 'posthog-js'
import { SidePanelTab } from '~/types'
-import type { sidePanelStateLogicType } from './sidePanelStateLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelStateLogicValues {
+ modalMode: boolean
+ selectedTab: SidePanelTab | null
+ selectedTabOptions: string | null
+ sidePanelAvailable: boolean
+ sidePanelOpen: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sidePanelStateLogicActions {
+ closeSidePanel: (tab?: SidePanelTab) => {
+ tab: SidePanelTab | undefined
+ }
+ openSidePanel: (
+ tab: SidePanelTab,
+ options?: string
+ ) => {
+ options: string | undefined
+ tab: SidePanelTab
+ }
+ setSidePanelAvailable: (available: boolean) => {
+ available: boolean
+ }
+ setSidePanelOpen: (open: boolean) => {
+ open: boolean
+ }
+ setSidePanelOptions: (options: string | null) => {
+ options: string | null
+ }
+}
+
+export type sidePanelStateLogicType = MakeLogicType<sidePanelStateLogicValues, sidePanelStateLogicActions>
// The side panel imports a lot of other components so this allows us to avoid circular dependencies
diff --git a/frontend/src/layout/navigation/Breadcrumbs/breadcrumbsLogic.tsx b/frontend/src/layout/navigation/Breadcrumbs/breadcrumbsLogic.tsx
index 2ef611c0125f..3256cd8f2628 100644
--- a/frontend/src/layout/navigation/Breadcrumbs/breadcrumbsLogic.tsx
+++ b/frontend/src/layout/navigation/Breadcrumbs/breadcrumbsLogic.tsx
@@ -1,4 +1,4 @@
-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 { subscriptions } from 'kea-subscriptions'
import { objectsEqual } from 'lib/utils/objects'
@@ -13,7 +13,99 @@ import { userLogic } from 'scenes/userLogic'
import { Breadcrumb, ProjectTreeRef } from '~/types'
-import type { breadcrumbsLogicType } from './breadcrumbsLogicType'
+import type { SceneConfig, SceneParams } from '../../../scenes/sceneTypes'
+import type { OrganizationBasicType, OrganizationType, PreflightStatus, ProjectType, UserType } from '../../../types'
+import type { TeamPublicType, TeamType } from '../../../types'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface breadcrumbsLogicValues {
+ currentOrganization: OrganizationType | null // organizationLogic
+ preflight: PreflightStatus | null // preflightLogic
+ currentProject: ProjectType | null // projectLogic
+ activeSceneId: string | null // sceneLogic
+ sceneConfig: SceneConfig | null // sceneLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ otherOrganizations: OrganizationBasicType[] // userLogic
+ user: UserType | null // userLogic
+ actionsContainer: HTMLElement | null
+ appBreadcrumbs: Breadcrumb[]
+ breadcrumbs: Breadcrumb[]
+ documentTitle: string
+ firstBreadcrumb: Breadcrumb
+ projectTreeRef: ProjectTreeRef | null
+ renameState: [breadcrumbGlobalKey: string, tentativeName: string] | null
+ sceneBreadcrumbKeys: Breadcrumb['key'][]
+ sceneBreadcrumbs: Breadcrumb[]
+ sceneBreadcrumbsDisplayString: string
+ tailBreadcrumbs: Breadcrumb[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface breadcrumbsLogicActions {
+ finishRenaming: () => {
+ value: true
+ }
+ setActionsContainer: (element: HTMLElement | null) => {
+ element: HTMLElement | null
+ }
+ tentativelyRename: (
+ breadcrumbGlobalKey: string,
+ tentativeName: string
+ ) => {
+ breadcrumbGlobalKey: string
+ tentativeName: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface breadcrumbsLogicProps {
+ hashParams: Record<string, any>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface breadcrumbsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ sceneBreadcrumbs: (arg: Breadcrumb[]) => Breadcrumb[]
+ projectTreeRef: (arg: ProjectTreeRef | null) => ProjectTreeRef | null
+ appBreadcrumbs: (
+ preflight: PreflightStatus | null,
+ sceneConfig: SceneConfig | null,
+ activeSceneId: string | null,
+ user: UserType | null,
+ currentProject: ProjectType | null,
+ currentTeam: TeamPublicType | TeamType | null
+ ) => Breadcrumb[]
+ sceneBreadcrumbKeys: (sceneBreadcrumbs: Breadcrumb[]) => Breadcrumb['key'][]
+ breadcrumbs: (appBreadcrumbs: Breadcrumb[], sceneBreadcrumbs: Breadcrumb[]) => Breadcrumb[]
+ firstBreadcrumb: (breadcrumbs: Breadcrumb[]) => Breadcrumb
+ tailBreadcrumbs: (breadcrumbs: Breadcrumb[]) => Breadcrumb[]
+ 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<
+ breadcrumbsLogicValues,
+ breadcrumbsLogicActions,
+ breadcrumbsLogicProps,
+ breadcrumbsLogicMeta
+>
export const breadcrumbsLogic = kea<breadcrumbsLogicType>([
path(['layout', 'navigation', 'Breadcrumbs', 'breadcrumbsLogic']),
@@ -95,7 +187,7 @@ export const breadcrumbsLogic = kea<breadcrumbsLogicType>([
return []
},
],
- (crumbs): Breadcrumb[] => crumbs,
+ (crumbs: Breadcrumb[]): Breadcrumb[] => crumbs,
{ resultEqualityCheck: objectsEqual },
],
projectTreeRef: [
@@ -121,7 +213,14 @@ export const breadcrumbsLogic = kea<breadcrumbsLogicType>([
],
appBreadcrumbs: [
(s) => [s.preflight, s.sceneConfig, s.activeSceneId, s.user, s.currentProject, s.currentTeam],
- (preflight, sceneConfig, activeSceneId, user, currentProject, currentTeam) => {
+ (
+ preflight: null | import('~/types').PreflightStatus,
+ sceneConfig: null | import('../../../scenes/sceneTypes').SceneConfig,
+ activeSceneId: string | null,
+ user: null | import('~/types').UserType,
+ currentProject: null | import('~/types').ProjectType,
+ currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType
+ ) => {
const breadcrumbs: Breadcrumb[] = []
if (!activeSceneId || !sceneConfig) {
return breadcrumbs
@@ -164,18 +263,19 @@ export const breadcrumbsLogic = kea<breadcrumbsLogicType>([
],
sceneBreadcrumbKeys: [
(s) => [s.sceneBreadcrumbs],
- (sceneBreadcrumbs): Breadcrumb['key'][] => sceneBreadcrumbs.map((breadcrumb) => breadcrumb.key),
+ (sceneBreadcrumbs: Breadcrumb[]): Breadcrumb['key'][] =>
+ sceneBreadcrumbs.map((breadcrumb) => breadcrumb.key),
],
breadcrumbs: [
(s) => [s.appBreadcrumbs, s.sceneBreadcrumbs],
- (appBreadcrumbs, sceneBreadcrumbs): Breadcrumb[] => {
+ (appBreadcrumbs: Breadcrumb[], sceneBreadcrumbs: Breadcrumb[]): Breadcrumb[] => {
return appBreadcrumbs.concat(sceneBreadcrumbs)
},
],
- firstBreadcrumb: [(s) => [s.breadcrumbs], (breadcrumbs) => breadcrumbs[0]],
+ firstBreadcrumb: [(s) => [s.breadcrumbs], (breadcrumbs: Breadcrumb[]) => breadcrumbs[0]],
tailBreadcrumbs: [
(s) => [s.breadcrumbs],
- (breadcrumbs) => {
+ (breadcrumbs: Breadcrumb[]) => {
const tailBreadcrumbs = breadcrumbs.slice(1)
// Remove "path" from the last breadcrumb to disable its link
if (tailBreadcrumbs.length > 0) {
@@ -186,7 +286,7 @@ export const breadcrumbsLogic = kea<breadcrumbsLogicType>([
],
sceneBreadcrumbsDisplayString: [
(s) => [s.sceneBreadcrumbs],
- (sceneBreadcrumbs): string =>
+ (sceneBreadcrumbs: Breadcrumb[]): string =>
sceneBreadcrumbs
.filter((breadcrumb) => !!breadcrumb.name)
.map((breadcrumb) => breadcrumb.name)
@@ -194,7 +294,7 @@ export const breadcrumbsLogic = kea<breadcrumbsLogicType>([
],
documentTitle: [
(s) => [s.sceneBreadcrumbs, s.preflight],
- (sceneBreadcrumbs, preflight): string =>
+ (sceneBreadcrumbs: Breadcrumb[], preflight: null | import('~/types').PreflightStatus): string =>
[
...sceneBreadcrumbs
.filter((breadcrumb) => !!breadcrumb.name)
diff --git a/frontend/src/layout/navigation/ImpersonationNotice/impersonationNoticeLogic.ts b/frontend/src/layout/navigation/ImpersonationNotice/impersonationNoticeLogic.ts
index 7d9ef8852a09..58a2ed21bcc6 100644
--- a/frontend/src/layout/navigation/ImpersonationNotice/impersonationNoticeLogic.ts
+++ b/frontend/src/layout/navigation/ImpersonationNotice/impersonationNoticeLogic.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 { urlToAction } from 'kea-router'
import { lemonToast } from '@posthog/lemon-ui'
@@ -13,7 +13,6 @@ import { userLogic } from 'scenes/userLogic'
import { OrganizationMemberType, Region, UserType } from '~/types'
import { adminLoginAs } from './adminLoginAs'
-import type { impersonationNoticeLogicType } from './impersonationNoticeLogicType'
export interface ExpiredSessionInfo {
email: string
@@ -48,6 +47,126 @@ function adminLoginUrlForRegion(region: Region, email: string): string {
return `https://${domain}/admin/posthog/user/?q=${encodeURIComponent(email)}`
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface impersonationNoticeLogicValues {
+ members: OrganizationMemberType[] | null // membersLogic
+ membersLoading: boolean // membersLogic
+ isImpersonationUpgradeInProgress: boolean // userLogic
+ user: UserType | null // userLogic
+ adminLoginUrls: AdminLoginUrl[]
+ changeableMembers: OrganizationMemberType[]
+ expiredSessionInfo: ExpiredSessionInfo | null
+ isChangingUser: boolean
+ isImpersonated: boolean
+ isMinimized: boolean
+ isReImpersonating: boolean
+ isReadOnly: boolean
+ isSessionExpired: boolean
+ isUpgradeModalOpen: boolean
+ pageHiddenAt: number | null
+ ticketContext: ImpersonationTicketContext | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface impersonationNoticeLogicActions {
+ ensureAllMembersLoaded: () => {
+ value: true
+ } // membersLogic
+ loadUser: (resetOnFailure?: boolean) => {
+ resetOnFailure: boolean | undefined
+ } // userLogic
+ loadUserSuccess: (
+ user: UserType | null,
+ payload?: {
+ resetOnFailure: boolean | undefined
+ }
+ ) => {
+ payload?: {
+ resetOnFailure: boolean | undefined
+ }
+ user: UserType | null
+ } // userLogic
+ upgradeImpersonation: (reason: string) => {
+ reason: string
+ } // userLogic
+ upgradeImpersonationSuccess: (
+ user: UserType | null,
+ payload?: {
+ reason: string
+ }
+ ) => {
+ payload?: {
+ reason: string
+ }
+ user: UserType | null
+ } // userLogic
+ changeUser: (
+ userId: number,
+ reason?: string
+ ) => {
+ reason: string | undefined
+ userId: number
+ }
+ changeUserFailure: (error: string) => {
+ error: string
+ }
+ clearPageHiddenAt: () => {
+ value: true
+ }
+ closeUpgradeModal: () => {
+ value: true
+ }
+ maximize: () => {
+ value: true
+ }
+ minimize: () => {
+ value: true
+ }
+ openUpgradeModal: () => {
+ value: true
+ }
+ reImpersonate: (
+ reason: string,
+ readOnly: boolean
+ ) => {
+ readOnly: boolean
+ reason: string
+ }
+ reImpersonateFailure: (error: string) => {
+ error: string
+ }
+ returnToPostHog: () => {
+ value: true
+ }
+ setPageVisible: (visible: boolean) => {
+ visible: boolean
+ }
+ setSessionExpired: (info: ExpiredSessionInfo | null) => {
+ info: ExpiredSessionInfo | null
+ }
+ setTicketContext: (context: ImpersonationTicketContext | null) => {
+ context: ImpersonationTicketContext | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface impersonationNoticeLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ isReadOnly: (user: UserType | null) => boolean
+ isImpersonated: (user: UserType | null) => boolean
+ adminLoginUrls: (ticketContext: ImpersonationTicketContext | null) => AdminLoginUrl[]
+ isSessionExpired: (expiredSessionInfo: ExpiredSessionInfo | null) => boolean
+ changeableMembers: (members: OrganizationMemberType[] | null, user: UserType | null) => OrganizationMemberType[]
+ }
+}
+
+export type impersonationNoticeLogicType = MakeLogicType<
+ impersonationNoticeLogicValues,
+ impersonationNoticeLogicActions,
+ Record<string, any>,
+ impersonationNoticeLogicMeta
+>
+
export const impersonationNoticeLogic = kea<impersonationNoticeLogicType>([
path(['layout', 'navigation', 'ImpersonationNotice', 'impersonationNoticeLogic']),
diff --git a/frontend/src/layout/navigation/SelfReadOnlyNotice/selfReadOnlyModeLogic.ts b/frontend/src/layout/navigation/SelfReadOnlyNotice/selfReadOnlyModeLogic.ts
index df65678256b7..39c640cd92c7 100644
--- a/frontend/src/layout/navigation/SelfReadOnlyNotice/selfReadOnlyModeLogic.ts
+++ b/frontend/src/layout/navigation/SelfReadOnlyNotice/selfReadOnlyModeLogic.ts
@@ -1,4 +1,15 @@
-import { actions, afterMount, beforeUnmount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ beforeUnmount,
+ connect,
+ kea,
+ listeners,
+ path,
+ reducers,
+ selectors,
+} from 'kea'
import posthog from 'posthog-js'
import { lemonToast } from '@posthog/lemon-ui'
@@ -7,7 +18,7 @@ import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { setReadOnlyGetter, setReadOnlyNotifier } from 'lib/readOnlyGuard'
-import type { selfReadOnlyModeLogicType } from './selfReadOnlyModeLogicType'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
export const ESCALATION_OPTIONS = [
{ seconds: 30, label: 'Allow for 30s' },
@@ -31,6 +42,44 @@ export function dropReadOnlyExceptions<T extends { event?: string; properties?:
return event
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface selfReadOnlyModeLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ escalatedUntil: number | null
+ isEscalated: boolean
+ isFlagEnabled: boolean
+ isReadOnly: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface selfReadOnlyModeLogicActions {
+ endEscalation: () => {
+ value: true
+ }
+ escalate: (durationSeconds: number) => {
+ durationSeconds: number
+ }
+ notifyBlocked: (method: string) => {
+ method: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface selfReadOnlyModeLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ isFlagEnabled: (featureFlags: FeatureFlagsSet) => boolean
+ isEscalated: (escalatedUntil: number | null) => boolean
+ isReadOnly: (isFlagEnabled: boolean, isEscalated: boolean) => boolean
+ }
+}
+
+export type selfReadOnlyModeLogicType = MakeLogicType<
+ selfReadOnlyModeLogicValues,
+ selfReadOnlyModeLogicActions,
+ Record<string, any>,
+ selfReadOnlyModeLogicMeta
+>
+
export const selfReadOnlyModeLogic = kea<selfReadOnlyModeLogicType>([
path(['layout', 'navigation', 'SelfReadOnlyNotice', 'selfReadOnlyModeLogic']),
@@ -57,16 +106,20 @@ export const selfReadOnlyModeLogic = kea<selfReadOnlyModeLogicType>([
selectors({
isFlagEnabled: [
(s) => [s.featureFlags],
- (featureFlags): boolean => !!featureFlags[FEATURE_FLAGS.READ_ONLY_MODE],
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet): boolean =>
+ !!featureFlags[FEATURE_FLAGS.READ_ONLY_MODE],
],
// isEscalated reads Date.now() inside a selector — selectors aren't time-reactive.
// It only flips back to false when escalatedUntil is reset by the setTimeout in the
// `escalate` listener firing `endEscalation`. Acceptable: the timer runs even on
// hidden tabs (pauseOnPageHidden: false).
- isEscalated: [(s) => [s.escalatedUntil], (until): boolean => until !== null && until > Date.now()],
+ isEscalated: [
+ (s) => [s.escalatedUntil],
+ (until: number | null): boolean => until !== null && until > Date.now(),
+ ],
isReadOnly: [
(s) => [s.isFlagEnabled, s.isEscalated],
- (isFlagEnabled, isEscalated): boolean => isFlagEnabled && !isEscalated,
+ (isFlagEnabled: boolean, isEscalated: boolean): boolean => isFlagEnabled && !isEscalated,
],
}),
diff --git a/frontend/src/layout/navigation/navigationLogic.ts b/frontend/src/layout/navigation/navigationLogic.ts
index 05a15cb5484d..aa6d76e111e9 100644
--- a/frontend/src/layout/navigation/navigationLogic.ts
+++ b/frontend/src/layout/navigation/navigationLogic.ts
@@ -1,7 +1,24 @@
-import { actions, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
import { windowValues } from 'kea-window-values'
-import type { navigationLogicType } from './navigationLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface navigationLogicValues {
+ fullscreen: boolean
+ isConfigureHomeModalOpen: boolean
+ mobileLayout: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface navigationLogicActions {
+ hideConfigureHomeModal: () => {
+ value: true
+ }
+ showConfigureHomeModal: () => {
+ value: true
+ }
+}
+
+export type navigationLogicType = MakeLogicType<navigationLogicValues, navigationLogicActions>
export const navigationLogic = kea<navigationLogicType>([
path(['layout', 'navigation', 'navigationLogic']),
diff --git a/frontend/src/layout/navigation/noEventsBannerLogic.ts b/frontend/src/layout/navigation/noEventsBannerLogic.ts
index 8e777ce3421c..1df29f4493b2 100644
--- a/frontend/src/layout/navigation/noEventsBannerLogic.ts
+++ b/frontend/src/layout/navigation/noEventsBannerLogic.ts
@@ -1,11 +1,16 @@
-import { afterMount, connect, kea, path } from 'kea'
+import { MakeLogicType, afterMount, connect, kea, path } from 'kea'
import { teamLogic } from 'scenes/teamLogic'
-import type { noEventsBannerLogicType } from './noEventsBannerLogicType'
-
const POLL_INTERVAL_MS = 30_000
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface noEventsBannerLogicActions {
+ loadCurrentTeam: () => any // teamLogic
+}
+
+export type noEventsBannerLogicType = MakeLogicType<{}, noEventsBannerLogicActions>
+
export const noEventsBannerLogic = kea<noEventsBannerLogicType>([
path(['layout', 'navigation', 'noEventsBannerLogic']),
connect(() => ({
diff --git a/frontend/src/layout/navigation/projectNoticeLogic.tsx b/frontend/src/layout/navigation/projectNoticeLogic.tsx
index be63c8064f93..bfd2332095d6 100644
--- a/frontend/src/layout/navigation/projectNoticeLogic.tsx
+++ b/frontend/src/layout/navigation/projectNoticeLogic.tsx
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
@@ -29,8 +29,6 @@ import { userLogic } from 'scenes/userLogic'
import { ProductKey } from '~/queries/schema/schema-general'
import { OnboardingStepKey, UserType } from '~/types'
-import type { projectNoticeLogicType } from './projectNoticeLogicType'
-
export type ProjectNoticeVariant =
| 'billing_alert'
| 'demo_project'
@@ -115,6 +113,117 @@ function buildBillingAlertNotice(
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface projectNoticeLogicValues {
+ memberCount: number // membersLogic
+ currentOrganizationId: string // organizationLogic
+ hasReverseProxy: boolean | null // reverseProxyCheckerLogic
+ user: UserType | null // userLogic
+ effectiveBillingAlert: BillingAlertConfig | null
+ noticeDismissedThisSession: boolean
+ projectNotice: ProjectNoticeBlueprint | null
+ projectNoticeDismissKey: string | null
+ projectNoticeVariant: ProjectNoticeVariant | null
+ proxyRecords: ProxyRecord[] | null
+ proxyRecordsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface projectNoticeLogicActions {
+ reportProjectNoticeDismissed: (key: string) => {
+ key: string
+ } // eventUsageLogic
+ reportProjectNoticeShown: (variant: string) => {
+ variant: string
+ } // eventUsageLogic
+ requestVerificationLink: (uuid: string) => {
+ uuid: string
+ } // verifyEmailLogic
+ dismissProjectNotice: (dismissKey: string | null) => {
+ dismissKey: string | null
+ }
+ loadRecords: () => any
+ loadRecordsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRecordsSuccess: (
+ proxyRecords: ProxyRecord[] | null,
+ payload?: any
+ ) => {
+ proxyRecords: ProxyRecord[] | null
+ payload?: any
+ }
+ reportNoticeShown: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface projectNoticeLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ effectiveBillingAlert: (
+ billingAlert: BillingAlertConfig | null,
+ fakeBillingAlert: import('lib/components/Superpowers/superpowersLogic').FakeBillingAlert
+ ) => BillingAlertConfig | null
+ projectNoticeVariant: (
+ currentOrganization: null | import('~/types').OrganizationType,
+ currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType,
+ preflight: null | import('~/types').PreflightStatus,
+ isCloudOrDev: boolean | undefined,
+ user: UserType | null,
+ memberCount: number,
+ internetConnectionIssue: boolean,
+ hasProjectNoticeRestriction: boolean,
+ proxyRecords: ProxyRecord[] | null,
+ effectiveBillingAlert: BillingAlertConfig | null,
+ currentLocation: {
+ hash: string
+ hashParams: Record<string, any>
+ method: string
+ pathname: string
+ search: string
+ searchParams: Record<string, any>
+ },
+ noticeDismissedThisSession: boolean,
+ activeSceneId: string | null,
+ arg: number,
+ hasReverseProxy: boolean | null
+ ) => ProjectNoticeVariant | null
+ projectNoticeDismissKey: (
+ projectNoticeVariant: ProjectNoticeVariant | null,
+ effectiveBillingAlert: BillingAlertConfig | null
+ ) => string | null
+ projectNotice: (
+ projectNoticeVariant: ProjectNoticeVariant | null,
+ effectiveBillingAlert: BillingAlertConfig | null,
+ projectNoticeDismissKey: string | null,
+ currentOrganization: null | import('~/types').OrganizationType,
+ user: UserType | null,
+ canAccessBilling: boolean,
+ currentLocation: {
+ hash: string
+ hashParams: Record<string, any>
+ method: string
+ pathname: string
+ search: string
+ searchParams: Record<string, any>
+ },
+ activeSceneProductKey: ProductKey | null
+ ) => ProjectNoticeBlueprint | null
+ }
+}
+
+export type projectNoticeLogicType = MakeLogicType<
+ projectNoticeLogicValues,
+ projectNoticeLogicActions,
+ Record<string, any>,
+ projectNoticeLogicMeta
+>
+
export const projectNoticeLogic = kea<projectNoticeLogicType>([
path(['layout', 'navigation', 'projectNoticeLogic']),
connect(() => ({
@@ -172,7 +281,10 @@ export const projectNoticeLogic = kea<projectNoticeLogicType>([
selectors({
effectiveBillingAlert: [
() => [billingLogic.selectors.billingAlert, superpowersLogic.selectors.fakeBillingAlert],
- (billingAlert, fakeBillingAlert): BillingAlertConfig | null => {
+ (
+ billingAlert: BillingAlertConfig | null,
+ fakeBillingAlert: import('lib/components/Superpowers/superpowersLogic').FakeBillingAlert
+ ): BillingAlertConfig | null => {
if (fakeBillingAlert !== 'none') {
return {
status: fakeBillingAlert,
@@ -203,21 +315,28 @@ export const projectNoticeLogic = kea<projectNoticeLogicType>([
s.hasReverseProxy,
],
(
- organization,
- currentTeam,
- preflight,
- isCloudOrDev,
- user,
- memberCount,
- internetConnectionIssue,
- hasEventIngestionRestriction,
- proxyRecords,
- effectiveBillingAlert,
- currentLocation,
- noticeDismissedThisSession,
- activeSceneId,
- liveEventCount,
- hasReverseProxy
+ organization: null | import('~/types').OrganizationType,
+ currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType,
+ preflight: null | import('~/types').PreflightStatus,
+ isCloudOrDev: boolean | undefined,
+ user: UserType | null,
+ memberCount: number,
+ internetConnectionIssue: boolean,
+ hasEventIngestionRestriction: boolean,
+ proxyRecords: ProxyRecord[] | null,
+ effectiveBillingAlert: BillingAlertConfig | null,
+ currentLocation: {
+ hash: string
+ hashParams: Record<string, any>
+ method: string
+ pathname: string
+ search: string
+ searchParams: Record<string, any>
+ },
+ noticeDismissedThisSession: boolean,
+ activeSceneId: string | null,
+ liveEventCount: number,
+ hasReverseProxy: boolean | null
): ProjectNoticeVariant | null => {
if (!organization) {
return null
@@ -279,7 +398,7 @@ export const projectNoticeLogic = kea<projectNoticeLogicType>([
],
projectNoticeDismissKey: [
(s) => [s.projectNoticeVariant, s.effectiveBillingAlert],
- (variant, effectiveBillingAlert): string | null => {
+ (variant: ProjectNoticeVariant | null, effectiveBillingAlert: BillingAlertConfig | null): string | null => {
switch (variant) {
case 'billing_alert':
return effectiveBillingAlert?.dismissKey
@@ -306,14 +425,21 @@ export const projectNoticeLogic = kea<projectNoticeLogicType>([
sceneLogic.selectors.activeSceneProductKey,
],
(
- variant,
- effectiveBillingAlert,
- dismissKey,
- currentOrganization,
- user,
- canAccessBilling,
- currentLocation,
- activeSceneProductKey
+ variant: ProjectNoticeVariant | null,
+ effectiveBillingAlert: BillingAlertConfig | null,
+ dismissKey: string | null,
+ currentOrganization: null | import('~/types').OrganizationType,
+ user: UserType | null,
+ canAccessBilling: boolean,
+ currentLocation: {
+ hash: string
+ hashParams: Record<string, any>
+ method: string
+ pathname: string
+ search: string
+ searchParams: Record<string, any>
+ },
+ activeSceneProductKey: ProductKey | null
): ProjectNoticeBlueprint | null => {
if (!variant) {
return null
diff --git a/frontend/src/layout/panel-layout/ProjectTree/customProductsLogic.tsx b/frontend/src/layout/panel-layout/ProjectTree/customProductsLogic.tsx
index b563ed21dc95..31a040f6dd3d 100644
--- a/frontend/src/layout/panel-layout/ProjectTree/customProductsLogic.tsx
+++ b/frontend/src/layout/panel-layout/ProjectTree/customProductsLogic.tsx
@@ -1,4 +1,4 @@
-import { kea, path } from 'kea'
+import { MakeLogicType, kea, path } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
@@ -6,7 +6,32 @@ import { getAppContext } from 'lib/utils/getAppContext'
import type { UserProductListItem } from '~/queries/schema/schema-general'
-import type { customProductsLogicType } from './customProductsLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customProductsLogicValues {
+ customProducts: UserProductListItem[]
+ customProductsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customProductsLogicActions {
+ loadCustomProducts: () => any
+ loadCustomProductsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadCustomProductsSuccess: (
+ customProducts: UserProductListItem[],
+ payload?: any
+ ) => {
+ customProducts: UserProductListItem[]
+ payload?: any
+ }
+}
+
+export type customProductsLogicType = MakeLogicType<customProductsLogicValues, customProductsLogicActions>
export const customProductsLogic = kea<customProductsLogicType>([
path(['layout', 'panel-layout', 'ProjectTree', 'customProductsLogic']),
diff --git a/frontend/src/layout/panel-layout/ProjectTree/menus/recentItemsMenuLogic.ts b/frontend/src/layout/panel-layout/ProjectTree/menus/recentItemsMenuLogic.ts
index cb75844496a1..9f15e28e00dc 100644
--- a/frontend/src/layout/panel-layout/ProjectTree/menus/recentItemsMenuLogic.ts
+++ b/frontend/src/layout/panel-layout/ProjectTree/menus/recentItemsMenuLogic.ts
@@ -1,12 +1,33 @@
-import { connect, kea, path, selectors } from 'kea'
+import { MakeLogicType, connect, kea, path, selectors } from 'kea'
import { recentItemsModel } from '~/models/recentItemsModel'
import { FileSystemEntry } from '~/queries/schema/schema-general'
-import type { recentItemsMenuLogicType } from './recentItemsMenuLogicType'
-
const RECENT_ITEMS_LIMIT = 10
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface recentItemsMenuLogicValues {
+ cachedRecents: FileSystemEntry[] // recentItemsModel
+ recentsHasLoaded: boolean // recentItemsModel
+ recentItems: FileSystemEntry[]
+ recentItemsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface recentItemsMenuLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ recentItems: (cachedRecents: FileSystemEntry[]) => FileSystemEntry[]
+ recentItemsLoading: (recentsHasLoaded: boolean) => boolean
+ }
+}
+
+export type recentItemsMenuLogicType = MakeLogicType<
+ recentItemsMenuLogicValues,
+ {},
+ Record<string, any>,
+ recentItemsMenuLogicMeta
+>
+
export const recentItemsMenuLogic = kea<recentItemsMenuLogicType>([
path(['layout', 'panel-layout', 'ProjectTree', 'menus', 'recentItemsMenuLogic']),
connect(() => ({
@@ -15,8 +36,8 @@ export const recentItemsMenuLogic = kea<recentItemsMenuLogicType>([
selectors({
recentItems: [
(s) => [s.cachedRecents],
- (cachedRecents): FileSystemEntry[] => cachedRecents.slice(0, RECENT_ITEMS_LIMIT),
+ (cachedRecents: FileSystemEntry[]): FileSystemEntry[] => cachedRecents.slice(0, RECENT_ITEMS_LIMIT),
],
- recentItemsLoading: [(s) => [s.recentsHasLoaded], (recentsHasLoaded): boolean => !recentsHasLoaded],
+ recentItemsLoading: [(s) => [s.recentsHasLoaded], (recentsHasLoaded: boolean): boolean => !recentsHasLoaded],
}),
])
diff --git a/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.tsx b/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.tsx
index 6a33fa22411e..d433bf337584 100644
--- a/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.tsx
+++ b/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.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 { IconDocument, IconFolder, IconPlus } from '@posthog/icons'
@@ -43,9 +43,13 @@ import { groupsModel } from '~/models/groupsModel'
import { FileSystemEntry, FileSystemIconType, FileSystemImport } from '~/queries/schema/schema-general'
import { UserBasicType } from '~/types'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { Noun } from '../../../models/groupsModel'
+import type { UserProductListItem } from '../../../queries/schema/schema-general'
+import type { GroupType, GroupTypeIndex, ProjectTreeRef, UserType } from '../../../types'
import { panelLayoutLogic } from '../panelLayoutLogic'
+import type { PanelLayoutNavIdentifier } from '../panelLayoutLogic'
import { customProductsLogic } from './customProductsLogic'
-import type { projectTreeDataLogicType } from './projectTreeDataLogicType'
const MOVE_ALERT_LIMIT = 50
const DELETE_ALERT_LIMIT = 0
@@ -154,6 +158,370 @@ const humanizeFileSystemEntryType = (type?: string): string => {
return humanizedType
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface projectTreeDataLogicValues {
+ projectTreeRef: ProjectTreeRef | null // breadcrumbsLogic
+ customProducts: UserProductListItem[] // customProductsLogic
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun // groupsModel
+ groupTypes: Map<GroupTypeIndex, GroupType> // groupsModel
+ groupTypesLoading: boolean // groupsModel
+ groupsAccessStatus: GroupsAccessStatus // groupsModel
+ user: UserType | null // userLogic
+ folderLoadOffset: Record<string, number>
+ folderStates: Record<string, FolderState>
+ folders: Record<string, FileSystemEntry[]>
+ getCustomProductTreeItems: (searchTerm: string) => TreeDataItem[]
+ getShortcutTreeItems: (searchTerm: string, onlyFolders: boolean) => TreeDataItem[]
+ getStaticTreeItems: (searchTerm: string, onlyFolders: boolean) => TreeDataItem[]
+ groupItems: FileSystemImport[]
+ itemsByHref: Record<string, FileSystemEntry>
+ itemsByPath: Record<string, FileSystemEntry>
+ itemsByRef: Record<string, FileSystemEntry>
+ lastNewFolder: string | null
+ loadingPaths: Record<string, boolean>
+ pendingActions: ProjectTreeAction[]
+ pendingLoader: boolean
+ pendingLoaderLoading: boolean
+ projectTreeRefEntry: FileSystemEntry | null
+ savedItems: FileSystemEntry[]
+ savedItemsLoading: boolean
+ shortcutData: FileSystemEntry[]
+ shortcutDataHasLoaded: boolean
+ shortcutDataLoading: boolean
+ shortcutEntryIdMap: Map<string, string>
+ shortcutNonFolderPaths: Set<string>
+ sortedItems: FileSystemEntry[]
+ treeItemsNew: TreeDataItem[]
+ unfiledItems: boolean
+ unfiledItemsLoading: boolean
+ users: Record<string, UserBasicType>
+ viableItems: FileSystemEntry[]
+ viableItemsById: Record<string, FileSystemEntry>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface projectTreeDataLogicActions {
+ setActivePanelIdentifier: (identifier: PanelLayoutNavIdentifier) => {
+ identifier: PanelLayoutNavIdentifier
+ } // panelLayoutLogic
+ addLoadedResults: (results: RecentResults | SearchResults) => {
+ results: RecentResults | SearchResults
+ }
+ addLoadedUsers: (users: UserBasicType[]) => {
+ users: UserBasicType[]
+ }
+ addShortcutItem: (item: FileSystemEntry) => {
+ item: FileSystemEntry
+ }
+ addShortcutItemFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ addShortcutItemSuccess: (
+ shortcutData: FileSystemEntry[],
+ payload?: {
+ item: FileSystemEntry
+ }
+ ) => {
+ shortcutData: FileSystemEntry[]
+ payload?: {
+ item: FileSystemEntry
+ }
+ }
+ createSavedItem: (savedItem: FileSystemEntry) => {
+ savedItem: FileSystemEntry
+ }
+ deleteItem: (
+ item: FileSystemEntry,
+ projectTreeLogicKey: string
+ ) => {
+ item: FileSystemEntry
+ projectTreeLogicKey: string
+ }
+ deleteSavedItem: (savedItem: FileSystemEntry) => {
+ savedItem: FileSystemEntry
+ }
+ deleteShortcut: (id: FileSystemEntry['id']) => {
+ id: string
+ }
+ deleteShortcutFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deleteShortcutSuccess: (
+ shortcutData: FileSystemEntry[],
+ payload?: {
+ id: string
+ }
+ ) => {
+ shortcutData: FileSystemEntry[]
+ payload?: {
+ id: string
+ }
+ }
+ deleteTypeAndRef: (
+ type: string,
+ ref: string
+ ) => {
+ ref: string
+ type: string
+ }
+ linkItem: (
+ oldPath: string,
+ newPath: string,
+ force: boolean,
+ projectTreeLogicKey: string
+ ) => {
+ force: boolean
+ newPath: string
+ oldPath: string
+ projectTreeLogicKey: string
+ }
+ loadFolder: (
+ folder: string,
+ forceReload?: boolean
+ ) => {
+ folder: string
+ forceReload: boolean
+ }
+ loadFolderFailure: (
+ folder: string,
+ error: string
+ ) => {
+ error: string
+ folder: string
+ }
+ loadFolderIfNotLoaded: (folderId: string) => {
+ folderId: string
+ }
+ loadFolderStart: (
+ folder: string,
+ forceReload?: boolean
+ ) => {
+ folder: string
+ forceReload: boolean
+ }
+ loadFolderSuccess: (
+ folder: string,
+ entries: FileSystemEntry[],
+ hasMore: boolean,
+ offsetIncrease: number,
+ forceReload?: boolean
+ ) => {
+ entries: FileSystemEntry[]
+ folder: string
+ forceReload: boolean
+ hasMore: boolean
+ offsetIncrease: number
+ }
+ loadShortcuts: () => {
+ value: true
+ }
+ loadShortcutsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadShortcutsSuccess: (
+ shortcutData: FileSystemEntry[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ shortcutData: FileSystemEntry[]
+ payload?: {
+ value: true
+ }
+ }
+ loadUnfiledItems: () => {
+ value: true
+ }
+ loadUnfiledItemsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadUnfiledItemsSuccess: (
+ unfiledItems: boolean,
+ payload?: {
+ value: true
+ }
+ ) => {
+ unfiledItems: boolean
+ payload?: {
+ value: true
+ }
+ }
+ moveItem: (
+ item: FileSystemEntry,
+ newPath: string,
+ force: boolean,
+ projectTreeLogicKey: string
+ ) => {
+ force: boolean
+ item: FileSystemEntry
+ newPath: string
+ projectTreeLogicKey: string
+ }
+ movedItem: (
+ item: FileSystemEntry,
+ oldPath: string,
+ newPath: string
+ ) => {
+ item: FileSystemEntry
+ newPath: string
+ oldPath: string
+ }
+ pruneClosedFolders: (expandedFolders: string[]) => {
+ expandedFolders: string[]
+ }
+ queueAction: (
+ action: ProjectTreeAction,
+ projectTreeLogicKey: string
+ ) => {
+ action: ProjectTreeAction
+ projectTreeLogicKey: string
+ }
+ queueActionFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ queueActionSuccess: (
+ pendingLoader: boolean,
+ payload?: {
+ action: ProjectTreeAction
+ projectTreeLogicKey: string
+ }
+ ) => {
+ pendingLoader: boolean
+ payload?: {
+ action: ProjectTreeAction
+ projectTreeLogicKey: string
+ }
+ }
+ removeQueuedAction: (action: ProjectTreeAction) => {
+ action: ProjectTreeAction
+ }
+ reorderShortcutByDrag: (
+ activeTreeId: string,
+ overTreeId: string,
+ position: 'after' | 'before'
+ ) => {
+ activeTreeId: string
+ overTreeId: string
+ position: 'after' | 'before'
+ }
+ reorderShortcuts: (orderedIds: NonNullable<FileSystemEntry['id']>[]) => {
+ orderedIds: string[]
+ }
+ reorderShortcutsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ reorderShortcutsSuccess: (
+ shortcutData: FileSystemEntry[],
+ payload?: {
+ orderedIds: string[]
+ }
+ ) => {
+ shortcutData: FileSystemEntry[]
+ payload?: {
+ orderedIds: string[]
+ }
+ }
+ restoredItems: () => {
+ value: true
+ }
+ setLastNewFolder: (folder: string | null) => {
+ folder: string | null
+ }
+ syncTypeAndRef: (
+ type: string,
+ ref: string
+ ) => {
+ ref: string
+ type: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface projectTreeDataLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ savedItems: (folders: Record<string, FileSystemEntry[]>) => FileSystemEntry[]
+ shortcutEntryIdMap: (shortcutData: FileSystemEntry[]) => Map<string, string>
+ savedItemsLoading: (folderStates: Record<string, FolderState>) => boolean
+ viableItems: (savedItems: FileSystemEntry[], pendingActions: ProjectTreeAction[]) => FileSystemEntry[]
+ sortedItems: (viableItems: FileSystemEntry[]) => FileSystemEntry[]
+ itemsByRef: (sortedItems: FileSystemEntry[]) => Record<string, FileSystemEntry>
+ itemsByHref: (sortedItems: FileSystemEntry[]) => Record<string, FileSystemEntry>
+ itemsByPath: (sortedItems: FileSystemEntry[]) => Record<string, FileSystemEntry>
+ viableItemsById: (viableItems: FileSystemEntry[]) => Record<string, FileSystemEntry>
+ loadingPaths: (
+ unfiledItemsLoading: boolean,
+ savedItemsLoading: boolean,
+ pendingLoaderLoading: boolean,
+ pendingActions: ProjectTreeAction[]
+ ) => Record<string, boolean>
+ projectTreeRefEntry: (
+ projectTreeRef: ProjectTreeRef | null,
+ sortedItems: FileSystemEntry[]
+ ) => FileSystemEntry | null
+ groupItems: (
+ groupTypes: Map<GroupTypeIndex, GroupType>,
+ groupsAccessStatus: GroupsAccessStatus,
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun,
+ shortcutData: FileSystemEntry[],
+ featureFlags: FeatureFlagsSet
+ ) => FileSystemImport[]
+ getShortcutTreeItems: (
+ shortcutData: FileSystemEntry[],
+ viableItems: FileSystemEntry[],
+ folderStates: Record<string, FolderState>,
+ users: Record<string, UserBasicType>,
+ featureFlags: FeatureFlagsSet
+ ) => (searchTerm: string, onlyFolders: boolean) => TreeDataItem[]
+ getStaticTreeItems: (
+ featureFlags: FeatureFlagsSet,
+ getShortcutTreeItems: (searchTerm: string, onlyFolders: boolean) => TreeDataItem[],
+ groupItems: FileSystemImport[]
+ ) => (searchTerm: string, onlyFolders: boolean) => TreeDataItem[]
+ treeItemsNew: (
+ getStaticTreeItems: (searchTerm: string, onlyFolders: boolean) => TreeDataItem[]
+ ) => TreeDataItem[]
+ shortcutNonFolderPaths: (shortcutData: FileSystemEntry[]) => Set<string>
+ getCustomProductTreeItems: (
+ customProducts: UserProductListItem[],
+ featureFlags: FeatureFlagsSet,
+ folderStates: Record<string, FolderState>,
+ users: Record<string, UserBasicType>
+ ) => (searchTerm: string) => TreeDataItem[]
+ }
+}
+
+export type projectTreeDataLogicType = MakeLogicType<
+ projectTreeDataLogicValues,
+ projectTreeDataLogicActions,
+ Record<string, any>,
+ projectTreeDataLogicMeta
+>
+
export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
path(['layout', 'panel-layout', 'ProjectTree', 'projectTreeDataLogic']),
connect(() => ({
@@ -759,7 +1127,7 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
selectors({
savedItems: [
(s) => [s.folders],
- (folders): FileSystemEntry[] =>
+ (folders: Record<string, FileSystemEntry[]>): FileSystemEntry[] =>
Object.entries(folders).reduce((acc, [_, items]) => acc.concat(items), [] as FileSystemEntry[]),
],
// Maps each top-level Starred row's tree id to the underlying FileSystemEntry id, so the
@@ -768,7 +1136,7 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
// intentionally excluded.
shortcutEntryIdMap: [
(s) => [s.shortcutData],
- (shortcutData): Map<string, string> => {
+ (shortcutData: FileSystemEntry[]): Map<string, string> => {
const map = new Map<string, string>()
for (const shortcut of shortcutData) {
if (!shortcut.id) {
@@ -783,12 +1151,13 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
],
savedItemsLoading: [
(s) => [s.folderStates],
- (folderStates): boolean => Object.values(folderStates).some((state) => state === 'loading'),
+ (folderStates: Record<string, FolderState>): boolean =>
+ Object.values(folderStates).some((state) => state === 'loading'),
],
viableItems: [
// Combine savedItems with pendingActions
(s) => [s.savedItems, s.pendingActions],
- (savedItems, pendingActions): FileSystemEntry[] => {
+ (savedItems: FileSystemEntry[], pendingActions: ProjectTreeAction[]): FileSystemEntry[] => {
const initialItems = [...savedItems]
const itemsByPath = initialItems.reduce(
(acc, item) => {
@@ -864,11 +1233,11 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
],
sortedItems: [
(s) => [s.viableItems],
- (viableItems): FileSystemEntry[] => [...viableItems].sort(sortFilesAndFolders),
+ (viableItems: FileSystemEntry[]): FileSystemEntry[] => [...viableItems].sort(sortFilesAndFolders),
],
itemsByRef: [
(s) => [s.sortedItems],
- (sortedItems): Record<string, FileSystemEntry> => {
+ (sortedItems: FileSystemEntry[]): Record<string, FileSystemEntry> => {
const keyedByRef: Record<string, FileSystemEntry> = {}
for (const item of sortedItems) {
@@ -882,7 +1251,7 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
],
itemsByHref: [
(s) => [s.sortedItems],
- (sortedItems): Record<string, FileSystemEntry> => {
+ (sortedItems: FileSystemEntry[]): Record<string, FileSystemEntry> => {
const keyedByHref: Record<string, FileSystemEntry> = {}
for (const item of sortedItems) {
@@ -896,7 +1265,7 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
],
itemsByPath: [
(s) => [s.sortedItems],
- (sortedItems): Record<string, FileSystemEntry> => {
+ (sortedItems: FileSystemEntry[]): Record<string, FileSystemEntry> => {
const keyedByPath: Record<string, FileSystemEntry> = {}
for (const item of sortedItems) {
@@ -910,7 +1279,7 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
],
viableItemsById: [
(s) => [s.viableItems],
- (viableItems): Record<string, FileSystemEntry> =>
+ (viableItems: FileSystemEntry[]): Record<string, FileSystemEntry> =>
viableItems.reduce(
(acc, item) =>
Object.assign(acc, {
@@ -922,7 +1291,12 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
loadingPaths: [
// Paths that are currently being loaded
(s) => [s.unfiledItemsLoading, s.savedItemsLoading, s.pendingLoaderLoading, s.pendingActions],
- (unfiledItemsLoading, savedItemsLoading, pendingLoaderLoading, pendingActions) => {
+ (
+ unfiledItemsLoading: boolean,
+ savedItemsLoading: boolean,
+ pendingLoaderLoading: boolean,
+ pendingActions: ProjectTreeAction[]
+ ) => {
const loadingPaths: Record<string, boolean> = {}
if (unfiledItemsLoading) {
loadingPaths['Unfiled'] = true
@@ -939,7 +1313,10 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
],
projectTreeRefEntry: [
(s) => [s.projectTreeRef, s.sortedItems],
- (projectTreeRef, sortedItems): FileSystemEntry | null => {
+ (
+ projectTreeRef: null | import('~/types').ProjectTreeRef,
+ sortedItems: FileSystemEntry[]
+ ): FileSystemEntry | null => {
if (!projectTreeRef || !projectTreeRef.type || !projectTreeRef.ref) {
return null
}
@@ -953,7 +1330,16 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
],
groupItems: [
(s) => [s.groupTypes, s.groupsAccessStatus, s.aggregationLabel, s.shortcutData, s.featureFlags],
- (groupTypes, groupsAccessStatus, aggregationLabel, shortcutData, featureFlags): FileSystemImport[] => {
+ (
+ groupTypes: Map<import('~/types').GroupTypeIndex, import('~/types').GroupType>,
+ groupsAccessStatus: GroupsAccessStatus,
+ aggregationLabel: (
+ groupTypeIndex: number | null | undefined,
+ deferToUserWording?: boolean
+ ) => import('~/models/groupsModel').Noun,
+ shortcutData: FileSystemEntry[],
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet
+ ): FileSystemImport[] => {
const showGroupsIntroductionPage = [
GroupsAccessStatus.HasAccess,
GroupsAccessStatus.HasGroupTypes,
@@ -1002,11 +1388,11 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
getShortcutTreeItems: [
(s) => [s.shortcutData, s.viableItems, s.folderStates, s.users, s.featureFlags],
(
- shortcutData,
- viableItems,
- folderStates,
- users,
- featureFlags
+ shortcutData: FileSystemEntry[],
+ viableItems: FileSystemEntry[],
+ folderStates: Record<string, FolderState>,
+ users: Record<string, UserBasicType>,
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet
): ((searchTerm: string, onlyFolders: boolean) => TreeDataItem[]) => {
return function getStaticItems(searchTerm: string, onlyFolders: boolean): TreeDataItem[] {
const newShortcutData = []
@@ -1076,9 +1462,9 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
getStaticTreeItems: [
(s) => [s.featureFlags, s.getShortcutTreeItems, s.groupItems],
(
- featureFlags,
- getShortcutTreeItems,
- groupItems
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet,
+ getShortcutTreeItems: (searchTerm: string, onlyFolders: boolean) => TreeDataItem[],
+ groupItems: FileSystemImport[]
): ((searchTerm: string, onlyFolders: boolean) => TreeDataItem[]) => {
const convert = (
imports: FileSystemImport[],
@@ -1131,16 +1517,22 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
],
treeItemsNew: [
(s) => [s.getStaticTreeItems],
- (getStaticTreeItems) => getStaticTreeItems('', false).find((item) => item.id === 'new://')?.children ?? [],
+ (getStaticTreeItems: (searchTerm: string, onlyFolders: boolean) => TreeDataItem[]) =>
+ getStaticTreeItems('', false).find((item) => item.id === 'new://')?.children ?? [],
],
shortcutNonFolderPaths: [
(s) => [s.shortcutData],
- (shortcutData) =>
+ (shortcutData: FileSystemEntry[]) =>
new Set(shortcutData.filter((shortcut) => shortcut.type !== 'folder').map((shortcut) => shortcut.path)),
],
getCustomProductTreeItems: [
(s) => [s.customProducts, s.featureFlags, s.folderStates, s.users],
- (customProducts, featureFlags, folderStates, users): ((searchTerm: string) => TreeDataItem[]) => {
+ (
+ customProducts: import('~/queries/schema/schema-general').UserProductListItem[],
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet,
+ folderStates: Record<string, FolderState>,
+ users: Record<string, UserBasicType>
+ ): ((searchTerm: string) => TreeDataItem[]) => {
return function getCustomProductItems(searchTerm: string): TreeDataItem[] {
const allProducts = getDefaultTreeProducts()
const productMap = new Map<string, FileSystemImport>(allProducts.map((p) => [p.path, p]))
diff --git a/frontend/src/layout/panel-layout/ProjectTree/projectTreeLogic.tsx b/frontend/src/layout/panel-layout/ProjectTree/projectTreeLogic.tsx
index 2c7b261b0aba..b9900c350246 100644
--- a/frontend/src/layout/panel-layout/ProjectTree/projectTreeLogic.tsx
+++ b/frontend/src/layout/panel-layout/ProjectTree/projectTreeLogic.tsx
@@ -1,4 +1,17 @@
-import { actions, afterMount, connect, kea, key, listeners, path, props, propsChanged, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ connect,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ propsChanged,
+ reducers,
+ selectors,
+} from 'kea'
import { loaders } from 'kea-loaders'
import { subscriptions } from 'kea-subscriptions'
@@ -15,8 +28,10 @@ import { PAGINATION_LIMIT, projectTreeDataLogic } from '~/layout/panel-layout/Pr
import { FileSystemEntry } from '~/queries/schema/schema-general'
import { ProjectTreeRef } from '~/types'
+import type { Breadcrumb, UserBasicType } from '../../../types'
import { panelLayoutLogic } from '../panelLayoutLogic'
-import type { projectTreeLogicType } from './projectTreeLogicType'
+import type { PanelLayoutNavIdentifier } from '../panelLayoutLogic'
+import type { FolderState, ProjectTreeAction } from './types'
import {
convertFileSystemEntryToTreeDataItem,
findInProjectTree,
@@ -61,6 +76,417 @@ const FOLDER_LOADING = [
} as TreeDataItem,
]
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface projectTreeLogicValues {
+ appBreadcrumbs: Breadcrumb[] // breadcrumbsLogic
+ projectTreeRef: ProjectTreeRef | null // breadcrumbsLogic
+ sceneBreadcrumbs: Breadcrumb[] // breadcrumbsLogic
+ folderLoadOffset: Record<string, number> // projectTreeDataLogic
+ folderStates: Record<string, FolderState> // projectTreeDataLogic
+ folders: Record<string, FileSystemEntry[]> // projectTreeDataLogic
+ getCustomProductTreeItems: (searchTerm: string) => TreeDataItem[] // projectTreeDataLogic
+ getStaticTreeItems: (searchTerm: string, onlyFolders: boolean) => TreeDataItem[] // projectTreeDataLogic
+ lastNewFolder: string | null // projectTreeDataLogic
+ loadingPaths: Record<string, boolean> // projectTreeDataLogic
+ shortcutData: FileSystemEntry[] // projectTreeDataLogic
+ sortedItems: FileSystemEntry[] // projectTreeDataLogic
+ users: Record<string, UserBasicType> // projectTreeDataLogic
+ viableItems: FileSystemEntry[] // projectTreeDataLogic
+ viableItemsById: Record<string, FileSystemEntry> // projectTreeDataLogic
+ checkedItemCountNumeric: number
+ checkedItems: Record<string, boolean>
+ checkedItemsArray: FileSystemEntry[]
+ checkedItemsCount: string
+ editingItemId: string
+ expandedFolders: string[]
+ expandedSearchFolders: string[]
+ fullFileSystem: TreeDataItem[]
+ fullFileSystemFiltered: TreeDataItem[]
+ helpNoticeVisible: boolean
+ lastCheckedItem: {
+ checked: boolean
+ id: string
+ shift: boolean
+ } | null
+ lastViewedId: string
+ onlyFolders: boolean
+ projectTree: TreeDataItem[]
+ projectTreeItems: TreeDataItem[]
+ recentResults: RecentResults
+ recentResultsLoading: boolean
+ recentTreeItems: TreeDataItem[]
+ scrollTargetId: string
+ searchResults: SearchResults
+ searchResultsLoading: boolean
+ searchTerm: string
+ searchTreeItems: TreeDataItem[]
+ selectMode: LemonTreeSelectMode
+ sortMethod: ProjectTreeSortMethod
+ treeTableColumnOffsets: number[]
+ treeTableColumnSizes: number[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface projectTreeLogicActions {
+ resetPanelLayout: (keyboardAction: boolean) => {
+ keyboardAction: boolean
+ } // panelLayoutLogic
+ setActivePanelIdentifier: (identifier: PanelLayoutNavIdentifier) => {
+ identifier: PanelLayoutNavIdentifier
+ } // panelLayoutLogic
+ addLoadedResults: (results: RecentResults | SearchResults) => {
+ results: RecentResults | SearchResults
+ } // projectTreeDataLogic
+ addLoadedUsers: (users: UserBasicType[]) => {
+ users: UserBasicType[]
+ } // projectTreeDataLogic
+ createSavedItem: (savedItem: FileSystemEntry) => {
+ savedItem: FileSystemEntry
+ } // projectTreeDataLogic
+ deleteItem: (
+ item: FileSystemEntry,
+ projectTreeLogicKey: string
+ ) => {
+ item: FileSystemEntry
+ projectTreeLogicKey: string
+ } // projectTreeDataLogic
+ deleteSavedItem: (savedItem: FileSystemEntry) => {
+ savedItem: FileSystemEntry
+ } // projectTreeDataLogic
+ deleteTypeAndRef: (
+ type: string,
+ ref: string
+ ) => {
+ ref: string
+ type: string
+ } // projectTreeDataLogic
+ linkItem: (
+ oldPath: string,
+ newPath: string,
+ force: boolean,
+ projectTreeLogicKey: string
+ ) => {
+ force: boolean
+ newPath: string
+ oldPath: string
+ projectTreeLogicKey: string
+ } // projectTreeDataLogic
+ loadFolder: (
+ folder: string,
+ forceReload?: boolean | undefined
+ ) => {
+ folder: string
+ forceReload: boolean
+ } // projectTreeDataLogic
+ loadFolderIfNotLoaded: (folderId: string) => {
+ folderId: string
+ } // projectTreeDataLogic
+ loadFolderStart: (
+ folder: string,
+ forceReload?: boolean | undefined
+ ) => {
+ folder: string
+ forceReload: boolean
+ } // projectTreeDataLogic
+ loadFolderSuccess: (
+ folder: string,
+ entries: FileSystemEntry[],
+ hasMore: boolean,
+ offsetIncrease: number,
+ forceReload?: boolean | undefined
+ ) => {
+ entries: FileSystemEntry[]
+ folder: string
+ forceReload: boolean
+ hasMore: boolean
+ offsetIncrease: number
+ } // projectTreeDataLogic
+ moveItem: (
+ item: FileSystemEntry,
+ newPath: string,
+ force: boolean,
+ projectTreeLogicKey: string
+ ) => {
+ force: boolean
+ item: FileSystemEntry
+ newPath: string
+ projectTreeLogicKey: string
+ } // projectTreeDataLogic
+ movedItem: (
+ item: FileSystemEntry,
+ oldPath: string,
+ newPath: string
+ ) => {
+ item: FileSystemEntry
+ newPath: string
+ oldPath: string
+ } // projectTreeDataLogic
+ pruneClosedFolders: (expandedFolders: string[]) => {
+ expandedFolders: string[]
+ } // projectTreeDataLogic
+ queueAction: (
+ action: ProjectTreeAction,
+ projectTreeLogicKey: string
+ ) => {
+ action: ProjectTreeAction
+ projectTreeLogicKey: string
+ } // projectTreeDataLogic
+ addFolder: (
+ folder: string,
+ editAfter?: any,
+ callback?: (folder: string) => void
+ ) => {
+ callback: ((folder: string) => void) | undefined
+ editAfter: any
+ folder: string
+ }
+ assureVisibility: (projectTreeRef: ProjectTreeRef) => {
+ projectTreeRef: ProjectTreeRef
+ }
+ checkSelectedFolders: () => {
+ value: true
+ }
+ clearScrollTarget: () => {
+ value: true
+ }
+ clearSearch: () => {
+ value: true
+ }
+ createFolder: (
+ parentPath: string,
+ editAfter?: any,
+ callback?: (folder: string) => void
+ ) => {
+ callback: ((folder: string) => void) | undefined
+ editAfter: any
+ parentPath: string
+ }
+ deleteCheckedItems: () => {
+ value: true
+ }
+ expandProjectFolder: (path: string) => {
+ path: string
+ }
+ linkCheckedItems: (path: string) => {
+ path: string
+ }
+ loadRecentResults: (type: 'end' | 'start') => {
+ type: 'end' | 'start'
+ }
+ loadRecentResultsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRecentResultsSuccess: (
+ recentResults: {
+ endTime: string | null
+ hasMore: boolean
+ results: FileSystemEntry[]
+ startTime: string | null
+ },
+ payload?: {
+ type: 'end' | 'start'
+ }
+ ) => {
+ recentResults: {
+ endTime: string | null
+ hasMore: boolean
+ results: FileSystemEntry[]
+ startTime: string | null
+ }
+ payload?: {
+ type: 'end' | 'start'
+ }
+ }
+ loadSearchResults: (
+ searchTerm: string,
+ offset?: any
+ ) => {
+ offset: any
+ searchTerm: string
+ }
+ loadSearchResultsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSearchResultsSuccess: (
+ searchResults: {
+ hasMore: boolean
+ lastCount: number
+ results: FileSystemEntry[]
+ searchTerm: string
+ },
+ payload?: {
+ offset: any
+ searchTerm: string
+ }
+ ) => {
+ searchResults: {
+ hasMore: boolean
+ lastCount: number
+ results: FileSystemEntry[]
+ searchTerm: string
+ }
+ payload?: {
+ offset: any
+ searchTerm: string
+ }
+ }
+ moveCheckedItems: (path: string) => {
+ path: string
+ }
+ onItemChecked: (
+ id: string,
+ checked: boolean,
+ shift: boolean
+ ) => {
+ checked: boolean
+ id: string
+ shift: boolean
+ }
+ rename: (
+ value: string,
+ item: FileSystemEntry
+ ) => {
+ item: FileSystemEntry
+ value: string
+ }
+ scrollToView: (item: FileSystemEntry) => {
+ item: FileSystemEntry
+ }
+ setCheckedItems: (checkedItems: Record<string, boolean>) => {
+ checkedItems: Record<string, boolean>
+ }
+ setEditingItemId: (id: string) => {
+ id: string
+ }
+ setExpandedFolders: (folderIds: string[]) => {
+ folderIds: string[]
+ }
+ setExpandedSearchFolders: (folderIds: string[]) => {
+ folderIds: string[]
+ }
+ setHelpNoticeVisibility: (visible: boolean) => {
+ visible: boolean
+ }
+ setLastCheckedItem: (
+ id: string,
+ checked: boolean,
+ shift: boolean
+ ) => {
+ checked: boolean
+ id: string
+ shift: boolean
+ }
+ setLastViewedId: (id: string) => {
+ id: string
+ }
+ setOnlyFolders: (onlyFolders: boolean) => {
+ onlyFolders: boolean
+ }
+ setSearchTerm: (searchTerm: string) => {
+ searchTerm: string
+ }
+ setSelectMode: (selectMode: LemonTreeSelectMode) => {
+ selectMode: LemonTreeSelectMode
+ }
+ setSortMethod: (sortMethod: ProjectTreeSortMethod) => {
+ sortMethod: ProjectTreeSortMethod
+ }
+ setTreeTableColumnSizes: (sizes: number[]) => {
+ sizes: number[]
+ }
+ toggleFolderOpen: (
+ folderId: string,
+ isExpanded: boolean
+ ) => {
+ folderId: string
+ isExpanded: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface projectTreeLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ projectTree: (
+ viableItems: FileSystemEntry[],
+ folderStates: Record<string, FolderState>,
+ checkedItems: Record<string, boolean>,
+ users: Record<string, UserBasicType>,
+ onlyFolders: boolean
+ ) => TreeDataItem[]
+ recentTreeItems: (
+ recentResults: RecentResults,
+ recentResultsLoading: boolean,
+ folderStates: Record<string, FolderState>,
+ checkedItems: Record<string, boolean>,
+ users: Record<string, UserBasicType>
+ ) => TreeDataItem[]
+ searchTreeItems: (
+ searchResults: SearchResults,
+ searchResultsLoading: boolean,
+ folderStates: Record<string, FolderState>,
+ checkedItems: Record<string, boolean>,
+ sortMethod: ProjectTreeSortMethod,
+ onlyFolders: boolean,
+ users: Record<string, UserBasicType>
+ ) => TreeDataItem[]
+ projectTreeItems: (
+ searchTerm: string,
+ searchTreeItems: TreeDataItem[],
+ projectTree: TreeDataItem[],
+ loadingPaths: Record<string, boolean>,
+ recentTreeItems: TreeDataItem[],
+ sortMethod: ProjectTreeSortMethod
+ ) => TreeDataItem[]
+ fullFileSystem: (
+ searchTerm: string,
+ searchTreeItems: TreeDataItem[],
+ searchResultsLoading: boolean,
+ projectTree: TreeDataItem[],
+ loadingPaths: Record<string, boolean>,
+ recentTreeItems: TreeDataItem[],
+ recentResultsLoading: boolean,
+ sortMethod: ProjectTreeSortMethod,
+ onlyFolders: boolean,
+ getStaticTreeItems: (searchTerm: string, onlyFolders: boolean) => TreeDataItem[],
+ getCustomProductTreeItems: (searchTerm: string) => TreeDataItem[],
+ arg: any
+ ) => TreeDataItem[]
+ fullFileSystemFiltered: (
+ fullFileSystem: TreeDataItem[],
+ searchTerm: string,
+ arg: any,
+ arg2: any,
+ arg3: any
+ ) => TreeDataItem[]
+ treeTableColumnOffsets: (treeTableColumnSizes: number[]) => number[]
+ checkedItemCountNumeric: (checkedItems: Record<string, boolean>) => number
+ checkedItemsCount: (
+ checkedItems: Record<string, boolean>,
+ viableItemsById: Record<string, FileSystemEntry>
+ ) => string
+ checkedItemsArray: (
+ checkedItems: Record<string, boolean>,
+ viableItemsById: Record<string, FileSystemEntry>
+ ) => FileSystemEntry[]
+ }
+}
+
+export type projectTreeLogicType = MakeLogicType<
+ projectTreeLogicValues,
+ projectTreeLogicActions,
+ ProjectTreeLogicProps,
+ projectTreeLogicMeta
+>
+
export const projectTreeLogic = kea<projectTreeLogicType>([
path(['layout', 'navigation-3000', 'components', 'projectTreeLogic']),
props({} as ProjectTreeLogicProps),
@@ -443,7 +869,13 @@ export const projectTreeLogic = kea<projectTreeLogicType>([
selectors({
projectTree: [
(s) => [s.viableItems, s.folderStates, s.checkedItems, s.users, s.onlyFolders],
- (viableItems, folderStates, checkedItems, users, onlyFolders): TreeDataItem[] => {
+ (
+ viableItems: FileSystemEntry[],
+ folderStates: Record<string, import('./types').FolderState>,
+ checkedItems: Record<string, boolean>,
+ users: Record<string, import('~/types').UserBasicType>,
+ onlyFolders: boolean
+ ): TreeDataItem[] => {
const children = convertFileSystemEntryToTreeDataItem({
imports: viableItems.map((i) => ({ ...i, protocol: 'project://' })),
folderStates,
@@ -459,7 +891,13 @@ export const projectTreeLogic = kea<projectTreeLogicType>([
],
recentTreeItems: [
(s) => [s.recentResults, s.recentResultsLoading, s.folderStates, s.checkedItems, s.users],
- (recentResults, recentResultsLoading, folderStates, checkedItems, users): TreeDataItem[] => {
+ (
+ recentResults: RecentResults,
+ recentResultsLoading: boolean,
+ folderStates: Record<string, import('./types').FolderState>,
+ checkedItems: Record<string, boolean>,
+ users: Record<string, import('~/types').UserBasicType>
+ ): TreeDataItem[] => {
const results = convertFileSystemEntryToTreeDataItem({
imports: recentResults.results.map((i) => ({ ...i, protocol: 'project://' })),
folderStates,
@@ -503,13 +941,13 @@ export const projectTreeLogic = kea<projectTreeLogicType>([
s.users,
],
(
- searchResults,
- searchResultsLoading,
- folderStates,
- checkedItems,
- sortMethod,
- onlyFolders,
- users
+ searchResults: SearchResults,
+ searchResultsLoading: boolean,
+ folderStates: Record<string, import('./types').FolderState>,
+ checkedItems: Record<string, boolean>,
+ sortMethod: ProjectTreeSortMethod,
+ onlyFolders: boolean,
+ users: Record<string, import('~/types').UserBasicType>
): TreeDataItem[] => {
const results = convertFileSystemEntryToTreeDataItem({
imports: searchResults.results.map((i) => ({ ...i, protocol: 'project://' })),
@@ -552,7 +990,14 @@ export const projectTreeLogic = kea<projectTreeLogicType>([
],
projectTreeItems: [
(s) => [s.searchTerm, s.searchTreeItems, s.projectTree, s.loadingPaths, s.recentTreeItems, s.sortMethod],
- (searchTerm, searchTreeItems, projectTree, loadingPaths, recentTreeItems, sortMethod): TreeDataItem[] => {
+ (
+ searchTerm: string,
+ searchTreeItems: TreeDataItem[],
+ projectTree: TreeDataItem[],
+ loadingPaths: Record<string, boolean>,
+ recentTreeItems: TreeDataItem[],
+ sortMethod: ProjectTreeSortMethod
+ ): TreeDataItem[] => {
if (searchTerm) {
return searchTreeItems
}
@@ -582,17 +1027,17 @@ export const projectTreeLogic = kea<projectTreeLogicType>([
(_, props) => props.root,
],
(
- searchTerm,
- searchTreeItems,
- searchResultsLoading,
- projectTree,
- loadingPaths,
- recentTreeItems,
- recentResultsLoading,
- sortMethod,
- onlyFolders,
- getStaticTreeItems,
- getCustomProductTreeItems,
+ searchTerm: string,
+ searchTreeItems: TreeDataItem[],
+ searchResultsLoading: boolean,
+ projectTree: TreeDataItem[],
+ loadingPaths: Record<string, boolean>,
+ recentTreeItems: TreeDataItem[],
+ recentResultsLoading: boolean,
+ sortMethod: ProjectTreeSortMethod,
+ onlyFolders: boolean,
+ getStaticTreeItems: (searchTerm: string, onlyFolders: boolean) => TreeDataItem[],
+ getCustomProductTreeItems: (searchTerm: string) => TreeDataItem[],
root
): TreeDataItem[] => {
if (root === 'custom-products://') {
@@ -630,7 +1075,7 @@ export const projectTreeLogic = kea<projectTreeLogicType>([
(_, props) => props.includeRoot,
(_, props) => props.hideFolders,
],
- (fullFileSystem, searchTerm, root, includeRoot, hideFolders): TreeDataItem[] => {
+ (fullFileSystem: TreeDataItem[], searchTerm: string, root, includeRoot, hideFolders): TreeDataItem[] => {
let firstFolders = fullFileSystem
// Filter out folders specified in hideFolders prop
@@ -710,15 +1155,16 @@ export const projectTreeLogic = kea<projectTreeLogicType>([
],
treeTableColumnOffsets: [
(s) => [s.treeTableColumnSizes],
- (sizes): number[] => sizes.map((_, index) => sizes.slice(0, index).reduce((acc, s) => acc + s, 0)),
+ (sizes: number[]): number[] =>
+ sizes.map((_, index) => sizes.slice(0, index).reduce((acc, s) => acc + s, 0)),
],
checkedItemCountNumeric: [
(s) => [s.checkedItems],
- (checkedItems): number => Object.values(checkedItems).filter((v) => !!v).length,
+ (checkedItems: Record<string, boolean>): number => Object.values(checkedItems).filter((v) => !!v).length,
],
checkedItemsCount: [
(s) => [s.checkedItems, s.viableItemsById],
- (checkedItems, viableItemsById): string => {
+ (checkedItems: Record<string, boolean>, viableItemsById: Record<string, FileSystemEntry>): string => {
let hasFolder = false
let sum = 0
for (const [key, value] of Object.entries(checkedItems)) {
@@ -735,7 +1181,10 @@ export const projectTreeLogic = kea<projectTreeLogicType>([
],
checkedItemsArray: [
(s) => [s.checkedItems, s.viableItemsById],
- (checkedItems, viableItemsById): FileSystemEntry[] => {
+ (
+ checkedItems: Record<string, boolean>,
+ viableItemsById: Record<string, FileSystemEntry>
+ ): FileSystemEntry[] => {
return Object.entries(checkedItems)
.filter(([_, checked]) => checked)
.map(([id]) => viableItemsById[id])
diff --git a/frontend/src/layout/panel-layout/ai-first/tabs/editToolsLogic.ts b/frontend/src/layout/panel-layout/ai-first/tabs/editToolsLogic.ts
index 31adbd03fed5..ce194dd65caf 100644
--- a/frontend/src/layout/panel-layout/ai-first/tabs/editToolsLogic.ts
+++ b/frontend/src/layout/panel-layout/ai-first/tabs/editToolsLogic.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'
@@ -8,10 +8,59 @@ import { customProductsLogic } from '~/layout/panel-layout/ProjectTree/customPro
import { getItemId } from '~/layout/panel-layout/ProjectTree/utils'
import { UserProductListItem, UserProductListReason } from '~/queries/schema/schema-general'
-import type { editToolsLogicType } from './editToolsLogicType'
-
const PRODUCTS_ROOT = 'products://'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editToolsLogicValues {
+ customProducts: UserProductListItem[] // customProductsLogic
+ checkedTools: Record<string, boolean>
+ isEditMode: boolean
+ localToggles: Record<string, boolean>
+ selectedPaths: Set<string>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editToolsLogicActions {
+ loadCustomProducts: () => any // customProductsLogic
+ loadCustomProductsSuccess: (
+ customProducts: UserProductListItem[],
+ payload?: any
+ ) => {
+ customProducts: UserProductListItem[]
+ payload?: any
+ } // customProductsLogic
+ enterEditMode: () => {
+ value: true
+ }
+ saveAndExitEditMode: () => {
+ value: true
+ }
+ setLocalToggles: (toggles: Record<string, boolean>) => {
+ toggles: Record<string, boolean>
+ }
+ toggleTool: (toolPath: string) => {
+ toolPath: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editToolsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ selectedPaths: (customProducts: UserProductListItem[]) => Set<string>
+ checkedTools: (
+ customProducts: UserProductListItem[],
+ localToggles: Record<string, boolean>
+ ) => Record<string, boolean>
+ }
+}
+
+export type editToolsLogicType = MakeLogicType<
+ editToolsLogicValues,
+ editToolsLogicActions,
+ Record<string, any>,
+ editToolsLogicMeta
+>
+
export const editToolsLogic = kea<editToolsLogicType>([
path(['layout', 'panel-layout', 'ai-first', 'tabs', 'editToolsLogic']),
connect(() => ({
@@ -43,12 +92,12 @@ export const editToolsLogic = kea<editToolsLogicType>([
selectors({
selectedPaths: [
(s) => [s.customProducts],
- (customProducts): Set<string> =>
+ (customProducts: UserProductListItem[]): Set<string> =>
new Set(customProducts.map((item: { product_path: string }) => item.product_path)),
],
checkedTools: [
(s) => [s.customProducts, s.localToggles],
- (customProducts, localToggles): Record<string, boolean> => {
+ (customProducts: UserProductListItem[], localToggles: Record<string, boolean>): Record<string, boolean> => {
const result: Record<string, boolean> = {}
for (const item of customProducts) {
const id = getItemId({ path: item.product_path, type: '' }, PRODUCTS_ROOT)
diff --git a/frontend/src/layout/panel-layout/ai-first/tabs/navRecentsLogic.ts b/frontend/src/layout/panel-layout/ai-first/tabs/navRecentsLogic.ts
index 13aec3d5b039..2600ef3b6734 100644
--- a/frontend/src/layout/panel-layout/ai-first/tabs/navRecentsLogic.ts
+++ b/frontend/src/layout/panel-layout/ai-first/tabs/navRecentsLogic.ts
@@ -1,12 +1,28 @@
-import { connect, kea, path, selectors } from 'kea'
+import { MakeLogicType, connect, kea, path, selectors } from 'kea'
import { recentItemsModel } from '~/models/recentItemsModel'
import { FileSystemEntry } from '~/queries/schema/schema-general'
-import type { navRecentsLogicType } from './navRecentsLogicType'
-
const NAV_RECENTS_LIMIT = 15
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface navRecentsLogicValues {
+ cachedRecents: FileSystemEntry[] // recentItemsModel
+ recentsHasLoaded: boolean // recentItemsModel
+ recentItems: FileSystemEntry[]
+ recentItemsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface navRecentsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ recentItems: (cachedRecents: FileSystemEntry[]) => FileSystemEntry[]
+ recentItemsLoading: (recentsHasLoaded: boolean) => boolean
+ }
+}
+
+export type navRecentsLogicType = MakeLogicType<navRecentsLogicValues, {}, Record<string, any>, navRecentsLogicMeta>
+
export const navRecentsLogic = kea<navRecentsLogicType>([
path(['layout', 'panel-layout', 'ai-first', 'tabs', 'navRecentsLogic']),
connect(() => ({
@@ -15,8 +31,8 @@ export const navRecentsLogic = kea<navRecentsLogicType>([
selectors({
recentItems: [
(s) => [s.cachedRecents],
- (cachedRecents): FileSystemEntry[] => cachedRecents.slice(0, NAV_RECENTS_LIMIT),
+ (cachedRecents: FileSystemEntry[]): FileSystemEntry[] => cachedRecents.slice(0, NAV_RECENTS_LIMIT),
],
- recentItemsLoading: [(s) => [s.recentsHasLoaded], (recentsHasLoaded): boolean => !recentsHasLoaded],
+ recentItemsLoading: [(s) => [s.recentsHasLoaded], (recentsHasLoaded: boolean): boolean => !recentsHasLoaded],
}),
])
diff --git a/frontend/src/layout/panel-layout/installationStatusNavLogic.ts b/frontend/src/layout/panel-layout/installationStatusNavLogic.ts
index 2e4a568c2f97..8989b146744b 100644
--- a/frontend/src/layout/panel-layout/installationStatusNavLogic.ts
+++ b/frontend/src/layout/panel-layout/installationStatusNavLogic.ts
@@ -1,4 +1,4 @@
-import { connect, kea, path, selectors } from 'kea'
+import { MakeLogicType, connect, kea, path, selectors } from 'kea'
import { activeCloudRunLogic } from 'scenes/onboarding/shared/wizard-sync/activeCloudRunLogic'
import { wizardActiveSessionDetectorLogic } from 'scenes/onboarding/shared/wizard-sync/wizardActiveSessionDetectorLogic'
@@ -6,10 +6,54 @@ import { wizardSyncUiLogic } from 'scenes/onboarding/shared/wizard-sync/wizardSy
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
-import type { installationStatusNavLogicType } from './installationStatusNavLogicType'
+import type { CloudRunHandle } from '../../scenes/onboarding/shared/wizard-sync/activeCloudRunLogic'
+import type { TeamPublicType, TeamType } from '../../types'
export type NavInstallationPhase = 'running' | 'completed' | 'error' | 'connecting' | 'idle'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface installationStatusNavLogicValues {
+ activeCloudRun: CloudRunHandle | null // activeCloudRunLogic
+ panelMounted: boolean // activeCloudRunLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ hasOnboardedAnyProduct: boolean // teamLogic
+ hasActiveSession: boolean // wizardActiveSessionDetectorLogic
+ dialogOpen: boolean // wizardSyncUiLogic
+ isRunActive: boolean
+ onboardingUrl: string
+ phase: NavInstallationPhase
+ shouldShow: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface installationStatusNavLogicActions {
+ openDialog: () => {
+ value: true
+ } // wizardSyncUiLogic
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface installationStatusNavLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ shouldShow: (
+ hasOnboardedAnyProduct: boolean,
+ currentTeam: TeamPublicType | TeamType | null,
+ activeCloudRun: CloudRunHandle | null,
+ hasActiveSession: boolean,
+ panelMounted: boolean
+ ) => boolean
+ isRunActive: (activeCloudRun: CloudRunHandle | null, hasActiveSession: boolean) => boolean
+ phase: (isRunActive: boolean) => NavInstallationPhase
+ }
+}
+
+export type installationStatusNavLogicType = MakeLogicType<
+ installationStatusNavLogicValues,
+ installationStatusNavLogicActions,
+ Record<string, any>,
+ installationStatusNavLogicMeta
+>
+
/**
* Coordinates whether to show an "Installation status" item in the sidebar footer,
* and what label / badge tone to display.
@@ -39,7 +83,15 @@ export const installationStatusNavLogic = kea<installationStatusNavLogicType>([
/** Whether the nav item should render at all. */
shouldShow: [
(s) => [s.hasOnboardedAnyProduct, s.currentTeam, s.activeCloudRun, s.hasActiveSession, s.panelMounted],
- (hasOnboardedAnyProduct, currentTeam, activeCloudRun, hasActiveSession, panelMounted): boolean => {
+ (
+ hasOnboardedAnyProduct: boolean,
+ currentTeam: null | import('../../types').TeamPublicType | import('../../types').TeamType,
+ activeCloudRun:
+ | null
+ | import('scenes/onboarding/shared/wizard-sync/activeCloudRunLogic').CloudRunHandle,
+ hasActiveSession: boolean,
+ panelMounted: boolean
+ ): boolean => {
// Panel-mounted inline progress already shows the run — avoid double-surfacing
if (panelMounted) {
return false
@@ -59,11 +111,19 @@ export const installationStatusNavLogic = kea<installationStatusNavLogicType>([
/** Whether an active run (cloud or local) is the reason we're showing. */
isRunActive: [
(s) => [s.activeCloudRun, s.hasActiveSession],
- (activeCloudRun, hasActiveSession): boolean => !!(activeCloudRun || hasActiveSession),
+ (
+ activeCloudRun:
+ | null
+ | import('scenes/onboarding/shared/wizard-sync/activeCloudRunLogic').CloudRunHandle,
+ hasActiveSession: boolean
+ ): boolean => !!(activeCloudRun || hasActiveSession),
],
/** High-level phase for the badge tone: 'running' while in flight, 'idle' for incomplete onboarding. */
- phase: [(s) => [s.isRunActive], (isRunActive): NavInstallationPhase => (isRunActive ? 'running' : 'idle')],
+ phase: [
+ (s) => [s.isRunActive],
+ (isRunActive: boolean): NavInstallationPhase => (isRunActive ? 'running' : 'idle'),
+ ],
/** URL to navigate to on click when no run is active. */
onboardingUrl: [() => [], (): string => urls.onboarding()],
diff --git a/frontend/src/layout/panel-layout/panelLayoutLogic.tsx b/frontend/src/layout/panel-layout/panelLayoutLogic.tsx
index efa017eee712..fc483beeff0a 100644
--- a/frontend/src/layout/panel-layout/panelLayoutLogic.tsx
+++ b/frontend/src/layout/panel-layout/panelLayoutLogic.tsx
@@ -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 { router, urlToAction } from 'kea-router'
import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
import { navigation3000Logic } from '../navigation-3000/navigationLogic'
-import type { panelLayoutLogicType } from './panelLayoutLogicType'
export type PanelLayoutNavIdentifier =
| 'Project'
@@ -26,6 +25,119 @@ export const PANEL_NAVBAR_DEFAULT_WIDTH: number = 215
// Below this the drag snaps to collapsed mode.
export const PANEL_NAVBAR_COLLAPSE_THRESHOLD: number = 140
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface panelLayoutLogicValues {
+ mobileLayout: boolean // navigation3000Logic
+ location: {
+ pathname: string
+ search: string
+ hash: string
+ } // router
+ activePanelIdentifier: string
+ activePanelIdentifierFromUrl: PanelLayoutNavIdentifier | ''
+ activePanelIdentifierFromUrlAiFirst: PanelLayoutNavIdentifier | ''
+ expandedNavSections: Record<string, boolean>
+ isLayoutNavCollapsed: boolean
+ isLayoutNavCollapsedDesktop: boolean
+ isLayoutNavbarVisible: boolean
+ isLayoutNavbarVisibleForDesktop: boolean
+ isLayoutNavbarVisibleForMobile: boolean
+ isLayoutPanelCloseable: boolean
+ isLayoutPanelVisible: boolean
+ mainContentRect: DOMRect | null
+ mainContentRef: PanelLayoutMainContentRef
+ navExperimentActiveTab: NavExperimentTab
+ navbarWidth: number
+ panelIsResizing: boolean
+ panelWidth: number
+ panelWillHide: boolean
+ pathname: string
+ sidePanelWidth: number
+ visibleSideAction: string
+ visitedNavTabs: NavExperimentTab[]
+ visitedPanels: PanelLayoutNavIdentifier[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface panelLayoutLogicActions {
+ clearActivePanelIdentifier: () => {
+ value: true
+ }
+ closePanel: () => {
+ value: true
+ }
+ resetPanelLayout: (keyboardAction: boolean) => {
+ keyboardAction: boolean
+ }
+ setActivePanelIdentifier: (identifier: PanelLayoutNavIdentifier) => {
+ identifier: PanelLayoutNavIdentifier
+ }
+ setMainContentRect: (rect: DOMRect) => {
+ rect: DOMRect
+ }
+ setMainContentRef: (ref: PanelLayoutMainContentRef) => {
+ ref: PanelLayoutMainContentRef
+ }
+ setNavExperimentTab: (tab: NavExperimentTab) => {
+ tab: NavExperimentTab
+ }
+ setNavbarWidth: (width: number) => {
+ width: number
+ }
+ setPanelIsResizing: (isResizing: boolean) => {
+ isResizing: boolean
+ }
+ setPanelWidth: (width: number) => {
+ width: number
+ }
+ setPanelWillHide: (willHide: boolean) => {
+ willHide: boolean
+ }
+ setSidePanelWidth: (width: number) => {
+ width: number
+ }
+ setVisibleSideAction: (sideAction: string) => {
+ sideAction: string
+ }
+ showLayoutNavBar: (visible: boolean) => {
+ visible: boolean
+ }
+ showLayoutPanel: (visible: boolean) => {
+ visible: boolean
+ }
+ toggleLayoutNavCollapsed: (override?: boolean) => {
+ override: boolean | undefined
+ }
+ toggleNavSection: (section: string) => {
+ section: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface panelLayoutLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ isLayoutNavCollapsed: (isLayoutNavCollapsedDesktop: boolean, mobileLayout: boolean) => boolean
+ activePanelIdentifierFromUrl: (location: {
+ hash: string
+ pathname: string
+ search: string
+ }) => PanelLayoutNavIdentifier | ''
+ activePanelIdentifierFromUrlAiFirst: (location: {
+ hash: string
+ pathname: string
+ search: string
+ }) => PanelLayoutNavIdentifier | ''
+ pathname: (location: { hash: string; pathname: string; search: string }) => string
+ }
+}
+
+export type panelLayoutLogicType = MakeLogicType<
+ panelLayoutLogicValues,
+ panelLayoutLogicActions,
+ Record<string, any>,
+ panelLayoutLogicMeta
+>
+
export const panelLayoutLogic = kea<panelLayoutLogicType>([
path(['layout', 'panel-layout', 'panelLayoutLogic']),
connect(() => ({
@@ -246,11 +358,12 @@ export const panelLayoutLogic = kea<panelLayoutLogicType>([
selectors({
isLayoutNavCollapsed: [
(s) => [s.isLayoutNavCollapsedDesktop, s.mobileLayout],
- (isLayoutNavCollapsedDesktop, mobileLayout): boolean => !mobileLayout && isLayoutNavCollapsedDesktop,
+ (isLayoutNavCollapsedDesktop: boolean, mobileLayout: boolean): boolean =>
+ !mobileLayout && isLayoutNavCollapsedDesktop,
],
activePanelIdentifierFromUrl: [
() => [router.selectors.location],
- (location): PanelLayoutNavIdentifier | '' => {
+ (location: { hash: string; pathname: string; search: string }): PanelLayoutNavIdentifier | '' => {
const cleanPath = removeProjectIdIfPresent(location.pathname)
if (cleanPath.startsWith('/data-management/')) {
@@ -266,7 +379,7 @@ export const panelLayoutLogic = kea<panelLayoutLogicType>([
],
activePanelIdentifierFromUrlAiFirst: [
() => [router.selectors.location],
- (location): PanelLayoutNavIdentifier | '' => {
+ (location: { hash: string; pathname: string; search: string }): PanelLayoutNavIdentifier | '' => {
const cleanPath = removeProjectIdIfPresent(location.pathname)
if (
@@ -281,7 +394,10 @@ export const panelLayoutLogic = kea<panelLayoutLogicType>([
return ''
},
],
- pathname: [(s) => [s.location], (location): string => location.pathname],
+ pathname: [
+ (s) => [s.location],
+ (location: { hash: string; pathname: string; search: string }): string => location.pathname,
+ ],
}),
urlToAction(({ actions, values }) => ({
'*': () => {
diff --git a/frontend/src/layout/scenes/sceneLayoutLogic.tsx b/frontend/src/layout/scenes/sceneLayoutLogic.tsx
index 63b059388739..5e9cd5e98997 100644
--- a/frontend/src/layout/scenes/sceneLayoutLogic.tsx
+++ b/frontend/src/layout/scenes/sceneLayoutLogic.tsx
@@ -1,14 +1,46 @@
-import { actions, connect, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers } from 'kea'
import React from 'react'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { SceneConfig } from 'scenes/sceneTypes'
+import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
import { panelLayoutLogic } from '../panel-layout/panelLayoutLogic'
-import type { sceneLayoutLogicType } from './sceneLayoutLogicType'
export type SceneLayoutContainerRef = React.RefObject<HTMLElement> | null
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sceneLayoutLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ mainContentRect: DOMRect | null // panelLayoutLogic
+ sceneLayoutConfig: SceneConfig | null
+ scenePanelElement: HTMLElement | null
+ scenePanelIsPresent: boolean
+ scenePanelOpenManual: boolean
+ showDescription: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sceneLayoutLogicActions {
+ registerScenePanelElement: (element: HTMLElement | null) => {
+ element: HTMLElement | null
+ }
+ setSceneLayoutConfig: (config: SceneConfig) => {
+ config: SceneConfig
+ }
+ setScenePanelIsPresent: (active: boolean) => {
+ active: boolean
+ }
+ setScenePanelOpen: (open: boolean) => {
+ open: boolean
+ }
+ toggleShowDescription: () => {
+ value: true
+ }
+}
+
+export type sceneLayoutLogicType = MakeLogicType<sceneLayoutLogicValues, sceneLayoutLogicActions>
+
export const sceneLayoutLogic = kea<sceneLayoutLogicType>([
path(['layout', 'scene-layout', 'sceneLayoutLogic']),
connect(() => ({
diff --git a/frontend/src/lib/components/Support/supportLogic.ts b/frontend/src/lib/components/Support/supportLogic.ts
index 32cb1c1f1624..9c745315629d 100644
--- a/frontend/src/lib/components/Support/supportLogic.ts
+++ b/frontend/src/lib/components/Support/supportLogic.ts
@@ -508,7 +508,7 @@ export interface supportLogicValues {
export interface supportLogicActions {
openSidePanel: (
tab: SidePanelTab,
- options?: string
+ options?: string | undefined
) => {
options: string | undefined
tab: SidePanelTab
diff --git a/frontend/src/scenes/activity/explore/eventsSceneLogic.tsx b/frontend/src/scenes/activity/explore/eventsSceneLogic.tsx
index 0d58d52f2dd8..1897708cf4aa 100644
--- a/frontend/src/scenes/activity/explore/eventsSceneLogic.tsx
+++ b/frontend/src/scenes/activity/explore/eventsSceneLogic.tsx
@@ -1,5 +1,5 @@
import { deepEqual as equal } from 'fast-equals'
-import { actions, connect, kea, key, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, reducers, selectors } from 'kea'
import { urlToAction } from 'kea-router'
import { UrlToActionPayload } from 'kea-router/lib/types'
@@ -19,7 +19,58 @@ import { getDefaultEventsQueryForTeam } from '~/queries/nodes/DataTable/defaultE
import { DataTableNode, Node } from '~/queries/schema/schema-general'
import { ActivityTab, Breadcrumb } from '~/types'
-import type { eventsSceneLogicType } from './eventsSceneLogicType'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { TeamPublicType, TeamType } from '../../../types'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface eventsSceneLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ filterTestAccountsDefault: boolean // filterTestAccountsDefaultsLogic
+ savedQueryFor: (tabId: string | undefined, sceneKey: string) => Node | null // tabUiStateLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ breadcrumbs: Breadcrumb[]
+ defaultQuery: DataTableNode
+ query: DataTableNode | Node<Record<string, any>>
+ savedQuery: Node | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface eventsSceneLogicActions {
+ setSavedQueryForTab: (
+ tabId: string | undefined,
+ sceneKey: string,
+ query: Node<Record<string, any>> | null
+ ) => {
+ query: Node<Record<string, any>> | null
+ sceneKey: string
+ tabId: string
+ } // tabUiStateLogic
+ setQuery: (query: Node) => {
+ query: Node<Record<string, any>>
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface eventsSceneLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ defaultQuery: (
+ currentTeam: TeamPublicType | TeamType | null,
+ filterTestAccountsDefault: boolean
+ ) => DataTableNode
+ query: (
+ savedQuery: Node<Record<string, any>> | null,
+ defaultQuery: DataTableNode
+ ) => DataTableNode | Node<Record<string, any>>
+ }
+}
+
+export type eventsSceneLogicType = MakeLogicType<
+ eventsSceneLogicValues,
+ eventsSceneLogicActions,
+ Record<string, any>,
+ eventsSceneLogicMeta
+>
export const eventsSceneLogic = kea<eventsSceneLogicType>([
key(() => 'scene'),
@@ -49,7 +100,10 @@ export const eventsSceneLogic = kea<eventsSceneLogicType>([
selectors({
defaultQuery: [
(s) => [s.currentTeam, s.filterTestAccountsDefault],
- (currentTeam, filterTestAccountsDefault): DataTableNode => {
+ (
+ currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType,
+ filterTestAccountsDefault: boolean
+ ): DataTableNode => {
const defaultSourceForTeam = currentTeam && getDefaultEventsQueryForTeam(currentTeam)
const defaultForScene = getDefaultEventsSceneQuery()
const base = defaultSourceForTeam
@@ -61,7 +115,10 @@ export const eventsSceneLogic = kea<eventsSceneLogicType>([
}
},
],
- query: [(s) => [s.savedQuery, s.defaultQuery], (savedQuery, defaultQuery) => savedQuery || defaultQuery],
+ query: [
+ (s) => [s.savedQuery, s.defaultQuery],
+ (savedQuery: Node | null, defaultQuery: DataTableNode) => savedQuery || defaultQuery,
+ ],
breadcrumbs: [
() => [],
(): Breadcrumb[] => [
diff --git a/frontend/src/scenes/activity/explore/sessionsSceneLogic.tsx b/frontend/src/scenes/activity/explore/sessionsSceneLogic.tsx
index 7994cbdad3f4..754c1e85d4ed 100644
--- a/frontend/src/scenes/activity/explore/sessionsSceneLogic.tsx
+++ b/frontend/src/scenes/activity/explore/sessionsSceneLogic.tsx
@@ -1,5 +1,5 @@
import { deepEqual as equal } from 'fast-equals'
-import { actions, connect, kea, key, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, reducers, selectors } from 'kea'
import { urlToAction } from 'kea-router'
import { UrlToActionPayload } from 'kea-router/lib/types'
@@ -17,7 +17,53 @@ import { urls } from 'scenes/urls'
import { DataTableNode, Node } from '~/queries/schema/schema-general'
import { ActivityTab, Breadcrumb } from '~/types'
-import type { sessionsSceneLogicType } from './sessionsSceneLogicType'
+import type { TeamPublicType, TeamType } from '../../../types'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionsSceneLogicValues {
+ filterTestAccountsDefault: boolean // filterTestAccountsDefaultsLogic
+ savedQueryFor: (tabId: string | undefined, sceneKey: string) => Node | null // tabUiStateLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ breadcrumbs: Breadcrumb[]
+ defaultQuery: DataTableNode
+ query: Node
+ savedQuery: Node | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionsSceneLogicActions {
+ setSavedQueryForTab: (
+ tabId: string | undefined,
+ sceneKey: string,
+ query: Node<Record<string, any>> | null
+ ) => {
+ query: Node<Record<string, any>> | null
+ sceneKey: string
+ tabId: string
+ } // tabUiStateLogic
+ setQuery: (query: Node) => {
+ query: Node<Record<string, any>>
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionsSceneLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ defaultQuery: (
+ currentTeam: TeamPublicType | TeamType | null,
+ filterTestAccountsDefault: boolean
+ ) => DataTableNode
+ query: (savedQuery: Node<Record<string, any>> | null, defaultQuery: DataTableNode) => Node
+ }
+}
+
+export type sessionsSceneLogicType = MakeLogicType<
+ sessionsSceneLogicValues,
+ sessionsSceneLogicActions,
+ Record<string, any>,
+ sessionsSceneLogicMeta
+>
export const sessionsSceneLogic = kea<sessionsSceneLogicType>([
key(() => 'scene'),
@@ -45,10 +91,16 @@ export const sessionsSceneLogic = kea<sessionsSceneLogicType>([
selectors({
defaultQuery: [
(s) => [s.currentTeam, s.filterTestAccountsDefault],
- (currentTeam, filterTestAccountsDefault): DataTableNode =>
+ (
+ currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType,
+ filterTestAccountsDefault: boolean
+ ): DataTableNode =>
applyTestAccountFilter(getDefaultSessionsSceneQuery(), currentTeam, filterTestAccountsDefault),
],
- query: [(s) => [s.savedQuery, s.defaultQuery], (savedQuery, defaultQuery): Node => savedQuery || defaultQuery],
+ query: [
+ (s) => [s.savedQuery, s.defaultQuery],
+ (savedQuery: Node | null, defaultQuery: DataTableNode): Node => savedQuery || defaultQuery,
+ ],
breadcrumbs: [
() => [],
(): Breadcrumb[] => [
diff --git a/frontend/src/scenes/activity/live/liveEventsLogic.tsx b/frontend/src/scenes/activity/live/liveEventsLogic.tsx
index e1f50a59c508..5114568951df 100644
--- a/frontend/src/scenes/activity/live/liveEventsLogic.tsx
+++ b/frontend/src/scenes/activity/live/liveEventsLogic.tsx
@@ -1,4 +1,4 @@
-import { actions, connect, events, kea, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, events, kea, listeners, path, props, reducers, selectors } from 'kea'
import { Spinner, lemonToast } from '@posthog/lemon-ui'
@@ -12,8 +12,9 @@ import { teamLogic } from 'scenes/teamLogic'
import { AnyPropertyFilter, LiveEvent, PropertyFilterValue, PropertyOperator } from '~/types'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { TeamPublicType, TeamType } from '../../../types'
import { deduplicateEvents } from './deduplicateEvents'
-import type { liveEventsLogicType } from './liveEventsLogicType'
const ERROR_TOAST_ID = 'live-stream-error'
@@ -36,6 +37,70 @@ export interface LiveEventsLogicProps {
showLiveStreamErrorToast?: boolean
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface liveEventsLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ clientSideFilters: Record<string, any>
+ eventCount: number
+ eventHosts: string[]
+ events: LiveEvent[]
+ filteredEvents: LiveEvent[]
+ filters: {
+ eventType: string | null
+ properties: AnyPropertyFilter[]
+ }
+ lastBatchTimestamp: number | null
+ streamPaused: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface liveEventsLogicActions {
+ loadCurrentTeam: () => any // teamLogic
+ addEventHost: (eventHost: string) => {
+ eventHost: string
+ }
+ addEvents: (events: LiveEvent[]) => {
+ events: LiveEvent[]
+ }
+ clearEvents: () => {
+ value: true
+ }
+ pauseStream: () => {
+ value: true
+ }
+ resumeStream: () => {
+ value: true
+ }
+ setClientSideFilters: (clientSideFilters: Record<string, any>) => {
+ clientSideFilters: Record<string, any>
+ }
+ setFilters: (filters: { eventType?: string | null; properties?: AnyPropertyFilter[] }) => {
+ filters: {
+ eventType?: string | null | undefined
+ properties?: AnyPropertyFilter[] | undefined
+ }
+ }
+ updateEventsConnection: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface liveEventsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ eventCount: (events: LiveEvent[]) => number
+ filteredEvents: (events: LiveEvent[], clientSideFilters: Record<string, any>) => LiveEvent[]
+ }
+}
+
+export type liveEventsLogicType = MakeLogicType<
+ liveEventsLogicValues,
+ liveEventsLogicActions,
+ LiveEventsLogicProps,
+ liveEventsLogicMeta
+>
+
export const liveEventsLogic = kea<liveEventsLogicType>([
path(['scenes', 'activity', 'live-events', 'liveEventsLogic']),
props({} as LiveEventsLogicProps),
diff --git a/frontend/src/scenes/activity/live/liveEventsTableSceneLogic.ts b/frontend/src/scenes/activity/live/liveEventsTableSceneLogic.ts
index 3579981a3cb7..af89e8e7c4dc 100644
--- a/frontend/src/scenes/activity/live/liveEventsTableSceneLogic.ts
+++ b/frontend/src/scenes/activity/live/liveEventsTableSceneLogic.ts
@@ -1,11 +1,26 @@
-import { kea, key, path, selectors } from 'kea'
+import { MakeLogicType, kea, key, path, selectors } from 'kea'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene } from 'scenes/sceneTypes'
import { Breadcrumb } from '~/types'
-import type { liveEventsTableSceneLogicType } from './liveEventsTableSceneLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface liveEventsTableSceneLogicValues {
+ breadcrumbs: Breadcrumb[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface liveEventsTableSceneLogicMeta {
+ key: string
+}
+
+export type liveEventsTableSceneLogicType = MakeLogicType<
+ liveEventsTableSceneLogicValues,
+ {},
+ Record<string, any>,
+ liveEventsTableSceneLogicMeta
+>
export const liveEventsTableSceneLogic = kea<liveEventsTableSceneLogicType>([
key(() => 'scene'),
diff --git a/frontend/src/scenes/agentic/agenticAuthorizeLogic.ts b/frontend/src/scenes/agentic/agenticAuthorizeLogic.ts
index 3a5ef111714d..0eb7aacfddb0 100644
--- a/frontend/src/scenes/agentic/agenticAuthorizeLogic.ts
+++ b/frontend/src/scenes/agentic/agenticAuthorizeLogic.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 { loaders } from 'kea-loaders'
import { urlToAction } from 'kea-router'
@@ -10,14 +11,154 @@ import { userLogic } from 'scenes/userLogic'
import type { OrganizationBasicType, TeamBasicType, UserType } from '~/types'
-import type { agenticAuthorizeLogicType } from './agenticAuthorizeLogicType'
-
export type AgenticAuthorizationFormValues = {
scoped_organizations: string[]
scoped_teams: number[]
access_type: 'teams'
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface agenticAuthorizeLogicValues {
+ user: UserType | null // userLogic
+ agenticAuthorization: AgenticAuthorizationFormValues
+ agenticAuthorizationAllErrors: Record<string, any>
+ agenticAuthorizationChanged: boolean
+ agenticAuthorizationErrors: DeepPartialMap<AgenticAuthorizationFormValues, ValidationErrorType>
+ agenticAuthorizationHasErrors: boolean
+ agenticAuthorizationManualErrors: Record<string, any>
+ agenticAuthorizationTouched: boolean
+ agenticAuthorizationTouches: Record<string, boolean>
+ agenticAuthorizationValidationErrors: DeepPartialMap<AgenticAuthorizationFormValues, ValidationErrorType>
+ allOrganizations: OrganizationBasicType[]
+ allTeams: TeamBasicType[] | null
+ allTeamsLoading: boolean
+ filteredTeams: TeamBasicType[]
+ isAgenticAuthorizationSubmitting: boolean
+ isAgenticAuthorizationValid: boolean
+ partnerName: string
+ pendingAuth: {
+ partner_name: string
+ scopes: string[]
+ } | null
+ pendingAuthLoading: boolean
+ scopeDescriptions: string[]
+ scopes: string[]
+ showAgenticAuthorizationErrors: boolean
+ state: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface agenticAuthorizeLogicActions {
+ cancel: () => {
+ value: true
+ }
+ loadAllTeams: () => any
+ loadAllTeamsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAllTeamsSuccess: (
+ allTeams: TeamBasicType[],
+ payload?: any
+ ) => {
+ allTeams: TeamBasicType[]
+ payload?: any
+ }
+ loadPendingAuth: () => any
+ loadPendingAuthFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPendingAuthSuccess: (
+ pendingAuth: {
+ partner_name: string
+ scopes: string[]
+ } | null,
+ payload?: any
+ ) => {
+ pendingAuth: {
+ partner_name: string
+ scopes: string[]
+ } | null
+ payload?: any
+ }
+ resetAgenticAuthorization: (values?: AgenticAuthorizationFormValues) => {
+ values?: AgenticAuthorizationFormValues
+ }
+ setAgenticAuthorizationManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setAgenticAuthorizationValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setAgenticAuthorizationValues: (values: DeepPartial<AgenticAuthorizationFormValues>) => {
+ values: DeepPartial<AgenticAuthorizationFormValues>
+ }
+ setState: (state: string) => {
+ state: string
+ }
+ submitAgenticAuthorization: () => {
+ value: boolean
+ }
+ submitAgenticAuthorizationFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitAgenticAuthorizationRequest: (agenticAuthorization: AgenticAuthorizationFormValues) => {
+ agenticAuthorization: AgenticAuthorizationFormValues
+ }
+ submitAgenticAuthorizationSuccess: (agenticAuthorization: AgenticAuthorizationFormValues) => {
+ agenticAuthorization: AgenticAuthorizationFormValues
+ }
+ touchAgenticAuthorizationField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface agenticAuthorizeLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ allOrganizations: (user: UserType | null) => OrganizationBasicType[]
+ filteredTeams: (
+ allTeams: TeamBasicType[] | null,
+ agenticAuthorization: AgenticAuthorizationFormValues
+ ) => TeamBasicType[]
+ partnerName: (
+ pendingAuth: {
+ partner_name: string
+ scopes: string[]
+ } | null
+ ) => string
+ scopes: (
+ pendingAuth: {
+ partner_name: string
+ scopes: string[]
+ } | null
+ ) => string[]
+ scopeDescriptions: (scopes: string[]) => string[]
+ }
+}
+
+export type agenticAuthorizeLogicType = MakeLogicType<
+ agenticAuthorizeLogicValues,
+ agenticAuthorizeLogicActions,
+ Record<string, any>,
+ agenticAuthorizeLogicMeta
+>
+
export const agenticAuthorizeLogic = kea<agenticAuthorizeLogicType>([
path(['agentic', 'authorize']),
connect(() => ({
diff --git a/frontend/src/scenes/experiments/ExperimentForm/ExperimentTemplates/experimentTemplateModalLogic.ts b/frontend/src/scenes/experiments/ExperimentForm/ExperimentTemplates/experimentTemplateModalLogic.ts
index 51d540b926e9..7f14709051a0 100644
--- a/frontend/src/scenes/experiments/ExperimentForm/ExperimentTemplates/experimentTemplateModalLogic.ts
+++ b/frontend/src/scenes/experiments/ExperimentForm/ExperimentTemplates/experimentTemplateModalLogic.ts
@@ -1,7 +1,27 @@
-import { actions, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
import { ExperimentTemplate } from './constants'
-import type { experimentTemplateModalLogicType } from './experimentTemplateModalLogicType'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentTemplateModalLogicValues {
+ isModalOpen: boolean
+ template: ExperimentTemplate | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentTemplateModalLogicActions {
+ closeTemplateModal: () => {
+ value: true
+ }
+ openTemplateModal: (template: ExperimentTemplate) => {
+ template: ExperimentTemplate
+ }
+}
+
+export type experimentTemplateModalLogicType = MakeLogicType<
+ experimentTemplateModalLogicValues,
+ experimentTemplateModalLogicActions
+>
export const experimentTemplateModalLogic = kea<experimentTemplateModalLogicType>([
path(['scenes', 'experiments', 'ExperimentForm', 'ExperimentTemplates', 'experimentTemplateModalLogic']),
diff --git a/frontend/src/scenes/experiments/ExperimentForm/MetricsPanel/metricRecentActivityLogic.ts b/frontend/src/scenes/experiments/ExperimentForm/MetricsPanel/metricRecentActivityLogic.ts
index ac9e9b164351..6ae22422d33b 100644
--- a/frontend/src/scenes/experiments/ExperimentForm/MetricsPanel/metricRecentActivityLogic.ts
+++ b/frontend/src/scenes/experiments/ExperimentForm/MetricsPanel/metricRecentActivityLogic.ts
@@ -1,18 +1,53 @@
import { deepEqual as equal } from 'fast-equals'
-import { afterMount, kea, key, path, props, propsChanged } from 'kea'
+import { MakeLogicType, afterMount, kea, key, path, props, propsChanged } from 'kea'
import { loaders } from 'kea-loaders'
import { performQuery } from '~/queries/query'
import type { ExperimentMetric } from '~/queries/schema/schema-general'
import { getEventCountQuery } from '~/scenes/experiments/utils'
-import type { metricRecentActivityLogicType } from './metricRecentActivityLogicType'
-
export type MetricRecentActivityLogicProps = {
metric: ExperimentMetric
filterTestAccounts: boolean
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface metricRecentActivityLogicValues {
+ eventCount: number | null
+ eventCountLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface metricRecentActivityLogicActions {
+ loadEventCount: () => any
+ loadEventCountFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadEventCountSuccess: (
+ eventCount: number | null,
+ payload?: any
+ ) => {
+ eventCount: number | null
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface metricRecentActivityLogicMeta {
+ key: string
+}
+
+export type metricRecentActivityLogicType = MakeLogicType<
+ metricRecentActivityLogicValues,
+ metricRecentActivityLogicActions,
+ MetricRecentActivityLogicProps,
+ metricRecentActivityLogicMeta
+>
+
export const metricRecentActivityLogic = kea<metricRecentActivityLogicType>([
props({} as MetricRecentActivityLogicProps),
key((props) => `${props.metric.uuid}`),
diff --git a/frontend/src/scenes/experiments/ExperimentForm/createExperimentLogic.ts b/frontend/src/scenes/experiments/ExperimentForm/createExperimentLogic.ts
index bca1dd80ffd0..4af7f00b80aa 100644
--- a/frontend/src/scenes/experiments/ExperimentForm/createExperimentLogic.ts
+++ b/frontend/src/scenes/experiments/ExperimentForm/createExperimentLogic.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 { router } from 'kea-router'
import api from 'lib/api'
@@ -23,11 +23,13 @@ import type { Experiment, FeatureFlagFilters, MultivariateFlagVariant } from '~/
import type { ExperimentFeatureFlagFiltersApi } from 'products/experiments/frontend/generated/api.schemas'
+import type { ProductIntentProperties } from '../../../lib/utils/product-intents'
+import type { ExperimentMetricUnion } from '../../../queries/schema/schema-general'
+import type { FeatureFlagType } from '../../../types'
import { NEW_EXPERIMENT } from '../constants'
import { FORM_MODES, experimentLogic } from '../experimentLogic'
import { experimentSceneLogic } from '../experimentSceneLogic'
import { getExperimentVariants, toExperimentWritePayload, toFlagVariantsInput } from '../utils'
-import type { createExperimentLogicType } from './createExperimentLogicType'
import { validateExperimentSubmission } from './experimentSubmissionValidation'
import type { FeatureFlagKeyValidation } from './variantsPanelLogic'
import { variantsPanelLogic } from './variantsPanelLogic'
@@ -84,6 +86,145 @@ const clearDraftStorage = (): void => {
export interface CreateExperimentLogicProps {}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface createExperimentLogicValues {
+ currentProjectId: number | null // projectLogic
+ featureFlagKeyValidation: FeatureFlagKeyValidation | null // variantsPanelLogic
+ featureFlagKeyValidationLoading: boolean // variantsPanelLogic
+ canSubmitExperiment: boolean
+ experiment: Experiment & {
+ feature_flag_filters?: FeatureFlagFilters
+ }
+ experimentErrors: Record<string, string>
+ experimentValidationErrors: string | undefined
+ formCanceled: boolean
+ isExperimentSubmitting: boolean
+ mode: 'create' | 'link'
+ sharedMetrics: {
+ primary: ExperimentMetric[]
+ secondary: ExperimentMetric[]
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface createExperimentLogicActions {
+ reportExperimentCreated: (
+ experiment: Experiment,
+ metadata?:
+ | {
+ creation_source?: string
+ has_linked_flag?: boolean
+ }
+ | undefined
+ ) => {
+ experiment: Experiment
+ metadata:
+ | {
+ creation_source?: string | undefined
+ has_linked_flag?: boolean | undefined
+ }
+ | undefined
+ } // eventUsageLogic
+ updateFlag: (flag: FeatureFlagType) => {
+ flag: FeatureFlagType
+ } // featureFlagsLogic
+ addProductIntent: (properties: ProductIntentProperties) => ProductIntentProperties // teamLogic
+ cancelForm: () => {
+ value: true
+ }
+ createExperimentSuccess: () => {
+ value: true
+ }
+ resetExperiment: () => {
+ value: true
+ }
+ saveExperiment: () => {
+ value: true
+ }
+ saveExperimentFailure: () => {
+ value: true
+ }
+ saveExperimentStarted: () => {
+ value: true
+ }
+ saveExperimentSuccess: () => {
+ value: true
+ }
+ setExperiment: (experiment: Experiment) => {
+ experiment: Experiment
+ }
+ setExperimentErrors: (errors: Record<string, string>) => {
+ errors: Record<string, string>
+ }
+ setExperimentValue: (
+ name: string,
+ value: any
+ ) => {
+ name: string
+ value: any
+ }
+ setExposureCriteria: (criteria: ExperimentExposureCriteria) => {
+ criteria: ExperimentExposureCriteria
+ }
+ setFeatureFlagConfig: (config: {
+ ensure_experience_continuity?: boolean
+ feature_flag_key?: string
+ rollout_percentage?: number
+ variants?: MultivariateFlagVariant[]
+ }) => {
+ config: {
+ ensure_experience_continuity?: boolean | undefined
+ feature_flag_key?: string | undefined
+ rollout_percentage?: number | undefined
+ variants?: MultivariateFlagVariant[] | undefined
+ }
+ }
+ setSharedMetrics: (sharedMetrics: { primary: ExperimentMetric[]; secondary: ExperimentMetric[] }) => {
+ sharedMetrics: {
+ primary: ExperimentMetricUnion[]
+ secondary: ExperimentMetricUnion[]
+ }
+ }
+ validateField: (field: 'name') => {
+ field: 'name'
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface createExperimentLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ canSubmitExperiment: (
+ experiment: Experiment & {
+ feature_flag_filters?: FeatureFlagFilters
+ },
+ featureFlagKeyValidation: FeatureFlagKeyValidation | null,
+ mode: 'create' | 'link',
+ experimentErrors: Record<string, string>
+ ) => boolean
+ experimentValidationErrors: (
+ experiment: Experiment & {
+ feature_flag_filters?: FeatureFlagFilters
+ },
+ featureFlagKeyValidation: FeatureFlagKeyValidation | null,
+ mode: 'create' | 'link',
+ experimentErrors: Record<string, string>
+ ) => string | undefined
+ mode: (
+ experiment: Experiment & {
+ feature_flag_filters?: FeatureFlagFilters
+ }
+ ) => 'create' | 'link'
+ }
+}
+
+export type createExperimentLogicType = MakeLogicType<
+ createExperimentLogicValues,
+ createExperimentLogicActions,
+ CreateExperimentLogicProps,
+ createExperimentLogicMeta
+>
+
export const createExperimentLogic = kea<createExperimentLogicType>([
props({} as CreateExperimentLogicProps),
key(() => 'create-experiment'),
diff --git a/frontend/src/scenes/experiments/ExperimentForm/selectExistingFeatureFlagModalLogic.ts b/frontend/src/scenes/experiments/ExperimentForm/selectExistingFeatureFlagModalLogic.ts
index 7cd949165d35..dac5be2349f3 100644
--- a/frontend/src/scenes/experiments/ExperimentForm/selectExistingFeatureFlagModalLogic.ts
+++ b/frontend/src/scenes/experiments/ExperimentForm/selectExistingFeatureFlagModalLogic.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 { PaginationManual } from '@posthog/lemon-ui'
@@ -11,8 +11,8 @@ import { teamLogic } from 'scenes/teamLogic'
import { FeatureFlagType } from '~/types'
+import type { TeamPublicType, TeamType } from '../../../types'
import type { FeatureFlagModalFilters } from '../experimentsLogic'
-import type { selectExistingFeatureFlagModalLogicType } from './selectExistingFeatureFlagModalLogicType'
// Canonical definition lives in experimentsLogic; re-exported so existing importers keep working.
export type { FeatureFlagModalFilters }
@@ -26,6 +26,106 @@ const DEFAULT_FILTERS: FeatureFlagModalFilters = {
evaluation_runtime: undefined,
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface selectExistingFeatureFlagModalLogicValues {
+ currentProjectId: number | string // teamLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ featureFlags: {
+ count: number
+ results: FeatureFlagType[]
+ }
+ featureFlagsLoading: boolean
+ filters: FeatureFlagModalFilters
+ isEvaluationTagsRequired: boolean
+ isModalOpen: boolean
+ pagination: PaginationManual
+ paramsFromFilters: Record<string, any>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface selectExistingFeatureFlagModalLogicActions {
+ reportExperimentFeatureFlagModalOpened: () => {} // eventUsageLogic
+ loadCurrentTeamSuccess: (
+ currentTeam: TeamPublicType | null,
+ payload?: any
+ ) => {
+ currentTeam: TeamPublicType | null
+ payload?: any
+ } // teamLogic
+ updateCurrentTeamSuccess: (
+ currentTeam: TeamPublicType | TeamType,
+ payload?: Partial<TeamType>
+ ) => {
+ currentTeam: TeamPublicType | TeamType
+ payload?: Partial<TeamType>
+ } // teamLogic
+ closeSelectExistingFeatureFlagModal: () => {
+ value: true
+ }
+ loadFeatureFlags: () => any
+ loadFeatureFlagsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadFeatureFlagsForAutocomplete: () => {
+ value: true
+ }
+ loadFeatureFlagsSuccess: (
+ featureFlags: {
+ count: number
+ results: FeatureFlagType[]
+ },
+ payload?: any
+ ) => {
+ featureFlags: {
+ count: number
+ results: FeatureFlagType[]
+ }
+ payload?: any
+ }
+ openSelectExistingFeatureFlagModal: () => {
+ value: true
+ }
+ resetFilters: () => {
+ value: true
+ }
+ setFilters: (
+ filters: Partial<FeatureFlagModalFilters>,
+ replace?: boolean
+ ) => {
+ filters: Partial<FeatureFlagModalFilters>
+ replace: boolean | undefined
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface selectExistingFeatureFlagModalLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ paramsFromFilters: (
+ filters: FeatureFlagModalFilters,
+ currentTeam: TeamPublicType | TeamType | null
+ ) => Record<string, any>
+ pagination: (
+ filters: FeatureFlagModalFilters,
+ featureFlags: {
+ count: number
+ results: FeatureFlagType[]
+ }
+ ) => PaginationManual
+ isEvaluationTagsRequired: (currentTeam: TeamPublicType | TeamType | null) => boolean
+ }
+}
+
+export type selectExistingFeatureFlagModalLogicType = MakeLogicType<
+ selectExistingFeatureFlagModalLogicValues,
+ selectExistingFeatureFlagModalLogicActions,
+ Record<string, any>,
+ selectExistingFeatureFlagModalLogicMeta
+>
+
export const selectExistingFeatureFlagModalLogic = kea<selectExistingFeatureFlagModalLogicType>([
path(['scenes', 'experiments', 'create', 'selectExistingFeatureFlagModalLogic']),
@@ -115,7 +215,10 @@ export const selectExistingFeatureFlagModalLogic = kea<selectExistingFeatureFlag
selectors({
paramsFromFilters: [
(s) => [s.filters, s.currentTeam],
- (filters: FeatureFlagModalFilters, currentTeam) => {
+ (
+ filters: FeatureFlagModalFilters,
+ currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType
+ ) => {
const params: Record<string, any> = {
...filters,
limit: FLAGS_PER_PAGE,
@@ -132,7 +235,13 @@ export const selectExistingFeatureFlagModalLogic = kea<selectExistingFeatureFlag
],
pagination: [
(s) => [s.filters, s.featureFlags],
- (filters, featureFlags): PaginationManual => {
+ (
+ filters: FeatureFlagModalFilters,
+ featureFlags: {
+ count: number
+ results: FeatureFlagType[]
+ }
+ ): PaginationManual => {
const currentPage = filters.page || 1
const hasNextPage = featureFlags.count > currentPage * FLAGS_PER_PAGE
const hasPreviousPage = currentPage > 1
@@ -162,7 +271,8 @@ export const selectExistingFeatureFlagModalLogic = kea<selectExistingFeatureFlag
],
isEvaluationTagsRequired: [
(s) => [s.currentTeam],
- (currentTeam) => currentTeam?.require_evaluation_contexts || false,
+ (currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType) =>
+ currentTeam?.require_evaluation_contexts || false,
],
}),
])
diff --git a/frontend/src/scenes/experiments/ExperimentForm/variantsPanelLogic.ts b/frontend/src/scenes/experiments/ExperimentForm/variantsPanelLogic.ts
index c47bf64278ae..46928887842e 100644
--- a/frontend/src/scenes/experiments/ExperimentForm/variantsPanelLogic.ts
+++ b/frontend/src/scenes/experiments/ExperimentForm/variantsPanelLogic.ts
@@ -1,4 +1,4 @@
-import { kea } from 'kea'
+import { MakeLogicType, kea } from 'kea'
import api from 'lib/api'
import { toParams } from 'lib/utils/url'
@@ -9,7 +9,9 @@ import { teamLogic } from 'scenes/teamLogic'
import type { Experiment, FeatureFlagType } from '~/types'
-import type { variantsPanelLogicType } from './variantsPanelLogicType'
+import type { ExperimentIdType } from '../../../types'
+import type { FeatureFlagsResult } from '../../feature-flags/featureFlagsLogic'
+import type { ExperimentsResult } from '../experimentsLogic'
export type FeatureFlagKeyValidation = {
valid: boolean
@@ -19,6 +21,132 @@ export type FeatureFlagKeyValidation = {
key?: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface variantsPanelLogicValues {
+ experiments: ExperimentsResult // experimentsLogic
+ featureFlags: FeatureFlagsResult // featureFlagsLogic
+ currentProjectId: number | string // teamLogic
+ featureFlagKeyError: string | null
+ featureFlagKeyForAutocomplete: string | null
+ featureFlagKeyValidation: FeatureFlagKeyValidation | null
+ featureFlagKeyValidationLoading: boolean
+ linkedFeatureFlag: FeatureFlagType | null
+ mode: 'create' | 'link'
+ unavailableFeatureFlagKeys: Set<string>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface variantsPanelLogicActions {
+ clearFeatureFlagKeyValidation: () => {
+ value: true
+ }
+ clearFeatureFlagKeyValidationFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ clearFeatureFlagKeyValidationSuccess: (
+ featureFlagKeyValidation: null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ featureFlagKeyValidation: null
+ payload?: {
+ value: true
+ }
+ }
+ setFeatureFlagKeyForAutocomplete: (key: string | null) => {
+ key: string | null
+ }
+ setLinkedFeatureFlag: (flag: FeatureFlagType | null) => {
+ flag: FeatureFlagType | null
+ }
+ setMode: (mode: 'create' | 'link') => {
+ mode: 'create' | 'link'
+ }
+ validateFeatureFlagKey: (key: string) => {
+ key: string
+ }
+ validateFeatureFlagKeyFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ validateFeatureFlagKeySuccess: (
+ featureFlagKeyValidation:
+ | {
+ error: string
+ existingFlag: any
+ key: string
+ valid: false
+ }
+ | {
+ error: string
+ existingFlag?: undefined
+ key: string
+ valid: false
+ }
+ | {
+ error: null
+ existingFlag?: undefined
+ key: string
+ valid: true
+ },
+ payload?: {
+ key: string
+ }
+ ) => {
+ featureFlagKeyValidation:
+ | {
+ error: string
+ existingFlag: any
+ key: string
+ valid: false
+ }
+ | {
+ error: string
+ existingFlag?: undefined
+ key: string
+ valid: false
+ }
+ | {
+ error: null
+ existingFlag?: undefined
+ key: string
+ valid: true
+ }
+ payload?: {
+ key: string
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface variantsPanelLogicProps {
+ disabled: boolean
+ experiment: Experiment
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface variantsPanelLogicMeta {
+ key: ExperimentIdType
+ __keaTypeGenInternalSelectorTypes: {
+ unavailableFeatureFlagKeys: (featureFlags: FeatureFlagsResult, experiments: ExperimentsResult) => Set<string>
+ }
+}
+
+export type variantsPanelLogicType = MakeLogicType<
+ variantsPanelLogicValues,
+ variantsPanelLogicActions,
+ variantsPanelLogicProps,
+ variantsPanelLogicMeta
+>
+
export const variantsPanelLogic = kea<variantsPanelLogicType>({
key: (props) => props.experiment?.id || 'new',
path: (key) => ['scenes', 'experiments', 'create', 'panels', 'variantsPanelLogic', key],
@@ -135,7 +263,10 @@ export const variantsPanelLogic = kea<variantsPanelLogicType>({
// TRICKY: we do not load all feature flags here, just the latest ones.
unavailableFeatureFlagKeys: [
(s) => [s.featureFlags, s.experiments],
- (featureFlags, experiments) => {
+ (
+ featureFlags: import('scenes/feature-flags/featureFlagsLogic').FeatureFlagsResult,
+ experiments: import('scenes/experiments/experimentsLogic').ExperimentsResult
+ ) => {
return new Set([
...featureFlags.results.map((flag) => flag.key),
...experiments.results.map((experiment) => experiment.feature_flag_key),
diff --git a/frontend/src/scenes/experiments/ExperimentTabContent/createDraftExperimentFromFlagLogic.ts b/frontend/src/scenes/experiments/ExperimentTabContent/createDraftExperimentFromFlagLogic.ts
index 74296de57743..3008eb874866 100644
--- a/frontend/src/scenes/experiments/ExperimentTabContent/createDraftExperimentFromFlagLogic.ts
+++ b/frontend/src/scenes/experiments/ExperimentTabContent/createDraftExperimentFromFlagLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, listeners, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, props, reducers } from 'kea'
import { router } from 'kea-router'
import api from 'lib/api'
@@ -9,12 +9,61 @@ import { urls } from 'scenes/urls'
import type { Experiment } from '~/types'
-import type { createDraftExperimentFromFlagLogicType } from './createDraftExperimentFromFlagLogicType'
-
export interface CreateDraftExperimentFromFlagLogicProps {
featureFlagKey: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface createDraftExperimentFromFlagLogicValues {
+ currentProjectId: number | string // teamLogic
+ error: string | null
+ experimentDescription: string
+ experimentName: string
+ isLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface createDraftExperimentFromFlagLogicActions {
+ reportExperimentCreated: (
+ experiment: Experiment,
+ metadata?:
+ | {
+ creation_source?: string
+ has_linked_flag?: boolean
+ }
+ | undefined
+ ) => {
+ experiment: Experiment
+ metadata:
+ | {
+ creation_source?: string | undefined
+ has_linked_flag?: boolean | undefined
+ }
+ | undefined
+ } // eventUsageLogic
+ createDraftExperiment: () => {
+ value: true
+ }
+ createDraftExperimentFailure: (error: string) => {
+ error: string
+ }
+ createDraftExperimentSuccess: (experiment: Experiment) => {
+ experiment: Experiment
+ }
+ setExperimentDescription: (description: string) => {
+ description: string
+ }
+ setExperimentName: (name: string) => {
+ name: string
+ }
+}
+
+export type createDraftExperimentFromFlagLogicType = MakeLogicType<
+ createDraftExperimentFromFlagLogicValues,
+ createDraftExperimentFromFlagLogicActions,
+ CreateDraftExperimentFromFlagLogicProps
+>
+
export const createDraftExperimentFromFlagLogic = kea<createDraftExperimentFromFlagLogicType>([
path(['scenes', 'experiments', 'ExperimentTabContent', 'createDraftExperimentFromFlagLogic']),
props({} as CreateDraftExperimentFromFlagLogicProps),
diff --git a/frontend/src/scenes/experiments/ExperimentView/exposureCriteriaModalLogic.ts b/frontend/src/scenes/experiments/ExperimentView/exposureCriteriaModalLogic.ts
index 9bb191918aa8..40d20905d24b 100644
--- a/frontend/src/scenes/experiments/ExperimentView/exposureCriteriaModalLogic.ts
+++ b/frontend/src/scenes/experiments/ExperimentView/exposureCriteriaModalLogic.ts
@@ -1,9 +1,31 @@
-import { actions, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
import type { ExperimentExposureCriteria } from '~/queries/schema/schema-general'
import { NEW_EXPERIMENT } from '~/scenes/experiments/constants'
-import type { exposureCriteriaModalLogicType } from './exposureCriteriaModalLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface exposureCriteriaModalLogicValues {
+ exposureCriteria: ExperimentExposureCriteria
+ isExposureCriteriaModalOpen: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface exposureCriteriaModalLogicActions {
+ closeExposureCriteriaModal: () => {
+ value: true
+ }
+ openExposureCriteriaModal: (exposureCriteria?: ExperimentExposureCriteria) => {
+ exposureCriteria: ExperimentExposureCriteria | undefined
+ }
+ setExposureCriteria: (exposureCriteria: ExperimentExposureCriteria) => {
+ exposureCriteria: ExperimentExposureCriteria
+ }
+}
+
+export type exposureCriteriaModalLogicType = MakeLogicType<
+ exposureCriteriaModalLogicValues,
+ exposureCriteriaModalLogicActions
+>
export const exposureCriteriaModalLogic = kea<exposureCriteriaModalLogicType>([
path(['scenes', 'experiments', 'ExperimentForm', 'exposureCriteriaModalLogic']),
diff --git a/frontend/src/scenes/experiments/ExperimentView/flagCleanupTaskLogic.ts b/frontend/src/scenes/experiments/ExperimentView/flagCleanupTaskLogic.ts
index 3c2aac568364..87debe375bd0 100644
--- a/frontend/src/scenes/experiments/ExperimentView/flagCleanupTaskLogic.ts
+++ b/frontend/src/scenes/experiments/ExperimentView/flagCleanupTaskLogic.ts
@@ -1,4 +1,4 @@
-import { afterMount, connect, kea, key, listeners, path, props } from 'kea'
+import { MakeLogicType, afterMount, connect, kea, key, listeners, path, props } from 'kea'
import { loaders } from 'kea-loaders'
import { projectLogic } from 'scenes/projectLogic'
@@ -6,14 +6,50 @@ import { projectLogic } from 'scenes/projectLogic'
import { experimentsFlagCleanupTaskRetrieve } from 'products/experiments/frontend/generated/api'
import type { ExperimentFlagCleanupTaskApi } from 'products/experiments/frontend/generated/api.schemas'
-import type { flagCleanupTaskLogicType } from './flagCleanupTaskLogicType'
-
export interface FlagCleanupTaskLogicProps {
experimentId: number
}
const POLL_INTERVAL_MS = 30000
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface flagCleanupTaskLogicValues {
+ currentProjectId: number | null // projectLogic
+ cleanupTask: ExperimentFlagCleanupTaskApi | null
+ cleanupTaskLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface flagCleanupTaskLogicActions {
+ loadCleanupTask: () => any
+ loadCleanupTaskFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadCleanupTaskSuccess: (
+ cleanupTask: ExperimentFlagCleanupTaskApi,
+ payload?: any
+ ) => {
+ cleanupTask: ExperimentFlagCleanupTaskApi
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface flagCleanupTaskLogicMeta {
+ key: number
+}
+
+export type flagCleanupTaskLogicType = MakeLogicType<
+ flagCleanupTaskLogicValues,
+ flagCleanupTaskLogicActions,
+ FlagCleanupTaskLogicProps,
+ flagCleanupTaskLogicMeta
+>
+
export const flagCleanupTaskLogic = kea<flagCleanupTaskLogicType>([
props({} as FlagCleanupTaskLogicProps),
key((props) => props.experimentId),
diff --git a/frontend/src/scenes/experiments/ExperimentWizard/experimentWizardLogic.ts b/frontend/src/scenes/experiments/ExperimentWizard/experimentWizardLogic.ts
index 0bc21aac7c38..dec4c981478c 100644
--- a/frontend/src/scenes/experiments/ExperimentWizard/experimentWizardLogic.ts
+++ b/frontend/src/scenes/experiments/ExperimentWizard/experimentWizardLogic.ts
@@ -1,16 +1,21 @@
-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 { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import type { Experiment, FeatureFlagType } from '~/types'
+import type {
+ ExperimentExposureCriteria,
+ ExperimentMetric,
+ ExperimentMetricUnion,
+} from '../../../queries/schema/schema-general'
+import type { FeatureFlagFilters, MultivariateFlagVariant } from '../../../types'
import { NEW_EXPERIMENT } from '../constants'
import { createExperimentLogic } from '../ExperimentForm/createExperimentLogic'
import { selectExistingFeatureFlagModalLogic } from '../ExperimentForm/selectExistingFeatureFlagModalLogic'
import type { FeatureFlagKeyValidation } from '../ExperimentForm/variantsPanelLogic'
import { variantsPanelLogic } from '../ExperimentForm/variantsPanelLogic'
import { getExperimentVariants, getFlagVariants } from '../utils'
-import type { experimentWizardLogicType } from './experimentWizardLogicType'
export type ExperimentWizardStep = 'about' | 'variants' | 'analytics'
@@ -43,6 +48,159 @@ export const STEP_ORDER: Record<ExperimentWizardStep, number> = {
export interface ExperimentWizardLogicProps {}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentWizardLogicValues {
+ experiment: Experiment & {
+ feature_flag_filters?: FeatureFlagFilters
+ } // createExperimentLogic
+ featureFlagKeyValidation: FeatureFlagKeyValidation | null // createExperimentLogic
+ featureFlagKeyValidationLoading: boolean // createExperimentLogic
+ isExperimentSubmitting: boolean // createExperimentLogic
+ sharedMetrics: {
+ primary: ExperimentMetric[]
+ secondary: ExperimentMetric[]
+ } // createExperimentLogic
+ currentStep: ExperimentWizardStep
+ currentStepHasErrors: boolean
+ departedSteps: Record<string, boolean>
+ hasFormErrors: boolean
+ initialFlagCheckDone: boolean
+ isFirstStep: boolean
+ isLastStep: boolean
+ linkedFeatureFlag: FeatureFlagType | null
+ showGuide: boolean
+ stepNumber: number
+ stepValidationErrors: Record<ExperimentWizardStep, string[]>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentWizardLogicActions {
+ saveExperiment: () => {
+ value: true
+ } // createExperimentLogic
+ saveExperimentSuccess: () => {
+ value: true
+ } // createExperimentLogic
+ setExperiment: (experiment: Experiment) => {
+ experiment: Experiment
+ } // createExperimentLogic
+ setExperimentValue: (
+ name: string,
+ value: any
+ ) => {
+ name: string
+ value: any
+ } // createExperimentLogic
+ setExposureCriteria: (criteria: ExperimentExposureCriteria) => {
+ criteria: ExperimentExposureCriteria
+ } // createExperimentLogic
+ setFeatureFlagConfig: (config: {
+ ensure_experience_continuity?: boolean
+ feature_flag_key?: string
+ rollout_percentage?: number
+ variants?: MultivariateFlagVariant[]
+ }) => {
+ config: {
+ ensure_experience_continuity?: boolean | undefined
+ feature_flag_key?: string | undefined
+ rollout_percentage?: number | undefined
+ variants?: MultivariateFlagVariant[] | undefined
+ }
+ } // createExperimentLogic
+ setSharedMetrics: (sharedMetrics: { primary: ExperimentMetric[]; secondary: ExperimentMetric[] }) => {
+ sharedMetrics: {
+ primary: ExperimentMetricUnion[]
+ secondary: ExperimentMetricUnion[]
+ }
+ } // createExperimentLogic
+ reportExperimentWizardGuideToggled: (
+ visible: boolean,
+ currentStep: string
+ ) => {
+ currentStep: string
+ visible: boolean
+ } // eventUsageLogic
+ reportExperimentWizardStarted: (guideVisible: boolean) => {
+ guideVisible: boolean
+ } // eventUsageLogic
+ loadFeatureFlagsForAutocomplete: () => {
+ value: true
+ } // selectExistingFeatureFlagModalLogic
+ loadFeatureFlagsSuccess: (
+ featureFlags: {
+ count: number
+ results: FeatureFlagType[]
+ },
+ payload?: any
+ ) => {
+ featureFlags: {
+ count: number
+ results: FeatureFlagType[]
+ }
+ payload?: any
+ } // selectExistingFeatureFlagModalLogic
+ clearFeatureFlagKeyValidation: () => {
+ value: true
+ } // variantsPanelLogic
+ validateFeatureFlagKey: (key: string) => {
+ key: string
+ } // variantsPanelLogic
+ _applyStep: (step: ExperimentWizardStep) => {
+ step: ExperimentWizardStep
+ }
+ markStepDeparted: (step: ExperimentWizardStep) => {
+ step: ExperimentWizardStep
+ }
+ nextStep: () => {
+ value: true
+ }
+ prevStep: () => {
+ value: true
+ }
+ resetWizard: () => {
+ value: true
+ }
+ setLinkedFeatureFlag: (flag: FeatureFlagType | null) => {
+ flag: FeatureFlagType | null
+ }
+ setStep: (step: ExperimentWizardStep) => {
+ step: ExperimentWizardStep
+ }
+ toggleGuide: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentWizardLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ stepNumber: (currentStep: ExperimentWizardStep) => number
+ isLastStep: (currentStep: ExperimentWizardStep) => boolean
+ isFirstStep: (currentStep: ExperimentWizardStep) => boolean
+ stepValidationErrors: (
+ experiment: Experiment & {
+ feature_flag_filters?: FeatureFlagFilters
+ },
+ featureFlagKeyValidation: FeatureFlagKeyValidation | null,
+ linkedFeatureFlag: FeatureFlagType | null,
+ departedSteps: Record<string, boolean>
+ ) => Record<ExperimentWizardStep, string[]>
+ currentStepHasErrors: (
+ stepValidationErrors: Record<ExperimentWizardStep, string[]>,
+ currentStep: ExperimentWizardStep
+ ) => boolean
+ hasFormErrors: (stepValidationErrors: Record<ExperimentWizardStep, string[]>) => boolean
+ }
+}
+
+export type experimentWizardLogicType = MakeLogicType<
+ experimentWizardLogicValues,
+ experimentWizardLogicActions,
+ ExperimentWizardLogicProps,
+ experimentWizardLogicMeta
+>
+
export const experimentWizardLogic = kea<experimentWizardLogicType>([
path(['scenes', 'experiments', 'wizard', 'experimentWizardLogic']),
diff --git a/frontend/src/scenes/experiments/Metrics/experimentMetricModalLogic.ts b/frontend/src/scenes/experiments/Metrics/experimentMetricModalLogic.ts
index 160194f4820f..fb7abdf94129 100644
--- a/frontend/src/scenes/experiments/Metrics/experimentMetricModalLogic.ts
+++ b/frontend/src/scenes/experiments/Metrics/experimentMetricModalLogic.ts
@@ -1,9 +1,9 @@
-import { actions, kea, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers, selectors } from 'kea'
import type { ExperimentMetric } from '~/queries/schema/schema-general'
+import type { ExperimentMetricUnion } from '../../../queries/schema/schema-general'
import { getDefaultFunnelMetric } from '../utils'
-import type { experimentMetricModalLogicType } from './experimentMetricModalLogicType'
export const METRIC_CONTEXTS = {
primary: {
@@ -20,6 +20,46 @@ export const METRIC_CONTEXTS = {
export type MetricContext = (typeof METRIC_CONTEXTS)[keyof typeof METRIC_CONTEXTS]
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentMetricModalLogicValues {
+ context: MetricContext
+ isCreateMode: boolean
+ isEditMode: boolean
+ isModalOpen: boolean
+ metric: ExperimentMetric | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentMetricModalLogicActions {
+ closeExperimentMetricModal: () => {
+ value: true
+ }
+ openExperimentMetricModal: (
+ context: MetricContext,
+ metric?: ExperimentMetric
+ ) => {
+ context: MetricContext
+ metric: ExperimentMetricUnion | undefined
+ }
+ setMetric: (metric?: ExperimentMetric) => {
+ metric: ExperimentMetricUnion | undefined
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentMetricModalLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ isCreateMode: (isEditMode: boolean) => boolean
+ }
+}
+
+export type experimentMetricModalLogicType = MakeLogicType<
+ experimentMetricModalLogicValues,
+ experimentMetricModalLogicActions,
+ Record<string, any>,
+ experimentMetricModalLogicMeta
+>
+
export const experimentMetricModalLogic = kea<experimentMetricModalLogicType>([
path(['scenes', 'experiments', 'Metrics', 'experimentMetricModalLogic']),
diff --git a/frontend/src/scenes/experiments/Metrics/metricSourceModalLogic.tsx b/frontend/src/scenes/experiments/Metrics/metricSourceModalLogic.tsx
index 8730aae556e0..da9b56f7f50e 100644
--- a/frontend/src/scenes/experiments/Metrics/metricSourceModalLogic.tsx
+++ b/frontend/src/scenes/experiments/Metrics/metricSourceModalLogic.tsx
@@ -1,8 +1,25 @@
-import { kea } from 'kea'
+import { MakeLogicType, kea } from 'kea'
import { actions, path, reducers } from 'kea'
import { METRIC_CONTEXTS, type MetricContext } from './experimentMetricModalLogic'
-import type { metricSourceModalLogicType } from './metricSourceModalLogicType'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface metricSourceModalLogicValues {
+ context: MetricContext
+ isModalOpen: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface metricSourceModalLogicActions {
+ closeMetricSourceModal: () => {
+ value: true
+ }
+ openMetricSourceModal: (context: MetricContext) => {
+ context: MetricContext
+ }
+}
+
+export type metricSourceModalLogicType = MakeLogicType<metricSourceModalLogicValues, metricSourceModalLogicActions>
export const metricSourceModalLogic = kea<metricSourceModalLogicType>([
path(['scenes', 'experiments', 'metrics', 'metricSourceModalLogic']),
diff --git a/frontend/src/scenes/experiments/Metrics/sharedMetricDetailsModalLogic.ts b/frontend/src/scenes/experiments/Metrics/sharedMetricDetailsModalLogic.ts
index 0f1ecf93019f..b69e89275656 100644
--- a/frontend/src/scenes/experiments/Metrics/sharedMetricDetailsModalLogic.ts
+++ b/frontend/src/scenes/experiments/Metrics/sharedMetricDetailsModalLogic.ts
@@ -1,9 +1,35 @@
-import { actions, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
import type { ExperimentMetric } from '~/queries/schema/schema-general'
+import type { ExperimentMetricUnion } from '../../../queries/schema/schema-general'
import { METRIC_CONTEXTS, type MetricContext } from './experimentMetricModalLogic'
-import type { sharedMetricDetailsModalLogicType } from './sharedMetricDetailsModalLogicType'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sharedMetricDetailsModalLogicValues {
+ context: MetricContext
+ isModalOpen: boolean
+ sharedMetric: ExperimentMetric | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sharedMetricDetailsModalLogicActions {
+ closeSharedMetricDetailModal: () => {
+ value: true
+ }
+ openSharedMetricDetailModal: (
+ metric: ExperimentMetric,
+ context: MetricContext
+ ) => {
+ context: MetricContext
+ metric: ExperimentMetricUnion
+ }
+}
+
+export type sharedMetricDetailsModalLogicType = MakeLogicType<
+ sharedMetricDetailsModalLogicValues,
+ sharedMetricDetailsModalLogicActions
+>
export const sharedMetricDetailsModalLogic = kea<sharedMetricDetailsModalLogicType>([
path(['scenes', 'experiments', 'Metrics', 'sharedMetricDetailsModalLogic']),
diff --git a/frontend/src/scenes/experiments/Metrics/sharedMetricModalLogic.ts b/frontend/src/scenes/experiments/Metrics/sharedMetricModalLogic.ts
index 6bca8f0f227b..6f3ff2619a7b 100644
--- a/frontend/src/scenes/experiments/Metrics/sharedMetricModalLogic.ts
+++ b/frontend/src/scenes/experiments/Metrics/sharedMetricModalLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import api, { CountedPaginatedResponse } from 'lib/api'
@@ -8,12 +8,144 @@ import { teamLogic } from 'scenes/teamLogic'
import { NodeKind } from '~/queries/schema/schema-general'
+import type { ExperimentIdType } from '../../../types'
import { SharedMetric } from '../SharedMetrics/sharedMetricLogic'
import { METRIC_CONTEXTS, type MetricContext } from './experimentMetricModalLogic'
-import type { sharedMetricModalLogicType } from './sharedMetricModalLogicType'
export const MODAL_PAGE_SIZE = 20
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sharedMetricModalLogicValues {
+ currentProjectId: number | string // teamLogic
+ availableTags: string[]
+ compatibleSharedMetrics: SharedMetric[]
+ context: MetricContext
+ displayedMetrics: SharedMetric[]
+ filterTags: string[]
+ hasAnyCompatibleSharedMetrics: boolean
+ isCreateMode: boolean
+ isEditMode: boolean
+ isLoadingAllSharedMetrics: boolean
+ isModalOpen: boolean
+ loadedSharedMetrics: SharedMetric[]
+ searchTerm: string
+ selectedMetricIds: SharedMetric['id'][]
+ sharedMetricId: SharedMetric['id'] | null
+ sharedMetricsResponse: CountedPaginatedResponse<SharedMetric> | null
+ sharedMetricsResponseLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sharedMetricModalLogicActions {
+ reportExperimentSharedMetricAssigned: (
+ experimentId: ExperimentIdType,
+ sharedMetric: SharedMetric
+ ) => {
+ experimentId: ExperimentIdType
+ sharedMetric: SharedMetric
+ } // eventUsageLogic
+ clearFilterTags: () => {
+ value: true
+ }
+ clearSelectedMetricIds: () => {
+ value: true
+ }
+ closeSharedMetricModal: () => {
+ value: true
+ }
+ loadAllSharedMetrics: (_: any) => any
+ loadAllSharedMetricsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAllSharedMetricsSuccess: (
+ sharedMetricsResponse: {
+ count: number
+ next: null
+ previous?: string | null | undefined
+ results: SharedMetric[]
+ },
+ payload?: any
+ ) => {
+ sharedMetricsResponse: {
+ count: number
+ next: null
+ previous?: string | null | undefined
+ results: SharedMetric[]
+ }
+ payload?: any
+ }
+ loadSharedMetrics: (_: void) => void
+ loadSharedMetricsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSharedMetricsSuccess: (
+ sharedMetricsResponse: CountedPaginatedResponse<SharedMetric>,
+ payload?: void
+ ) => {
+ sharedMetricsResponse: CountedPaginatedResponse<SharedMetric>
+ payload?: void
+ }
+ openSharedMetricModal: (
+ context: MetricContext,
+ sharedMetricId?: SharedMetric['id'] | null
+ ) => {
+ context: MetricContext
+ sharedMetricId: number | null | undefined
+ }
+ selectByTag: (
+ tag: string,
+ alreadyAddedIds: SharedMetric['id'][]
+ ) => {
+ alreadyAddedIds: number[]
+ tag: string
+ }
+ setHasAnyCompatibleSharedMetrics: (hasAny: boolean) => {
+ hasAny: boolean
+ }
+ setSearchTerm: (searchTerm: string) => {
+ searchTerm: string
+ }
+ setSelectedMetricIds: (ids: SharedMetric['id'][]) => {
+ ids: number[]
+ }
+ setSharedMetric: (sharedMetric: SharedMetric) => {
+ sharedMetric: SharedMetric
+ }
+ toggleSelectedMetricId: (id: SharedMetric['id']) => {
+ id: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sharedMetricModalLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ loadedSharedMetrics: (sharedMetricsResponse: CountedPaginatedResponse<SharedMetric> | null) => SharedMetric[]
+ compatibleSharedMetrics: (loadedSharedMetrics: SharedMetric[]) => SharedMetric[]
+ availableTags: (compatibleSharedMetrics: SharedMetric[]) => string[]
+ displayedMetrics: (compatibleSharedMetrics: SharedMetric[], filterTags: string[]) => SharedMetric[]
+ isLoadingAllSharedMetrics: (
+ sharedMetricsResponseLoading: boolean,
+ sharedMetricsResponse: CountedPaginatedResponse<SharedMetric> | null
+ ) => boolean
+ isCreateMode: (isEditMode: boolean) => boolean
+ }
+}
+
+export type sharedMetricModalLogicType = MakeLogicType<
+ sharedMetricModalLogicValues,
+ sharedMetricModalLogicActions,
+ Record<string, any>,
+ sharedMetricModalLogicMeta
+>
+
export const sharedMetricModalLogic = kea<sharedMetricModalLogicType>([
path(['scenes', 'experiments', 'Metrics', 'sharedMetricModalLogic']),
@@ -160,7 +292,10 @@ export const sharedMetricModalLogic = kea<sharedMetricModalLogicType>([
})),
selectors({
- loadedSharedMetrics: [(s) => [s.sharedMetricsResponse], (response): SharedMetric[] => response?.results ?? []],
+ loadedSharedMetrics: [
+ (s) => [s.sharedMetricsResponse],
+ (response: CountedPaginatedResponse<SharedMetric> | null): SharedMetric[] => response?.results ?? [],
+ ],
compatibleSharedMetrics: [
(s) => [s.loadedSharedMetrics],
(loadedSharedMetrics: SharedMetric[]): SharedMetric[] =>
diff --git a/frontend/src/scenes/experiments/RunningTimeCalculator/runningTimeLogic.ts b/frontend/src/scenes/experiments/RunningTimeCalculator/runningTimeLogic.ts
index 44cd45fc8ee8..901b35aacaf4 100644
--- a/frontend/src/scenes/experiments/RunningTimeCalculator/runningTimeLogic.ts
+++ b/frontend/src/scenes/experiments/RunningTimeCalculator/runningTimeLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { subscriptions } from 'kea-subscriptions'
@@ -17,6 +17,8 @@ import type {
RunningTimeCalculationResultApi,
} from 'products/experiments/frontend/generated/api.schemas'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { CachedNewExperimentQueryResponse, ExperimentMetricUnion } from '../../../queries/schema/schema-general'
import { experimentLogic } from '../experimentLogic'
import { experimentMetricsLogic } from '../experimentMetricsLogic'
import { isLaunched } from '../experimentsLogic'
@@ -30,7 +32,6 @@ import {
calculateExposureRate,
getCalculatorMetricType,
} from './calculations'
-import type { runningTimeLogicType } from './runningTimeLogicType'
export interface RunningTimeLogicProps {
experiment: Experiment
@@ -49,6 +50,209 @@ export interface ManualPreview {
runningTime: number | null
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface runningTimeLogicValues {
+ currentProjectId: number | null // experimentLogic
+ experiment: Experiment // experimentLogic
+ orderedPrimaryMetricsWithResults: {
+ displayIndex: number
+ error: any
+ metric: ExperimentMetricUnion
+ metricIndex: number
+ result: any
+ }[] // experimentLogic
+ primaryMetricsResultsLoading: boolean // experimentLogic
+ recalcPrimaryMetricsResults: CachedNewExperimentQueryResponse[] // experimentMetricsLogic
+ recalcPrimaryMetricsResultsErrors: (unknown | null)[] // experimentMetricsLogic
+ defaultMinimumDetectableEffect: number // experimentsConfigLogic
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ isRunningTimeConfigModalOpen: boolean // modalsLogic
+ automaticCalculation: RunningTimeCalculationResultApi | null
+ automaticCalculationInput: RunningTimeCalculationInputApi | null
+ automaticCalculationLoading: boolean
+ config: RunningTimeConfig
+ configOverrides: Partial<RunningTimeConfig> | null
+ currentExposures: number | null
+ dailyExposureRate: number | null
+ initialConfig: RunningTimeConfig
+ isComplete: boolean
+ isManualMode: boolean
+ isSaving: boolean
+ manualFormPreview: ManualPreview
+ manualPreview: ManualPreview
+ manualPreviewInput: RunningTimeCalculationInputApi | null
+ manualPreviewLoading: boolean
+ mde: number
+ metricsWithResults: {
+ displayIndex: number
+ error: any
+ metric: ExperimentMetricUnion
+ metricIndex: number
+ result: any
+ }[]
+ mode: RunningTimeConfig['mode']
+ numberOfVariants: number
+ remainingDays: number | null
+ targetSampleSize: number | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface runningTimeLogicActions {
+ setExperiment: (experiment: Partial<Experiment>) => {
+ experiment: Partial<Experiment>
+ } // experimentLogic
+ closeRunningTimeConfigModal: () => {
+ value: true
+ } // modalsLogic
+ cancel: () => {
+ value: true
+ }
+ loadAutomaticCalculation: (input: RunningTimeCalculationInputApi) => RunningTimeCalculationInputApi
+ loadAutomaticCalculationFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAutomaticCalculationSuccess: (
+ automaticCalculation: RunningTimeCalculationResultApi,
+ payload?: RunningTimeCalculationInputApi
+ ) => {
+ automaticCalculation: RunningTimeCalculationResultApi
+ payload?: RunningTimeCalculationInputApi
+ }
+ loadManualPreview: (input: RunningTimeCalculationInputApi) => RunningTimeCalculationInputApi
+ loadManualPreviewFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadManualPreviewSuccess: (
+ manualPreview: {
+ runningTime: number | null
+ sampleSize: number | null
+ },
+ payload?: RunningTimeCalculationInputApi
+ ) => {
+ manualPreview: {
+ runningTime: number | null
+ sampleSize: number | null
+ }
+ payload?: RunningTimeCalculationInputApi
+ }
+ persistRunningTimeEstimate: () => {
+ value: true
+ }
+ resetConfig: () => {
+ value: true
+ }
+ save: () => {
+ value: true
+ }
+ setConfig: (config: Partial<RunningTimeConfig>) => {
+ config: Partial<RunningTimeConfig>
+ }
+ setSaving: (saving: boolean) => {
+ saving: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface runningTimeLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ numberOfVariants: (experiment: Experiment) => number
+ isManualMode: (experiment: Experiment) => boolean
+ initialConfig: (
+ experiment: Experiment,
+ isManualMode: boolean,
+ defaultMinimumDetectableEffect: number
+ ) => RunningTimeConfig
+ config: (
+ initialConfig: RunningTimeConfig,
+ configOverrides: Partial<RunningTimeConfig> | null
+ ) => RunningTimeConfig
+ mde: (config: RunningTimeConfig) => number
+ mode: (config: RunningTimeConfig) => RunningTimeConfig['mode']
+ metricsWithResults: (
+ experiment: Experiment,
+ featureFlags: FeatureFlagsSet,
+ orderedPrimaryMetricsWithResults: {
+ displayIndex: number
+ error: any
+ metric: ExperimentMetricUnion
+ metricIndex: number
+ result: any
+ }[],
+ recalcPrimaryMetricsResults: CachedNewExperimentQueryResponse[],
+ recalcPrimaryMetricsResultsErrors: unknown[]
+ ) => {
+ displayIndex: number
+ error: any
+ metric: ExperimentMetricUnion
+ metricIndex: number
+ result: any
+ }[]
+ currentExposures: (
+ metricsWithResults: {
+ displayIndex: number
+ error: any
+ metric: ExperimentMetricUnion
+ metricIndex: number
+ result: any
+ }[]
+ ) => number | null
+ automaticCalculationInput: (
+ mode: 'automatic' | 'manual',
+ metricsWithResults: {
+ displayIndex: number
+ error: any
+ metric: ExperimentMetricUnion
+ metricIndex: number
+ result: any
+ }[],
+ numberOfVariants: number,
+ mde: number
+ ) => RunningTimeCalculationInputApi | null
+ manualPreviewInput: (
+ config: RunningTimeConfig,
+ numberOfVariants: number
+ ) => RunningTimeCalculationInputApi | null
+ targetSampleSize: (
+ isManualMode: boolean,
+ experiment: Experiment,
+ automaticCalculationInput: RunningTimeCalculationInputApi | null,
+ automaticCalculation: RunningTimeCalculationResultApi | null
+ ) => number | null
+ dailyExposureRate: (
+ isManualMode: boolean,
+ experiment: Experiment,
+ currentExposures: number | null
+ ) => number | null
+ remainingDays: (
+ targetSampleSize: number | null,
+ currentExposures: number | null,
+ dailyExposureRate: number | null,
+ experiment: Experiment
+ ) => number | null
+ isComplete: (currentExposures: number | null, targetSampleSize: number | null) => boolean
+ manualFormPreview: (
+ manualPreviewInput: RunningTimeCalculationInputApi | null,
+ manualPreview: ManualPreview
+ ) => ManualPreview
+ }
+}
+
+export type runningTimeLogicType = MakeLogicType<
+ runningTimeLogicValues,
+ runningTimeLogicActions,
+ RunningTimeLogicProps,
+ runningTimeLogicMeta
+>
+
export const runningTimeLogic = kea<runningTimeLogicType>([
path(['scenes', 'experiments', 'RunningTimeCalculator', 'runningTimeLogic']),
props({} as RunningTimeLogicProps),
@@ -140,19 +344,23 @@ export const runningTimeLogic = kea<runningTimeLogicType>([
selectors({
numberOfVariants: [
(s) => [s.experiment],
- (experiment): number => getFlagVariants(experiment?.feature_flag).length || 2,
+ (experiment: Experiment): number => getFlagVariants(experiment?.feature_flag).length || 2,
],
isManualMode: [
(s) => [s.experiment],
- (experiment): boolean =>
+ (experiment: Experiment): boolean =>
experiment?.running_time_calculation?.exposure_estimate_config?.conversionRateInputType ===
ConversionRateInputType.MANUAL,
],
initialConfig: [
(s) => [s.experiment, s.isManualMode, s.defaultMinimumDetectableEffect],
- (experiment, isManualMode, defaultMinimumDetectableEffect): RunningTimeConfig => {
+ (
+ experiment: Experiment,
+ isManualMode: boolean,
+ defaultMinimumDetectableEffect: number
+ ): RunningTimeConfig => {
// Pre-launch experiments must use manual mode (no data available for automatic)
const isPreLaunch = !isLaunched(experiment)
const exposureEstimateConfig = experiment?.running_time_calculation?.exposure_estimate_config
@@ -170,14 +378,14 @@ export const runningTimeLogic = kea<runningTimeLogicType>([
config: [
(s) => [s.initialConfig, s.configOverrides],
- (initialConfig, configOverrides): RunningTimeConfig =>
+ (initialConfig: RunningTimeConfig, configOverrides: Partial<RunningTimeConfig> | null): RunningTimeConfig =>
configOverrides ? { ...initialConfig, ...configOverrides } : initialConfig,
],
// Pulled out as primitives so automaticCalculationInput stays stable when the experiment object
// is replaced (e.g. after persisting an estimate) but the underlying values are unchanged.
- mde: [(s) => [s.config], (config): number => config.mde],
- mode: [(s) => [s.config], (config): RunningTimeConfig['mode'] => config.mode],
+ mde: [(s) => [s.config], (config: RunningTimeConfig): number => config.mde],
+ mode: [(s) => [s.config], (config: RunningTimeConfig): RunningTimeConfig['mode'] => config.mode],
// Legacy flow exposes metric results via experimentLogic; the recalculation flow exposes them
// via experimentMetricsLogic. Pick whichever is active so automatic mode always has a baseline.
@@ -189,7 +397,19 @@ export const runningTimeLogic = kea<runningTimeLogicType>([
s.recalcPrimaryMetricsResults,
s.recalcPrimaryMetricsResultsErrors,
],
- (experiment, featureFlags, legacyMetricsWithResults, recalcResults, recalcErrors) => {
+ (
+ experiment: Experiment,
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet,
+ legacyMetricsWithResults: {
+ displayIndex: number
+ error: any
+ metric: import('../../../queries/schema').ExperimentMetricUnion
+ metricIndex: number
+ result: any
+ }[],
+ recalcResults: import('../../../queries/schema').CachedNewExperimentQueryResponse[],
+ recalcErrors: (unknown | null)[]
+ ) => {
if (experiment && featureFlags[FEATURE_FLAGS.EXPERIMENTS_METRICS_RECALCULATION]) {
return getOrderedMetricsWithResults(experiment, recalcResults, recalcErrors, [], [], false)
}
@@ -199,13 +419,32 @@ export const runningTimeLogic = kea<runningTimeLogicType>([
currentExposures: [
(s) => [s.metricsWithResults],
- (results): number | null => calculateCurrentExposures(results?.[0]?.result ?? null),
+ (
+ results: {
+ displayIndex: number
+ error: any
+ metric: import('../../../queries/schema').ExperimentMetricUnion
+ metricIndex: number
+ result: any
+ }[]
+ ): number | null => calculateCurrentExposures(results?.[0]?.result ?? null),
],
// Request body for the automatic-mode calculation, or null when not applicable (manual mode / no results yet).
automaticCalculationInput: [
(s) => [s.mode, s.metricsWithResults, s.numberOfVariants, s.mde],
- (mode, results, numberOfVariants, mde): RunningTimeCalculationInputApi | null => {
+ (
+ mode: RunningTimeConfig['mode'],
+ results: {
+ displayIndex: number
+ error: any
+ metric: import('../../../queries/schema').ExperimentMetricUnion
+ metricIndex: number
+ result: any
+ }[],
+ numberOfVariants: number,
+ mde: number
+ ): RunningTimeCalculationInputApi | null => {
// Gate on the in-form mode rather than the persisted mode. While the form is in manual mode
// (even if the experiment is still saved as automatic), the automatic estimate is neither
// shown nor persisted, so editing the MDE shouldn't fire a wasted automatic calculation.
@@ -228,7 +467,7 @@ export const runningTimeLogic = kea<runningTimeLogicType>([
// Request body for the live manual-mode preview, or null when the form inputs aren't usable yet.
manualPreviewInput: [
(s) => [s.config, s.numberOfVariants],
- (config, numberOfVariants): RunningTimeCalculationInputApi | null => {
+ (config: RunningTimeConfig, numberOfVariants: number): RunningTimeCalculationInputApi | null => {
// Use !(x > 0) to catch NaN, 0, negative, and undefined
if (config.mode !== 'manual' || !(config.baselineValue > 0) || !(config.mde > 0)) {
return null
@@ -246,7 +485,12 @@ export const runningTimeLogic = kea<runningTimeLogicType>([
targetSampleSize: [
(s) => [s.isManualMode, s.experiment, s.automaticCalculationInput, s.automaticCalculation],
- (isManualMode, experiment, automaticInput, automaticCalculation): number | null => {
+ (
+ isManualMode: boolean,
+ experiment: Experiment,
+ automaticInput: RunningTimeCalculationInputApi | null,
+ automaticCalculation: RunningTimeCalculationResultApi | null
+ ): number | null => {
if (isManualMode) {
// Persisted by the save listener from the same backend calculation.
return experiment?.running_time_calculation?.recommended_sample_size ?? null
@@ -260,7 +504,7 @@ export const runningTimeLogic = kea<runningTimeLogicType>([
dailyExposureRate: [
(s) => [s.isManualMode, s.experiment, s.currentExposures],
- (isManualMode, experiment, currentExposures): number | null => {
+ (isManualMode: boolean, experiment: Experiment, currentExposures: number | null): number | null => {
if (isManualMode) {
return experiment?.running_time_calculation?.exposure_estimate_config?.manualExposureRate ?? null
}
@@ -274,7 +518,12 @@ export const runningTimeLogic = kea<runningTimeLogicType>([
// Days until we reach target sample size
remainingDays: [
(s) => [s.targetSampleSize, s.currentExposures, s.dailyExposureRate, s.experiment],
- (target, current, rate, experiment): number | null => {
+ (
+ target: number | null,
+ current: number | null,
+ rate: number | null,
+ experiment: Experiment
+ ): number | null => {
if (!target || !rate || rate <= 0) {
return null
}
@@ -299,11 +548,13 @@ export const runningTimeLogic = kea<runningTimeLogicType>([
],
isComplete: [
(s) => [s.currentExposures, s.targetSampleSize],
- (current, target): boolean => current !== null && target !== null && current >= target,
+ (current: number | null, target: number | null): boolean =>
+ current !== null && target !== null && current >= target,
],
manualFormPreview: [
(s) => [s.manualPreviewInput, s.manualPreview],
- (input, preview): ManualPreview => (input ? preview : { sampleSize: null, runningTime: null }),
+ (input: RunningTimeCalculationInputApi | null, preview: ManualPreview): ManualPreview =>
+ input ? preview : { sampleSize: null, runningTime: null },
],
}),
diff --git a/frontend/src/scenes/experiments/SharedMetrics/sharedMetricLogic.tsx b/frontend/src/scenes/experiments/SharedMetrics/sharedMetricLogic.tsx
index d36fb17ab415..6b9fff8817d8 100644
--- a/frontend/src/scenes/experiments/SharedMetrics/sharedMetricLogic.tsx
+++ b/frontend/src/scenes/experiments/SharedMetrics/sharedMetricLogic.tsx
@@ -1,4 +1,4 @@
-import { actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { router, urlToAction } from 'kea-router'
@@ -17,8 +17,10 @@ import { SIDE_PANEL_CONTEXT_KEY, SidePanelSceneContext } from '~/layout/navigati
import { AccessControlLevel, ActivityScope, Breadcrumb, ExperimentsTabs } from '~/types'
import type { UserBasicType } from '~/types'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { ExperimentMetricUnion } from '../../../queries/schema/schema-general'
+import type { BillingType } from '../../../types'
import { getDefaultFunnelMetric } from '../utils'
-import type { sharedMetricLogicType } from './sharedMetricLogicType'
import { sharedMetricsLogic } from './sharedMetricsLogic'
export interface SharedMetricLogicProps {
@@ -47,6 +49,113 @@ export const NEW_SHARED_METRIC: Partial<SharedMetric> = {
user_access_level: AccessControlLevel.Editor,
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sharedMetricLogicValues {
+ billing: BillingType | null // billingLogic
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ currentProjectId: number | string // teamLogic
+ action: 'create' | 'duplicate' | 'update'
+ breadcrumbs: Breadcrumb[]
+ newSharedMetric: {
+ created_at?: string | null | undefined
+ created_by?: UserBasicType | null | undefined
+ description?: string | undefined
+ id?: number | undefined
+ metadata?: Record<string, any> | undefined
+ name?: string | undefined
+ query: ExperimentMetricUnion
+ tags?: string[] | undefined
+ updated_at?: string | null | undefined
+ user_access_level?: AccessControlLevel | undefined
+ }
+ sharedMetric: Partial<SharedMetric>
+ sharedMetricId: number | string
+ sharedMetricLoading: boolean
+ sidePanelContext: SidePanelSceneContext | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sharedMetricLogicActions {
+ reportExperimentSharedMetricCreated: (sharedMetric: SharedMetric) => {
+ sharedMetric: SharedMetric
+ } // eventUsageLogic
+ loadSharedMetrics: (_?: void | undefined) => void // sharedMetricsLogic
+ createSharedMetric: () => {
+ value: true
+ }
+ deleteSharedMetric: () => {
+ value: true
+ }
+ loadSharedMetric: () => any
+ loadSharedMetricFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSharedMetricSuccess: (
+ sharedMetric:
+ | SharedMetric
+ | {
+ created_at?: string | null | undefined
+ created_by?: UserBasicType | null | undefined
+ description?: string | undefined
+ id?: number | undefined
+ metadata?: Record<string, any> | undefined
+ name?: string | undefined
+ query: ExperimentMetricUnion
+ tags?: string[] | undefined
+ updated_at?: string | null | undefined
+ user_access_level?: AccessControlLevel | undefined
+ },
+ payload?: any
+ ) => {
+ sharedMetric:
+ | SharedMetric
+ | {
+ created_at?: string | null | undefined
+ created_by?: UserBasicType | null | undefined
+ description?: string | undefined
+ id?: number | undefined
+ metadata?: Record<string, any> | undefined
+ name?: string | undefined
+ query: ExperimentMetricUnion
+ tags?: string[] | undefined
+ updated_at?: string | null | undefined
+ user_access_level?: AccessControlLevel | undefined
+ }
+ payload?: any
+ }
+ setSharedMetric: (metric: Partial<SharedMetric>) => {
+ metric: Partial<SharedMetric>
+ }
+ updateSharedMetric: (redirect?: boolean) => {
+ redirect: boolean | undefined
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sharedMetricLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ sharedMetricId: (arg: any) => number | string
+ action: (action: 'create' | 'duplicate' | 'update') => 'create' | 'duplicate' | 'update'
+ breadcrumbs: (sharedMetric: Partial<SharedMetric>, sharedMetricId: number | string) => Breadcrumb[]
+ sidePanelContext: (
+ sharedMetric: Partial<SharedMetric>,
+ sharedMetricId: number | string
+ ) => SidePanelSceneContext | null
+ }
+}
+
+export type sharedMetricLogicType = MakeLogicType<
+ sharedMetricLogicValues,
+ sharedMetricLogicActions,
+ SharedMetricLogicProps,
+ sharedMetricLogicMeta
+>
+
export const sharedMetricLogic = kea<sharedMetricLogicType>([
props({} as SharedMetricLogicProps),
path((key) => ['scenes', 'experiments', 'sharedMetricLogic', key]),
@@ -161,7 +270,7 @@ export const sharedMetricLogic = kea<sharedMetricLogicType>([
() => [(_, props) => props.sharedMetricId ?? 'new'],
(sharedMetricId): string | number => sharedMetricId,
],
- action: [(_, p) => [p.action], (action) => action],
+ action: [(_, p) => [p.action], (action: 'create' | 'duplicate' | 'update') => action],
newSharedMetric: [
() => [],
() => ({
diff --git a/frontend/src/scenes/experiments/SharedMetrics/sharedMetricsLogic.tsx b/frontend/src/scenes/experiments/SharedMetrics/sharedMetricsLogic.tsx
index b6d9cb095680..ae3d5b510609 100644
--- a/frontend/src/scenes/experiments/SharedMetrics/sharedMetricsLogic.tsx
+++ b/frontend/src/scenes/experiments/SharedMetrics/sharedMetricsLogic.tsx
@@ -1,4 +1,4 @@
-import { actions, connect, events, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, connect, events, kea, listeners, path, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import { lemonToast } from '@posthog/lemon-ui'
@@ -8,10 +8,60 @@ import { toParams } from 'lib/utils/url'
import { teamLogic } from 'scenes/teamLogic'
import type { SharedMetric } from './sharedMetricLogic'
-import type { sharedMetricsLogicType } from './sharedMetricsLogicType'
export const PAGE_SIZE = 100
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sharedMetricsLogicValues {
+ currentProjectId: number | string // teamLogic
+ count: number
+ page: number
+ savingTagsMetricId: SharedMetric['id'] | null
+ searchTerm: string
+ sharedMetrics: SharedMetric[]
+ sharedMetricsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sharedMetricsLogicActions {
+ deleteSharedMetric: (metricId: SharedMetric['id']) => {
+ metricId: number
+ }
+ loadSharedMetrics: (_: void) => void
+ loadSharedMetricsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSharedMetricsSuccess: (
+ sharedMetrics: SharedMetric[],
+ payload?: void
+ ) => {
+ sharedMetrics: SharedMetric[]
+ payload?: void
+ }
+ setCount: (count: number) => {
+ count: number
+ }
+ setPage: (page: number) => {
+ page: number
+ }
+ setSearchTerm: (searchTerm: string) => {
+ searchTerm: string
+ }
+ updateSharedMetricTags: (
+ metricId: SharedMetric['id'],
+ tags: string[]
+ ) => {
+ metricId: number
+ tags: string[]
+ }
+}
+
+export type sharedMetricsLogicType = MakeLogicType<sharedMetricsLogicValues, sharedMetricsLogicActions>
+
export const sharedMetricsLogic = kea<sharedMetricsLogicType>([
path(['scenes', 'experiments', 'sharedMetricsLogic']),
connect(() => ({ values: [teamLogic, ['currentProjectId']] })),
diff --git a/frontend/src/scenes/experiments/components/ResultsBreakdown/resultsBreakdownLogic.ts b/frontend/src/scenes/experiments/components/ResultsBreakdown/resultsBreakdownLogic.ts
index 2974097a2f10..afabd86c4151 100644
--- a/frontend/src/scenes/experiments/components/ResultsBreakdown/resultsBreakdownLogic.ts
+++ b/frontend/src/scenes/experiments/components/ResultsBreakdown/resultsBreakdownLogic.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 { P, match } from 'ts-pattern'
@@ -35,7 +35,9 @@ import {
StepOrderValue,
} from '~/types'
-import type { resultsBreakdownLogicType } from './resultsBreakdownLogicType'
+import type { FeatureFlagsSet } from '../../../../lib/logic/featureFlagLogic'
+import type { InsightQueryNode } from '../../../../queries/schema/schema-general'
+import type { ExperimentTriggeredBy } from '../../experimentLogic'
const filterFunnelSteps = (steps: FunnelStep[], variants: string[]): FunnelStep[] =>
steps.filter((step) =>
@@ -52,6 +54,67 @@ export type ResultBreakdownLogicProps = {
isPrimary: boolean
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface resultsBreakdownLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ breakdownLastRefresh: string | null
+ breakdownResults: FunnelStep[] | FunnelStep[][] | null
+ breakdownResultsLoading: boolean
+ query: InsightVizNode<InsightQueryNode> | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface resultsBreakdownLogicActions {
+ refreshExperimentResults: (
+ forceRefresh?: boolean | undefined,
+ triggeredBy?: ExperimentTriggeredBy | undefined,
+ refreshIfStale?: boolean | undefined
+ ) => {
+ forceRefresh: boolean | undefined
+ refreshIfStale: boolean
+ triggeredBy: ExperimentTriggeredBy
+ } // experimentLogic
+ loadBreakdownResults: (refresh?: boolean) => {
+ refresh: boolean | undefined
+ }
+ loadBreakdownResultsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadBreakdownResultsSuccess: (
+ breakdownResults: FunnelStep[] | FunnelStep[][],
+ payload?: {
+ refresh: boolean | undefined
+ }
+ ) => {
+ breakdownResults: FunnelStep[] | FunnelStep[][]
+ payload?: {
+ refresh: boolean | undefined
+ }
+ }
+ setBreakdownLastRefresh: (lastRefresh: string | null) => {
+ lastRefresh: string | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface resultsBreakdownLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ query: (arg: any) => InsightVizNode<InsightQueryNode> | null
+ }
+}
+
+export type resultsBreakdownLogicType = MakeLogicType<
+ resultsBreakdownLogicValues,
+ resultsBreakdownLogicActions,
+ ResultBreakdownLogicProps,
+ resultsBreakdownLogicMeta
+>
+
/**
* This logic only works with the new query runner.
* Legacy Funnels and Trends engine are resolved backend side.
diff --git a/frontend/src/scenes/experiments/experimentLogic.tsx b/frontend/src/scenes/experiments/experimentLogic.tsx
index 6b1d32800c31..6ef44886e78d 100644
--- a/frontend/src/scenes/experiments/experimentLogic.tsx
+++ b/frontend/src/scenes/experiments/experimentLogic.tsx
@@ -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 { loaders } from 'kea-loaders'
import { router } from 'kea-router'
@@ -71,6 +84,20 @@ import {
PropertyMathType,
} from '~/types'
+import type { ProductIntentProperties } from '../../lib/utils/product-intents'
+import type { Noun } from '../../models/groupsModel'
+import type { ExperimentMetricUnion } from '../../queries/schema/schema-general'
+import type {
+ BillingType,
+ ExperimentHoldoutType,
+ ExperimentIdType,
+ FunnelResultType,
+ FunnelTimeConversionMetrics,
+ GroupType,
+ GroupTypeIndex,
+} from '../../types'
+import type { TrendResult } from '../../types'
+import type { ExperimentsConfig } from '../settings/environment/experimentsConfigLogic'
import {
EXPERIMENT_AUTO_REFRESH_INITIAL_INTERVAL_SECONDS,
EXPERIMENT_MIN_EXPOSURES_FOR_RESULTS,
@@ -78,7 +105,6 @@ import {
NEW_EXPERIMENT_FORCE_REFRESH_AFTER_MINUTES,
MetricInsightId,
} from './constants'
-import type { experimentLogicType } from './experimentLogicType'
import { experimentMetricsLogic } from './experimentMetricsLogic'
import { experimentSceneLogic } from './experimentSceneLogic'
import {
@@ -457,6 +483,913 @@ export type ExperimentSavedMetric = {
name: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentLogicValues {
+ billing: BillingType | null // billingLogic
+ defaultMinimumDetectableEffect: number // experimentsConfigLogic
+ experimentsConfig: ExperimentsConfig | null // experimentsConfigLogic
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ conversionMetrics: FunnelTimeConversionMetrics // funnelDataLogic
+ funnelResults: FunnelResultType // funnelDataLogic
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun // groupsModel
+ groupTypes: Map<GroupTypeIndex, GroupType> // groupsModel
+ showGroupsOptions: boolean // groupsModel
+ holdouts: ExperimentHoldoutType[] // holdoutsLogic
+ funnelMetricInsightLoading: boolean // insightDataLogic
+ trendMetricInsightLoading: boolean // insightDataLogic
+ currentProjectId: number | null // projectLogic
+ sharedMetrics: SharedMetric[] // sharedMetricsLogic
+ currentTeamId: number | null // teamLogic
+ trendResults: TrendResult[] // trendsDataLogic
+ actualRunningTime: number
+ autoRefresh: {
+ enabled: boolean
+ interval: number
+ }
+ compatibleSharedMetrics: SharedMetric[]
+ createExperimentLoading: boolean
+ currentRefresh: CurrentRefreshSnapshot | null
+ editingPrimaryMetricUuid: string | null
+ editingSecondaryMetricUuid: string | null
+ editingSharedMetricId: SharedMetric['id'] | null
+ endExperimentLoading: boolean
+ excludedVariants: string[]
+ experiment: Experiment
+ experimentAllErrors: Record<string, any>
+ experimentChanged: boolean
+ experimentErrors: DeepPartialMap<Experiment, ValidationErrorType>
+ experimentHasErrors: boolean
+ experimentId: Experiment['id']
+ experimentLoading: boolean
+ experimentManualErrors: Record<string, any>
+ experimentMathAggregationForTrends: () => CountPerActorMathType | PropertyMathType | undefined
+ experimentMissing: boolean
+ experimentTouched: boolean
+ experimentTouches: Record<string, boolean>
+ experimentUpdate: Experiment | null
+ experimentUpdateLoading: boolean
+ experimentValidationErrors: DeepPartialMap<Experiment, ValidationErrorType>
+ experimentWarning: ExperimentWarning | null
+ exposureCohort: CohortType | null
+ exposureCohortLoading: boolean
+ exposureCriteria: ExperimentExposureCriteria | undefined
+ exposures: any
+ exposuresLoading: boolean
+ featureFlagValidationError: string | null
+ firstPrimaryMetric: ExperimentFunnelsQuery | ExperimentMetric | ExperimentTrendsQuery | undefined
+ formMode: FormModes
+ freezeExposureLoading: boolean
+ getExperimentMetricType: (metric: ExperimentMetricUnion | undefined) => ExperimentMetricType
+ getInsightType: (
+ metric: ExperimentFunnelsQuery | ExperimentMetricUnion | ExperimentTrendsQuery | undefined
+ ) => InsightType
+ getOrderedMetricsWithResults: (isSecondary: boolean) => {
+ displayIndex: number
+ error: any
+ metric: ExperimentMetricUnion
+ metricIndex: number
+ result: any
+ }[]
+ hasMinimumExposureForResults: boolean
+ hasPrimaryMetricSet: boolean
+ hogfettiTrigger: (() => void) | null
+ isCreatingExperimentDashboard: boolean
+ isExperimentDraft: boolean
+ isExperimentLaunched: boolean
+ isExperimentRunning: boolean
+ isExperimentStopped: boolean
+ isExperimentSubmitting: boolean
+ isExperimentValid: boolean
+ isFlagActive: boolean
+ isPageVisible: boolean
+ isSingleVariantShipped: boolean
+ launchExperimentLoading: boolean
+ minimumDetectableEffect: number
+ notifyWhenResultsReady: boolean
+ orderedPrimaryMetricsWithResults: {
+ displayIndex: number
+ error: any
+ metric: ExperimentMetricUnion
+ metricIndex: number
+ result: any
+ }[]
+ orderedSecondaryMetricsWithResults: {
+ displayIndex: number
+ error: any
+ metric: ExperimentMetricUnion
+ metricIndex: number
+ result: any
+ }[]
+ primaryMetricsLengthWithSharedMetrics: number
+ primaryMetricsResults: CachedNewExperimentQueryResponse[]
+ primaryMetricsResultsErrors: any[]
+ primaryMetricsResultsLoading: boolean
+ props: any
+ recommendedRunningTime: number
+ recommendedSampleSize: number
+ secondaryMetricsLengthWithSharedMetrics: number
+ secondaryMetricsResults: CachedNewExperimentQueryResponse[]
+ secondaryMetricsResultsErrors: any[]
+ secondaryMetricsResultsLoading: boolean
+ shippedVariantKey: string | null
+ showDebugPanel: boolean
+ showExperimentErrors: boolean
+ showNotificationOffer: boolean
+ statsMethod: ExperimentStatsMethod
+ unfreezeExposureLoading: boolean
+ unmodifiedExperiment: Experiment | null
+ usesNewQueryRunner: boolean
+ validExistingFeatureFlag: FeatureFlagType | null
+ variants: MultivariateFlagVariant[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentLogicActions {
+ reportExperimentAiSummaryRequested: (experiment: Experiment) => {
+ experiment: Experiment
+ } // eventUsageLogic
+ reportExperimentAutoRefreshToggled: (
+ experiment: Experiment,
+ enabled: boolean,
+ interval: number
+ ) => {
+ enabled: boolean
+ experiment: Experiment
+ interval: number
+ } // eventUsageLogic
+ reportExperimentCreated: (
+ experiment: Experiment,
+ metadata?:
+ | {
+ creation_source?: string
+ has_linked_flag?: boolean
+ }
+ | undefined
+ ) => {
+ experiment: Experiment
+ metadata:
+ | {
+ creation_source?: string | undefined
+ has_linked_flag?: boolean | undefined
+ }
+ | undefined
+ } // eventUsageLogic
+ reportExperimentDashboardCreated: (
+ experiment: Experiment,
+ dashboardId: number
+ ) => {
+ dashboardId: number
+ experiment: Experiment
+ } // eventUsageLogic
+ reportExperimentExposureCohortCreated: (
+ experiment: Experiment,
+ cohort: CohortType
+ ) => {
+ cohort: CohortType
+ experiment: Experiment
+ } // eventUsageLogic
+ reportExperimentHoldoutAssigned: (args_0: {
+ experimentId: ExperimentIdType
+ holdoutId: ExperimentHoldoutType['id']
+ }) => {
+ experimentId: ExperimentIdType
+ holdoutId: number | null
+ } // eventUsageLogic
+ reportExperimentMetricBreakdownAdded: (
+ experiment: Experiment,
+ metricUuid: string,
+ breakdown: Breakdown,
+ isPrimary: boolean
+ ) => {
+ breakdown: Breakdown
+ experiment: Experiment
+ isPrimary: boolean
+ metricUuid: string
+ } // eventUsageLogic
+ reportExperimentMetricBreakdownRemoved: (
+ experiment: Experiment,
+ metricUuid: string,
+ breakdown: Breakdown,
+ index: number,
+ isPrimary: boolean
+ ) => {
+ breakdown: Breakdown
+ experiment: Experiment
+ index: number
+ isPrimary: boolean
+ metricUuid: string
+ } // eventUsageLogic
+ reportExperimentMetricsRefreshed: (
+ experiment: Experiment,
+ forceRefresh: boolean,
+ context?:
+ | {
+ auto_refresh_enabled?: boolean
+ auto_refresh_interval?: number
+ previous_refresh_age_ms?: number | null
+ previous_refresh_id?: string | null
+ previous_refresh_state?: string | null
+ previous_refresh_triggered_by?: string | null
+ triggered_by: 'auto-refresh' | 'manual'
+ }
+ | undefined
+ ) => {
+ context:
+ | {
+ auto_refresh_enabled?: boolean | undefined
+ auto_refresh_interval?: number | undefined
+ previous_refresh_age_ms?: number | null | undefined
+ previous_refresh_id?: string | null | undefined
+ previous_refresh_state?: string | null | undefined
+ previous_refresh_triggered_by?: string | null | undefined
+ triggered_by: 'auto-refresh' | 'manual'
+ }
+ | undefined
+ experiment: Experiment
+ forceRefresh: boolean
+ } // eventUsageLogic
+ reportExperimentReleaseConditionsViewed: (experimentId: ExperimentIdType) => {
+ experimentId: ExperimentIdType
+ } // eventUsageLogic
+ reportExperimentResultsLoadingTimeout: (experimentId: ExperimentIdType) => {
+ experimentId: ExperimentIdType
+ } // eventUsageLogic
+ reportExperimentSessionReplaySummaryRequested: (experiment: Experiment) => {
+ experiment: Experiment
+ } // eventUsageLogic
+ reportExperimentSharedMetricAssigned: (
+ experimentId: ExperimentIdType,
+ sharedMetric: SharedMetric
+ ) => {
+ experimentId: ExperimentIdType
+ sharedMetric: SharedMetric
+ } // eventUsageLogic
+ reportExperimentTimeseriesRecalculated: (
+ experimentId: ExperimentIdType,
+ metric: ExperimentMetricUnion
+ ) => {
+ experimentId: ExperimentIdType
+ metric: ExperimentMetricUnion
+ } // eventUsageLogic
+ reportExperimentTimeseriesViewed: (
+ experimentId: ExperimentIdType,
+ metric: ExperimentMetricUnion
+ ) => {
+ experimentId: ExperimentIdType
+ metric: ExperimentMetricUnion
+ } // eventUsageLogic
+ reportExperimentVariantScreenshotUploaded: (experimentId: ExperimentIdType) => {
+ experimentId: ExperimentIdType
+ } // eventUsageLogic
+ reportExperimentViewed: (
+ experiment: Experiment,
+ duration: number | null
+ ) => {
+ duration: number | null
+ experiment: Experiment
+ } // eventUsageLogic
+ addToExperiments: (experiment: Experiment) => Experiment // experimentsLogic
+ updateExperiments: (experiment: Experiment) => Experiment // experimentsLogic
+ updateFlagFromPartial: (
+ flag: Partial<FeatureFlagType> & {
+ id: number
+ }
+ ) => {
+ flag: Partial<FeatureFlagType> & {
+ id: number
+ }
+ } // featureFlagsLogic
+ closeFinishExperimentModal: () => {
+ value: true
+ } // modalsLogic
+ closePauseExperimentModal: () => {
+ value: true
+ } // modalsLogic
+ closePrimaryMetricModal: () => {
+ value: true
+ } // modalsLogic
+ closePrimaryMetricsReorderModal: () => {
+ value: true
+ } // modalsLogic
+ closeResumeExperimentModal: () => {
+ value: true
+ } // modalsLogic
+ closeSecondaryMetricModal: () => {
+ value: true
+ } // modalsLogic
+ closeSecondaryMetricsReorderModal: () => {
+ value: true
+ } // modalsLogic
+ openPrimaryMetricModal: (uuid: string) => {
+ uuid: string
+ } // modalsLogic
+ openPrimarySharedMetricModal: (sharedMetricId: number | null) => {
+ sharedMetricId: number | null
+ } // modalsLogic
+ openReleaseConditionsModal: () => {
+ value: true
+ } // modalsLogic
+ openSecondaryMetricModal: (uuid: string) => {
+ uuid: string
+ } // modalsLogic
+ openSecondarySharedMetricModal: (sharedMetricId: number | null) => {
+ sharedMetricId: number | null
+ } // modalsLogic
+ addProductIntent: (properties: ProductIntentProperties) => ProductIntentProperties // teamLogic
+ addSharedMetricsToExperiment: (
+ sharedMetricIds: SharedMetric['id'][],
+ metadata: {
+ type: 'primary' | 'secondary'
+ }
+ ) => {
+ metadata: {
+ type: 'primary' | 'secondary'
+ }
+ sharedMetricIds: number[]
+ }
+ archiveExperiment: (disableFeatureFlag?: boolean) => {
+ disableFeatureFlag: boolean
+ }
+ changeExperimentEndDate: (endDate: string) => {
+ endDate: string
+ }
+ changeExperimentStartDate: (startDate: string) => {
+ startDate: string
+ }
+ clearMetricsResults: () => {
+ value: true
+ }
+ createExperiment: (
+ draft?: boolean,
+ folder?: string | null
+ ) => {
+ draft: boolean | undefined
+ folder: string | null | undefined
+ }
+ createExperimentDashboard: () => {
+ value: true
+ }
+ createExposureCohort: () => any
+ createExposureCohortFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ createExposureCohortSuccess: (
+ exposureCohort: CohortType | null,
+ payload?: any
+ ) => {
+ exposureCohort: CohortType | null
+ payload?: any
+ }
+ dismissNotificationOffer: () => {
+ value: true
+ }
+ duplicateMetric: ({ uuid, isSecondary, newUuid }: { isSecondary: boolean; newUuid: string; uuid: string }) => {
+ isSecondary: boolean
+ newUuid: string
+ uuid: string
+ }
+ endExperiment: (openCleanupPr?: boolean) => {
+ openCleanupPr: boolean
+ }
+ endExperimentWithoutShipping: (openCleanupPr?: boolean) => {
+ openCleanupPr: boolean
+ }
+ finishExperiment: ({
+ selectedVariantKey,
+ releaseToEveryone,
+ openCleanupPr,
+ }: {
+ openCleanupPr?: boolean
+ releaseToEveryone: boolean
+ selectedVariantKey: string
+ }) => {
+ openCleanupPr: boolean
+ releaseToEveryone: boolean
+ selectedVariantKey: string
+ }
+ freezeExposure: () => {
+ value: true
+ }
+ launchExperiment: () => {
+ value: true
+ }
+ loadExperiment: (payload?: { triggeredBy?: ExperimentTriggeredBy }) => {
+ triggeredBy?: ExperimentTriggeredBy
+ }
+ loadExperimentFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadExperimentSuccess: (
+ experiment: Experiment,
+ payload?: {
+ triggeredBy?: ExperimentTriggeredBy
+ }
+ ) => {
+ experiment: Experiment
+ payload?: {
+ triggeredBy?: ExperimentTriggeredBy
+ }
+ }
+ loadExposures: (refresh?: boolean) => boolean
+ loadExposuresFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadExposuresSuccess: (
+ exposures: any,
+ payload?: boolean
+ ) => {
+ exposures: any
+ payload?: boolean
+ }
+ loadPrimaryMetricsResults: (
+ refresh?: boolean,
+ refreshId?: string
+ ) => {
+ refresh: boolean | undefined
+ refreshId: string | undefined
+ }
+ loadSecondaryMetricsResults: (
+ refresh?: boolean,
+ refreshId?: string
+ ) => {
+ refresh: boolean | undefined
+ refreshId: string | undefined
+ }
+ markRefreshFinished: (
+ refreshId: string,
+ finalState: FinishedRefreshState
+ ) => {
+ finalState: FinishedRefreshState
+ refreshId: string
+ }
+ markRefreshStarted: (
+ refreshId: string,
+ triggeredBy: ExperimentTriggeredBy
+ ) => {
+ refreshId: string
+ triggeredBy: ExperimentTriggeredBy
+ }
+ pauseExperiment: () => {
+ value: true
+ }
+ refreshExperimentResults: (
+ forceRefresh?: boolean,
+ triggeredBy?: ExperimentTriggeredBy,
+ refreshIfStale?: boolean
+ ) => {
+ forceRefresh: boolean | undefined
+ refreshIfStale: boolean
+ triggeredBy: ExperimentTriggeredBy
+ }
+ refreshStaleResultsOnReentry: () => {
+ value: true
+ }
+ removeMetric: (
+ uuid: string,
+ context: 'primary' | 'secondary'
+ ) => {
+ context: 'primary' | 'secondary'
+ uuid: string
+ }
+ removeMetricBreakdown: (
+ uuid: string,
+ index: number,
+ breakdown: Breakdown
+ ) => {
+ breakdown: Breakdown
+ index: number
+ uuid: string
+ }
+ removeSharedMetricFromExperiment: (sharedMetricId: SharedMetric['id']) => {
+ sharedMetricId: number
+ }
+ resetAutoRefreshInterval: () => {
+ value: true
+ }
+ resetExperiment: (values?: Experiment) => {
+ values?: Experiment
+ }
+ resetRunningExperiment: () => {
+ value: true
+ }
+ restoreUnmodifiedExperiment: () => {
+ value: true
+ }
+ resumeExperiment: () => {
+ value: true
+ }
+ retryPrimaryMetric: (index: number) => {
+ index: number
+ }
+ retrySecondaryMetric: (index: number) => {
+ index: number
+ }
+ saveMetricsReorder: (
+ isSecondary: boolean,
+ orderedUuids: string[],
+ removedUuids: string[],
+ movedUuids: string[]
+ ) => {
+ isSecondary: boolean
+ movedUuids: string[]
+ orderedUuids: string[]
+ removedUuids: string[]
+ }
+ setAutoRefresh: (
+ enabled: boolean,
+ interval: number
+ ) => {
+ enabled: boolean
+ interval: number
+ }
+ setCreateExperimentLoading: (loading: boolean) => {
+ loading: boolean
+ }
+ setEditExperiment: (editing: boolean) => {
+ editing: boolean
+ }
+ setEndExperimentLoading: (loading: boolean) => {
+ loading: boolean
+ }
+ setExperiment: (experiment: Partial<Experiment>) => {
+ experiment: Partial<Experiment>
+ }
+ setExperimentManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setExperimentMissing: () => {
+ value: true
+ }
+ setExperimentValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setExperimentValues: (values: DeepPartial<Experiment>) => {
+ values: DeepPartial<Experiment>
+ }
+ setExposureCriteria: (exposureCriteria: ExperimentExposureCriteria) => {
+ exposureCriteria: ExperimentExposureCriteria
+ }
+ setFeatureFlagValidationError: (error: string) => {
+ error: string
+ }
+ setFreezeExposureLoading: (loading: boolean) => {
+ loading: boolean
+ }
+ setFunnelsMetric: ({
+ uuid,
+ name,
+ series,
+ filterTestAccounts,
+ breakdownAttributionType,
+ breakdownAttributionValue,
+ funnelWindowInterval,
+ funnelWindowIntervalUnit,
+ aggregation_group_type_index,
+ funnelAggregateByHogQL,
+ isSecondary,
+ }: {
+ aggregation_group_type_index?: number
+ breakdownAttributionType?: BreakdownAttributionType
+ breakdownAttributionValue?: number
+ filterTestAccounts?: boolean
+ funnelAggregateByHogQL?: string
+ funnelWindowInterval?: number
+ funnelWindowIntervalUnit?: string
+ isSecondary?: boolean
+ name?: string
+ series?: AnyEntityNode[]
+ uuid: string
+ }) => {
+ aggregation_group_type_index: number | undefined
+ breakdownAttributionType: BreakdownAttributionType | undefined
+ breakdownAttributionValue: number | undefined
+ filterTestAccounts: boolean | undefined
+ funnelAggregateByHogQL: string | undefined
+ funnelWindowInterval: number | undefined
+ funnelWindowIntervalUnit: string | undefined
+ isSecondary: boolean | undefined
+ name: string | undefined
+ series: AnyEntityNode[] | undefined
+ uuid: string
+ }
+ setHogfettiTrigger: (trigger: (() => void) | null) => {
+ trigger: (() => void) | null
+ }
+ setIsCreatingExperimentDashboard: (isCreating: boolean) => {
+ isCreating: boolean
+ }
+ setLaunchExperimentLoading: (loading: boolean) => {
+ loading: boolean
+ }
+ setMetric: ({
+ uuid,
+ name,
+ metric,
+ isSecondary,
+ }: {
+ isSecondary?: boolean
+ metric: ExperimentMetric
+ name?: string
+ uuid: string
+ }) => {
+ isSecondary: boolean
+ metric: ExperimentMetricUnion
+ name: string | undefined
+ uuid: string
+ }
+ setNotifyWhenResultsReady: (notify: boolean) => {
+ notify: boolean
+ }
+ setPageVisibility: (visible: boolean) => {
+ visible: boolean
+ }
+ setPrimaryMetricsResults: (results: CachedNewExperimentQueryResponse[]) => {
+ results: CachedNewExperimentQueryResponse[]
+ }
+ setPrimaryMetricsResultsErrors: (errors: any[]) => {
+ errors: any[]
+ }
+ setPrimaryMetricsResultsLoading: (loading: boolean) => {
+ loading: boolean
+ }
+ setSecondaryMetricsResults: (results: CachedNewExperimentQueryResponse[]) => {
+ results: CachedNewExperimentQueryResponse[]
+ }
+ setSecondaryMetricsResultsErrors: (errors: any[]) => {
+ errors: any[]
+ }
+ setSecondaryMetricsResultsLoading: (loading: boolean) => {
+ loading: boolean
+ }
+ setShowNotificationOffer: (show: boolean) => {
+ show: boolean
+ }
+ setTrendsExposureMetric: ({
+ uuid,
+ name,
+ series,
+ filterTestAccounts,
+ isSecondary,
+ }: {
+ filterTestAccounts?: boolean
+ isSecondary?: boolean
+ name?: string
+ series?: AnyEntityNode[]
+ uuid: string
+ }) => {
+ filterTestAccounts: boolean | undefined
+ isSecondary: boolean
+ name: string | undefined
+ series: AnyEntityNode[] | undefined
+ uuid: string
+ }
+ setTrendsMetric: ({
+ uuid,
+ name,
+ series,
+ filterTestAccounts,
+ isSecondary,
+ }: {
+ filterTestAccounts?: boolean
+ isSecondary?: boolean
+ name?: string
+ series?: AnyEntityNode[]
+ uuid: string
+ }) => {
+ filterTestAccounts: boolean | undefined
+ isSecondary: boolean
+ name: string | undefined
+ series: AnyEntityNode[] | undefined
+ uuid: string
+ }
+ setUnfreezeExposureLoading: (loading: boolean) => {
+ loading: boolean
+ }
+ setUnmodifiedExperiment: (experiment: Experiment) => {
+ experiment: Experiment
+ }
+ setValidExistingFeatureFlag: (featureFlag: FeatureFlagType | null) => {
+ featureFlag: FeatureFlagType | null
+ }
+ setVariantExcluded: (
+ variantKey: string,
+ excluded: boolean
+ ) => {
+ excluded: boolean
+ variantKey: string
+ }
+ stopAutoRefreshInterval: () => {
+ value: true
+ }
+ submitExperiment: () => {
+ value: boolean
+ }
+ submitExperimentFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitExperimentRequest: (experiment: Experiment) => {
+ experiment: Experiment
+ }
+ submitExperimentSuccess: (experiment: Experiment) => {
+ experiment: Experiment
+ }
+ subscribeToResultsNotification: () => {
+ value: true
+ }
+ toggleDebugPanel: () => {
+ value: true
+ }
+ touchExperimentField: (key: string) => {
+ key: string
+ }
+ unarchiveExperiment: () => {
+ value: true
+ }
+ unfreezeExposure: () => {
+ value: true
+ }
+ updateDistribution: (
+ variants: MultivariateFlagVariant[],
+ rolloutPercentage?: number
+ ) => {
+ rolloutPercentage: number | undefined
+ variants: MultivariateFlagVariant[]
+ }
+ updateExperiment: (update: ExperimentUpdatePayload) => ExperimentUpdatePayload
+ updateExperimentCollectionGoal: () => {
+ value: true
+ }
+ updateExperimentFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateExperimentMetrics: () => {
+ value: true
+ }
+ updateExperimentSettings: (update: Partial<Experiment>) => {
+ update: Partial<Experiment>
+ }
+ updateExperimentSuccess: (
+ experimentUpdate: Experiment,
+ payload?: ExperimentUpdatePayload
+ ) => {
+ experimentUpdate: Experiment
+ payload?: ExperimentUpdatePayload
+ }
+ updateExperimentVariantImages: (variantPreviewMediaIds: Record<string, string[]>) => {
+ variantPreviewMediaIds: Record<string, string[]>
+ }
+ updateExperimentVariantNotes: (variantNotes: Record<string, string>) => {
+ variantNotes: Record<string, string>
+ }
+ updateExposureCriteria: () => {
+ value: true
+ }
+ updateMetricBreakdown: (
+ uuid: string,
+ breakdown: Breakdown
+ ) => {
+ breakdown: Breakdown
+ uuid: string
+ }
+ validateFeatureFlag: (featureFlagKey: string) => {
+ featureFlagKey: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentLogicMeta {
+ key: ExperimentIdType
+ __keaTypeGenInternalSelectorTypes: {
+ props: (arg: any) => any
+ experimentId: (arg: any) => Experiment['id']
+ formMode: (arg: any) => FormModes
+ isExperimentDraft: (experiment: Experiment) => boolean
+ isExperimentLaunched: (experiment: Experiment) => boolean
+ isExperimentRunning: (experiment: Experiment) => boolean
+ isFlagActive: (experiment: Experiment) => boolean
+ isExperimentStopped: (experiment: Experiment) => boolean
+ variants: (experiment: Experiment) => MultivariateFlagVariant[]
+ excludedVariants: (experiment: Experiment) => string[]
+ experimentMathAggregationForTrends: (
+ experiment: Experiment
+ ) => () => CountPerActorMathType | PropertyMathType | undefined
+ minimumDetectableEffect: (experiment: Experiment, defaultMinimumDetectableEffect: number) => number
+ recommendedSampleSize: (
+ conversionMetrics: FunnelTimeConversionMetrics,
+ variants: MultivariateFlagVariant[],
+ minimumDetectableEffect: number
+ ) => number
+ recommendedRunningTime: (
+ experiment: Experiment,
+ variants: MultivariateFlagVariant[],
+ getInsightType: (
+ metric: ExperimentFunnelsQuery | ExperimentMetricUnion | ExperimentTrendsQuery | undefined
+ ) => InsightType,
+ firstPrimaryMetric: ExperimentFunnelsQuery | ExperimentMetricUnion | ExperimentTrendsQuery | undefined,
+ funnelResults: FunnelResultType,
+ conversionMetrics: FunnelTimeConversionMetrics,
+ trendResults: TrendResult[],
+ minimumDetectableEffect: number
+ ) => number
+ actualRunningTime: (experiment: Experiment) => number
+ isSingleVariantShipped: (experiment: Experiment) => boolean
+ shippedVariantKey: (experiment: Experiment) => string | null
+ experimentWarning: (
+ experiment: Experiment,
+ isExperimentRunning: boolean,
+ isExperimentDraft: boolean,
+ isFlagActive: boolean,
+ isSingleVariantShipped: boolean,
+ shippedVariantKey: string | null
+ ) => ExperimentWarning | null
+ hasPrimaryMetricSet: (primaryMetricsLengthWithSharedMetrics: number) => boolean
+ firstPrimaryMetric: (
+ experiment: Experiment
+ ) => ExperimentFunnelsQuery | ExperimentMetric | ExperimentTrendsQuery | undefined
+ primaryMetricsLengthWithSharedMetrics: (experiment: Experiment) => number
+ secondaryMetricsLengthWithSharedMetrics: (experiment: Experiment) => number
+ compatibleSharedMetrics: (sharedMetrics: SharedMetric[], usesNewQueryRunner: boolean) => SharedMetric[]
+ usesNewQueryRunner: (experiment: Experiment) => boolean
+ hasMinimumExposureForResults: (exposures: any, usesNewQueryRunner: boolean) => boolean
+ exposureCriteria: (experiment: Experiment) => ExperimentExposureCriteria | undefined
+ getOrderedMetricsWithResults: (
+ experiment: Experiment,
+ primaryMetricsResults: CachedNewExperimentQueryResponse[],
+ primaryMetricsResultsErrors: any[],
+ secondaryMetricsResults: CachedNewExperimentQueryResponse[],
+ secondaryMetricsResultsErrors: any[]
+ ) => (isSecondary: boolean) => {
+ displayIndex: number
+ error: any
+ metric: ExperimentMetricUnion
+ metricIndex: number
+ result: any
+ }[]
+ orderedPrimaryMetricsWithResults: (
+ getOrderedMetricsWithResults: (isSecondary: boolean) => {
+ displayIndex: number
+ error: any
+ metric: ExperimentMetricUnion
+ metricIndex: number
+ result: any
+ }[]
+ ) => {
+ displayIndex: number
+ error: any
+ metric: ExperimentMetricUnion
+ metricIndex: number
+ result: any
+ }[]
+ orderedSecondaryMetricsWithResults: (
+ getOrderedMetricsWithResults: (isSecondary: boolean) => {
+ displayIndex: number
+ error: any
+ metric: ExperimentMetricUnion
+ metricIndex: number
+ result: any
+ }[]
+ ) => {
+ displayIndex: number
+ error: any
+ metric: ExperimentMetricUnion
+ metricIndex: number
+ result: any
+ }[]
+ statsMethod: (experiment: Experiment) => ExperimentStatsMethod
+ }
+}
+
+export type experimentLogicType = MakeLogicType<
+ experimentLogicValues,
+ experimentLogicActions,
+ ExperimentLogicProps,
+ experimentLogicMeta
+>
+
export const experimentLogic = kea<experimentLogicType>([
props({} as ExperimentLogicProps),
key((props) => props.experimentId ?? 'new'),
@@ -2632,42 +3565,45 @@ export const experimentLogic = kea<experimentLogicType>([
],
isExperimentDraft: [
(s) => [s.experiment],
- (experiment): boolean => {
+ (experiment: Experiment): boolean => {
return !!experiment && !isLaunched(experiment) && !experiment.archived
},
],
isExperimentLaunched: [
(s) => [s.experiment],
- (experiment): boolean => {
+ (experiment: Experiment): boolean => {
return !!experiment && isLaunched(experiment)
},
],
isExperimentRunning: [
(s) => [s.experiment],
- (experiment): boolean => {
+ (experiment: Experiment): boolean => {
return isLaunched(experiment) && !hasEnded(experiment)
},
],
isFlagActive: [
(s) => [s.experiment],
- (experiment): boolean => {
+ (experiment: Experiment): boolean => {
return !!experiment?.feature_flag?.active
},
],
isExperimentStopped: [
(s) => [s.experiment],
- (experiment): boolean => {
+ (experiment: Experiment): boolean => {
return hasEnded(experiment) && !experiment.archived
},
],
- variants: [(s) => [s.experiment], (experiment): MultivariateFlagVariant[] => getExperimentVariants(experiment)],
+ variants: [
+ (s) => [s.experiment],
+ (experiment: Experiment): MultivariateFlagVariant[] => getExperimentVariants(experiment),
+ ],
excludedVariants: [
(s) => [s.experiment],
(experiment: Experiment): string[] => experiment?.excluded_variants ?? [],
],
experimentMathAggregationForTrends: [
(s) => [s.experiment],
- (experiment) => (): PropertyMathType | CountPerActorMathType | undefined => {
+ (experiment: Experiment) => (): PropertyMathType | CountPerActorMathType | undefined => {
const query = experiment?.metrics?.[0] as ExperimentTrendsQuery
if (!query) {
return undefined
@@ -2693,7 +3629,7 @@ export const experimentLogic = kea<experimentLogicType>([
],
minimumDetectableEffect: [
(s) => [s.experiment, s.defaultMinimumDetectableEffect],
- (newExperiment, defaultMinimumDetectableEffect): number => {
+ (newExperiment: Experiment, defaultMinimumDetectableEffect: number): number => {
return (
newExperiment?.running_time_calculation?.minimum_detectable_effect ?? defaultMinimumDetectableEffect
)
@@ -2701,7 +3637,11 @@ export const experimentLogic = kea<experimentLogicType>([
],
recommendedSampleSize: [
(s) => [s.conversionMetrics, s.variants, s.minimumDetectableEffect],
- (conversionMetrics, variants, minimumDetectableEffect): number => {
+ (
+ conversionMetrics: import('~/types').FunnelTimeConversionMetrics,
+ variants: MultivariateFlagVariant[],
+ minimumDetectableEffect: number
+ ): number => {
const conversionRate = conversionMetrics.totalRate * 100
const sampleSizePerVariant = legacyMinimumSampleSizePerVariant(minimumDetectableEffect, conversionRate)
const sampleSize = sampleSizePerVariant * variants.length
@@ -2720,14 +3660,20 @@ export const experimentLogic = kea<experimentLogicType>([
s.minimumDetectableEffect,
],
(
- experiment,
- variants,
- getInsightType,
- firstPrimaryMetric,
- funnelResults,
- conversionMetrics,
- trendResults,
- minimumDetectableEffect
+ experiment: Experiment,
+ variants: MultivariateFlagVariant[],
+ getInsightType: (
+ metric:
+ | ExperimentFunnelsQuery
+ | ExperimentTrendsQuery
+ | import('~/queries/schema/schema-general').ExperimentMetricUnion
+ | undefined
+ ) => InsightType,
+ firstPrimaryMetric: ExperimentFunnelsQuery | ExperimentMetric | ExperimentTrendsQuery | undefined,
+ funnelResults: import('~/types').FunnelResultType,
+ conversionMetrics: import('~/types').FunnelTimeConversionMetrics,
+ trendResults: import('~/types').TrendResult[],
+ minimumDetectableEffect: number
): number => {
if (getInsightType(firstPrimaryMetric) === InsightType.FUNNELS) {
const currentDuration = dayjs().diff(dayjs(experiment?.start_date), 'hour')
@@ -2832,7 +3778,7 @@ export const experimentLogic = kea<experimentLogicType>([
],
hasPrimaryMetricSet: [
(s) => [s.primaryMetricsLengthWithSharedMetrics],
- (primaryMetricsLengthWithSharedMetrics): boolean => {
+ (primaryMetricsLengthWithSharedMetrics: number): boolean => {
return primaryMetricsLengthWithSharedMetrics > 0
},
],
@@ -2937,11 +3883,11 @@ export const experimentLogic = kea<experimentLogicType>([
s.secondaryMetricsResultsErrors,
],
(
- experiment,
- primaryMetricsResults,
- primaryMetricsResultsErrors,
- secondaryMetricsResults,
- secondaryMetricsResultsErrors
+ experiment: Experiment,
+ primaryMetricsResults: CachedNewExperimentQueryResponse[],
+ primaryMetricsResultsErrors: any[],
+ secondaryMetricsResults: CachedNewExperimentQueryResponse[],
+ secondaryMetricsResultsErrors: any[]
) =>
(isSecondary: boolean) =>
getOrderedMetricsWithResults(
@@ -2955,11 +3901,27 @@ export const experimentLogic = kea<experimentLogicType>([
],
orderedPrimaryMetricsWithResults: [
(s) => [s.getOrderedMetricsWithResults],
- (getOrderedMetricsWithResults) => getOrderedMetricsWithResults(false),
+ (
+ getOrderedMetricsWithResults: (isSecondary: boolean) => {
+ displayIndex: number
+ error: any
+ metric: import('~/queries/schema/schema-general').ExperimentMetricUnion
+ metricIndex: number
+ result: any
+ }[]
+ ) => getOrderedMetricsWithResults(false),
],
orderedSecondaryMetricsWithResults: [
(s) => [s.getOrderedMetricsWithResults],
- (getOrderedMetricsWithResults) => getOrderedMetricsWithResults(true),
+ (
+ getOrderedMetricsWithResults: (isSecondary: boolean) => {
+ displayIndex: number
+ error: any
+ metric: import('~/queries/schema/schema-general').ExperimentMetricUnion
+ metricIndex: number
+ result: any
+ }[]
+ ) => getOrderedMetricsWithResults(true),
],
statsMethod: [
(s) => [s.experiment],
diff --git a/frontend/src/scenes/experiments/experimentMetricsLogic.ts b/frontend/src/scenes/experiments/experimentMetricsLogic.ts
index b803543c904c..5a2846c30c5d 100644
--- a/frontend/src/scenes/experiments/experimentMetricsLogic.ts
+++ b/frontend/src/scenes/experiments/experimentMetricsLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { lemonToast } from '@posthog/lemon-ui'
@@ -20,7 +20,8 @@ import type {
TriggerEnumApi,
} from 'products/experiments/frontend/generated/api.schemas'
-import type { experimentMetricsLogicType } from './experimentMetricsLogicType'
+import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
+import type { ExperimentIdType } from '../../types'
import { isLaunched } from './experimentsLogic'
type ExperimentSavedMetric = {
@@ -136,6 +137,135 @@ const resolveErrorByUuid = (recalculation: ExperimentMetricsRecalculationApi): R
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentMetricsLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ currentProjectId: number | null // projectLogic
+ currentRecalculation: ExperimentMetricsRecalculationApi | null
+ isMetricRecalculating: (metricUuid: string | undefined) => boolean
+ isRecalculating: boolean
+ lastRefresh: string | null
+ primaryMetricsResults: CachedNewExperimentQueryResponse[]
+ primaryMetricsResultsErrors: (unknown | null)[]
+ recalculatingMetricUuids: string[]
+ recalculationDisplayState: 'cold' | 'initial' | 'partial' | 'refreshing' | 'resting'
+ recalculationLoading: boolean
+ recalculationProgress: {
+ completed: number
+ total: number
+ }
+ secondaryMetricsResults: CachedNewExperimentQueryResponse[]
+ secondaryMetricsResultsErrors: (unknown | null)[]
+ totalMetricsCount: number
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentMetricsLogicActions {
+ reportExperimentMetricRecalculation: (
+ status: 'completed' | 'failed' | 'triggered',
+ properties: {
+ duration_ms?: number
+ experiment_id: number
+ failed?: number
+ is_existing?: boolean
+ poll_count?: number
+ recalculation_id: string | null
+ succeeded?: number
+ total_metrics?: number
+ trigger?:
+ | 'auto_refresh'
+ | 'cold_run'
+ | 'config_change'
+ | 'experiment_launch'
+ | 'experiment_stop'
+ | 'experiment_update'
+ | 'manual'
+ | 'stale_refresh'
+ }
+ ) => {
+ properties: {
+ duration_ms?: number | undefined
+ experiment_id: number
+ failed?: number | undefined
+ is_existing?: boolean | undefined
+ poll_count?: number | undefined
+ recalculation_id: string | null
+ succeeded?: number | undefined
+ total_metrics?: number | undefined
+ trigger?:
+ | 'auto_refresh'
+ | 'cold_run'
+ | 'config_change'
+ | 'experiment_launch'
+ | 'experiment_stop'
+ | 'experiment_update'
+ | 'manual'
+ | 'stale_refresh'
+ | undefined
+ }
+ status: 'completed' | 'failed' | 'triggered'
+ } // eventUsageLogic
+ loadLatestRecalculation: () => {
+ value: true
+ }
+ pollRecalculation: (recalculationId: string) => {
+ recalculationId: string
+ }
+ setCurrentRecalculation: (recalculation: ExperimentMetricsRecalculationApi | null) => {
+ recalculation: ExperimentMetricsRecalculationApi | null
+ }
+ setPrimaryMetricsResults: (results: CachedNewExperimentQueryResponse[]) => {
+ results: CachedNewExperimentQueryResponse[]
+ }
+ setPrimaryMetricsResultsErrors: (errors: (unknown | null)[]) => {
+ errors: unknown[]
+ }
+ setRecalculatingMetricUuids: (uuids: string[]) => {
+ uuids: string[]
+ }
+ setRecalculationLoading: (loading: boolean) => {
+ loading: boolean
+ }
+ setSecondaryMetricsResults: (results: CachedNewExperimentQueryResponse[]) => {
+ results: CachedNewExperimentQueryResponse[]
+ }
+ setSecondaryMetricsResultsErrors: (errors: (unknown | null)[]) => {
+ errors: unknown[]
+ }
+ triggerRecalculation: (trigger?: TriggerEnumApi) => {
+ trigger: TriggerEnumApi
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentMetricsLogicMeta {
+ key: ExperimentIdType
+ __keaTypeGenInternalSelectorTypes: {
+ isRecalculating: (
+ recalculationLoading: boolean,
+ currentRecalculation: ExperimentMetricsRecalculationApi | null
+ ) => boolean
+ recalculationProgress: (currentRecalculation: ExperimentMetricsRecalculationApi | null) => {
+ completed: number
+ total: number
+ }
+ totalMetricsCount: (arg: any) => number
+ lastRefresh: (currentRecalculation: ExperimentMetricsRecalculationApi | null) => string | null
+ recalculationDisplayState: (
+ recalculationLoading: boolean,
+ currentRecalculation: ExperimentMetricsRecalculationApi | null
+ ) => 'cold' | 'initial' | 'partial' | 'refreshing' | 'resting'
+ isMetricRecalculating: (recalculatingMetricUuids: string[]) => (metricUuid: string | undefined) => boolean
+ }
+}
+
+export type experimentMetricsLogicType = MakeLogicType<
+ experimentMetricsLogicValues,
+ experimentMetricsLogicActions,
+ ExperimentMetricsLogicProps,
+ experimentMetricsLogicMeta
+>
+
export const experimentMetricsLogic = kea<experimentMetricsLogicType>([
props({} as ExperimentMetricsLogicProps),
key((props) => props.experiment.id),
@@ -207,7 +337,7 @@ export const experimentMetricsLogic = kea<experimentMetricsLogicType>([
// True while a recalculation is being fetched or is still running.
isRecalculating: [
(s) => [s.recalculationLoading, s.currentRecalculation],
- (recalculationLoading, recalculation): boolean =>
+ (recalculationLoading: boolean, recalculation: ExperimentMetricsRecalculationApi | null): boolean =>
recalculationLoading ||
recalculation?.status === RECALCULATION_STATUSES.pending ||
recalculation?.status === RECALCULATION_STATUSES.in_progress,
@@ -216,7 +346,7 @@ export const experimentMetricsLogic = kea<experimentMetricsLogicType>([
(s) => [s.currentRecalculation],
// "completed" here means resolved: a failed metric is done too, so it counts toward progress.
// Without this, a run where every metric fails sits at 0/N forever and looks stuck.
- (recalc): { completed: number; total: number } => ({
+ (recalc: ExperimentMetricsRecalculationApi | null): { completed: number; total: number } => ({
completed: (recalc?.completed_metrics ?? 0) + (recalc?.failed_metrics ?? 0),
total: recalc?.total_metrics ?? 0,
}),
@@ -228,10 +358,16 @@ export const experimentMetricsLogic = kea<experimentMetricsLogicType>([
(experiment: Experiment): number =>
metricsInOrder(experiment, 'primary').length + metricsInOrder(experiment, 'secondary').length,
],
- lastRefresh: [(s) => [s.currentRecalculation], (recalc): string | null => recalc?.query_to ?? null],
+ lastRefresh: [
+ (s) => [s.currentRecalculation],
+ (recalc: ExperimentMetricsRecalculationApi | null): string | null => recalc?.query_to ?? null,
+ ],
recalculationDisplayState: [
(s) => [s.recalculationLoading, s.currentRecalculation],
- (recalculationLoading, recalculation): 'initial' | 'cold' | 'refreshing' | 'partial' | 'resting' => {
+ (
+ recalculationLoading: boolean,
+ recalculation: ExperimentMetricsRecalculationApi | null
+ ): 'initial' | 'cold' | 'refreshing' | 'partial' | 'resting' => {
if (!recalculation) {
return recalculationLoading ? 'initial' : 'resting'
}
@@ -248,7 +384,7 @@ export const experimentMetricsLogic = kea<experimentMetricsLogicType>([
// Predicate the table uses to dim a metric whose stale value is still being refreshed.
isMetricRecalculating: [
(s) => [s.recalculatingMetricUuids],
- (uuids): ((metricUuid: string | undefined) => boolean) => {
+ (uuids: string[]): ((metricUuid: string | undefined) => boolean) => {
const recalculating = new Set(uuids)
return (metricUuid) => !!metricUuid && recalculating.has(metricUuid)
},
diff --git a/frontend/src/scenes/experiments/experimentResultsNotificationLogic.ts b/frontend/src/scenes/experiments/experimentResultsNotificationLogic.ts
index d8ff9113ce53..42c48141d6ed 100644
--- a/frontend/src/scenes/experiments/experimentResultsNotificationLogic.ts
+++ b/frontend/src/scenes/experiments/experimentResultsNotificationLogic.ts
@@ -1,17 +1,48 @@
-import { actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
import { subscriptions } from 'kea-subscriptions'
import { lemonToast } from '@posthog/lemon-ui'
import { Experiment } from '~/types'
+import type { ExperimentIdType } from '../../types'
import { experimentMetricsLogic } from './experimentMetricsLogic'
-import type { experimentResultsNotificationLogicType } from './experimentResultsNotificationLogicType'
export interface ExperimentResultsNotificationLogicProps {
experiment: Experiment
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentResultsNotificationLogicValues {
+ isRecalculating: boolean // experimentMetricsLogic
+ notifyWhenResultsReady: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentResultsNotificationLogicActions {
+ notifyResultsReady: () => {
+ value: true
+ }
+ setNotifyWhenResultsReady: (notify: boolean) => {
+ notify: boolean
+ }
+ subscribeToResultsNotification: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentResultsNotificationLogicMeta {
+ key: ExperimentIdType
+}
+
+export type experimentResultsNotificationLogicType = MakeLogicType<
+ experimentResultsNotificationLogicValues,
+ experimentResultsNotificationLogicActions,
+ ExperimentResultsNotificationLogicProps,
+ experimentResultsNotificationLogicMeta
+>
+
/**
* Browser notification for the recalculation flow: the status bar's "Notify me" button opts in, and a
* notification fires when the run finishes. Driven entirely by `experimentMetricsLogic.isRecalculating`
diff --git a/frontend/src/scenes/experiments/experimentSceneLogic.tsx b/frontend/src/scenes/experiments/experimentSceneLogic.tsx
index cd178afa73c0..de4d04d1364f 100644
--- a/frontend/src/scenes/experiments/experimentSceneLogic.tsx
+++ b/frontend/src/scenes/experiments/experimentSceneLogic.tsx
@@ -1,4 +1,16 @@
-import { BuiltLogic, actions, kea, listeners, path, props, reducers, selectors, sharedListeners } from 'kea'
+import {
+ MakeLogicType,
+ BuiltLogic,
+ actions,
+ kea,
+ listeners,
+ path,
+ props,
+ reducers,
+ selectors,
+ sharedListeners,
+} from 'kea'
+import type { BreakPointFunction } from 'kea'
import { router, urlToAction } from 'kea-router'
import { trackedActionToUrl } from 'lib/logic/scenes/trackedActionToUrl'
@@ -9,14 +21,120 @@ import { urls } from 'scenes/urls'
import { SIDE_PANEL_CONTEXT_KEY, SidePanelSceneContext } from '~/layout/navigation-3000/sidepanel/types'
import { ActivityScope, Breadcrumb, Experiment, ProjectTreeRef } from '~/types'
+import type { ExperimentIdType } from '../../types'
import { NEW_EXPERIMENT } from './constants'
-import { type ExperimentLogicProps, FORM_MODES, type FormModes, experimentLogic } from './experimentLogic'
-import type { experimentLogicType } from './experimentLogicType'
-import type { experimentSceneLogicType } from './experimentSceneLogicType'
+import {
+ type ExperimentLogicProps,
+ type experimentLogicType,
+ FORM_MODES,
+ type FormModes,
+ experimentLogic,
+} from './experimentLogic'
import { stepStorageKey } from './ExperimentWizard/experimentWizardLogic'
export interface ExperimentSceneLogicProps extends ExperimentLogicProps {}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentSceneLogicValues {
+ activeTabKey: string
+ breadcrumbs: Breadcrumb[]
+ experiment: Experiment
+ experimentId: ExperimentIdType
+ experimentLogicRef: {
+ logic: BuiltLogic<experimentLogicType>
+ props: ExperimentLogicProps
+ unmount: () => void
+ } | null
+ experimentMissing: boolean
+ experimentMissingSelector: ((state: any, props?: ExperimentLogicProps | undefined) => boolean) | undefined
+ experimentSelector: ((state: any, props?: ExperimentLogicProps | undefined) => Experiment) | undefined
+ formMode: FormModes
+ isExperimentLaunched: boolean
+ isExperimentLaunchedSelector: ((state: any, props?: ExperimentLogicProps | undefined) => boolean) | undefined
+ projectTreeRef: ProjectTreeRef
+ sidePanelContext: SidePanelSceneContext | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentSceneLogicActions {
+ resetExperimentState: (experimentConfig: Experiment) => {
+ experimentConfig: Experiment
+ }
+ setActiveTabKey: (activeTabKey: string) => {
+ activeTabKey: string
+ }
+ setEditMode: (editing: boolean) => {
+ editing: boolean
+ }
+ setExperimentLogicRef: (
+ logic: BuiltLogic<experimentLogicType> | null,
+ unmount: (() => void) | null,
+ logicProps: ExperimentLogicProps | null
+ ) => {
+ logic: BuiltLogic<experimentLogicType> | null
+ logicProps: ExperimentLogicProps | null
+ unmount: (() => void) | null
+ }
+ setSceneState: (
+ experimentId: Experiment['id'],
+ formMode: FormModes
+ ) => {
+ experimentId: ExperimentIdType
+ formMode: FormModes
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentSceneLogicMeta {
+ sharedListeners: {
+ ensureExperimentLogicMounted: (
+ payload: any,
+ breakpoint: BreakPointFunction,
+ action: {
+ type: string
+ payload: any
+ },
+ previousState: any
+ ) => void | Promise<void>
+ }
+ __keaTypeGenInternalSelectorTypes: {
+ experimentSelector: (
+ experimentLogicRef: {
+ logic: BuiltLogic<experimentLogicType>
+ props: ExperimentLogicProps
+ unmount: () => void
+ } | null
+ ) => ((state: any, props?: ExperimentLogicProps | undefined) => Experiment) | undefined
+ experiment: (arg: Experiment | null | undefined) => Experiment
+ experimentMissingSelector: (
+ experimentLogicRef: {
+ logic: BuiltLogic<experimentLogicType>
+ props: ExperimentLogicProps
+ unmount: () => void
+ } | null
+ ) => ((state: any, props?: ExperimentLogicProps | undefined) => boolean) | undefined
+ experimentMissing: (arg: boolean | undefined) => boolean
+ isExperimentLaunchedSelector: (
+ experimentLogicRef: {
+ logic: BuiltLogic<experimentLogicType>
+ props: ExperimentLogicProps
+ unmount: () => void
+ } | null
+ ) => ((state: any, props?: ExperimentLogicProps | undefined) => boolean) | undefined
+ isExperimentLaunched: (arg: boolean | undefined) => boolean
+ breadcrumbs: (experiment: Experiment, experimentId: ExperimentIdType) => Breadcrumb[]
+ sidePanelContext: (experimentId: ExperimentIdType) => SidePanelSceneContext | null
+ projectTreeRef: (experimentId: ExperimentIdType) => ProjectTreeRef
+ }
+}
+
+export type experimentSceneLogicType = MakeLogicType<
+ experimentSceneLogicValues,
+ experimentSceneLogicActions,
+ ExperimentSceneLogicProps,
+ experimentSceneLogicMeta
+>
+
export const experimentSceneLogic = kea<experimentSceneLogicType>([
props({} as ExperimentSceneLogicProps),
path(['scenes', 'experiments', 'experimentSceneLogic']),
@@ -70,7 +188,13 @@ export const experimentSceneLogic = kea<experimentSceneLogicType>([
selectors({
experimentSelector: [
(s) => [s.experimentLogicRef],
- (experimentLogicRef) => experimentLogicRef?.logic.selectors.experiment,
+ (
+ experimentLogicRef: {
+ logic: BuiltLogic<experimentLogicType>
+ props: ExperimentLogicProps
+ unmount: () => void
+ } | null
+ ) => experimentLogicRef?.logic.selectors.experiment,
],
experiment: [
(s) => [
@@ -82,11 +206,17 @@ export const experimentSceneLogic = kea<experimentSceneLogicType>([
}
},
],
- (experiment): Experiment => (experiment ?? NEW_EXPERIMENT) as Experiment,
+ (experiment: Experiment | null | undefined): Experiment => (experiment ?? NEW_EXPERIMENT) as Experiment,
],
experimentMissingSelector: [
(s) => [s.experimentLogicRef],
- (experimentLogicRef) => experimentLogicRef?.logic.selectors.experimentMissing,
+ (
+ experimentLogicRef: {
+ logic: BuiltLogic<experimentLogicType>
+ props: ExperimentLogicProps
+ unmount: () => void
+ } | null
+ ) => experimentLogicRef?.logic.selectors.experimentMissing,
],
experimentMissing: [
(s) => [
@@ -98,11 +228,17 @@ export const experimentSceneLogic = kea<experimentSceneLogicType>([
}
},
],
- (experimentMissing): boolean => experimentMissing ?? false,
+ (experimentMissing: boolean | undefined): boolean => experimentMissing ?? false,
],
isExperimentLaunchedSelector: [
(s) => [s.experimentLogicRef],
- (experimentLogicRef) => experimentLogicRef?.logic.selectors.isExperimentLaunched,
+ (
+ experimentLogicRef: {
+ logic: BuiltLogic<experimentLogicType>
+ props: ExperimentLogicProps
+ unmount: () => void
+ } | null
+ ) => experimentLogicRef?.logic.selectors.isExperimentLaunched,
],
isExperimentLaunched: [
(s) => [
@@ -114,7 +250,7 @@ export const experimentSceneLogic = kea<experimentSceneLogicType>([
}
},
],
- (isExperimentLaunched): boolean => isExperimentLaunched ?? false,
+ (isExperimentLaunched: boolean | undefined): boolean => isExperimentLaunched ?? false,
],
breadcrumbs: [
(s) => [s.experiment, s.experimentId],
diff --git a/frontend/src/scenes/experiments/experimentTabLogic.ts b/frontend/src/scenes/experiments/experimentTabLogic.ts
index b4bd07bdb1fe..e01389cae091 100644
--- a/frontend/src/scenes/experiments/experimentTabLogic.ts
+++ b/frontend/src/scenes/experiments/experimentTabLogic.ts
@@ -1,4 +1,4 @@
-import { afterMount, connect, kea, key, path, props } from 'kea'
+import { MakeLogicType, afterMount, connect, kea, key, path, props } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
@@ -6,12 +6,48 @@ import { teamLogic } from 'scenes/teamLogic'
import type { Experiment } from '~/types'
-import type { experimentTabLogicType } from './experimentTabLogicType'
-
export interface ExperimentTabLogicProps {
featureFlagId: number
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentTabLogicValues {
+ currentProjectId: number | string // teamLogic
+ relatedExperiments: Experiment[]
+ relatedExperimentsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentTabLogicActions {
+ loadRelatedExperiments: () => any
+ loadRelatedExperimentsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRelatedExperimentsSuccess: (
+ relatedExperiments: Experiment[],
+ payload?: any
+ ) => {
+ relatedExperiments: Experiment[]
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentTabLogicMeta {
+ key: number
+}
+
+export type experimentTabLogicType = MakeLogicType<
+ experimentTabLogicValues,
+ experimentTabLogicActions,
+ ExperimentTabLogicProps,
+ experimentTabLogicMeta
+>
+
export const experimentTabLogic = kea<experimentTabLogicType>([
path(['scenes', 'experiments', 'experimentTabLogic']),
props({} as ExperimentTabLogicProps),
diff --git a/frontend/src/scenes/experiments/experimentTimeseriesLogic.ts b/frontend/src/scenes/experiments/experimentTimeseriesLogic.ts
index c356b7b83ff1..2bd50f20d842 100644
--- a/frontend/src/scenes/experiments/experimentTimeseriesLogic.ts
+++ b/frontend/src/scenes/experiments/experimentTimeseriesLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, listeners, path, props, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, props, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
@@ -19,7 +19,7 @@ import {
} from '~/queries/schema/schema-general'
import { Experiment, ExperimentIdType } from '~/types'
-import type { experimentTimeseriesLogicType } from './experimentTimeseriesLogicType'
+import type { ExperimentMetricUnion } from '../../queries/schema/schema-general'
import { COLORS } from './MetricsView/shared/colors'
import { getMetricColors, getVariantInterval } from './MetricsView/shared/utils'
import { getExperimentVariants } from './utils'
@@ -59,6 +59,117 @@ export interface ExperimentTimeseriesLogicProps {
metric: ExperimentMetric | undefined
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentTimeseriesLogicValues {
+ currentProjectId: number | string // teamLogic
+ chartData: (variantKey: string) => ProcessedChartData | null
+ hasTimeseriesData: boolean
+ isRecalculating: boolean
+ processedVariantData: (variantKey: string) => ProcessedTimeseriesDataPoint[]
+ progressMessage: string | null
+ timeseries: ExperimentMetricTimeseries | null
+ timeseriesLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentTimeseriesLogicActions {
+ reportExperimentTimeseriesRecalculated: (
+ experimentId: ExperimentIdType,
+ metric: ExperimentMetricUnion
+ ) => {
+ experimentId: ExperimentIdType
+ metric: ExperimentMetricUnion
+ } // eventUsageLogic
+ clearTimeseries: () => {
+ value: true
+ }
+ clearTimeseriesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ clearTimeseriesSuccess: (
+ timeseries: null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ timeseries: null
+ payload?: {
+ value: true
+ }
+ }
+ loadTimeseries: ({ metric }: { metric: ExperimentMetric }) => {
+ metric: ExperimentMetric
+ }
+ loadTimeseriesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadTimeseriesSuccess: (
+ timeseries: ExperimentMetricTimeseries | null,
+ payload?: {
+ metric: ExperimentMetric
+ }
+ ) => {
+ timeseries: ExperimentMetricTimeseries | null
+ payload?: {
+ metric: ExperimentMetric
+ }
+ }
+ recalculateTimeseries: ({ metric }: { metric: ExperimentMetric }) => {
+ metric: ExperimentMetricUnion
+ }
+ recalculateTimeseriesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ recalculateTimeseriesSuccess: (
+ timeseries: null,
+ payload?: {
+ metric: ExperimentMetricUnion
+ }
+ ) => {
+ timeseries: null
+ payload?: {
+ metric: ExperimentMetricUnion
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentTimeseriesLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ isRecalculating: (timeseries: ExperimentMetricTimeseries | null) => boolean
+ processedVariantData: (
+ timeseries: ExperimentMetricTimeseries | null
+ ) => (variantKey: string) => ProcessedTimeseriesDataPoint[]
+ progressMessage: (timeseries: ExperimentMetricTimeseries | null) => string | null
+ hasTimeseriesData: (timeseries: ExperimentMetricTimeseries | null) => boolean
+ chartData: (
+ processedVariantData: (variantKey: string) => ProcessedTimeseriesDataPoint[],
+ timeseries: ExperimentMetricTimeseries | null,
+ experiment: Experiment,
+ metric: ExperimentMetricUnion | undefined
+ ) => (variantKey: string) => ProcessedChartData | null
+ }
+}
+
+export type experimentTimeseriesLogicType = MakeLogicType<
+ experimentTimeseriesLogicValues,
+ experimentTimeseriesLogicActions,
+ ExperimentTimeseriesLogicProps,
+ experimentTimeseriesLogicMeta
+>
+
export const experimentTimeseriesLogic = kea<experimentTimeseriesLogicType>([
props({} as ExperimentTimeseriesLogicProps),
path((key) => ['scenes', 'experiments', 'experimentTimeseriesLogic', key]),
diff --git a/frontend/src/scenes/experiments/experimentsLogic.ts b/frontend/src/scenes/experiments/experimentsLogic.ts
index e15cb3cdd566..d65418b37aed 100644
--- a/frontend/src/scenes/experiments/experimentsLogic.ts
+++ b/frontend/src/scenes/experiments/experimentsLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, router, urlToAction } from 'kea-router'
@@ -25,7 +25,8 @@ import {
FeatureFlagType,
} from '~/types'
-import type { experimentsLogicType } from './experimentsLogicType'
+import type { AvailableFeature, UserType } from '../../types'
+import type { TeamPublicType, TeamType } from '../../types'
import { getFlagVariants } from './utils'
export const EXPERIMENTS_PER_PAGE = 100
@@ -150,6 +151,387 @@ function normalizeExperimentFilterStatus(status: string | undefined): Experiment
return 'all'
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentsLogicValues {
+ featureFlags: FeatureFlagsResult // featureFlagsLogic
+ currentProjectId: number | null // projectLogic
+ location: {
+ pathname: string
+ search: string
+ hash: string
+ } // router
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean // userLogic
+ user: UserType | null // userLogic
+ breadcrumbs: Breadcrumb[]
+ count: number
+ experiments: ExperimentsResult
+ experimentsLoading: boolean
+ experimentsStats: ExperimentVelocityStats
+ experimentsStatsLoading: boolean
+ featureFlagModalFeatureFlags: {
+ count: number
+ results: FeatureFlagType[]
+ }
+ featureFlagModalFeatureFlagsLoading: boolean
+ featureFlagModalFilters: FeatureFlagModalFilters
+ featureFlagModalPageFromURL: number
+ featureFlagModalPagination: PaginationManual
+ featureFlagModalParamsFromFilters: Record<string, any>
+ filters: ExperimentsFilters
+ hasLoadedExperiments: boolean
+ pagination: PaginationManual
+ paramsFromFilters: {
+ archived?: boolean | undefined
+ created_by_id?: number[] | undefined
+ limit: number
+ offset: number
+ order?: string | undefined
+ page?: number | undefined
+ search?: string | undefined
+ status?: ExperimentStatus | 'all' | undefined
+ }
+ shouldShowEmptyState: boolean
+ sidePanelContext: SidePanelSceneContext
+ tab: ExperimentsTabs
+ unavailableFeatureFlagKeys: Set<string>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentsLogicActions {
+ loadCurrentTeamSuccess: (
+ currentTeam: TeamPublicType | null,
+ payload?: any
+ ) => {
+ currentTeam: TeamPublicType | null
+ payload?: any
+ } // teamLogic
+ updateCurrentTeamSuccess: (
+ currentTeam: TeamPublicType | TeamType,
+ payload?: Partial<TeamType>
+ ) => {
+ currentTeam: TeamPublicType | TeamType
+ payload?: Partial<TeamType>
+ } // teamLogic
+ addToExperiments: (experiment: Experiment) => Experiment
+ addToExperimentsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ addToExperimentsSuccess: (
+ experiments: {
+ count: number
+ filters?: ExperimentsFilters | null | undefined
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: Experiment[]
+ },
+ payload?: Experiment
+ ) => {
+ experiments: {
+ count: number
+ filters?: ExperimentsFilters | null | undefined
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: Experiment[]
+ }
+ payload?: Experiment
+ }
+ archiveExperiment: ({ id, disableFeatureFlag }: { disableFeatureFlag: boolean; id: number }) => {
+ id: number
+ disableFeatureFlag: boolean
+ }
+ archiveExperimentFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ archiveExperimentSuccess: (
+ experiments: {
+ count: number
+ filters?: ExperimentsFilters | null | undefined
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: Experiment[]
+ },
+ payload?: {
+ id: number
+ disableFeatureFlag: boolean
+ }
+ ) => {
+ experiments: {
+ count: number
+ filters?: ExperimentsFilters | null | undefined
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: Experiment[]
+ }
+ payload?: {
+ id: number
+ disableFeatureFlag: boolean
+ }
+ }
+ copyExperimentToProject: (payload: {
+ featureFlagKey?: string
+ id: number
+ name?: string
+ onSuccess?: () => void
+ targetProjectId: number
+ targetTeamId: number
+ }) => {
+ id: number
+ targetProjectId: number
+ targetTeamId: number
+ featureFlagKey?: string
+ name?: string
+ onSuccess?: () => void
+ }
+ copyExperimentToProjectFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ copyExperimentToProjectSuccess: (
+ experiments: ExperimentsResult,
+ payload?: {
+ id: number
+ targetProjectId: number
+ targetTeamId: number
+ featureFlagKey?: string
+ name?: string
+ onSuccess?: () => void
+ }
+ ) => {
+ experiments: ExperimentsResult
+ payload?: {
+ id: number
+ targetProjectId: number
+ targetTeamId: number
+ featureFlagKey?: string
+ name?: string
+ onSuccess?: () => void
+ }
+ }
+ duplicateExperiment: (payload: { featureFlagKey?: string; id: number; name?: string }) => {
+ id: number
+ featureFlagKey?: string
+ name?: string
+ }
+ duplicateExperimentFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ duplicateExperimentSuccess: (
+ experiments: {
+ count: number
+ filters?: ExperimentsFilters | null | undefined
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: any[]
+ },
+ payload?: {
+ id: number
+ featureFlagKey?: string
+ name?: string
+ }
+ ) => {
+ experiments: {
+ count: number
+ filters?: ExperimentsFilters | null | undefined
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: any[]
+ }
+ payload?: {
+ id: number
+ featureFlagKey?: string
+ name?: string
+ }
+ }
+ loadExperiments: (_: void) => void
+ loadExperimentsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadExperimentsStats: () => any
+ loadExperimentsStatsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadExperimentsStatsSuccess: (
+ experimentsStats: ExperimentVelocityStats,
+ payload?: any
+ ) => {
+ experimentsStats: ExperimentVelocityStats
+ payload?: any
+ }
+ loadExperimentsSuccess: (
+ experiments: ExperimentsResult,
+ payload?: void
+ ) => {
+ experiments: ExperimentsResult
+ payload?: void
+ }
+ loadFeatureFlagModalFeatureFlags: (_: void) => void
+ loadFeatureFlagModalFeatureFlagsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadFeatureFlagModalFeatureFlagsSuccess: (
+ featureFlagModalFeatureFlags: {
+ count: number
+ results: FeatureFlagType[]
+ },
+ payload?: void
+ ) => {
+ featureFlagModalFeatureFlags: {
+ count: number
+ results: FeatureFlagType[]
+ }
+ payload?: void
+ }
+ openFeatureFlagModal: () => {
+ value: true
+ }
+ resetFeatureFlagModalFilters: () => {
+ value: true
+ }
+ setExperimentsFilters: (
+ filters: Partial<ExperimentsFilters>,
+ replace?: boolean
+ ) => {
+ filters: Partial<ExperimentsFilters>
+ replace: boolean | undefined
+ }
+ setExperimentsTab: (tabKey: ExperimentsTabs) => {
+ tabKey: ExperimentsTabs
+ }
+ setFeatureFlagModalFilters: (
+ filters: Partial<FeatureFlagModalFilters>,
+ replace?: boolean
+ ) => {
+ filters: Partial<FeatureFlagModalFilters>
+ replace: boolean | undefined
+ }
+ unarchiveExperiment: (id: number) => number
+ unarchiveExperimentFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ unarchiveExperimentSuccess: (
+ experiments: {
+ count: number
+ filters?: ExperimentsFilters | null | undefined
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: Experiment[]
+ },
+ payload?: number
+ ) => {
+ experiments: {
+ count: number
+ filters?: ExperimentsFilters | null | undefined
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: Experiment[]
+ }
+ payload?: number
+ }
+ updateExperiments: (experiment: Experiment) => Experiment
+ updateExperimentsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateExperimentsSuccess: (
+ experiments: {
+ count: number
+ filters?: ExperimentsFilters | null | undefined
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: Experiment[]
+ },
+ payload?: Experiment
+ ) => {
+ experiments: {
+ count: number
+ filters?: ExperimentsFilters | null | undefined
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: Experiment[]
+ }
+ payload?: Experiment
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ count: (experiments: ExperimentsResult) => number
+ paramsFromFilters: (filters: ExperimentsFilters) => {
+ archived?: boolean | undefined
+ created_by_id?: number[] | undefined
+ limit: number
+ offset: number
+ order?: string | undefined
+ page?: number | undefined
+ search?: string | undefined
+ status?: ExperimentStatus | 'all' | undefined
+ }
+ featureFlagModalParamsFromFilters: (
+ featureFlagModalFilters: FeatureFlagModalFilters,
+ currentTeam: TeamPublicType | TeamType | null
+ ) => Record<string, any>
+ featureFlagModalPageFromURL: (searchParams: Record<string, any>) => number
+ featureFlagModalPagination: (
+ featureFlagModalFilters: FeatureFlagModalFilters,
+ featureFlagModalFeatureFlags: {
+ count: number
+ results: FeatureFlagType[]
+ },
+ featureFlagModalPageFromURL: number
+ ) => PaginationManual
+ shouldShowEmptyState: (
+ experimentsLoading: boolean,
+ experiments: ExperimentsResult,
+ filters: ExperimentsFilters
+ ) => boolean
+ pagination: (filters: ExperimentsFilters, count: number) => PaginationManual
+ unavailableFeatureFlagKeys: (featureFlags: FeatureFlagsResult, experiments: ExperimentsResult) => Set<string>
+ }
+}
+
+export type experimentsLogicType = MakeLogicType<
+ experimentsLogicValues,
+ experimentsLogicActions,
+ Record<string, any>,
+ experimentsLogicMeta
+>
+
export const experimentsLogic = kea<experimentsLogicType>([
path(['scenes', 'experiments', 'experimentsLogic']),
connect(() => ({
@@ -384,7 +766,7 @@ export const experimentsLogic = kea<experimentsLogicType>([
],
})),
selectors(() => ({
- count: [(selectors) => [selectors.experiments], (experiments) => experiments.count],
+ count: [(selectors) => [selectors.experiments], (experiments: ExperimentsResult) => experiments.count],
paramsFromFilters: [
(s) => [s.filters],
(filters: ExperimentsFilters) => ({
@@ -395,7 +777,10 @@ export const experimentsLogic = kea<experimentsLogicType>([
],
featureFlagModalParamsFromFilters: [
(s) => [s.featureFlagModalFilters, s.currentTeam],
- (filters: FeatureFlagModalFilters, currentTeam) => {
+ (
+ filters: FeatureFlagModalFilters,
+ currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType
+ ) => {
const params: Record<string, any> = {
...filters,
limit: FLAGS_PER_PAGE,
@@ -412,13 +797,20 @@ export const experimentsLogic = kea<experimentsLogicType>([
],
featureFlagModalPageFromURL: [
() => [router.selectors.searchParams],
- (searchParams) => {
+ (searchParams: Record<string, any>) => {
return parseInt(searchParams['ff_page']) || 1
},
],
featureFlagModalPagination: [
(s) => [s.featureFlagModalFilters, s.featureFlagModalFeatureFlags, s.featureFlagModalPageFromURL],
- (filters, featureFlags, urlPage): PaginationManual => {
+ (
+ filters: FeatureFlagModalFilters,
+ featureFlags: {
+ count: number
+ results: FeatureFlagType[]
+ },
+ urlPage: number
+ ): PaginationManual => {
const currentPage = Math.max(filters.page || 1, urlPage)
const hasNextPage = featureFlags.count > currentPage * FLAGS_PER_PAGE
@@ -449,7 +841,7 @@ export const experimentsLogic = kea<experimentsLogicType>([
],
shouldShowEmptyState: [
(s) => [s.experimentsLoading, s.experiments, s.filters],
- (experimentsLoading, experiments, filters): boolean => {
+ (experimentsLoading: boolean, experiments: ExperimentsResult, filters: ExperimentsFilters): boolean => {
return (
!experimentsLoading &&
(experiments.results?.length ?? 0) === 0 &&
@@ -459,7 +851,7 @@ export const experimentsLogic = kea<experimentsLogicType>([
],
pagination: [
(s) => [s.filters, s.count],
- (filters, count): PaginationManual => {
+ (filters: ExperimentsFilters, count: number): PaginationManual => {
return {
controlled: true,
pageSize: EXPERIMENTS_PER_PAGE,
diff --git a/frontend/src/scenes/experiments/holdoutsLogic.tsx b/frontend/src/scenes/experiments/holdoutsLogic.tsx
index 2b7aa04b0c6e..f897ab0e5d6b 100644
--- a/frontend/src/scenes/experiments/holdoutsLogic.tsx
+++ b/frontend/src/scenes/experiments/holdoutsLogic.tsx
@@ -1,4 +1,4 @@
-import { actions, connect, events, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, connect, events, kea, listeners, path, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
@@ -8,8 +8,6 @@ import { teamLogic } from 'scenes/teamLogic'
import { ExperimentHoldoutType } from '~/types'
-import type { holdoutsLogicType } from './holdoutsLogicType'
-
export const NEW_HOLDOUT: ExperimentHoldoutType = {
id: null,
name: '',
@@ -26,6 +24,113 @@ export const NEW_HOLDOUT: ExperimentHoldoutType = {
updated_at: null,
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface holdoutsLogicValues {
+ currentProjectId: number | string // teamLogic
+ holdout: ExperimentHoldoutType
+ holdouts: ExperimentHoldoutType[]
+ holdoutsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface holdoutsLogicActions {
+ reportExperimentHoldoutCreated: (holdout: ExperimentHoldoutType) => {
+ holdout: ExperimentHoldoutType
+ } // eventUsageLogic
+ createHoldout: () => {
+ value: true
+ }
+ createHoldoutFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ createHoldoutSuccess: (
+ holdouts: ExperimentHoldoutType[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ holdouts: ExperimentHoldoutType[]
+ payload?: {
+ value: true
+ }
+ }
+ deleteHoldout: (id: number | null) => {
+ id: number | null
+ }
+ deleteHoldoutFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deleteHoldoutSuccess: (
+ holdouts: ExperimentHoldoutType[],
+ payload?: {
+ id: number | null
+ }
+ ) => {
+ holdouts: ExperimentHoldoutType[]
+ payload?: {
+ id: number | null
+ }
+ }
+ loadHoldout: (id: number | null) => {
+ id: number | null
+ }
+ loadHoldouts: () => any
+ loadHoldoutsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadHoldoutsSuccess: (
+ holdouts: ExperimentHoldoutType[],
+ payload?: any
+ ) => {
+ holdouts: ExperimentHoldoutType[]
+ payload?: any
+ }
+ setHoldout: (holdout: Partial<ExperimentHoldoutType>) => {
+ holdout: Partial<ExperimentHoldoutType>
+ }
+ updateHoldout: (
+ id: number | null,
+ holdout: Partial<ExperimentHoldoutType>
+ ) => {
+ holdout: Partial<ExperimentHoldoutType>
+ id: number | null
+ }
+ updateHoldoutFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateHoldoutSuccess: (
+ holdouts: ExperimentHoldoutType[],
+ payload?: {
+ holdout: Partial<ExperimentHoldoutType>
+ id: number | null
+ }
+ ) => {
+ holdouts: ExperimentHoldoutType[]
+ payload?: {
+ holdout: Partial<ExperimentHoldoutType>
+ id: number | null
+ }
+ }
+}
+
+export type holdoutsLogicType = MakeLogicType<holdoutsLogicValues, holdoutsLogicActions>
+
export const holdoutsLogic = kea<holdoutsLogicType>([
path(['scenes', 'experiments', 'holdoutsLogic']),
actions({
diff --git a/frontend/src/scenes/experiments/legacy/legacyExperimentLogic.tsx b/frontend/src/scenes/experiments/legacy/legacyExperimentLogic.tsx
index 98bd2fa75b72..cb21d0371e48 100644
--- a/frontend/src/scenes/experiments/legacy/legacyExperimentLogic.tsx
+++ b/frontend/src/scenes/experiments/legacy/legacyExperimentLogic.tsx
@@ -1,4 +1,4 @@
-import { actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
@@ -18,8 +18,8 @@ import {
import { setLatestVersionsOnQuery } from '~/queries/utils'
import { Experiment } from '~/types'
+import type { ExperimentIdType } from '../../../types'
import { modalsLogic } from '../modalsLogic'
-import type { legacyExperimentLogicType } from './legacyExperimentLogicType'
export interface LegacyExperimentLogicProps {
experiment: Experiment
@@ -288,6 +288,134 @@ const loadLegacyMetrics = async ({
return { successfulCount, erroredCount, cachedCount }
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface legacyExperimentLogicValues {
+ currentProjectId: number | string // teamLogic
+ currentTeamId: number | null // teamLogic
+ experiment: Experiment
+ experimentId: ExperimentIdType
+ legacyPrimaryMetricsResults: (
+ | CachedExperimentFunnelsQueryResponse
+ | CachedExperimentTrendsQueryResponse
+ | CachedLegacyExperimentQueryResponse
+ | null
+ )[]
+ legacySecondaryMetricsResults: (
+ | CachedExperimentFunnelsQueryResponse
+ | CachedExperimentTrendsQueryResponse
+ | CachedLegacyExperimentQueryResponse
+ | null
+ )[]
+ primaryMetricsResultsErrors: any[]
+ primaryMetricsResultsLoading: boolean
+ secondaryMetricsResultsErrors: any[]
+ secondaryMetricsResultsLoading: boolean
+ unmodifiedExperiment: Experiment | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface legacyExperimentLogicActions {
+ closeFinishExperimentModal: () => {
+ value: true
+ } // modalsLogic
+ archiveExperiment: (disableFeatureFlag?: boolean) => {
+ disableFeatureFlag: boolean
+ }
+ endExperiment: () => {
+ value: true
+ }
+ endExperimentWithoutShipping: () => {
+ value: true
+ }
+ finishExperiment: ({ selectedVariantKey }: { selectedVariantKey: string }) => {
+ selectedVariantKey: string
+ }
+ loadPrimaryMetricsResults: (
+ refresh?: boolean,
+ refreshId?: string
+ ) => {
+ refresh: boolean | undefined
+ refreshId: string | undefined
+ }
+ loadSecondaryMetricsResults: (
+ refresh?: boolean,
+ refreshId?: string
+ ) => {
+ refresh: boolean | undefined
+ refreshId: string | undefined
+ }
+ refreshExperimentResults: (
+ forceRefresh?: boolean,
+ triggeredBy?: LegacyExperimentTriggeredBy
+ ) => {
+ forceRefresh: boolean | undefined
+ triggeredBy: LegacyExperimentTriggeredBy
+ }
+ restoreUnmodifiedExperiment: () => {
+ value: true
+ }
+ setExperiment: (update: Partial<Experiment>) => {
+ update: Partial<Experiment>
+ }
+ setLegacyPrimaryMetricsResults: (
+ results: (
+ | CachedExperimentFunnelsQueryResponse
+ | CachedExperimentTrendsQueryResponse
+ | CachedLegacyExperimentQueryResponse
+ | null
+ )[]
+ ) => {
+ results: (
+ | CachedExperimentFunnelsQueryResponse
+ | CachedExperimentTrendsQueryResponse
+ | CachedLegacyExperimentQueryResponse
+ | null
+ )[]
+ }
+ setLegacySecondaryMetricsResults: (
+ results: (
+ | CachedExperimentFunnelsQueryResponse
+ | CachedExperimentTrendsQueryResponse
+ | CachedLegacyExperimentQueryResponse
+ | null
+ )[]
+ ) => {
+ results: (
+ | CachedExperimentFunnelsQueryResponse
+ | CachedExperimentTrendsQueryResponse
+ | CachedLegacyExperimentQueryResponse
+ | null
+ )[]
+ }
+ setPrimaryMetricsResultsErrors: (errors: any[]) => {
+ errors: any[]
+ }
+ setPrimaryMetricsResultsLoading: (loading: boolean) => {
+ loading: boolean
+ }
+ setSecondaryMetricsResultsErrors: (errors: any[]) => {
+ errors: any[]
+ }
+ setSecondaryMetricsResultsLoading: (loading: boolean) => {
+ loading: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface legacyExperimentLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ experimentId: (experiment: Experiment) => ExperimentIdType
+ }
+}
+
+export type legacyExperimentLogicType = MakeLogicType<
+ legacyExperimentLogicValues,
+ legacyExperimentLogicActions,
+ LegacyExperimentLogicProps,
+ legacyExperimentLogicMeta
+>
+
/**
* @deprecated Legacy experiment logic for read-only legacy experiments.
*
@@ -415,7 +543,7 @@ export const legacyExperimentLogic = kea<legacyExperimentLogicType>([
],
})),
selectors({
- experimentId: [(s) => [s.experiment], (experiment) => experiment.id],
+ experimentId: [(s) => [s.experiment], (experiment: Experiment) => experiment.id],
}),
listeners(({ values, actions }) => ({
afterMount: () => {
diff --git a/frontend/src/scenes/experiments/legacy/legacyExperimentModalsLogic.ts b/frontend/src/scenes/experiments/legacy/legacyExperimentModalsLogic.ts
index 36fd399191f5..c69a986ccd4b 100644
--- a/frontend/src/scenes/experiments/legacy/legacyExperimentModalsLogic.ts
+++ b/frontend/src/scenes/experiments/legacy/legacyExperimentModalsLogic.ts
@@ -1,7 +1,61 @@
-import { actions, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
import { SharedMetric } from '../SharedMetrics/sharedMetricLogic'
-import type { legacyExperimentModalsLogicType } from './legacyExperimentModalsLogicType'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface legacyExperimentModalsLogicValues {
+ isPrimaryMetricModalOpen: boolean
+ isPrimaryMetricSourceModalOpen: boolean
+ isPrimarySharedMetricModalOpen: boolean
+ isSecondaryMetricModalOpen: boolean
+ isSecondaryMetricSourceModalOpen: boolean
+ isSecondarySharedMetricModalOpen: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface legacyExperimentModalsLogicActions {
+ closePrimaryMetricModal: () => {
+ value: true
+ }
+ closePrimaryMetricSourceModal: () => {
+ value: true
+ }
+ closePrimarySharedMetricModal: () => {
+ value: true
+ }
+ closeSecondaryMetricModal: () => {
+ value: true
+ }
+ closeSecondaryMetricSourceModal: () => {
+ value: true
+ }
+ closeSecondarySharedMetricModal: () => {
+ value: true
+ }
+ openPrimaryMetricModal: (uuid: string) => {
+ uuid: string
+ }
+ openPrimaryMetricSourceModal: () => {
+ value: true
+ }
+ openPrimarySharedMetricModal: (sharedMetricId: SharedMetric['id'] | null) => {
+ sharedMetricId: number | null
+ }
+ openSecondaryMetricModal: (uuid: string) => {
+ uuid: string
+ }
+ openSecondaryMetricSourceModal: () => {
+ value: true
+ }
+ openSecondarySharedMetricModal: (sharedMetricId: SharedMetric['id'] | null) => {
+ sharedMetricId: number | null
+ }
+}
+
+export type legacyExperimentModalsLogicType = MakeLogicType<
+ legacyExperimentModalsLogicValues,
+ legacyExperimentModalsLogicActions
+>
/**
* @deprecated
diff --git a/frontend/src/scenes/experiments/modalsLogic.ts b/frontend/src/scenes/experiments/modalsLogic.ts
index 836bb1f78355..0d9b1975b50d 100644
--- a/frontend/src/scenes/experiments/modalsLogic.ts
+++ b/frontend/src/scenes/experiments/modalsLogic.ts
@@ -1,12 +1,174 @@
-import { actions, connect, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, path, reducers } from 'kea'
import { featureFlagsLogic } from 'scenes/feature-flags/featureFlagsLogic'
import { projectLogic } from 'scenes/projectLogic'
import { teamLogic } from 'scenes/teamLogic'
-import type { modalsLogicType } from './modalsLogicType'
+import type { FeatureFlagType } from '../../types'
import { SharedMetric } from './SharedMetrics/sharedMetricLogic'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface modalsLogicValues {
+ currentProjectId: number | null // projectLogic
+ currentTeamId: number | null // teamLogic
+ isCupedModalOpen: boolean
+ isDescriptionModalOpen: boolean
+ isDistributionModalOpen: boolean
+ isEditConclusionModalOpen: boolean
+ isExperimentCollectionGoalModalOpen: boolean
+ isExposureCriteriaModalOpen: boolean
+ isFinishExperimentModalOpen: boolean
+ isPauseExperimentModalOpen: boolean
+ isPrimaryMetricModalOpen: boolean
+ isPrimaryMetricSourceModalOpen: boolean
+ isPrimaryMetricsReorderModalOpen: boolean
+ isPrimarySharedMetricModalOpen: boolean
+ isReleaseConditionsModalOpen: boolean
+ isResumeExperimentModalOpen: boolean
+ isRunningTimeConfigModalOpen: boolean
+ isSecondaryMetricModalOpen: boolean
+ isSecondaryMetricSourceModalOpen: boolean
+ isSecondaryMetricsReorderModalOpen: boolean
+ isSecondarySharedMetricModalOpen: boolean
+ isStatsEngineModalOpen: boolean
+ isVariantDeltaTimeseriesModalOpen: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface modalsLogicActions {
+ updateFlag: (flag: FeatureFlagType) => {
+ flag: FeatureFlagType
+ } // featureFlagsLogic
+ closeCupedModal: () => {
+ value: true
+ }
+ closeDescriptionModal: () => {
+ value: true
+ }
+ closeDistributionModal: () => {
+ value: true
+ }
+ closeEditConclusionModal: () => {
+ value: true
+ }
+ closeExperimentCollectionGoalModal: () => {
+ value: true
+ }
+ closeExposureCriteriaModal: () => {
+ value: true
+ }
+ closeFinishExperimentModal: () => {
+ value: true
+ }
+ closePauseExperimentModal: () => {
+ value: true
+ }
+ closePrimaryMetricModal: () => {
+ value: true
+ }
+ closePrimaryMetricSourceModal: () => {
+ value: true
+ }
+ closePrimaryMetricsReorderModal: () => {
+ value: true
+ }
+ closePrimarySharedMetricModal: () => {
+ value: true
+ }
+ closeReleaseConditionsModal: () => {
+ value: true
+ }
+ closeResumeExperimentModal: () => {
+ value: true
+ }
+ closeRunningTimeConfigModal: () => {
+ value: true
+ }
+ closeSecondaryMetricModal: () => {
+ value: true
+ }
+ closeSecondaryMetricSourceModal: () => {
+ value: true
+ }
+ closeSecondaryMetricsReorderModal: () => {
+ value: true
+ }
+ closeSecondarySharedMetricModal: () => {
+ value: true
+ }
+ closeStatsEngineModal: () => {
+ value: true
+ }
+ closeVariantDeltaTimeseriesModal: () => {
+ value: true
+ }
+ openCupedModal: () => {
+ value: true
+ }
+ openDescriptionModal: () => {
+ value: true
+ }
+ openDistributionModal: () => {
+ value: true
+ }
+ openEditConclusionModal: () => {
+ value: true
+ }
+ openExperimentCollectionGoalModal: () => {
+ value: true
+ }
+ openExposureCriteriaModal: () => {
+ value: true
+ }
+ openFinishExperimentModal: () => {
+ value: true
+ }
+ openPauseExperimentModal: () => {
+ value: true
+ }
+ openPrimaryMetricModal: (uuid: string) => {
+ uuid: string
+ }
+ openPrimaryMetricSourceModal: () => {
+ value: true
+ }
+ openPrimaryMetricsReorderModal: () => {
+ value: true
+ }
+ openPrimarySharedMetricModal: (sharedMetricId: SharedMetric['id'] | null) => {
+ sharedMetricId: number | null
+ }
+ openReleaseConditionsModal: () => {
+ value: true
+ }
+ openResumeExperimentModal: () => {
+ value: true
+ }
+ openRunningTimeConfigModal: () => {
+ value: true
+ }
+ openSecondaryMetricModal: (uuid: string) => {
+ uuid: string
+ }
+ openSecondaryMetricSourceModal: () => {
+ value: true
+ }
+ openSecondaryMetricsReorderModal: () => {
+ value: true
+ }
+ openSecondarySharedMetricModal: (sharedMetricId: SharedMetric['id'] | null) => {
+ sharedMetricId: number | null
+ }
+ openStatsEngineModal: () => {
+ value: true
+ }
+ openVariantDeltaTimeseriesModal: () => {
+ value: true
+ }
+}
+
+export type modalsLogicType = MakeLogicType<modalsLogicValues, modalsLogicActions>
+
export const modalsLogic = kea<modalsLogicType>([
path(['scenes', 'experiments', 'modalsLogic']),
connect(() => ({
diff --git a/frontend/src/scenes/hog-functions/HogFunctionScene.tsx b/frontend/src/scenes/hog-functions/HogFunctionScene.tsx
index c4fde5684f44..5a55163a0c10 100644
--- a/frontend/src/scenes/hog-functions/HogFunctionScene.tsx
+++ b/frontend/src/scenes/hog-functions/HogFunctionScene.tsx
@@ -1,4 +1,17 @@
-import { BindLogic, actions, connect, kea, key, path, props, reducers, selectors, useActions, useValues } from 'kea'
+import {
+ MakeLogicType,
+ BindLogic,
+ actions,
+ connect,
+ kea,
+ key,
+ path,
+ props,
+ reducers,
+ selectors,
+ useActions,
+ useValues,
+} from 'kea'
import { actionToUrl, router, urlToAction } from 'kea-router'
import { LemonDivider } from '@posthog/lemon-ui'
@@ -35,13 +48,13 @@ import {
HogFunctionTypeType,
} from '~/types'
+import type { HogFunctionConfigurationType } from '../../types'
import { HogFunctionBackfills } from './backfills/HogFunctionBackfills'
import {
HogFunctionConfigurationClearChangesButton,
HogFunctionConfigurationSaveButton,
} from './configuration/components/HogFunctionConfigurationButtons'
import { HogFunctionIconEditable } from './configuration/HogFunctionIcon'
-import type { hogFunctionSceneLogicType } from './HogFunctionSceneType'
import { HogInvocations } from './invocations/HogInvocations'
import { HogFunctionMetrics } from './metrics/HogFunctionMetrics'
import { HogFunctionSkeleton } from './misc/HogFunctionSkeleton'
@@ -66,6 +79,59 @@ const HogFunctionSceneMapping: Partial<Record<HogFunctionTypeType, { scene: Scen
source_webhook: { scene: Scene.Sources, url: urls.sources },
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionSceneLogicValues {
+ configuration: HogFunctionConfigurationType // hogFunctionConfigurationLogic
+ loaded: boolean // hogFunctionConfigurationLogic
+ loading: boolean // hogFunctionConfigurationLogic
+ type: HogFunctionTypeType // hogFunctionConfigurationLogic
+ alertId: string | undefined
+ breadcrumbs: Breadcrumb[]
+ currentTab: HogFunctionSceneTab
+ isSurveyNotification: boolean
+ logicProps: any
+ returnTo: string | undefined
+ supportsBackfills: boolean
+ surveyId: string | undefined
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionSceneLogicActions {
+ setCurrentTab: (tab: HogFunctionSceneTab) => {
+ tab: 'backfills' | 'configuration' | 'history' | 'invocations' | 'logs' | 'metrics' | 'runs' | 'testing'
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionSceneLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ logicProps: (arg: any) => any
+ supportsBackfills: (type: HogFunctionTypeType, configuration: HogFunctionConfigurationType) => boolean
+ alertId: (configuration: HogFunctionConfigurationType) => string | undefined
+ surveyId: (configuration: HogFunctionConfigurationType) => string | undefined
+ isSurveyNotification: (configuration: HogFunctionConfigurationType) => boolean
+ returnTo: (searchParams: Record<string, any>) => string | undefined
+ breadcrumbs: (
+ type: HogFunctionTypeType,
+ loading: boolean,
+ configuration: HogFunctionConfigurationType,
+ alertId: string | undefined,
+ surveyId: string | undefined,
+ isSurveyNotification: boolean,
+ returnTo: string | undefined,
+ arg: any
+ ) => Breadcrumb[]
+ }
+}
+
+export type hogFunctionSceneLogicType = MakeLogicType<
+ hogFunctionSceneLogicValues,
+ hogFunctionSceneLogicActions,
+ HogFunctionConfigurationLogicProps,
+ hogFunctionSceneLogicMeta
+>
+
export const hogFunctionSceneLogic = kea<hogFunctionSceneLogicType>([
props({} as HogFunctionConfigurationLogicProps),
key(({ id, templateId }: HogFunctionConfigurationLogicProps) => id ?? templateId ?? 'new'),
diff --git a/frontend/src/scenes/hog-functions/backfills/hogFunctionBackfillsLogic.tsx b/frontend/src/scenes/hog-functions/backfills/hogFunctionBackfillsLogic.tsx
index 972904d8f89c..1a32ca80d214 100644
--- a/frontend/src/scenes/hog-functions/backfills/hogFunctionBackfillsLogic.tsx
+++ b/frontend/src/scenes/hog-functions/backfills/hogFunctionBackfillsLogic.tsx
@@ -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 { DeepPartial } from 'kea-forms/lib/index'
import { lemonToast } from '@posthog/lemon-ui'
@@ -6,13 +7,55 @@ import api from 'lib/api'
import { HogFunctionConfigurationType } from '~/types'
+import type { HogFunctionType } from '../../../types'
import { hogFunctionConfigurationLogic } from '../configuration/hogFunctionConfigurationLogic'
-import type { hogFunctionBackfillsLogicType } from './hogFunctionBackfillsLogicType'
export interface HogFunctionBackfillsLogicProps {
id: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionBackfillsLogicValues {
+ configuration: HogFunctionConfigurationType // hogFunctionConfigurationLogic
+ hasTriedEnabling: boolean
+ isLoading: boolean
+ isReady: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionBackfillsLogicActions {
+ loadHogFunction: () => any // hogFunctionConfigurationLogic
+ loadHogFunctionSuccess: (
+ hogFunction: HogFunctionType | null,
+ payload?: any
+ ) => {
+ hogFunction: HogFunctionType | null
+ payload?: any
+ } // hogFunctionConfigurationLogic
+ setConfigurationValues: (values: DeepPartial<HogFunctionConfigurationType>) => {
+ values: DeepPartial<HogFunctionConfigurationType>
+ } // hogFunctionConfigurationLogic
+ enableHogFunctionBackfills: () => boolean
+ setLoading: (loading: boolean) => {
+ loading: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionBackfillsLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ isReady: (configuration: HogFunctionConfigurationType, isLoading: boolean) => boolean
+ }
+}
+
+export type hogFunctionBackfillsLogicType = MakeLogicType<
+ hogFunctionBackfillsLogicValues,
+ hogFunctionBackfillsLogicActions,
+ HogFunctionBackfillsLogicProps,
+ hogFunctionBackfillsLogicMeta
+>
+
export const hogFunctionBackfillsLogic = kea<hogFunctionBackfillsLogicType>([
props({} as HogFunctionBackfillsLogicProps),
key(({ id }: HogFunctionBackfillsLogicProps) => id),
diff --git a/frontend/src/scenes/hog-functions/configuration/components/hogFunctionSourceWebhookTestLogic.tsx b/frontend/src/scenes/hog-functions/configuration/components/hogFunctionSourceWebhookTestLogic.tsx
index d968afc727ff..140e331bbc41 100644
--- a/frontend/src/scenes/hog-functions/configuration/components/hogFunctionSourceWebhookTestLogic.tsx
+++ b/frontend/src/scenes/hog-functions/configuration/components/hogFunctionSourceWebhookTestLogic.tsx
@@ -1,11 +1,12 @@
-import { actions, connect, kea, key, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, path, props, reducers, selectors } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { publicWebhooksHostOrigin } from 'lib/utils/apiHost'
import { tryJsonParse } from 'lib/utils/json'
+import type { HogFunctionConfigurationType } from '../../../../types'
import { HogFunctionConfigurationLogicProps, hogFunctionConfigurationLogic } from '../hogFunctionConfigurationLogic'
-import type { hogFunctionSourceWebhookTestLogicType } from './hogFunctionSourceWebhookTestLogicType'
export type HogFunctionSourceWebhookTestForm = {
method: string
@@ -20,6 +21,87 @@ export type HogFunctionSourceWebhookTestResult = {
body: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionSourceWebhookTestLogicValues {
+ configuration: HogFunctionConfigurationType // hogFunctionConfigurationLogic
+ templateId: string | undefined // hogFunctionConfigurationLogic
+ exampleCurlRequest: string
+ expanded: boolean
+ isTestInvocationSubmitting: boolean
+ isTestInvocationValid: boolean
+ showTestInvocationErrors: boolean
+ testInvocation: HogFunctionSourceWebhookTestForm
+ testInvocationAllErrors: Record<string, any>
+ testInvocationChanged: boolean
+ testInvocationErrors: DeepPartialMap<HogFunctionSourceWebhookTestForm, ValidationErrorType>
+ testInvocationHasErrors: boolean
+ testInvocationManualErrors: Record<string, any>
+ testInvocationTouched: boolean
+ testInvocationTouches: Record<string, boolean>
+ testInvocationValidationErrors: DeepPartialMap<HogFunctionSourceWebhookTestForm, ValidationErrorType>
+ testResult: HogFunctionSourceWebhookTestResult | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionSourceWebhookTestLogicActions {
+ resetTestInvocation: (values?: HogFunctionSourceWebhookTestForm) => {
+ values?: HogFunctionSourceWebhookTestForm
+ }
+ setTestInvocationManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setTestInvocationValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setTestInvocationValues: (values: DeepPartial<HogFunctionSourceWebhookTestForm>) => {
+ values: DeepPartial<HogFunctionSourceWebhookTestForm>
+ }
+ setTestResult: (result: HogFunctionSourceWebhookTestResult | null) => {
+ result: HogFunctionSourceWebhookTestResult | null
+ }
+ submitTestInvocation: () => {
+ value: boolean
+ }
+ submitTestInvocationFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitTestInvocationRequest: (testInvocation: HogFunctionSourceWebhookTestForm) => {
+ testInvocation: HogFunctionSourceWebhookTestForm
+ }
+ submitTestInvocationSuccess: (testInvocation: HogFunctionSourceWebhookTestForm) => {
+ testInvocation: HogFunctionSourceWebhookTestForm
+ }
+ toggleExpanded: (expanded?: boolean) => {
+ expanded: boolean | undefined
+ }
+ touchTestInvocationField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionSourceWebhookTestLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ exampleCurlRequest: (testInvocation: HogFunctionSourceWebhookTestForm, arg: any) => string
+ }
+}
+
+export type hogFunctionSourceWebhookTestLogicType = MakeLogicType<
+ hogFunctionSourceWebhookTestLogicValues,
+ hogFunctionSourceWebhookTestLogicActions,
+ HogFunctionConfigurationLogicProps,
+ hogFunctionSourceWebhookTestLogicMeta
+>
+
export const hogFunctionSourceWebhookTestLogic = kea<hogFunctionSourceWebhookTestLogicType>([
props({} as HogFunctionConfigurationLogicProps),
key(({ id, templateId }: HogFunctionConfigurationLogicProps) => {
@@ -96,7 +178,7 @@ export const hogFunctionSourceWebhookTestLogic = kea<hogFunctionSourceWebhookTes
selectors({
exampleCurlRequest: [
(s) => [s.testInvocation, (_, props) => props],
- (testInvocation, props) => {
+ (testInvocation: HogFunctionSourceWebhookTestForm, props) => {
const headersJson = tryJsonParse(testInvocation.headers)
const headers = headersJson
? Object.entries(headersJson)
diff --git a/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigurationLogic.tsx b/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigurationLogic.tsx
index 2167b7d93256..4056f3e69ca6 100644
--- a/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigurationLogic.tsx
+++ b/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigurationLogic.tsx
@@ -1,6 +1,20 @@
import { deepEqual as equal } from 'fast-equals'
-import { actions, afterMount, connect, isBreakpoint, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ connect,
+ isBreakpoint,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ reducers,
+ selectors,
+} from 'kea'
import { DeepPartialMap, ValidationErrorType, forms } from 'kea-forms'
+import type { DeepPartial, FieldName } from 'kea-forms'
import { loaders } from 'kea-loaders'
import { beforeUnload, router, urlToAction } from 'kea-router'
import { CombinedLocation } from 'kea-router/lib/utils'
@@ -67,9 +81,10 @@ import {
SurveyEventProperties,
} from '~/types'
+import type { GroupType, GroupTypeIndex, HogFunctionMappingTemplateType, ProjectType } from '../../../types'
+import type { TeamPublicType, TeamType } from '../../../types'
import { performWideEventsQueryInTwoPhases } from '../sampleEventsQuery'
import { eventToHogFunctionContextId } from '../sub-templates/sub-templates'
-import type { hogFunctionConfigurationLogicType } from './hogFunctionConfigurationLogicType'
export interface HogFunctionConfigurationLogicProps {
logicKey?: string
@@ -302,6 +317,490 @@ export function mightDropEvents(code: string): boolean {
return false
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionConfigurationLogicValues {
+ groupTypes: Map<GroupTypeIndex, GroupType> // groupsModel
+ currentProject: ProjectType | null // projectLogic
+ currentProjectId: number | null // projectLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean // userLogic
+ baseEventsQuery: EventsQuery | null
+ canEditSource: boolean
+ canLoadSampleGlobals: boolean
+ configuration: HogFunctionConfigurationType
+ configurationAllErrors: Record<string, any>
+ configurationChanged: boolean
+ configurationErrors: DeepPartialMap<HogFunctionConfigurationType, ValidationErrorType>
+ configurationHasErrors: boolean
+ configurationManualErrors: Record<string, any>
+ configurationTouched: boolean
+ configurationTouches: Record<string, boolean>
+ configurationValidationErrors: DeepPartialMap<HogFunctionConfigurationType, ValidationErrorType>
+ contextId: HogFunctionConfigurationContextId
+ currentHogCode: string
+ currentInputs: CyclotronJobInputSchemaType[]
+ defaultFormState: HogFunctionConfigurationType | null
+ eventsDataTableNode: DataTableNode | null
+ exampleInvocationGlobals: CyclotronJobInvocationGlobals
+ filtersContainPersonProperties: boolean
+ hasGroupsAddon: boolean
+ hasHadSubmissionErrors: boolean
+ hogFunction: HogFunctionType | null
+ hogFunctionLoading: boolean
+ inputFormErrors: Record<string, string> | null
+ inputFormWarnings: Record<string, string>
+ inputsDiff: {
+ newInputs: CyclotronJobInputSchemaType[]
+ oldInputs: CyclotronJobInputSchemaType[]
+ } | null
+ inputsValidation: CyclotronJobInputsValidationResult
+ isConfigurationSubmitting: boolean
+ isConfigurationValid: boolean
+ isLegacyPlugin: boolean | undefined
+ lastEventQuery: EventsQuery | null
+ lastEventSecondQuery: EventsQuery | null
+ loaded: boolean
+ loading: boolean
+ logicProps: HogFunctionConfigurationLogicProps
+ mappingTemplates: HogFunctionMappingTemplateType[]
+ matchingFilters: PropertyGroupFilter
+ mightDropEvents: boolean
+ newFilters: CyclotronJobFiltersType | null
+ newHogCode: string | null
+ newInputs: CyclotronJobInputSchemaType[] | null
+ oldFilters: CyclotronJobFiltersType | null
+ oldHogCode: string | null
+ oldInputs: CyclotronJobInputSchemaType[] | null
+ sampleGlobals: CyclotronJobInvocationGlobals | null
+ sampleGlobalsError: string | null
+ sampleGlobalsLoading: boolean
+ sampleGlobalsWithInputs: CyclotronJobInvocationGlobalsWithInputs
+ showConfigurationErrors: boolean
+ showEventsList: boolean
+ showExpectedVolume: boolean
+ showFilters: boolean
+ showSource: boolean
+ showTesting: boolean
+ sourceUsesEvents: boolean
+ sparkline: SparklineData | null
+ sparklineLoading: boolean
+ sparklineQuery: TrendsQuery | null
+ survey: Survey | null
+ surveyIdFromFilters: string | null
+ surveyLoading: boolean
+ template: HogFunctionTemplateType | null
+ templateHasChanged: boolean | '' | undefined
+ templateId: string | undefined
+ templateLoading: boolean
+ type: HogFunctionTypeType
+ unsavedConfiguration: {
+ configuration: HogFunctionConfigurationType
+ timestamp: number
+ } | null
+ useMapping: number | true | undefined
+ usesGroups: boolean
+ willChangeEnabledOnSave: boolean
+ willReEnableOnSave: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionConfigurationLogicActions {
+ clearFiltersDiff: () => {
+ value: true
+ }
+ clearHogCodeDiff: () => {
+ value: true
+ }
+ clearInputsDiff: () => {
+ value: true
+ }
+ deleteHogFunction: () => {
+ value: true
+ }
+ duplicate: () => {
+ value: true
+ }
+ duplicateFromTemplate: () => {
+ value: true
+ }
+ loadHogFunction: () => any
+ loadHogFunctionFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadHogFunctionSuccess: (
+ hogFunction: HogFunctionType | null,
+ payload?: any
+ ) => {
+ hogFunction: HogFunctionType | null
+ payload?: any
+ }
+ loadSampleGlobals: (payload?: { eventId?: string }) => {
+ eventId: string | undefined
+ }
+ loadSampleGlobalsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSampleGlobalsSuccess: (
+ sampleGlobals: CyclotronJobInvocationGlobals | null,
+ payload?: {
+ eventId: string | undefined
+ }
+ ) => {
+ sampleGlobals: CyclotronJobInvocationGlobals | null
+ payload?: {
+ eventId: string | undefined
+ }
+ }
+ loadSurvey: () => any
+ loadSurveyFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSurveySuccess: (
+ survey: Survey | null,
+ payload?: any
+ ) => {
+ survey: Survey | null
+ payload?: any
+ }
+ loadTemplate: () => any
+ loadTemplateFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadTemplateSuccess: (
+ template: HogFunctionTemplateType | null,
+ payload?: any
+ ) => {
+ template: HogFunctionTemplateType | null
+ payload?: any
+ }
+ persistForUnload: () => {
+ value: true
+ }
+ reportAIFiltersAccepted: () => {
+ value: true
+ }
+ reportAIFiltersPromptOpen: () => {
+ value: true
+ }
+ reportAIFiltersPrompted: () => {
+ value: true
+ }
+ reportAIFiltersRejected: () => {
+ value: true
+ }
+ reportAIHogFunctionAccepted: () => {
+ value: true
+ }
+ reportAIHogFunctionInputsAccepted: () => {
+ value: true
+ }
+ reportAIHogFunctionInputsPromptOpen: () => {
+ value: true
+ }
+ reportAIHogFunctionInputsPrompted: () => {
+ value: true
+ }
+ reportAIHogFunctionInputsRejected: () => {
+ value: true
+ }
+ reportAIHogFunctionPromptOpen: () => {
+ value: true
+ }
+ reportAIHogFunctionPrompted: () => {
+ value: true
+ }
+ reportAIHogFunctionRejected: () => {
+ value: true
+ }
+ resetConfiguration: (values?: HogFunctionConfigurationType) => {
+ values?: HogFunctionConfigurationType
+ }
+ resetForm: () => {
+ value: true
+ }
+ resetToTemplate: () => {
+ value: true
+ }
+ setConfigurationManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setConfigurationValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setConfigurationValues: (values: DeepPartial<HogFunctionConfigurationType>) => {
+ values: DeepPartial<HogFunctionConfigurationType>
+ }
+ setNewFilters: (newFilters: CyclotronJobFiltersType) => {
+ newFilters: CyclotronJobFiltersType
+ }
+ setNewHogCode: (newHogCode: string) => {
+ newHogCode: string
+ }
+ setNewInputs: (newInputs: CyclotronJobInputSchemaType[]) => {
+ newInputs: CyclotronJobInputSchemaType[]
+ }
+ setOldFilters: (oldFilters: CyclotronJobFiltersType) => {
+ oldFilters: CyclotronJobFiltersType
+ }
+ setOldHogCode: (oldHogCode: string) => {
+ oldHogCode: string
+ }
+ setOldInputs: (oldInputs: CyclotronJobInputSchemaType[]) => {
+ oldInputs: CyclotronJobInputSchemaType[]
+ }
+ setSampleGlobals: (sampleGlobals: CyclotronJobInvocationGlobals | null) => {
+ sampleGlobals: CyclotronJobInvocationGlobals | null
+ }
+ setSampleGlobalsError: (error: any) => {
+ error: any
+ }
+ setShowEventsList: (showEventsList: boolean) => {
+ showEventsList: boolean
+ }
+ setShowSource: (showSource: boolean) => {
+ showSource: boolean
+ }
+ setUnsavedConfiguration: (configuration: HogFunctionConfigurationType | null) => {
+ configuration: HogFunctionConfigurationType | null
+ }
+ sparklineQueryChanged: (sparklineQuery: TrendsQuery) => {
+ sparklineQuery: TrendsQuery
+ }
+ sparklineQueryChangedFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ sparklineQueryChangedSuccess: (
+ sparkline:
+ | {
+ count: any
+ data: {
+ color: string
+ name: string
+ values: number[]
+ }[]
+ labels: any
+ warning: string | undefined
+ }
+ | {
+ count: any
+ data: {
+ color: string
+ name: string
+ values: number[]
+ }[]
+ labels: any
+ warning?: undefined
+ }
+ | null,
+ payload?: {
+ sparklineQuery: TrendsQuery
+ }
+ ) => {
+ sparkline:
+ | {
+ count: any
+ data: {
+ color: string
+ name: string
+ values: number[]
+ }[]
+ labels: any
+ warning: string | undefined
+ }
+ | {
+ count: any
+ data: {
+ color: string
+ name: string
+ values: number[]
+ }[]
+ labels: any
+ warning?: undefined
+ }
+ | null
+ payload?: {
+ sparklineQuery: TrendsQuery
+ }
+ }
+ submitConfiguration: () => {
+ value: boolean
+ }
+ submitConfigurationFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitConfigurationRequest: (configuration: HogFunctionConfigurationType) => {
+ configuration: HogFunctionConfigurationType
+ }
+ submitConfigurationSuccess: (configuration: HogFunctionConfigurationType) => {
+ configuration: HogFunctionConfigurationType
+ }
+ touchConfigurationField: (key: string) => {
+ key: string
+ }
+ upsertHogFunction: (configuration: HogFunctionConfigurationType) => {
+ configuration: HogFunctionConfigurationType
+ }
+ upsertHogFunctionFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ upsertHogFunctionSuccess: (
+ hogFunction: HogFunctionType,
+ payload?: {
+ configuration: HogFunctionConfigurationType
+ }
+ ) => {
+ hogFunction: HogFunctionType
+ payload?: {
+ configuration: HogFunctionConfigurationType
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionConfigurationLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ logicProps: (arg: any) => HogFunctionConfigurationLogicProps
+ surveyIdFromFilters: (configuration: HogFunctionConfigurationType) => string | null
+ type: (configuration: HogFunctionConfigurationType, hogFunction: HogFunctionType | null) => HogFunctionTypeType
+ hasGroupsAddon: (
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean
+ ) => boolean
+ useMapping: (
+ hogFunction: HogFunctionType | null,
+ template: HogFunctionTemplateType | null
+ ) => number | true | undefined
+ defaultFormState: (
+ template: HogFunctionTemplateType | null,
+ hogFunction: HogFunctionType | null
+ ) => HogFunctionConfigurationType | null
+ templateId: (
+ template: HogFunctionTemplateType | null,
+ hogFunction: HogFunctionType | null
+ ) => string | undefined
+ loading: (hogFunctionLoading: boolean, templateLoading: boolean) => boolean
+ loaded: (hogFunction: HogFunctionType | null, template: HogFunctionTemplateType | null) => boolean
+ contextId: (configuration: HogFunctionConfigurationType) => HogFunctionConfigurationContextId
+ inputsValidation: (configuration: HogFunctionConfigurationType) => CyclotronJobInputsValidationResult
+ inputFormErrors: (inputsValidation: CyclotronJobInputsValidationResult) => Record<string, string> | null
+ inputFormWarnings: (inputsValidation: CyclotronJobInputsValidationResult) => Record<string, string>
+ willReEnableOnSave: (
+ configuration: HogFunctionConfigurationType,
+ hogFunction: HogFunctionType | null
+ ) => boolean
+ willChangeEnabledOnSave: (
+ configuration: HogFunctionConfigurationType,
+ hogFunction: HogFunctionType | null
+ ) => boolean
+ exampleInvocationGlobals: (
+ configuration: HogFunctionConfigurationType,
+ currentProject: ProjectType | null,
+ groupTypes: Map<GroupTypeIndex, GroupType>,
+ contextId: HogFunctionConfigurationContextId,
+ survey: Survey | null
+ ) => CyclotronJobInvocationGlobals
+ sampleGlobalsWithInputs: (
+ sampleGlobals: CyclotronJobInvocationGlobals | null,
+ exampleInvocationGlobals: CyclotronJobInvocationGlobals,
+ configuration: HogFunctionConfigurationType
+ ) => CyclotronJobInvocationGlobalsWithInputs
+ matchingFilters: (
+ configuration: HogFunctionConfigurationType,
+ useMapping: number | true | undefined
+ ) => PropertyGroupFilter
+ filtersContainPersonProperties: (configuration: HogFunctionConfigurationType) => boolean
+ sourceUsesEvents: (configuration: HogFunctionConfigurationType, type: HogFunctionTypeType) => boolean
+ sparklineQuery: (
+ configuration: HogFunctionConfigurationType,
+ matchingFilters: PropertyGroupFilter,
+ sourceUsesEvents: boolean
+ ) => TrendsQuery | null
+ baseEventsQuery: (
+ configuration: HogFunctionConfigurationType,
+ matchingFilters: PropertyGroupFilter,
+ groupTypes: Map<GroupTypeIndex, GroupType>,
+ sourceUsesEvents: boolean
+ ) => EventsQuery | null
+ eventsDataTableNode: (baseEventsQuery: EventsQuery | null) => DataTableNode | null
+ lastEventQuery: (baseEventsQuery: EventsQuery | null) => EventsQuery | null
+ lastEventSecondQuery: (lastEventQuery: EventsQuery | null) => EventsQuery | null
+ templateHasChanged: (
+ hogFunction: HogFunctionType | null,
+ configuration: HogFunctionConfigurationType
+ ) => boolean | '' | undefined
+ mappingTemplates: (
+ hogFunction: HogFunctionType | null,
+ template: HogFunctionTemplateType | null
+ ) => HogFunctionMappingTemplateType[]
+ usesGroups: (configuration: HogFunctionConfigurationType) => boolean
+ mightDropEvents: (configuration: HogFunctionConfigurationType, type: HogFunctionTypeType) => boolean
+ currentHogCode: (newHogCode: string | null, configuration: HogFunctionConfigurationType) => string
+ currentInputs: (
+ newInputs: CyclotronJobInputSchemaType[] | null,
+ configuration: HogFunctionConfigurationType
+ ) => CyclotronJobInputSchemaType[]
+ inputsDiff: (
+ oldInputs: CyclotronJobInputSchemaType[] | null,
+ newInputs: CyclotronJobInputSchemaType[] | null
+ ) => {
+ newInputs: CyclotronJobInputSchemaType[]
+ oldInputs: CyclotronJobInputSchemaType[]
+ } | null
+ canLoadSampleGlobals: (lastEventQuery: EventsQuery | null) => boolean
+ showFilters: (type: HogFunctionTypeType) => boolean
+ showExpectedVolume: (type: HogFunctionTypeType, sourceUsesEvents: boolean) => boolean
+ canEditSource: (
+ type: HogFunctionTypeType,
+ template: HogFunctionTemplateType | null,
+ hogFunction: HogFunctionType | null
+ ) => boolean
+ showTesting: (type: HogFunctionTypeType) => boolean
+ isLegacyPlugin: (
+ template: HogFunctionTemplateType | null,
+ hogFunction: HogFunctionType | null
+ ) => boolean | undefined
+ }
+}
+
+export type hogFunctionConfigurationLogicType = MakeLogicType<
+ hogFunctionConfigurationLogicValues,
+ hogFunctionConfigurationLogicActions,
+ HogFunctionConfigurationLogicProps,
+ hogFunctionConfigurationLogicMeta
+>
+
export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicType>([
path((id) => ['scenes', 'pipeline', 'hogFunctionConfigurationLogic', id]),
props({} as HogFunctionConfigurationLogicProps),
@@ -753,7 +1252,7 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
logicProps: [() => [(_, props) => props], (props: HogFunctionConfigurationLogicProps) => props],
surveyIdFromFilters: [
(s) => [s.configuration],
- (configuration): string | null => {
+ (configuration: HogFunctionConfigurationType): string | null => {
for (const event of configuration?.filters?.events ?? []) {
const prop = (event.properties as AnyPropertyFilter[] | undefined)?.find(
(p) => p.key === SurveyEventProperties.SURVEY_ID && 'value' in p && p.value
@@ -767,22 +1266,27 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
],
type: [
(s) => [s.configuration, s.hogFunction],
- (configuration, hogFunction) => configuration?.type ?? hogFunction?.type ?? 'loading',
+ (configuration: HogFunctionConfigurationType, hogFunction: HogFunctionType | null) =>
+ configuration?.type ?? hogFunction?.type ?? 'loading',
],
hasGroupsAddon: [
(s) => [s.hasAvailableFeature],
- (hasAvailableFeature) => {
+ (hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean) => {
return hasAvailableFeature(AvailableFeature.GROUP_ANALYTICS)
},
],
useMapping: [
(s) => [s.hogFunction, s.template],
// If the function has mappings, or the template has mapping templates, we use mappings
- (hogFunction, template) => Array.isArray(hogFunction?.mappings) || template?.mapping_templates?.length,
+ (hogFunction: HogFunctionType | null, template: HogFunctionTemplateType | null) =>
+ Array.isArray(hogFunction?.mappings) || template?.mapping_templates?.length,
],
defaultFormState: [
(s) => [s.template, s.hogFunction],
- (template, hogFunction): HogFunctionConfigurationType | null => {
+ (
+ template: HogFunctionTemplateType | null,
+ hogFunction: HogFunctionType | null
+ ): HogFunctionConfigurationType | null => {
if (template) {
return templateToConfiguration(template)
}
@@ -792,39 +1296,44 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
templateId: [
(s) => [s.template, s.hogFunction],
- (template, hogFunction) => template?.id || hogFunction?.template?.id,
+ (template: HogFunctionTemplateType | null, hogFunction: HogFunctionType | null) =>
+ template?.id || hogFunction?.template?.id,
],
loading: [
(s) => [s.hogFunctionLoading, s.templateLoading],
- (hogFunctionLoading, templateLoading) => hogFunctionLoading || templateLoading,
+ (hogFunctionLoading: boolean, templateLoading: boolean) => hogFunctionLoading || templateLoading,
+ ],
+ loaded: [
+ (s) => [s.hogFunction, s.template],
+ (hogFunction: HogFunctionType | null, template: HogFunctionTemplateType | null) =>
+ !!hogFunction || !!template,
],
- loaded: [(s) => [s.hogFunction, s.template], (hogFunction, template) => !!hogFunction || !!template],
contextId: [
(s) => [s.configuration],
- (configuration): HogFunctionConfigurationContextId => {
+ (configuration: HogFunctionConfigurationType): HogFunctionConfigurationContextId => {
return eventToHogFunctionContextId(configuration.filters?.events?.[0]?.id)
},
],
inputsValidation: [
(s) => [s.configuration],
- (configuration): CyclotronJobInputsValidationResult =>
+ (configuration: HogFunctionConfigurationType): CyclotronJobInputsValidationResult =>
CyclotronJobInputsValidation.validate(configuration.inputs ?? {}, configuration.inputs_schema ?? []),
],
inputFormErrors: [
(s) => [s.inputsValidation],
- (inputsValidation): Record<string, string> | null =>
+ (inputsValidation: CyclotronJobInputsValidationResult): Record<string, string> | null =>
inputsValidation.valid ? null : inputsValidation.errors,
],
inputFormWarnings: [
(s) => [s.inputsValidation],
- (inputsValidation): Record<string, string> => inputsValidation.warnings,
+ (inputsValidation: CyclotronJobInputsValidationResult): Record<string, string> => inputsValidation.warnings,
],
willReEnableOnSave: [
(s) => [s.configuration, s.hogFunction],
- (configuration, hogFunction) => {
+ (configuration: HogFunctionConfigurationType, hogFunction: HogFunctionType | null) => {
const hogState = hogFunction?.status?.state ?? 0
return configuration?.enabled && hogState === HogWatcherState.disabled
},
@@ -832,13 +1341,19 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
willChangeEnabledOnSave: [
(s) => [s.configuration, s.hogFunction],
- (configuration, hogFunction) => {
+ (configuration: HogFunctionConfigurationType, hogFunction: HogFunctionType | null) => {
return configuration?.enabled !== (hogFunction?.enabled ?? false)
},
],
exampleInvocationGlobals: [
(s) => [s.configuration, s.currentProject, s.groupTypes, s.contextId, s.survey],
- (configuration, currentProject, groupTypes, contextId, survey): CyclotronJobInvocationGlobals => {
+ (
+ configuration: HogFunctionConfigurationType,
+ currentProject: null | import('~/types').ProjectType,
+ groupTypes: Map<import('~/types').GroupTypeIndex, import('~/types').GroupType>,
+ contextId: HogFunctionConfigurationContextId,
+ survey: Survey | null
+ ): CyclotronJobInvocationGlobals => {
const currentUrl = window.location.href.split('#')[0]
const eventId = uuid()
const personId = uuid()
@@ -955,7 +1470,11 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
],
sampleGlobalsWithInputs: [
(s) => [s.sampleGlobals, s.exampleInvocationGlobals, s.configuration],
- (sampleGlobals, exampleInvocationGlobals, configuration): CyclotronJobInvocationGlobalsWithInputs => {
+ (
+ sampleGlobals: CyclotronJobInvocationGlobals | null,
+ exampleInvocationGlobals: CyclotronJobInvocationGlobals,
+ configuration: HogFunctionConfigurationType
+ ): CyclotronJobInvocationGlobalsWithInputs => {
const inputs: Record<string, any> = {}
for (const input of configuration?.inputs_schema || []) {
inputs[input.key] = input.type
@@ -994,7 +1513,10 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
],
matchingFilters: [
(s) => [s.configuration, s.useMapping],
- (configuration, useMapping): PropertyGroupFilter => {
+ (
+ configuration: HogFunctionConfigurationType,
+ useMapping: number | true | undefined
+ ): PropertyGroupFilter => {
// We're using mappings, but none are provided, so match zero events.
if (useMapping && !configuration.mappings?.length) {
return {
@@ -1084,7 +1606,7 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
filtersContainPersonProperties: [
(s) => [s.configuration],
- (configuration) => {
+ (configuration: HogFunctionConfigurationType) => {
const filters = configuration.filters
let containsPersonProperties = false
if (filters?.properties && !containsPersonProperties) {
@@ -1106,14 +1628,18 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
sourceUsesEvents: [
(s) => [s.configuration, s.type],
- (configuration, type) => {
+ (configuration: HogFunctionConfigurationType, type: HogFunctionTypeType) => {
return TYPES_WITH_REAL_EVENTS.includes(type) && (configuration.filters?.source ?? 'events') === 'events'
},
],
sparklineQuery: [
(s) => [s.configuration, s.matchingFilters, s.sourceUsesEvents],
- (configuration, matchingFilters, sourceUsesEvents): TrendsQuery | null => {
+ (
+ configuration: HogFunctionConfigurationType,
+ matchingFilters: PropertyGroupFilter,
+ sourceUsesEvents: boolean
+ ): TrendsQuery | null => {
if (!sourceUsesEvents) {
return null
}
@@ -1146,7 +1672,12 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
baseEventsQuery: [
(s) => [s.configuration, s.matchingFilters, s.groupTypes, s.sourceUsesEvents],
- (configuration, matchingFilters, groupTypes, sourceUsesEvents): EventsQuery | null => {
+ (
+ configuration: HogFunctionConfigurationType,
+ matchingFilters: PropertyGroupFilter,
+ groupTypes: Map<import('~/types').GroupTypeIndex, import('~/types').GroupType>,
+ sourceUsesEvents: boolean
+ ): EventsQuery | null => {
if (!sourceUsesEvents) {
return null
}
@@ -1175,7 +1706,7 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
eventsDataTableNode: [
(s) => [s.baseEventsQuery],
- (baseEventsQuery): DataTableNode | null => {
+ (baseEventsQuery: EventsQuery | null): DataTableNode | null => {
return baseEventsQuery
? setLatestVersionsOnQuery(
{
@@ -1193,29 +1724,31 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
lastEventQuery: [
(s) => [s.baseEventsQuery],
- (baseEventsQuery): EventsQuery | null => {
+ (baseEventsQuery: EventsQuery | null): EventsQuery | null => {
return baseEventsQuery ? { ...baseEventsQuery, limit: 1 } : null
},
{ resultEqualityCheck: equal },
],
lastEventSecondQuery: [
(s) => [s.lastEventQuery],
- (lastEventQuery): EventsQuery | null => (lastEventQuery ? { ...lastEventQuery, after: '-30d' } : null),
+ (lastEventQuery: EventsQuery | null): EventsQuery | null =>
+ lastEventQuery ? { ...lastEventQuery, after: '-30d' } : null,
],
templateHasChanged: [
(s) => [s.hogFunction, s.configuration],
- (hogFunction, configuration) => {
+ (hogFunction: HogFunctionType | null, configuration: HogFunctionConfigurationType) => {
return hogFunction?.template?.code && hogFunction.template.code !== configuration.hog
},
],
mappingTemplates: [
(s) => [s.hogFunction, s.template],
- (hogFunction, template) => template?.mapping_templates ?? hogFunction?.template?.mapping_templates ?? [],
+ (hogFunction: HogFunctionType | null, template: HogFunctionTemplateType | null) =>
+ template?.mapping_templates ?? hogFunction?.template?.mapping_templates ?? [],
],
usesGroups: [
(s) => [s.configuration],
- (configuration) => {
+ (configuration: HogFunctionConfigurationType) => {
// NOTE: Bit hacky but works good enough...
const configStr = JSON.stringify(configuration)
return configStr.includes('groups.') || configStr.includes('{groups}')
@@ -1223,7 +1756,7 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
],
mightDropEvents: [
(s) => [s.configuration, s.type],
- (configuration, type) => {
+ (configuration: HogFunctionConfigurationType, type: HogFunctionTypeType) => {
if (type !== 'transformation') {
return false
}
@@ -1259,28 +1792,32 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
canLoadSampleGlobals: [
(s) => [s.lastEventQuery],
- (lastEventQuery) => {
+ (lastEventQuery: EventsQuery | null) => {
return !!lastEventQuery
},
],
showFilters: [
(s) => [s.type],
- (type) => {
+ (type: HogFunctionTypeType) => {
return ['destination', 'internal_destination', 'site_destination', 'transformation'].includes(type)
},
],
showExpectedVolume: [
(s) => [s.type, s.sourceUsesEvents],
- (type, sourceUsesEvents) => {
+ (type: HogFunctionTypeType, sourceUsesEvents: boolean) => {
return sourceUsesEvents && ['destination', 'site_destination', 'transformation'].includes(type)
},
],
canEditSource: [
(s) => [s.type, s.template, s.hogFunction],
- (type, template, hogFunction) => {
+ (
+ type: HogFunctionTypeType,
+ template: HogFunctionTemplateType | null,
+ hogFunction: HogFunctionType | null
+ ) => {
const codeLanguage = template?.code_language || hogFunction?.template?.code_language
if (type === 'site_app' || type === 'site_destination') {
@@ -1298,14 +1835,14 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
showTesting: [
(s) => [s.type],
- (type) => {
+ (type: HogFunctionTypeType) => {
return ['destination', 'internal_destination', 'transformation'].includes(type)
},
],
isLegacyPlugin: [
(s) => [s.template, s.hogFunction],
- (template, hogFunction) => {
+ (template: HogFunctionTemplateType | null, hogFunction: HogFunctionType | null) => {
return (template?.id || hogFunction?.template?.id)?.startsWith('plugin-')
},
],
diff --git a/frontend/src/scenes/hog-functions/configuration/hogFunctionIconLogic.ts b/frontend/src/scenes/hog-functions/configuration/hogFunctionIconLogic.ts
index 9121f2b304df..8e88d3f4aedd 100644
--- a/frontend/src/scenes/hog-functions/configuration/hogFunctionIconLogic.ts
+++ b/frontend/src/scenes/hog-functions/configuration/hogFunctionIconLogic.ts
@@ -1,18 +1,75 @@
-import { actions, kea, key, listeners, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, kea, key, listeners, path, props, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
import { HogFunctionIconResponse } from '~/types'
-import type { hogFunctionIconLogicType } from './hogFunctionIconLogicType'
-
export interface HogFunctionIconLogicProps {
logicKey: string
src?: string
onChange?: (src: string) => void
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionIconLogicValues {
+ possibleIcons: HogFunctionIconResponse[] | null
+ possibleIconsLoading: boolean
+ searchTerm: string | null
+ showPopover: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionIconLogicActions {
+ loadPossibleIcons: () => {
+ value: true
+ }
+ loadPossibleIconsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPossibleIconsSuccess: (
+ possibleIcons: {
+ id: string
+ name: string
+ url: string
+ }[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ possibleIcons: {
+ id: string
+ name: string
+ url: string
+ }[]
+ payload?: {
+ value: true
+ }
+ }
+ setSearchTerm: (search: string) => {
+ search: string
+ }
+ setShowPopover: (show: boolean) => {
+ show: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionIconLogicMeta {
+ key: string
+}
+
+export type hogFunctionIconLogicType = MakeLogicType<
+ hogFunctionIconLogicValues,
+ hogFunctionIconLogicActions,
+ HogFunctionIconLogicProps,
+ hogFunctionIconLogicMeta
+>
+
export const hogFunctionIconLogic = kea<hogFunctionIconLogicType>([
props({} as HogFunctionIconLogicProps),
key((props) => props.logicKey ?? 'default'),
diff --git a/frontend/src/scenes/hog-functions/configuration/hogFunctionTestLogic.tsx b/frontend/src/scenes/hog-functions/configuration/hogFunctionTestLogic.tsx
index 3ddf59c89ad4..9a44f22baf5b 100644
--- a/frontend/src/scenes/hog-functions/configuration/hogFunctionTestLogic.tsx
+++ b/frontend/src/scenes/hog-functions/configuration/hogFunctionTestLogic.tsx
@@ -1,5 +1,6 @@
-import { actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import type { editor } from 'monaco-editor'
import { lemonToast } from '@posthog/lemon-ui'
@@ -11,12 +12,12 @@ import { tryJsonParse } from 'lib/utils/json'
import { groupsModel } from '~/models/groupsModel'
import { CyclotronJobInvocationGlobals, CyclotronJobTestInvocationResult } from '~/types'
+import type { GroupType, GroupTypeIndex, HogFunctionConfigurationType, HogFunctionTypeType } from '../../../types'
import {
HogFunctionConfigurationLogicProps,
hogFunctionConfigurationLogic,
sanitizeConfiguration,
} from './hogFunctionConfigurationLogic'
-import type { hogFunctionTestLogicType } from './hogFunctionTestLogicType'
export type HogFunctionTestInvocationForm = {
globals: string // CyclotronJobInvocationGlobals
@@ -65,6 +66,171 @@ export interface CodeEditorValidation {
decorations: string[]
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionTestLogicValues {
+ groupTypes: Map<GroupTypeIndex, GroupType> // groupsModel
+ configuration: HogFunctionConfigurationType // hogFunctionConfigurationLogic
+ configurationHasErrors: boolean // hogFunctionConfigurationLogic
+ currentHogCode: string // hogFunctionConfigurationLogic
+ exampleInvocationGlobals: CyclotronJobInvocationGlobals // hogFunctionConfigurationLogic
+ sampleGlobals: CyclotronJobInvocationGlobals | null // hogFunctionConfigurationLogic
+ sampleGlobalsError: string | null // hogFunctionConfigurationLogic
+ sampleGlobalsLoading: boolean // hogFunctionConfigurationLogic
+ templateId: string | undefined // hogFunctionConfigurationLogic
+ type: HogFunctionTypeType // hogFunctionConfigurationLogic
+ currentDecorationIds: string[]
+ expanded: boolean
+ fetchCancelled: boolean
+ isTestInvocationSubmitting: boolean
+ isTestInvocationValid: boolean
+ jsonError: string | null
+ sampleGlobalsLoadingAndNotCancelled: boolean
+ savedGlobals: {
+ globals: CyclotronJobInvocationGlobals
+ name: string
+ }[]
+ showTestInvocationErrors: boolean
+ sortedTestsResult: {
+ hasDiff: boolean
+ input: string
+ output: string
+ } | null
+ testInvocation: HogFunctionTestInvocationForm
+ testInvocationAllErrors: Record<string, any>
+ testInvocationChanged: boolean
+ testInvocationErrors: DeepPartialMap<HogFunctionTestInvocationForm, ValidationErrorType>
+ testInvocationHasErrors: boolean
+ testInvocationManualErrors: Record<string, any>
+ testInvocationTouched: boolean
+ testInvocationTouches: Record<string, boolean>
+ testInvocationValidationErrors: DeepPartialMap<HogFunctionTestInvocationForm, ValidationErrorType>
+ testResult: CyclotronJobTestInvocationResult | null
+ testResultMode: 'diff' | 'raw'
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionTestLogicActions {
+ loadSampleGlobals: (
+ payload?:
+ | {
+ eventId?: string
+ }
+ | undefined
+ ) => {
+ eventId: string | undefined
+ } // hogFunctionConfigurationLogic
+ loadSampleGlobalsSuccess: (
+ sampleGlobals: CyclotronJobInvocationGlobals | null,
+ payload?:
+ | {
+ eventId: string | undefined
+ }
+ | undefined
+ ) => {
+ payload?: {
+ eventId: string | undefined
+ }
+ sampleGlobals: CyclotronJobInvocationGlobals | null
+ } // hogFunctionConfigurationLogic
+ setSampleGlobals: (sampleGlobals: CyclotronJobInvocationGlobals | null) => {
+ sampleGlobals: CyclotronJobInvocationGlobals | null
+ } // hogFunctionConfigurationLogic
+ touchConfigurationField: (key: string) => {
+ key: string
+ } // hogFunctionConfigurationLogic
+ cancelSampleGlobalsLoading: () => {
+ value: true
+ }
+ deleteSavedGlobals: (index: number) => {
+ index: number
+ }
+ receiveExampleGlobals: (globals: CyclotronJobInvocationGlobals | null) => {
+ globals: CyclotronJobInvocationGlobals | null
+ }
+ resetTestInvocation: (values?: HogFunctionTestInvocationForm) => {
+ values?: HogFunctionTestInvocationForm
+ }
+ saveGlobals: (
+ name: string,
+ globals: CyclotronJobInvocationGlobals
+ ) => {
+ globals: CyclotronJobInvocationGlobals
+ name: string
+ }
+ setDecorationIds: (decorationIds: string[]) => {
+ decorationIds: string[]
+ }
+ setJsonError: (error: string | null) => {
+ error: string | null
+ }
+ setTestInvocationManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setTestInvocationValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setTestInvocationValues: (values: DeepPartial<HogFunctionTestInvocationForm>) => {
+ values: DeepPartial<HogFunctionTestInvocationForm>
+ }
+ setTestResult: (result: CyclotronJobTestInvocationResult | null) => {
+ result: CyclotronJobTestInvocationResult | null
+ }
+ setTestResultMode: (mode: 'diff' | 'raw') => {
+ mode: 'diff' | 'raw'
+ }
+ submitTestInvocation: () => {
+ value: boolean
+ }
+ submitTestInvocationFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitTestInvocationRequest: (testInvocation: HogFunctionTestInvocationForm) => {
+ testInvocation: HogFunctionTestInvocationForm
+ }
+ submitTestInvocationSuccess: (testInvocation: HogFunctionTestInvocationForm) => {
+ testInvocation: HogFunctionTestInvocationForm
+ }
+ toggleExpanded: (expanded?: boolean) => {
+ expanded: boolean | undefined
+ }
+ touchTestInvocationField: (key: string) => {
+ key: string
+ }
+ validateJson: (value: string, editor: editor.IStandaloneCodeEditor, decorations: string[]) => CodeEditorValidation
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionTestLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ sortedTestsResult: (
+ configuration: HogFunctionConfigurationType,
+ testResult: CyclotronJobTestInvocationResult | null,
+ testInvocation: HogFunctionTestInvocationForm
+ ) => {
+ hasDiff: boolean
+ input: string
+ output: string
+ } | null
+ sampleGlobalsLoadingAndNotCancelled: (sampleGlobalsLoading: boolean, fetchCancelled: boolean) => boolean
+ }
+}
+
+export type hogFunctionTestLogicType = MakeLogicType<
+ hogFunctionTestLogicValues,
+ hogFunctionTestLogicActions,
+ HogFunctionConfigurationLogicProps,
+ hogFunctionTestLogicMeta
+>
+
export const hogFunctionTestLogic = kea<hogFunctionTestLogicType>([
props({} as HogFunctionConfigurationLogicProps),
key(({ id, templateId }: HogFunctionConfigurationLogicProps) => {
@@ -359,9 +525,9 @@ export const hogFunctionTestLogic = kea<hogFunctionTestLogicType>([
sortedTestsResult: [
(s) => [s.configuration, s.testResult, s.testInvocation],
(
- configuration,
- testResult,
- testInvocation
+ configuration: import('~/types').HogFunctionConfigurationType,
+ testResult: CyclotronJobTestInvocationResult | null,
+ testInvocation: HogFunctionTestInvocationForm
): {
input: string
output: string
@@ -388,7 +554,7 @@ export const hogFunctionTestLogic = kea<hogFunctionTestLogicType>([
sampleGlobalsLoadingAndNotCancelled: [
(s) => [s.sampleGlobalsLoading, s.fetchCancelled],
- (sampleGlobalsLoading, fetchCancelled) => sampleGlobalsLoading && !fetchCancelled,
+ (sampleGlobalsLoading: boolean, fetchCancelled: boolean) => sampleGlobalsLoading && !fetchCancelled,
],
})),
diff --git a/frontend/src/scenes/hog-functions/email-templater/emailTemplaterLogic.tsx b/frontend/src/scenes/hog-functions/email-templater/emailTemplaterLogic.tsx
index 57e5293045de..7a61459dbfcf 100644
--- a/frontend/src/scenes/hog-functions/email-templater/emailTemplaterLogic.tsx
+++ b/frontend/src/scenes/hog-functions/email-templater/emailTemplaterLogic.tsx
@@ -1,5 +1,18 @@
-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 { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { loaders } from 'kea-loaders'
import { Editor, EmailEditorProps, EditorRef as _EditorRef } from 'react-email-editor'
@@ -14,7 +27,6 @@ import { PreflightStatus, PropertyDefinition, PropertyDefinitionType, Realm } fr
import { MessageTemplate } from 'products/workflows/frontend/TemplateLibrary/types'
-import type { emailTemplaterLogicType } from './emailTemplaterLogicType'
import type { EmailTemplate } from './types'
export type { EmailTemplate }
@@ -116,6 +128,164 @@ function autoRevealAdvancedFields(
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface emailTemplaterLogicValues {
+ preflight: PreflightStatus | null // preflightLogic
+ activeContentTab: 'plaintext' | 'visual'
+ appliedTemplate: MessageTemplate | null
+ emailEditorRef: EditorRef | null
+ emailTemplate: EmailTemplate
+ emailTemplateAllErrors: Record<string, any>
+ emailTemplateChanged: boolean
+ emailTemplateErrors: DeepPartialMap<EmailTemplate, ValidationErrorType>
+ emailTemplateHasErrors: boolean
+ emailTemplateManualErrors: Record<string, any>
+ emailTemplateTouched: boolean
+ emailTemplateTouches: Record<string, boolean>
+ emailTemplateValidationErrors: DeepPartialMap<EmailTemplate, ValidationErrorType>
+ hiddenAdvancedFields: EmailMetaField[]
+ isEmailEditorReady: boolean
+ isEmailTemplateSubmitting: boolean
+ isEmailTemplateValid: boolean
+ isModalOpen: boolean
+ isSaveTemplateModalOpen: boolean
+ logicProps: EmailTemplaterLogicProps
+ mergeTags: UnlayerMergeTags
+ personPropertyDefinitions: PropertyDefinition[]
+ personPropertyDefinitionsLoading: boolean
+ revealedAdvancedFields: EmailMetaFieldKey[]
+ showEmailTemplateErrors: boolean
+ templates: MessageTemplate[]
+ templatesLoading: boolean
+ templatingEngine: 'hog' | 'liquid'
+ unlayerEditorProjectId: 275430 | undefined
+ visibleFields: EmailMetaField[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface emailTemplaterLogicActions {
+ applyTemplate: (template: MessageTemplate) => {
+ template: MessageTemplate
+ }
+ closeWithConfirmation: () => {
+ value: true
+ }
+ hideAdvancedField: (key: EmailMetaFieldKey) => {
+ key: EmailMetaFieldKey
+ }
+ loadPersonPropertyDefinitions: () => any
+ loadPersonPropertyDefinitionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPersonPropertyDefinitionsSuccess: (
+ personPropertyDefinitions: PropertyDefinition[],
+ payload?: any
+ ) => {
+ personPropertyDefinitions: PropertyDefinition[]
+ payload?: any
+ }
+ loadTemplates: () => any
+ loadTemplatesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadTemplatesSuccess: (
+ templates: MessageTemplate[],
+ payload?: any
+ ) => {
+ templates: MessageTemplate[]
+ payload?: any
+ }
+ onEmailEditorReady: () => {
+ value: true
+ }
+ resetEmailTemplate: (values?: EmailTemplate) => {
+ values?: EmailTemplate
+ }
+ revealAdvancedField: (key: EmailMetaFieldKey) => {
+ key: EmailMetaFieldKey
+ }
+ saveAsTemplate: (
+ name: string,
+ description: string
+ ) => {
+ description: string
+ name: string
+ }
+ setActiveContentTab: (tab: 'plaintext' | 'visual') => {
+ tab: 'plaintext' | 'visual'
+ }
+ setEmailEditorRef: (emailEditorRef: EditorRef | null) => {
+ emailEditorRef: EditorRef | null
+ }
+ setEmailTemplateManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setEmailTemplateValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setEmailTemplateValues: (values: DeepPartial<EmailTemplate>) => {
+ values: DeepPartial<EmailTemplate>
+ }
+ setIsModalOpen: (isModalOpen: boolean) => {
+ isModalOpen: boolean
+ }
+ setIsSaveTemplateModalOpen: (isOpen: boolean) => {
+ isOpen: boolean
+ }
+ setTemplatingEngine: (templating: 'hog' | 'liquid') => {
+ templating: 'hog' | 'liquid'
+ }
+ submitEmailTemplate: () => {
+ value: boolean
+ }
+ submitEmailTemplateFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitEmailTemplateRequest: (emailTemplate: EmailTemplate) => {
+ emailTemplate: EmailTemplate
+ }
+ submitEmailTemplateSuccess: (emailTemplate: EmailTemplate) => {
+ emailTemplate: EmailTemplate
+ }
+ touchEmailTemplateField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface emailTemplaterLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ logicProps: (arg: any) => EmailTemplaterLogicProps
+ mergeTags: (personPropertyDefinitions: PropertyDefinition[]) => UnlayerMergeTags
+ unlayerEditorProjectId: (preflight: PreflightStatus | null) => 275430 | undefined
+ visibleFields: (arg: EmailTemplaterType, revealedAdvancedFields: EmailMetaFieldKey[]) => EmailMetaField[]
+ hiddenAdvancedFields: (arg: EmailTemplaterType, visibleFields: EmailMetaField[]) => EmailMetaField[]
+ }
+}
+
+export type emailTemplaterLogicType = MakeLogicType<
+ emailTemplaterLogicValues,
+ emailTemplaterLogicActions,
+ EmailTemplaterLogicProps,
+ emailTemplaterLogicMeta
+>
+
export const emailTemplaterLogic = kea<emailTemplaterLogicType>([
props({} as EmailTemplaterLogicProps),
path(['scenes', 'hog-functions', 'email-templater', 'emailTemplaterLogic']),
diff --git a/frontend/src/scenes/hog-functions/invocations/hogInvocationsLogic.tsx b/frontend/src/scenes/hog-functions/invocations/hogInvocationsLogic.tsx
index 783ceb4d98f9..8adf6c84e648 100644
--- a/frontend/src/scenes/hog-functions/invocations/hogInvocationsLogic.tsx
+++ b/frontend/src/scenes/hog-functions/invocations/hogInvocationsLogic.tsx
@@ -1,4 +1,4 @@
-import { actions, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, router, urlToAction } from 'kea-router'
@@ -16,8 +16,6 @@ import { hogFunctionsRerunCreate } from 'products/cdp/frontend/generated/api'
import type { HogInvocationRerunFilterStatusEnumApi } from 'products/cdp/frontend/generated/api.schemas'
import { hogFlowsRerunCreate } from 'products/workflows/frontend/generated/api'
-import type { hogInvocationsLogicType } from './hogInvocationsLogicType'
-
export const HOG_INVOCATIONS_PAGE_SIZE = 100
/** Display-side mirror of the backend cap. Backend enforces the actual limit via the
@@ -702,6 +700,213 @@ async function fetchProblemLevels(
return levelByInvocationId
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogInvocationsLogicValues {
+ canBulkRerun: boolean
+ expandedIds: Record<string, boolean>
+ filters: HogInvocationsFilters
+ hasLoadedOnce: boolean
+ hasMore: boolean
+ hasRunningRows: boolean
+ personPropertiesById: Record<
+ string,
+ {
+ distinct_ids?: string[]
+ properties: Record<string, any>
+ }
+ >
+ personPropertiesByIdLoading: boolean
+ personSearchResults: PersonType[]
+ personSearchResultsLoading: boolean
+ pickedPerson: PersonType | null
+ rerunableSelectedIds: string[]
+ runs: HogInvocationRow[]
+ runsLoading: boolean
+ selectAllState: 'all' | 'none' | 'some'
+ selectableIds: string[]
+ selectedCount: number
+ selectedIds: Record<string, boolean>
+ sparkline: SparklineData | null
+ sparklineLoading: boolean
+ statusCounts: Record<RunStatus, number>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogInvocationsLogicActions {
+ bulkRerun: (params: BulkRerunParams) => {
+ params: BulkRerunParams
+ }
+ clearSelected: () => {
+ value: true
+ }
+ enrichProblems: (invocationIds: string[] | null) => string[] | null
+ enrichProblemsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ enrichProblemsSuccess: (
+ runs: HogInvocationRow[],
+ payload?: string[] | null
+ ) => {
+ runs: HogInvocationRow[]
+ payload?: string[] | null
+ }
+ hydratePeople: (personIds: string[]) => {
+ personIds: string[]
+ }
+ hydratePeopleFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ hydratePeopleSuccess: (
+ personPropertiesById: Record<
+ string,
+ {
+ distinct_ids?: string[] | undefined
+ properties: Record<string, any>
+ }
+ >,
+ payload?: {
+ personIds: string[]
+ }
+ ) => {
+ personPropertiesById: Record<
+ string,
+ {
+ distinct_ids?: string[] | undefined
+ properties: Record<string, any>
+ }
+ >
+ payload?: {
+ personIds: string[]
+ }
+ }
+ loadMore: (_: any) => any
+ loadMoreFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadMoreSuccess: (
+ runs: HogInvocationRow[],
+ payload?: any
+ ) => {
+ runs: HogInvocationRow[]
+ payload?: any
+ }
+ loadRuns: (_: any) => any
+ loadRunsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRunsSuccess: (
+ runs: HogInvocationRow[],
+ payload?: any
+ ) => {
+ runs: HogInvocationRow[]
+ payload?: any
+ }
+ loadSparkline: (_: any) => any
+ loadSparklineFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSparklineSuccess: (
+ sparkline: SparklineData,
+ payload?: any
+ ) => {
+ sparkline: SparklineData
+ payload?: any
+ }
+ refresh: () => {
+ value: true
+ }
+ rerunInvocations: (invocationIds: string[]) => {
+ invocationIds: string[]
+ }
+ resetFilters: () => {
+ value: true
+ }
+ searchPersons: ({ search }: { search: string }) => {
+ search: string
+ }
+ searchPersonsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ searchPersonsSuccess: (
+ personSearchResults: PersonType[],
+ payload?: {
+ search: string
+ }
+ ) => {
+ personSearchResults: PersonType[]
+ payload?: {
+ search: string
+ }
+ }
+ setExpanded: (
+ invocationId: string,
+ expanded: boolean
+ ) => {
+ expanded: boolean
+ invocationId: string
+ }
+ setFilters: (filters: Partial<HogInvocationsFilters>) => {
+ filters: Partial<HogInvocationsFilters>
+ }
+ setHasMore: (hasMore: boolean) => {
+ hasMore: boolean
+ }
+ setPickedPerson: (person: PersonType | null) => {
+ person: PersonType | null
+ }
+ setSelectedIds: (ids: string[]) => {
+ ids: string[]
+ }
+ toggleSelected: (invocationId: string) => {
+ invocationId: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogInvocationsLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ statusCounts: (runs: HogInvocationRow[]) => Record<RunStatus, number>
+ selectedCount: (selectedIds: Record<string, boolean>) => number
+ canBulkRerun: (selectedCount: number) => boolean
+ rerunableSelectedIds: (selectedIds: Record<string, boolean>, runs: HogInvocationRow[]) => string[]
+ hasRunningRows: (runs: HogInvocationRow[]) => boolean
+ selectableIds: (runs: HogInvocationRow[]) => string[]
+ selectAllState: (selectedIds: Record<string, boolean>, selectableIds: string[]) => 'all' | 'none' | 'some'
+ }
+}
+
+export type hogInvocationsLogicType = MakeLogicType<
+ hogInvocationsLogicValues,
+ hogInvocationsLogicActions,
+ HogInvocationsLogicProps,
+ hogInvocationsLogicMeta
+>
+
/**
* Rerun is async — the `/rerun` endpoint enqueues a cyclotron wrapper job;
* new lifecycle rows show up here once the worker drains it.
diff --git a/frontend/src/scenes/hog-functions/list/hogFunctionRequestModalLogic.tsx b/frontend/src/scenes/hog-functions/list/hogFunctionRequestModalLogic.tsx
index 0faf0831e250..6544ae306b84 100644
--- a/frontend/src/scenes/hog-functions/list/hogFunctionRequestModalLogic.tsx
+++ b/frontend/src/scenes/hog-functions/list/hogFunctionRequestModalLogic.tsx
@@ -1,4 +1,4 @@
-import { actions, connect, kea, listeners, path } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path } from 'kea'
import posthog from 'posthog-js'
import { LemonDialog, LemonInput, LemonTextArea, lemonToast } from '@posthog/lemon-ui'
@@ -9,8 +9,31 @@ import { userLogic } from 'scenes/userLogic'
import { HogFunctionTypeType } from '~/types'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { UserType } from '../../../types'
import { humanizeHogFunctionType } from '../hog-function-utils'
-import type { hogFunctionRequestModalLogicType } from './hogFunctionRequestModalLogicType'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionRequestModalLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ user: UserType | null // userLogic
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionRequestModalLogicActions {
+ openFeedbackDialog: (
+ type: HogFunctionTypeType,
+ name?: string
+ ) => {
+ name: string
+ type: HogFunctionTypeType
+ }
+}
+
+export type hogFunctionRequestModalLogicType = MakeLogicType<
+ hogFunctionRequestModalLogicValues,
+ hogFunctionRequestModalLogicActions
+>
export const hogFunctionRequestModalLogic = kea<hogFunctionRequestModalLogicType>([
path(() => ['scenes', 'hog-functions', 'list', 'hogFunctionRequestModalLogic']),
diff --git a/frontend/src/scenes/hog-functions/list/hogFunctionTemplateListLogic.tsx b/frontend/src/scenes/hog-functions/list/hogFunctionTemplateListLogic.tsx
index a5e195be331f..0a887d057afe 100644
--- a/frontend/src/scenes/hog-functions/list/hogFunctionTemplateListLogic.tsx
+++ b/frontend/src/scenes/hog-functions/list/hogFunctionTemplateListLogic.tsx
@@ -1,5 +1,5 @@
import FuseClass from 'fuse.js'
-import { actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, combineUrl, router, urlToAction } from 'kea-router'
import posthog from 'posthog-js'
@@ -25,9 +25,10 @@ import {
import { cleanSourceId, isManagedSourceId, isSelfManagedSourceId } from 'products/data_warehouse/frontend/utils'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { AvailableFeature } from '../../../types'
import { HogFunctionDeliveryType, getHogFunctionDeliveryType } from '../hog-function-utils'
import { getSubTemplate } from '../sub-templates/sub-templates'
-import type { hogFunctionTemplateListLogicType } from './hogFunctionTemplateListLogicType'
// Helping kea-typegen navigate the exported default class for Fuse
export interface Fuse extends FuseClass<HogFunctionTemplateType> {}
@@ -83,6 +84,80 @@ export const shouldShowHogFunctionTemplate = (
return true
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionTemplateListLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean // userLogic
+ user: UserType | null // userLogic
+ filteredTemplates: HogFunctionTemplateType[]
+ filters: HogFunctionTemplateListFilters
+ loading: boolean
+ rawTemplates: HogFunctionTemplateType[]
+ rawTemplatesLoading: boolean
+ templates: HogFunctionTemplateWithSubTemplateType[]
+ templatesFuse: Fuse
+ urlForTemplate: (template: HogFunctionTemplateWithSubTemplateType) => string | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionTemplateListLogicActions {
+ loadHogFunctionTemplates: () => any
+ loadHogFunctionTemplatesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadHogFunctionTemplatesSuccess: (
+ rawTemplates: HogFunctionTemplateType[],
+ payload?: any
+ ) => {
+ rawTemplates: HogFunctionTemplateType[]
+ payload?: any
+ }
+ registerInterest: (template: HogFunctionTemplateType) => {
+ template: HogFunctionTemplateType
+ }
+ resetFilters: () => {
+ value: true
+ }
+ setFilters: (filters: Partial<HogFunctionTemplateListFilters>) => {
+ filters: Partial<HogFunctionTemplateListFilters>
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionTemplateListLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ loading: (rawTemplatesLoading: boolean) => boolean
+ templates: (
+ rawTemplates: HogFunctionTemplateType[],
+ user: UserType | null,
+ featureFlags: FeatureFlagsSet,
+ arg: HogFunctionTemplateType[],
+ arg2: HogFunctionSubTemplateIdType[]
+ ) => HogFunctionTemplateWithSubTemplateType[]
+ templatesFuse: (templates: HogFunctionTemplateWithSubTemplateType[]) => Fuse
+ filteredTemplates: (
+ filters: HogFunctionTemplateListFilters,
+ templates: HogFunctionTemplateWithSubTemplateType[],
+ templatesFuse: Fuse,
+ arg: any,
+ arg2: any
+ ) => HogFunctionTemplateType[]
+ urlForTemplate: (arg: any) => (template: HogFunctionTemplateWithSubTemplateType) => string | null
+ }
+}
+
+export type hogFunctionTemplateListLogicType = MakeLogicType<
+ hogFunctionTemplateListLogicValues,
+ hogFunctionTemplateListLogicActions,
+ HogFunctionTemplateListLogicProps,
+ hogFunctionTemplateListLogicMeta
+>
+
export const hogFunctionTemplateListLogic = kea<hogFunctionTemplateListLogicType>([
props({
manualTemplates: null,
@@ -130,7 +205,7 @@ export const hogFunctionTemplateListLogic = kea<hogFunctionTemplateListLogicType
],
})),
selectors({
- loading: [(s) => [s.rawTemplatesLoading], (x) => x],
+ loading: [(s) => [s.rawTemplatesLoading], (x: boolean) => x],
templates: [
(s) => [
@@ -141,11 +216,11 @@ export const hogFunctionTemplateListLogic = kea<hogFunctionTemplateListLogicType
(_, p: HogFunctionTemplateListLogicProps) => p.subTemplateIds ?? EMPTY_ARRAY,
],
(
- rawTemplates,
- user,
- featureFlags,
- manualTemplates,
- subTemplateIds
+ rawTemplates: HogFunctionTemplateType[],
+ user: UserType | null,
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet,
+ manualTemplates: HogFunctionTemplateType[],
+ subTemplateIds: HogFunctionSubTemplateIdType[]
): HogFunctionTemplateWithSubTemplateType[] => {
let templates: HogFunctionTemplateWithSubTemplateType[] = []
@@ -191,7 +266,7 @@ export const hogFunctionTemplateListLogic = kea<hogFunctionTemplateListLogicType
templatesFuse: [
(s) => [s.templates],
- (templates): Fuse => {
+ (templates: HogFunctionTemplateWithSubTemplateType[]): Fuse => {
return createFuse(templates || [], {
keys: ['name', 'description'],
})
@@ -207,9 +282,9 @@ export const hogFunctionTemplateListLogic = kea<hogFunctionTemplateListLogicType
(_, props) => props.customFilterFunction ?? ALWAYS_TRUE,
],
(
- filters,
- templates,
- templatesFuse,
+ filters: HogFunctionTemplateListFilters,
+ templates: HogFunctionTemplateWithSubTemplateType[],
+ templatesFuse: Fuse,
hideComingSoonByDefault,
customFilterFunction
): HogFunctionTemplateType[] => {
diff --git a/frontend/src/scenes/hog-functions/list/hogFunctionsListLogic.tsx b/frontend/src/scenes/hog-functions/list/hogFunctionsListLogic.tsx
index e9f634696520..c67f5ecbde38 100644
--- a/frontend/src/scenes/hog-functions/list/hogFunctionsListLogic.tsx
+++ b/frontend/src/scenes/hog-functions/list/hogFunctionsListLogic.tsx
@@ -1,4 +1,4 @@
-import { actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, router, urlToAction } from 'kea-router'
@@ -14,8 +14,9 @@ import { userLogic } from 'scenes/userLogic'
import { deleteFromTree, refreshTreeItem } from '~/layout/panel-layout/ProjectTree/projectTreeLogic'
import { CyclotronJobFiltersType, HogFunctionType, HogFunctionTypeType, UserType } from '~/types'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { AvailableFeature } from '../../../types'
import { HogFunctionDeliveryType, getHogFunctionDeliveryType } from '../hog-function-utils'
-import type { hogFunctionsListLogicType } from './hogFunctionsListLogicType'
export const CDP_TEST_HIDDEN_FLAG = '[CDP-TEST-HIDDEN]'
const EMPTY_MANUAL_FUNCTIONS: HogFunctionType[] = []
@@ -46,6 +47,171 @@ export const shouldShowHogFunction = (hogFunction: HogFunctionType, user?: UserT
return true
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionsListLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ currentProjectId: number | null // projectLogic
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean // userLogic
+ user: UserType | null // userLogic
+ enabledHogFunctions: HogFunctionType[]
+ filteredHogFunctions: HogFunctionType[]
+ filters: HogFunctionListFilters
+ hiddenHogFunctions: HogFunctionType[]
+ hogFunctions: HogFunctionType[]
+ hogFunctionsLoading: boolean
+ loading: boolean
+ reorderModalOpen: boolean
+ sortedHogFunctions: HogFunctionType[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionsListLogicActions {
+ addHogFunction: (hogFunction: HogFunctionType) => {
+ hogFunction: HogFunctionType
+ }
+ addHogFunctionFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ addHogFunctionSuccess: (
+ hogFunctions: HogFunctionType[],
+ payload?: {
+ hogFunction: HogFunctionType
+ }
+ ) => {
+ hogFunctions: HogFunctionType[]
+ payload?: {
+ hogFunction: HogFunctionType
+ }
+ }
+ deleteHogFunction: (hogFunction: HogFunctionType) => {
+ hogFunction: HogFunctionType
+ }
+ deleteHogFunctionFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deleteHogFunctionSuccess: (
+ hogFunctions: HogFunctionType[],
+ payload?: {
+ hogFunction: HogFunctionType
+ }
+ ) => {
+ hogFunctions: HogFunctionType[]
+ payload?: {
+ hogFunction: HogFunctionType
+ }
+ }
+ loadHogFunctions: () => any
+ loadHogFunctionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadHogFunctionsSuccess: (
+ hogFunctions: HogFunctionType[],
+ payload?: any
+ ) => {
+ hogFunctions: HogFunctionType[]
+ payload?: any
+ }
+ resetFilters: () => {
+ value: true
+ }
+ saveHogFunctionOrder: (newOrders: Record<string, number>) => {
+ newOrders: Record<string, number>
+ }
+ saveHogFunctionOrderFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ saveHogFunctionOrderSuccess: (
+ hogFunctions: HogFunctionType[],
+ payload?: {
+ newOrders: Record<string, number>
+ }
+ ) => {
+ hogFunctions: HogFunctionType[]
+ payload?: {
+ newOrders: Record<string, number>
+ }
+ }
+ setFilters: (filters: Partial<HogFunctionListFilters>) => {
+ filters: Partial<HogFunctionListFilters>
+ }
+ setReorderModalOpen: (open: boolean) => {
+ open: boolean
+ }
+ toggleEnabled: (
+ hogFunction: HogFunctionType,
+ enabled: boolean
+ ) => {
+ enabled: boolean
+ hogFunction: HogFunctionType
+ }
+ toggleEnabledFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ toggleEnabledSuccess: (
+ hogFunctions: HogFunctionType[],
+ payload?: {
+ enabled: boolean
+ hogFunction: HogFunctionType
+ }
+ ) => {
+ hogFunctions: HogFunctionType[]
+ payload?: {
+ enabled: boolean
+ hogFunction: HogFunctionType
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionsListLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ loading: (hogFunctionsLoading: boolean) => boolean
+ sortedHogFunctions: (
+ hogFunctions: HogFunctionType[],
+ filters: HogFunctionListFilters,
+ arg: any
+ ) => HogFunctionType[]
+ enabledHogFunctions: (sortedHogFunctions: HogFunctionType[]) => HogFunctionType[]
+ filteredHogFunctions: (
+ filters: HogFunctionListFilters,
+ sortedHogFunctions: HogFunctionType[],
+ user: UserType | null
+ ) => HogFunctionType[]
+ hiddenHogFunctions: (
+ sortedHogFunctions: HogFunctionType[],
+ filteredHogFunctions: HogFunctionType[]
+ ) => HogFunctionType[]
+ }
+}
+
+export type hogFunctionsListLogicType = MakeLogicType<
+ hogFunctionsListLogicValues,
+ hogFunctionsListLogicActions,
+ HogFunctionListLogicProps,
+ hogFunctionsListLogicMeta
+>
+
export const hogFunctionsListLogic = kea<hogFunctionsListLogicType>([
props({} as HogFunctionListLogicProps),
key((props) =>
@@ -151,7 +317,7 @@ export const hogFunctionsListLogic = kea<hogFunctionsListLogicType>([
],
})),
selectors({
- loading: [(s) => [s.hogFunctionsLoading], (hogFunctionsLoading) => hogFunctionsLoading],
+ loading: [(s) => [s.hogFunctionsLoading], (hogFunctionsLoading: boolean) => hogFunctionsLoading],
sortedHogFunctions: [
(s) => [s.hogFunctions, s.filters, (_, props) => props.manualFunctions ?? EMPTY_MANUAL_FUNCTIONS],
(
@@ -173,13 +339,17 @@ export const hogFunctionsListLogic = kea<hogFunctionsListLogicType>([
],
enabledHogFunctions: [
(s) => [s.sortedHogFunctions],
- (hogFunctions): HogFunctionType[] => {
+ (hogFunctions: HogFunctionType[]): HogFunctionType[] => {
return hogFunctions.filter((hogFunction) => hogFunction.enabled)
},
],
filteredHogFunctions: [
(s) => [s.filters, s.sortedHogFunctions, s.user],
- (filters, hogFunctions, user): HogFunctionType[] => {
+ (
+ filters: HogFunctionListFilters,
+ hogFunctions: HogFunctionType[],
+ user: UserType | null
+ ): HogFunctionType[] => {
const { showPaused, createdBy, deliveryType } = filters
return hogFunctions.filter((x) => {
@@ -206,7 +376,7 @@ export const hogFunctionsListLogic = kea<hogFunctionsListLogicType>([
hiddenHogFunctions: [
(s) => [s.sortedHogFunctions, s.filteredHogFunctions],
- (sortedHogFunctions, filteredHogFunctions): HogFunctionType[] => {
+ (sortedHogFunctions: HogFunctionType[], filteredHogFunctions: HogFunctionType[]): HogFunctionType[] => {
return sortedHogFunctions.filter((hogFunction) => !filteredHogFunctions.includes(hogFunction))
},
],
diff --git a/frontend/src/scenes/hog-functions/list/newNotificationDialogLogic.ts b/frontend/src/scenes/hog-functions/list/newNotificationDialogLogic.ts
index 068f8adbb08f..5deab8f80397 100644
--- a/frontend/src/scenes/hog-functions/list/newNotificationDialogLogic.ts
+++ b/frontend/src/scenes/hog-functions/list/newNotificationDialogLogic.ts
@@ -1,5 +1,6 @@
-import { actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { lemonToast } from '@posthog/lemon-ui'
@@ -8,8 +9,8 @@ import { integrationsLogic } from 'lib/integrations/integrationsLogic'
import { CyclotronJobFiltersType, HogFunctionSubTemplateIdType, HogFunctionType } from '~/types'
+import type { IntegrationType } from '../../../types'
import { HOG_FUNCTION_SUB_TEMPLATE_COMMON_PROPERTIES, HOG_FUNCTION_SUB_TEMPLATES } from '../sub-templates/sub-templates'
-import type { newNotificationDialogLogicType } from './newNotificationDialogLogicType'
export type DestinationKey = 'slack' | 'discord' | 'microsoft-teams' | 'webhook'
@@ -43,6 +44,88 @@ export interface NewNotificationDialogLogicProps {
filtersOverride?: CyclotronJobFiltersType
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface newNotificationDialogLogicValues {
+ integrations: IntegrationType[] | null // integrationsLogic
+ isNotificationFormSubmitting: boolean
+ isNotificationFormValid: boolean
+ isOpen: boolean
+ notificationForm: NewNotificationForm
+ notificationFormAllErrors: Record<string, any>
+ notificationFormChanged: boolean
+ notificationFormErrors: DeepPartialMap<NewNotificationForm, ValidationErrorType>
+ notificationFormHasErrors: boolean
+ notificationFormManualErrors: Record<string, any>
+ notificationFormTouched: boolean
+ notificationFormTouches: Record<string, boolean>
+ notificationFormValidationErrors: DeepPartialMap<NewNotificationForm, ValidationErrorType>
+ selectedSlackIntegration: IntegrationType | null
+ showNotificationFormErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface newNotificationDialogLogicActions {
+ closeDialog: () => {
+ value: true
+ }
+ openDialog: () => {
+ value: true
+ }
+ resetNotificationForm: (values?: NewNotificationForm) => {
+ values?: NewNotificationForm
+ }
+ setNotificationFormManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setNotificationFormValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setNotificationFormValues: (values: DeepPartial<NewNotificationForm>) => {
+ values: DeepPartial<NewNotificationForm>
+ }
+ submitNotificationForm: () => {
+ value: boolean
+ }
+ submitNotificationFormFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitNotificationFormRequest: (notificationForm: NewNotificationForm) => {
+ notificationForm: NewNotificationForm
+ }
+ submitNotificationFormSuccess: (notificationForm: NewNotificationForm) => {
+ notificationForm: NewNotificationForm
+ }
+ touchNotificationFormField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface newNotificationDialogLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ selectedSlackIntegration: (
+ integrations: IntegrationType[] | null,
+ notificationForm: NewNotificationForm
+ ) => IntegrationType | null
+ }
+}
+
+export type newNotificationDialogLogicType = MakeLogicType<
+ newNotificationDialogLogicValues,
+ newNotificationDialogLogicActions,
+ NewNotificationDialogLogicProps,
+ newNotificationDialogLogicMeta
+>
+
export const newNotificationDialogLogic = kea<newNotificationDialogLogicType>([
path(['scenes', 'hog-functions', 'list', 'newNotificationDialogLogic']),
props({} as NewNotificationDialogLogicProps),
@@ -149,7 +232,8 @@ export const newNotificationDialogLogic = kea<newNotificationDialogLogicType>([
selectors({
selectedSlackIntegration: [
(s) => [s.integrations, s.notificationForm],
- (integrations, form) => integrations?.find((i) => i.id === form.slackIntegrationId) ?? null,
+ (integrations: import('~/types').IntegrationType[] | null, form: NewNotificationForm) =>
+ integrations?.find((i) => i.id === form.slackIntegrationId) ?? null,
],
}),
diff --git a/frontend/src/scenes/hog-functions/logs/hogFunctionLogsLogic.ts b/frontend/src/scenes/hog-functions/logs/hogFunctionLogsLogic.ts
index 9952f25abd3d..3de54807a4c7 100644
--- a/frontend/src/scenes/hog-functions/logs/hogFunctionLogsLogic.ts
+++ b/frontend/src/scenes/hog-functions/logs/hogFunctionLogsLogic.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 { beforeUnload } from 'kea-router'
import { lemonToast } from '@posthog/lemon-ui'
@@ -9,7 +9,6 @@ import { Dayjs, dayjs } from 'lib/dayjs'
import { hogql } from '~/queries/utils'
import { LogEntryLevel } from '~/types'
-import type { hogFunctionLogsLogicType } from './hogFunctionLogsLogicType'
import { GroupedLogEntry, LogsViewerLogicProps, logsViewerLogic } from './logsViewerLogic'
export type RetryInvocationState = 'pending' | 'success' | 'failure'
@@ -92,6 +91,77 @@ const loadClickhouseEvents = async (
})
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionLogsLogicValues {
+ groupedLogs: GroupedLogEntry[] // logsViewerLogic
+ eventIdByInvocationId: Record<string, string>
+ retries: Record<string, RetryInvocationState>
+ retryRunning: boolean
+ selectedForRetry: Record<string, boolean>
+ selectingMany: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionLogsLogicActions {
+ addLogGroups: (logGroups: GroupedLogEntry[]) => {
+ logGroups: GroupedLogEntry[]
+ } // logsViewerLogic
+ setRowExpanded: (
+ instanceId: string,
+ expanded: boolean
+ ) => {
+ expanded: boolean
+ instanceId: string
+ } // logsViewerLogic
+ retryInvocation: (
+ groupedLogEntry: GroupedLogEntry,
+ eventId: string
+ ) => {
+ eventId: string
+ groupedLogEntry: GroupedLogEntry
+ }
+ retryInvocationFailure: (groupedLogEntry: GroupedLogEntry) => {
+ groupedLogEntry: GroupedLogEntry
+ }
+ retryInvocationStarted: (groupedLogEntry: GroupedLogEntry) => {
+ groupedLogEntry: GroupedLogEntry
+ }
+ retryInvocationSuccess: (groupedLogEntry: GroupedLogEntry) => {
+ groupedLogEntry: GroupedLogEntry
+ }
+ retryInvocations: (groupedLogEntries: GroupedLogEntry[]) => {
+ groupedLogEntries: GroupedLogEntry[]
+ }
+ retrySelectedInvocations: () => {
+ value: true
+ }
+ selectAllForRetry: () => {
+ value: true
+ }
+ setSelectedForRetry: (selectedForRetry: Record<string, boolean>) => {
+ selectedForRetry: Record<string, boolean>
+ }
+ setSelectingMany: (selectingMany: boolean) => {
+ selectingMany: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionLogsLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ retryRunning: (retries: Record<string, RetryInvocationState>) => boolean
+ eventIdByInvocationId: (groupedLogs: GroupedLogEntry[]) => Record<string, string>
+ }
+}
+
+export type hogFunctionLogsLogicType = MakeLogicType<
+ hogFunctionLogsLogicValues,
+ hogFunctionLogsLogicActions,
+ LogsViewerLogicProps,
+ hogFunctionLogsLogicMeta
+>
+
export const hogFunctionLogsLogic = kea<hogFunctionLogsLogicType>([
path((key) => ['scenes', 'pipeline', 'hogfunctions', 'logs', 'hogFunctionLogsLogic', key]),
props({} as LogsViewerLogicProps), // TODO: Remove `stage` from props, it isn't needed here for anything
@@ -170,14 +240,14 @@ export const hogFunctionLogsLogic = kea<hogFunctionLogsLogicType>([
selectors({
retryRunning: [
(s) => [s.retries],
- (retries) => {
+ (retries: Record<string, RetryInvocationState>) => {
return Object.values(retries).some((x) => x === 'pending')
},
],
eventIdByInvocationId: [
(s) => [s.groupedLogs],
- (groupedLogs) => {
+ (groupedLogs: GroupedLogEntry[]) => {
const eventIdByInvocationId: Record<string, string> = {}
for (const record of groupedLogs) {
diff --git a/frontend/src/scenes/hog-functions/logs/logsViewerLogic.tsx b/frontend/src/scenes/hog-functions/logs/logsViewerLogic.tsx
index 74a74d830364..59b1fa624abe 100644
--- a/frontend/src/scenes/hog-functions/logs/logsViewerLogic.tsx
+++ b/frontend/src/scenes/hog-functions/logs/logsViewerLogic.tsx
@@ -1,4 +1,5 @@
import {
+ MakeLogicType,
actions,
afterMount,
beforeUnmount,
@@ -23,8 +24,6 @@ import { teamLogic } from 'scenes/teamLogic'
import { HogQLQueryString, hogql } from '~/queries/utils'
import { LogEntryLevel } from '~/types'
-import type { logsViewerLogicType } from './logsViewerLogicType'
-
export const ALL_LOG_LEVELS: LogEntryLevel[] = ['DEBUG', 'LOG', 'INFO', 'WARN', 'ERROR']
export const POLLING_INTERVAL = 5000
export const LOG_VIEWER_LIMIT = 100
@@ -248,6 +247,216 @@ export const groupLogs = (logs: LogEntry[]): GroupedLogEntry[] => {
return Object.values(byId).reverse()
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewerLogicValues {
+ allLogEntries: LogEntry[]
+ allLogEntryKeys: Set<string>
+ expandedRows: Record<string, boolean>
+ filters: LogsViewerFilters
+ groupedLogs: GroupedLogEntry[]
+ groupedLogsLoading: boolean
+ hiddenLogs: LogEntry[]
+ hiddenLogsLoading: boolean
+ isGrouped: boolean
+ isThereMoreToLoad: boolean
+ logEntryParams: LogEntryParams
+ logsLoading: boolean
+ newestLogTimestamp: Dayjs | null
+ oldestLogTimestamp: Dayjs | null
+ unGroupedLogs: LogEntry[]
+ unGroupedLogsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewerLogicActions {
+ addLogGroups: (logGroups: GroupedLogEntry[]) => {
+ logGroups: GroupedLogEntry[]
+ }
+ addLogGroupsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ addLogGroupsSuccess: (
+ groupedLogs: GroupedLogEntry[],
+ payload?: {
+ logGroups: GroupedLogEntry[]
+ }
+ ) => {
+ groupedLogs: GroupedLogEntry[]
+ payload?: {
+ logGroups: GroupedLogEntry[]
+ }
+ }
+ clearHiddenLogs: () => {
+ value: true
+ }
+ clearHiddenLogsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ clearHiddenLogsSuccess: (
+ hiddenLogs: never[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ hiddenLogs: never[]
+ payload?: {
+ value: true
+ }
+ }
+ clearLogs: () => {
+ value: true
+ }
+ loadGroupedLogs: () => {
+ value: true
+ }
+ loadGroupedLogsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadGroupedLogsSuccess: (
+ groupedLogs: GroupedLogEntry[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ groupedLogs: GroupedLogEntry[]
+ payload?: {
+ value: true
+ }
+ }
+ loadLogs: () => {
+ value: true
+ }
+ loadMoreGroupedLogs: () => any
+ loadMoreGroupedLogsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadMoreGroupedLogsSuccess: (
+ groupedLogs: GroupedLogEntry[],
+ payload?: any
+ ) => {
+ groupedLogs: GroupedLogEntry[]
+ payload?: any
+ }
+ loadMoreUngroupedLogs: () => any
+ loadMoreUngroupedLogsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadMoreUngroupedLogsSuccess: (
+ unGroupedLogs: LogEntry[],
+ payload?: any
+ ) => {
+ unGroupedLogs: LogEntry[]
+ payload?: any
+ }
+ loadNewerLogs: () => {
+ value: true
+ }
+ loadNewerLogsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadNewerLogsSuccess: (
+ hiddenLogs: LogEntry[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ hiddenLogs: LogEntry[]
+ payload?: {
+ value: true
+ }
+ }
+ loadOlderLogs: () => {
+ value: true
+ }
+ loadUngroupedLogs: () => {
+ value: true
+ }
+ loadUngroupedLogsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadUngroupedLogsSuccess: (
+ unGroupedLogs: LogEntry[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ unGroupedLogs: LogEntry[]
+ payload?: {
+ value: true
+ }
+ }
+ markLogsEnd: () => {
+ value: true
+ }
+ revealHiddenLogs: () => {
+ value: true
+ }
+ scheduleLoadNewerLogs: () => {
+ value: true
+ }
+ setFilters: (filters: Partial<LogsViewerFilters>) => {
+ filters: Partial<LogsViewerFilters>
+ }
+ setIsGrouped: (isGrouped: boolean) => {
+ isGrouped: boolean
+ }
+ setRowExpanded: (
+ instanceId: string,
+ expanded: boolean
+ ) => {
+ expanded: boolean
+ instanceId: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsViewerLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ logsLoading: (groupedLogsLoading: boolean, unGroupedLogsLoading: boolean) => boolean
+ logEntryParams: (arg: any, filters: LogsViewerFilters) => LogEntryParams
+ allLogEntries: (groupedLogs: GroupedLogEntry[], unGroupedLogs: LogEntry[], hiddenLogs: LogEntry[]) => LogEntry[]
+ allLogEntryKeys: (allLogEntries: LogEntry[]) => Set<string>
+ newestLogTimestamp: (allLogEntries: LogEntry[]) => Dayjs | null
+ oldestLogTimestamp: (allLogEntries: LogEntry[]) => Dayjs | null
+ }
+}
+
+export type logsViewerLogicType = MakeLogicType<
+ logsViewerLogicValues,
+ logsViewerLogicActions,
+ LogsViewerLogicProps,
+ logsViewerLogicMeta
+>
+
export const logsViewerLogic = kea<logsViewerLogicType>([
path((key) => ['scenes', 'pipeline', 'hogfunctions', 'logs', 'logsViewerLogic', key]),
props({} as LogsViewerLogicProps), // TODO: Remove `stage` from props, it isn't needed here for anything
@@ -462,13 +671,13 @@ export const logsViewerLogic = kea<logsViewerLogicType>([
selectors(() => ({
logsLoading: [
(s) => [s.groupedLogsLoading, s.unGroupedLogsLoading],
- (groupedLogsLoading, unGroupedLogsLoading): boolean => {
+ (groupedLogsLoading: boolean, unGroupedLogsLoading: boolean): boolean => {
return groupedLogsLoading || unGroupedLogsLoading
},
],
logEntryParams: [
(s) => [(_, p) => p, s.filters],
- (props, filters): LogEntryParams => {
+ (props, filters: LogsViewerFilters): LogEntryParams => {
const searchGroups = [filters.search, ...(props.searchGroups || [])].filter((x) => !!x) as string[]
return {
...props.defaultFilters,
@@ -485,21 +694,21 @@ export const logsViewerLogic = kea<logsViewerLogicType>([
allLogEntries: [
(s) => [s.groupedLogs, s.unGroupedLogs, s.hiddenLogs],
- (groupedLogs, unGroupedLogs, hiddenLogs): LogEntry[] => {
+ (groupedLogs: GroupedLogEntry[], unGroupedLogs: LogEntry[], hiddenLogs: LogEntry[]): LogEntry[] => {
return [...groupedLogs.flatMap((log) => log.entries), ...unGroupedLogs, ...hiddenLogs]
},
],
allLogEntryKeys: [
(s) => [s.allLogEntries],
- (allLogEntries): Set<string> => {
+ (allLogEntries: LogEntry[]): Set<string> => {
return new Set(allLogEntries.map(toKey))
},
],
newestLogTimestamp: [
(s) => [s.allLogEntries],
- (allLogEntries): Dayjs | null => {
+ (allLogEntries: LogEntry[]): Dayjs | null => {
const item = allLogEntries.reduce(
(max, log) => {
if (!max) {
@@ -516,7 +725,7 @@ export const logsViewerLogic = kea<logsViewerLogicType>([
oldestLogTimestamp: [
(s) => [s.allLogEntries],
- (allLogEntries): Dayjs | null => {
+ (allLogEntries: LogEntry[]): Dayjs | null => {
return allLogEntries.reduce(
(min, log) => {
if (!min) {
diff --git a/frontend/src/scenes/hog-functions/testing/hogFunctionTestingLogic.tsx b/frontend/src/scenes/hog-functions/testing/hogFunctionTestingLogic.tsx
index 6e4b5ad9b7c9..4f6c3c1ac30c 100644
--- a/frontend/src/scenes/hog-functions/testing/hogFunctionTestingLogic.tsx
+++ b/frontend/src/scenes/hog-functions/testing/hogFunctionTestingLogic.tsx
@@ -1,5 +1,5 @@
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 { loaders } from 'kea-loaders'
import { beforeUnload } from 'kea-router'
import { subscriptions } from 'kea-subscriptions'
@@ -19,8 +19,16 @@ import {
CyclotronJobTestInvocationResult,
} from '~/types'
+import type {
+ AccessControlFilterWarning,
+ DataWarehouseSyncWarning,
+ HogQLQueryModifiers,
+ QueryStatus,
+ QueryTiming,
+ ResolvedDateRangeResponse,
+} from '../../../queries/schema/schema-general'
+import type { GroupType, GroupTypeIndex, HogFunctionConfigurationType, PropertyGroupFilter } from '../../../types'
import { hogFunctionConfigurationLogic, sanitizeConfiguration } from '../configuration/hogFunctionConfigurationLogic'
-import type { hogFunctionTestingLogicType } from './hogFunctionTestingLogicType'
export interface HogFunctionTestingLogicProps {
id: string
@@ -37,6 +45,331 @@ export interface CyclotronJobTestInvocationResultWithEventId extends CyclotronJo
const PAGE_ROWS = 20
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionTestingLogicValues {
+ groupTypes: Map<GroupTypeIndex, GroupType> // groupsModel
+ configuration: HogFunctionConfigurationType // hogFunctionConfigurationLogic
+ matchingFilters: PropertyGroupFilter // hogFunctionConfigurationLogic
+ templateId: string | undefined // hogFunctionConfigurationLogic
+ baseEventsQuery: EventsQuery | null
+ dateRange: {
+ after: string | null
+ before: string | null
+ }
+ events: EventsResultType
+ eventsLoading: boolean
+ eventsWithRetries: any[][]
+ expandedRows: string[]
+ loadingRetries: string[]
+ nextQuery: EventsQuery | null
+ pageTimestamps: (string | undefined)[]
+ previousQuery: EventsQuery | null
+ retries: CyclotronJobTestInvocationResultWithEventId[]
+ retriesLoading: boolean
+ selectedForRetry: string[]
+ selectingMany: boolean
+ totalEvents: number
+ totalEventsLoading: boolean
+ totalEventsQuery: TrendsQuery | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionTestingLogicActions {
+ addLoadingRetry: (eventId: string) => {
+ eventId: string
+ }
+ changeDateRange: (
+ after: string | null,
+ before: string | null
+ ) => {
+ after: string | null
+ before: string | null
+ }
+ collapseRow: (eventId: string) => {
+ eventId: string
+ }
+ decreaseCurrentPage: () => {
+ value: true
+ }
+ deselectForRetry: (eventIds: string[]) => {
+ eventIds: string[]
+ }
+ expandRow: (eventId: string) => {
+ eventId: string
+ }
+ increaseCurrentPage: (timestamp: string | undefined) => {
+ timestamp: string | undefined
+ }
+ loadEvents: () => any
+ loadEventsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadEventsSuccess: (
+ events:
+ | {
+ before: undefined
+ results: never[]
+ }
+ | {
+ before: string | undefined
+ columns: any[]
+ error?: string | undefined
+ hasMore?: boolean | undefined
+ hogql: string
+ limit?: number | undefined
+ modifiers?: HogQLQueryModifiers | undefined
+ nextCursor?: string | undefined
+ offset?: number | undefined
+ query_status?: QueryStatus | undefined
+ resolved_compare_date_range?: ResolvedDateRangeResponse | undefined
+ resolved_date_range?: ResolvedDateRangeResponse | undefined
+ results: any[][]
+ timings?: QueryTiming[] | undefined
+ types: string[]
+ warnings?: (AccessControlFilterWarning | DataWarehouseSyncWarning)[] | undefined
+ },
+ payload?: any
+ ) => {
+ events:
+ | {
+ before: undefined
+ results: never[]
+ }
+ | {
+ before: string | undefined
+ columns: any[]
+ error?: string | undefined
+ hasMore?: boolean | undefined
+ hogql: string
+ limit?: number | undefined
+ modifiers?: HogQLQueryModifiers | undefined
+ nextCursor?: string | undefined
+ offset?: number | undefined
+ query_status?: QueryStatus | undefined
+ resolved_compare_date_range?: ResolvedDateRangeResponse | undefined
+ resolved_date_range?: ResolvedDateRangeResponse | undefined
+ results: any[][]
+ timings?: QueryTiming[] | undefined
+ types: string[]
+ warnings?: (AccessControlFilterWarning | DataWarehouseSyncWarning)[] | undefined
+ }
+ payload?: any
+ }
+ loadNextEventsPage: () => any
+ loadNextEventsPageFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadNextEventsPageSuccess: (
+ events:
+ | {
+ before: undefined
+ results: any[][]
+ }
+ | {
+ before: string | undefined
+ columns: any[]
+ error?: string | undefined
+ hasMore?: boolean | undefined
+ hogql: string
+ limit?: number | undefined
+ modifiers?: HogQLQueryModifiers | undefined
+ nextCursor?: string | undefined
+ offset?: number | undefined
+ query_status?: QueryStatus | undefined
+ resolved_compare_date_range?: ResolvedDateRangeResponse | undefined
+ resolved_date_range?: ResolvedDateRangeResponse | undefined
+ results: any[][]
+ timings?: QueryTiming[] | undefined
+ types: string[]
+ warnings?: (AccessControlFilterWarning | DataWarehouseSyncWarning)[] | undefined
+ },
+ payload?: any
+ ) => {
+ events:
+ | {
+ before: undefined
+ results: any[][]
+ }
+ | {
+ before: string | undefined
+ columns: any[]
+ error?: string | undefined
+ hasMore?: boolean | undefined
+ hogql: string
+ limit?: number | undefined
+ modifiers?: HogQLQueryModifiers | undefined
+ nextCursor?: string | undefined
+ offset?: number | undefined
+ query_status?: QueryStatus | undefined
+ resolved_compare_date_range?: ResolvedDateRangeResponse | undefined
+ resolved_date_range?: ResolvedDateRangeResponse | undefined
+ results: any[][]
+ timings?: QueryTiming[] | undefined
+ types: string[]
+ warnings?: (AccessControlFilterWarning | DataWarehouseSyncWarning)[] | undefined
+ }
+ payload?: any
+ }
+ loadPreviousEventsPage: () => any
+ loadPreviousEventsPageFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPreviousEventsPageSuccess: (
+ events:
+ | {
+ before: undefined
+ results: any[][]
+ }
+ | {
+ before: string | undefined
+ columns: any[]
+ error?: string | undefined
+ hasMore?: boolean | undefined
+ hogql: string
+ limit?: number | undefined
+ modifiers?: HogQLQueryModifiers | undefined
+ nextCursor?: string | undefined
+ offset?: number | undefined
+ query_status?: QueryStatus | undefined
+ resolved_compare_date_range?: ResolvedDateRangeResponse | undefined
+ resolved_date_range?: ResolvedDateRangeResponse | undefined
+ results: any[][]
+ timings?: QueryTiming[] | undefined
+ types: string[]
+ warnings?: (AccessControlFilterWarning | DataWarehouseSyncWarning)[] | undefined
+ },
+ payload?: any
+ ) => {
+ events:
+ | {
+ before: undefined
+ results: any[][]
+ }
+ | {
+ before: string | undefined
+ columns: any[]
+ error?: string | undefined
+ hasMore?: boolean | undefined
+ hogql: string
+ limit?: number | undefined
+ modifiers?: HogQLQueryModifiers | undefined
+ nextCursor?: string | undefined
+ offset?: number | undefined
+ query_status?: QueryStatus | undefined
+ resolved_compare_date_range?: ResolvedDateRangeResponse | undefined
+ resolved_date_range?: ResolvedDateRangeResponse | undefined
+ results: any[][]
+ timings?: QueryTiming[] | undefined
+ types: string[]
+ warnings?: (AccessControlFilterWarning | DataWarehouseSyncWarning)[] | undefined
+ }
+ payload?: any
+ }
+ loadTotalEvents: () => any
+ loadTotalEventsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadTotalEventsSuccess: (
+ totalEvents: number,
+ payload?: any
+ ) => {
+ totalEvents: number
+ payload?: any
+ }
+ removeLoadingRetry: (eventId: string) => {
+ eventId: string
+ }
+ resetCollapsedRows: () => {
+ value: true
+ }
+ resetCurrentPage: () => {
+ value: true
+ }
+ resetSelectedForRetry: () => {
+ value: true
+ }
+ retryInvocation: ({ eventId, globals }: { eventId: string; globals: CyclotronJobInvocationGlobals }) => {
+ eventId: string
+ globals: CyclotronJobInvocationGlobals
+ }
+ retryInvocationFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ retryInvocationSuccess: (
+ retries: CyclotronJobTestInvocationResultWithEventId[],
+ payload?: {
+ eventId: string
+ globals: CyclotronJobInvocationGlobals
+ }
+ ) => {
+ retries: CyclotronJobTestInvocationResultWithEventId[]
+ payload?: {
+ eventId: string
+ globals: CyclotronJobInvocationGlobals
+ }
+ }
+ selectForRetry: (eventIds: string[]) => {
+ eventIds: string[]
+ }
+ setSelectingMany: (selectingMany: boolean) => {
+ selectingMany: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface hogFunctionTestingLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ baseEventsQuery: (
+ configuration: HogFunctionConfigurationType,
+ matchingFilters: PropertyGroupFilter,
+ groupTypes: Map<GroupTypeIndex, GroupType>,
+ dateRange: {
+ after: string | null
+ before: string | null
+ }
+ ) => EventsQuery | null
+ totalEventsQuery: (
+ configuration: HogFunctionConfigurationType,
+ matchingFilters: PropertyGroupFilter,
+ dateRange: {
+ after: string | null
+ before: string | null
+ }
+ ) => TrendsQuery | null
+ eventsWithRetries: (events: EventsResultType, retries: CyclotronJobTestInvocationResultWithEventId[]) => any[][]
+ nextQuery: (baseEventsQuery: EventsQuery | null, events: EventsResultType) => EventsQuery | null
+ previousQuery: (baseEventsQuery: EventsQuery | null, events: EventsResultType) => EventsQuery | null
+ }
+}
+
+export type hogFunctionTestingLogicType = MakeLogicType<
+ hogFunctionTestingLogicValues,
+ hogFunctionTestingLogicActions,
+ HogFunctionTestingLogicProps,
+ hogFunctionTestingLogicMeta
+>
+
export const hogFunctionTestingLogic = kea<hogFunctionTestingLogicType>([
path((key) => ['scenes', 'pipeline', 'hogFunctionTestingLogic', key]),
props({} as HogFunctionTestingLogicProps),
@@ -209,7 +542,15 @@ export const hogFunctionTestingLogic = kea<hogFunctionTestingLogicType>([
selectors(({ values }) => ({
baseEventsQuery: [
(s) => [s.configuration, s.matchingFilters, s.groupTypes, s.dateRange],
- (configuration, matchingFilters, groupTypes, dateRange): EventsQuery | null => {
+ (
+ configuration: import('~/types').HogFunctionConfigurationType,
+ matchingFilters: import('~/types').PropertyGroupFilter,
+ groupTypes: Map<import('~/types').GroupTypeIndex, import('~/types').GroupType>,
+ dateRange: {
+ after: string | null
+ before: string | null
+ }
+ ): EventsQuery | null => {
const query: EventsQuery = {
kind: NodeKind.EventsQuery,
filterTestAccounts: configuration.filters?.filter_test_accounts,
@@ -235,7 +576,14 @@ export const hogFunctionTestingLogic = kea<hogFunctionTestingLogicType>([
],
totalEventsQuery: [
(s) => [s.configuration, s.matchingFilters, s.dateRange],
- (configuration, matchingFilters, dateRange): TrendsQuery | null => {
+ (
+ configuration: import('~/types').HogFunctionConfigurationType,
+ matchingFilters: import('~/types').PropertyGroupFilter,
+ dateRange: {
+ after: string | null
+ before: string | null
+ }
+ ): TrendsQuery | null => {
return setLatestVersionsOnQuery({
kind: NodeKind.TrendsQuery,
filterTestAccounts: configuration.filters?.filter_test_accounts,
@@ -273,7 +621,7 @@ export const hogFunctionTestingLogic = kea<hogFunctionTestingLogicType>([
],
nextQuery: [
(s) => [s.baseEventsQuery, s.events],
- (baseEventsQuery, events): EventsQuery | null => {
+ (baseEventsQuery: EventsQuery | null, events: EventsResultType): EventsQuery | null => {
if (!baseEventsQuery || !events) {
return null
}
@@ -297,7 +645,7 @@ export const hogFunctionTestingLogic = kea<hogFunctionTestingLogicType>([
],
previousQuery: [
(s) => [s.baseEventsQuery, s.events],
- (baseEventsQuery, events): EventsQuery | null => {
+ (baseEventsQuery: EventsQuery | null, events: EventsResultType): EventsQuery | null => {
if (!baseEventsQuery || !events) {
return null
}
diff --git a/frontend/src/scenes/models/dagsLogic.ts b/frontend/src/scenes/models/dagsLogic.ts
index 6446f24b55d5..912805b6616b 100644
--- a/frontend/src/scenes/models/dagsLogic.ts
+++ b/frontend/src/scenes/models/dagsLogic.ts
@@ -1,4 +1,4 @@
-import { kea, listeners, path } from 'kea'
+import { MakeLogicType, kea, listeners, path } from 'kea'
import { loaders } from 'kea-loaders'
import { lemonToast } from '@posthog/lemon-ui'
@@ -7,8 +7,6 @@ import api from 'lib/api'
import { DataModelingDAG, DataModelingSyncInterval } from '~/types'
-import type { dagsLogicType } from './dagsLogicType'
-
export const SYNC_FREQUENCY_OPTIONS: { value: DataModelingSyncInterval; label: string }[] = [
{ value: '15min', label: '15 minutes' },
{ value: '30min', label: '30 minutes' },
@@ -20,6 +18,63 @@ export const SYNC_FREQUENCY_OPTIONS: { value: DataModelingSyncInterval; label: s
{ value: '30day', label: 'Monthly' },
]
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dagsLogicValues {
+ dags: DataModelingDAG[]
+ dagsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dagsLogicActions {
+ deleteDag: (dag: DataModelingDAG) => DataModelingDAG
+ deleteDagFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deleteDagSuccess: (
+ dags: DataModelingDAG[],
+ payload?: DataModelingDAG
+ ) => {
+ dags: DataModelingDAG[]
+ payload?: DataModelingDAG
+ }
+ loadDags: () => any
+ loadDagsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadDagsSuccess: (
+ dags: DataModelingDAG[],
+ payload?: any
+ ) => {
+ dags: DataModelingDAG[]
+ payload?: any
+ }
+ updateDag: (dag: DataModelingDAG) => DataModelingDAG
+ updateDagFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateDagSuccess: (
+ dags: DataModelingDAG[],
+ payload?: DataModelingDAG
+ ) => {
+ dags: DataModelingDAG[]
+ payload?: DataModelingDAG
+ }
+}
+
+export type dagsLogicType = MakeLogicType<dagsLogicValues, dagsLogicActions>
+
export const dagsLogic = kea<dagsLogicType>([
path(['scenes', 'models', 'dagsLogic']),
loaders(({ values }) => ({
diff --git a/frontend/src/scenes/models/modelsSceneLogic.ts b/frontend/src/scenes/models/modelsSceneLogic.ts
index 4b8409eef426..e41e2916d7c6 100644
--- a/frontend/src/scenes/models/modelsSceneLogic.ts
+++ b/frontend/src/scenes/models/modelsSceneLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, urlToAction } from 'kea-router'
@@ -8,12 +8,62 @@ import { urls } from 'scenes/urls'
import { DataModelingNode } from '~/types'
-import type { modelsSceneLogicType } from './modelsSceneLogicType'
+import type { DataWarehouseSavedQuery } from '../../types'
export const MODELS_SCENE_TABS = ['views', 'dags'] as const
export type ModelsSceneTab = (typeof MODELS_SCENE_TABS)[number]
export const DEFAULT_MODELS_SCENE_TAB: ModelsSceneTab = 'views'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface modelsSceneLogicValues {
+ dataWarehouseSavedQueries: DataWarehouseSavedQuery[] // dataWarehouseViewsLogic
+ dataWarehouseSavedQueriesLoading: boolean // dataWarehouseViewsLogic
+ currentTab: ModelsSceneTab
+ nodes: DataModelingNode[]
+ nodesLoading: boolean
+ savedQueryIdToNodeId: Record<string, string>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface modelsSceneLogicActions {
+ loadDataWarehouseSavedQueries: () => any // dataWarehouseViewsLogic
+ _setCurrentTab: (tab: ModelsSceneTab) => {
+ tab: 'dags' | 'views'
+ }
+ loadNodes: () => any
+ loadNodesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadNodesSuccess: (
+ nodes: DataModelingNode[],
+ payload?: any
+ ) => {
+ nodes: DataModelingNode[]
+ payload?: any
+ }
+ setCurrentTab: (tab: ModelsSceneTab) => {
+ tab: 'dags' | 'views'
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface modelsSceneLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ savedQueryIdToNodeId: (nodes: DataModelingNode[]) => Record<string, string>
+ }
+}
+
+export type modelsSceneLogicType = MakeLogicType<
+ modelsSceneLogicValues,
+ modelsSceneLogicActions,
+ Record<string, any>,
+ modelsSceneLogicMeta
+>
+
export const modelsSceneLogic = kea<modelsSceneLogicType>([
path(['scenes', 'models', 'modelsSceneLogic']),
connect(() => ({
diff --git a/frontend/src/scenes/models/nodeDetailSceneLogic.ts b/frontend/src/scenes/models/nodeDetailSceneLogic.ts
index 5672d53b6554..0ad7f9462f56 100644
--- a/frontend/src/scenes/models/nodeDetailSceneLogic.ts
+++ b/frontend/src/scenes/models/nodeDetailSceneLogic.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, { CountedPaginatedResponse } from 'lib/api'
@@ -7,7 +7,7 @@ import { urls } from 'scenes/urls'
import { Breadcrumb, DataModelingEdge, DataModelingJob, DataModelingNode, DataWarehouseSavedQuery } from '~/types'
-import type { nodeDetailSceneLogicType } from './nodeDetailSceneLogicType'
+import type { DataModelingNodeType } from '../../types'
export interface NodeDetailSceneLogicProps {
id: string
@@ -22,6 +22,177 @@ export interface LineageGraphData {
currentNodeId: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface nodeDetailSceneLogicValues {
+ breadcrumbs: Breadcrumb[]
+ effectiveLastRunAt: string | null
+ effectiveLastRunStatus: string | null
+ hasMaterialization: boolean
+ jobsOffset: number
+ lineageGraph: LineageGraphData | null
+ lineageGraphLoading: boolean
+ lineageModalOpen: boolean
+ materializationJobs: CountedPaginatedResponse<DataModelingJob> | null
+ materializationJobsLoading: boolean
+ node: DataModelingNode | null
+ nodeLoading: boolean
+ nodeType: DataModelingNodeType | null
+ savedQuery: DataWarehouseSavedQuery | null
+ savedQueryLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+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[][]
+ }
+ ) => {
+ 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[][]
+ }
+ } // dataWarehouseViewsLogic
+ closeLineageModal: () => {
+ value: true
+ }
+ loadLineageGraph: () => any
+ loadLineageGraphFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadLineageGraphSuccess: (
+ lineageGraph: {
+ currentNodeId: string
+ edges: DataModelingEdge[]
+ nodes: DataModelingNode[]
+ } | null,
+ payload?: any
+ ) => {
+ lineageGraph: {
+ currentNodeId: string
+ edges: DataModelingEdge[]
+ nodes: DataModelingNode[]
+ } | null
+ payload?: any
+ }
+ loadMaterializationJobs: () => any
+ loadMaterializationJobsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadMaterializationJobsSuccess: (
+ materializationJobs: CountedPaginatedResponse<DataModelingJob> | null,
+ payload?: any
+ ) => {
+ materializationJobs: CountedPaginatedResponse<DataModelingJob> | null
+ payload?: any
+ }
+ loadNode: () => any
+ loadNodeFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadNodeSuccess: (
+ node: DataModelingNode,
+ payload?: any
+ ) => {
+ node: DataModelingNode
+ payload?: any
+ }
+ loadSavedQuery: () => any
+ loadSavedQueryFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSavedQuerySuccess: (
+ savedQuery: DataWarehouseSavedQuery | null,
+ payload?: any
+ ) => {
+ savedQuery: DataWarehouseSavedQuery | null
+ payload?: any
+ }
+ openLineageModal: () => {
+ value: true
+ }
+ setJobsOffset: (offset: number) => {
+ offset: number
+ }
+ updateNodeDescription: (description: string) => {
+ description: string
+ }
+ updateNodeDescriptionFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateNodeDescriptionSuccess: (
+ node: DataModelingNode,
+ payload?: {
+ description: string
+ }
+ ) => {
+ node: DataModelingNode
+ payload?: {
+ description: string
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface nodeDetailSceneLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ breadcrumbs: (node: DataModelingNode | null) => Breadcrumb[]
+ nodeType: (node: DataModelingNode | null) => DataModelingNodeType | null
+ hasMaterialization: (node: DataModelingNode | null, savedQuery: DataWarehouseSavedQuery | null) => boolean
+ effectiveLastRunAt: (
+ node: DataModelingNode | null,
+ materializationJobs: CountedPaginatedResponse<DataModelingJob> | null
+ ) => string | null
+ effectiveLastRunStatus: (
+ node: DataModelingNode | null,
+ materializationJobs: CountedPaginatedResponse<DataModelingJob> | null
+ ) => string | null
+ }
+}
+
+export type nodeDetailSceneLogicType = MakeLogicType<
+ nodeDetailSceneLogicValues,
+ nodeDetailSceneLogicActions,
+ NodeDetailSceneLogicProps,
+ nodeDetailSceneLogicMeta
+>
+
export const nodeDetailSceneLogic = kea<nodeDetailSceneLogicType>([
props({} as NodeDetailSceneLogicProps),
key((props) => props.id),
diff --git a/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts b/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts
index 2041d7d33844..e90ec8b61828 100644
--- a/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts
+++ b/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts
@@ -363,7 +363,7 @@ export interface notebookLogicActions {
} // notebooksModel
openSidePanel: (
tab: SidePanelTab,
- options?: string
+ options?: string | undefined
) => {
options: string | undefined
tab: SidePanelTab
diff --git a/frontend/src/scenes/notebooks/NotebookPanel/notebookPanelLogic.ts b/frontend/src/scenes/notebooks/NotebookPanel/notebookPanelLogic.ts
index 8c9e59711381..56412423abf3 100644
--- a/frontend/src/scenes/notebooks/NotebookPanel/notebookPanelLogic.ts
+++ b/frontend/src/scenes/notebooks/NotebookPanel/notebookPanelLogic.ts
@@ -22,12 +22,12 @@ export interface notebookPanelLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface notebookPanelLogicActions {
- closeSidePanel: (tab?: SidePanelTab) => {
+ closeSidePanel: (tab?: SidePanelTab | undefined) => {
tab: SidePanelTab | undefined
} // sidePanelStateLogic
openSidePanel: (
tab: SidePanelTab,
- options?: string
+ options?: string | undefined
) => {
options: string | undefined
tab: SidePanelTab
diff --git a/frontend/src/scenes/oauth/oauthAuthorizeLogic.ts b/frontend/src/scenes/oauth/oauthAuthorizeLogic.ts
index 830405645037..876662621f2f 100644
--- a/frontend/src/scenes/oauth/oauthAuthorizeLogic.ts
+++ b/frontend/src/scenes/oauth/oauthAuthorizeLogic.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 { loaders } from 'kea-loaders'
import { router, urlToAction } from 'kea-router'
@@ -11,8 +12,6 @@ import { userLogic } from 'scenes/userLogic'
import type { OAuthApplicationPublicMetadata, OrganizationBasicType, TeamBasicType, UserType } from '~/types'
-import type { oauthAuthorizeLogicType } from './oauthAuthorizeLogicType'
-
export type OAuthAuthorizationFormValues = {
scoped_organizations: number[]
scoped_teams: number[]
@@ -146,6 +145,220 @@ const oauthAuthorize = async (
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface oauthAuthorizeLogicValues {
+ user: UserType | null // userLogic
+ adjustableScopeRows: OAuthScopeRow[]
+ allOrganizations: OrganizationBasicType[]
+ allScopesRequired: boolean
+ allTeams: TeamBasicType[] | null
+ allTeamsLoading: boolean
+ authorizationComplete: boolean
+ consentResourceScopes: string[]
+ effectiveScopes: string[]
+ filteredTeams: TeamBasicType[] | null
+ identityScopeDescriptions: string[]
+ isCanceling: boolean
+ isMcpResource: boolean
+ isOauthAuthorizationSubmitting: boolean
+ isOauthAuthorizationValid: boolean
+ isRedirecting: boolean
+ newProjectLoading: boolean
+ oauthApplication: OAuthApplicationPublicMetadata | null
+ oauthApplicationLoading: boolean
+ oauthAuthorization: OAuthAuthorizationFormValues
+ oauthAuthorizationAllErrors: Record<string, any>
+ oauthAuthorizationChanged: boolean
+ oauthAuthorizationErrors: DeepPartialMap<OAuthAuthorizationFormValues, ValidationErrorType>
+ oauthAuthorizationHasErrors: boolean
+ oauthAuthorizationManualErrors: Record<string, any>
+ oauthAuthorizationTouched: boolean
+ oauthAuthorizationTouches: Record<string, boolean>
+ oauthAuthorizationValidationErrors: DeepPartialMap<OAuthAuthorizationFormValues, ValidationErrorType>
+ redirectDomain: string
+ redirectUrl: string
+ requiredAccessLevel: 'organization' | 'team' | null
+ requiredScopeLevels: Map<string, RequiredLevel>
+ requiredScopeRows: OAuthScopeRow[]
+ scopeAccessSelections: {
+ bulk: ScopeAccessLevel | null
+ overrides: Record<string, ScopeAccessLevel>
+ }
+ scopeRows: OAuthScopeRow[]
+ scopes: string[]
+ scopesWereDefaulted: boolean
+ selectedOrganization: string | null
+ showCreateProject: boolean
+ showOauthAuthorizationErrors: boolean
+ showReadOnlyBulkAction: boolean
+ sortedTeams: TeamBasicType[] | null
+ teamHint: number | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface oauthAuthorizeLogicActions {
+ cancel: () => {}
+ createNewProject: (name: string) => {
+ name: string
+ }
+ loadAllTeams: () => any
+ loadAllTeamsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAllTeamsSuccess: (
+ allTeams: TeamBasicType[],
+ payload?: any
+ ) => {
+ allTeams: TeamBasicType[]
+ payload?: any
+ }
+ loadOAuthApplication: () => any
+ loadOAuthApplicationFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadOAuthApplicationSuccess: (
+ oauthApplication: OAuthApplicationPublicMetadata | null,
+ payload?: any
+ ) => {
+ oauthApplication: OAuthApplicationPublicMetadata | null
+ payload?: any
+ }
+ resetOauthAuthorization: (values?: OAuthAuthorizationFormValues) => {
+ values?: OAuthAuthorizationFormValues
+ }
+ setAllScopeAccess: (level: ScopeAccessLevel) => {
+ level: ScopeAccessLevel
+ }
+ setAuthorizationComplete: (complete: boolean) => {
+ complete: boolean
+ }
+ setCanceling: (canceling: boolean) => {
+ canceling: boolean
+ }
+ setIsMcpResource: (isMcpResource: boolean) => {
+ isMcpResource: boolean
+ }
+ setNewProjectLoading: (loading: boolean) => {
+ loading: boolean
+ }
+ setOauthAuthorizationManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setOauthAuthorizationValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setOauthAuthorizationValues: (values: DeepPartial<OAuthAuthorizationFormValues>) => {
+ values: DeepPartial<OAuthAuthorizationFormValues>
+ }
+ setRedirecting: (redirectUrl: string) => {
+ redirectUrl: string
+ }
+ setRequiredAccessLevel: (requiredAccessLevel: 'organization' | 'team' | null) => {
+ requiredAccessLevel: 'organization' | 'team' | null
+ }
+ setScopeAccess: (
+ scopeObject: string,
+ level: ScopeAccessLevel
+ ) => {
+ level: ScopeAccessLevel
+ scopeObject: string
+ }
+ setScopes: (scopes: string[]) => {
+ scopes: string[]
+ }
+ setScopesWereDefaulted: (scopesWereDefaulted: boolean) => {
+ scopesWereDefaulted: boolean
+ }
+ setSelectedOrganization: (
+ organizationId: string,
+ preferredTeamId?: number
+ ) => {
+ organizationId: string
+ preferredTeamId: number | undefined
+ }
+ setShowCreateProject: (show: boolean) => {
+ show: boolean
+ }
+ setTeamHint: (teamId: number | null) => {
+ teamId: number | null
+ }
+ submitOauthAuthorization: () => {
+ value: boolean
+ }
+ submitOauthAuthorizationFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitOauthAuthorizationRequest: (oauthAuthorization: OAuthAuthorizationFormValues) => {
+ oauthAuthorization: OAuthAuthorizationFormValues
+ }
+ submitOauthAuthorizationSuccess: (oauthAuthorization: OAuthAuthorizationFormValues) => {
+ oauthAuthorization: OAuthAuthorizationFormValues
+ }
+ touchOauthAuthorizationField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface oauthAuthorizeLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ allOrganizations: (user: UserType | null) => OrganizationBasicType[]
+ sortedTeams: (
+ allTeams: TeamBasicType[] | null,
+ allOrganizations: OrganizationBasicType[],
+ user: UserType | null
+ ) => TeamBasicType[] | null
+ filteredTeams: (
+ sortedTeams: TeamBasicType[] | null,
+ selectedOrganization: string | null
+ ) => TeamBasicType[] | null
+ identityScopeDescriptions: (scopes: string[]) => string[]
+ requiredScopeLevels: (oauthApplication: OAuthApplicationPublicMetadata | null) => Map<string, RequiredLevel>
+ consentResourceScopes: (scopes: string[], oauthApplication: OAuthApplicationPublicMetadata | null) => string[]
+ scopeRows: (
+ consentResourceScopes: string[],
+ scopeAccessSelections: {
+ bulk: ScopeAccessLevel | null
+ overrides: Record<string, ScopeAccessLevel>
+ },
+ requiredScopeLevels: Map<string, RequiredLevel>
+ ) => OAuthScopeRow[]
+ requiredScopeRows: (scopeRows: OAuthScopeRow[]) => OAuthScopeRow[]
+ adjustableScopeRows: (scopeRows: OAuthScopeRow[]) => OAuthScopeRow[]
+ allScopesRequired: (scopeRows: OAuthScopeRow[]) => boolean
+ showReadOnlyBulkAction: (adjustableScopeRows: OAuthScopeRow[]) => boolean
+ effectiveScopes: (
+ scopes: string[],
+ scopeRows: OAuthScopeRow[],
+ oauthApplication: OAuthApplicationPublicMetadata | null
+ ) => string[]
+ redirectDomain: (oauthApplication: OAuthApplicationPublicMetadata | null) => string
+ }
+}
+
+export type oauthAuthorizeLogicType = MakeLogicType<
+ oauthAuthorizeLogicValues,
+ oauthAuthorizeLogicActions,
+ Record<string, any>,
+ oauthAuthorizeLogicMeta
+>
+
export const oauthAuthorizeLogic = kea<oauthAuthorizeLogicType>([
path(['oauth', 'authorize']),
connect(() => ({
diff --git a/frontend/src/scenes/retention/retentionGraphLogic.ts b/frontend/src/scenes/retention/retentionGraphLogic.ts
index 4629f500c624..a44a2c57d3bf 100644
--- a/frontend/src/scenes/retention/retentionGraphLogic.ts
+++ b/frontend/src/scenes/retention/retentionGraphLogic.ts
@@ -1,4 +1,4 @@
-import { connect, kea, key, path, props, selectors } from 'kea'
+import { MakeLogicType, connect, kea, key, path, props, selectors } from 'kea'
import { dayjs } from 'lib/dayjs'
import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
@@ -10,13 +10,118 @@ import { teamLogic } from 'scenes/teamLogic'
import { DateRange, RetentionFilter, RetentionQuery } from '~/queries/schema/schema-general'
import { InsightLogicProps, RetentionPeriod } from '~/types'
+import type {
+ FunnelsQuery,
+ LifecycleQuery,
+ PathsQuery,
+ StickinessQuery,
+ TrendsQuery,
+ WebOverviewQuery,
+ WebStatsTableQuery,
+} from '../../queries/schema/schema-general'
+import type { LabelGroupType } from '../../types'
import { dateOptionToTimeIntervalMap } from './constants'
-import type { retentionGraphLogicType } from './retentionGraphLogicType'
import { MeanRetentionValue, retentionLogic } from './retentionLogic'
import { formatRetentionCohortLabel } from './utils'
const DEFAULT_RETENTION_LOGIC_KEY = 'default_retention_key'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface retentionGraphLogicValues {
+ dateRange: DateRange | null | undefined // insightVizDataLogic
+ labelGroupType: LabelGroupType // insightVizDataLogic
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null // insightVizDataLogic
+ retentionFilter: RetentionFilter | null // insightVizDataLogic
+ breakdownDisplayNames: Record<string, string> // retentionLogic
+ filteredResults: ProcessedRetentionPayload[] // retentionLogic
+ hasValidBreakdown: boolean // retentionLogic
+ isPropertyValueAggregation: boolean // retentionLogic
+ results: ProcessedRetentionPayload[] // retentionLogic
+ retentionMeans: Record<string, MeanRetentionValue> // retentionLogic
+ selectedBreakdownValue: boolean | number | string | null // retentionLogic
+ timezone: string // teamLogic
+ filteredTrendSeries: RetentionTrendPayload[]
+ incompletenessOffsetFromEnd: number
+ intervalViewSeries: RetentionTrendPayload[]
+ shouldShowMeanPerBreakdown: boolean
+ showTrendLines: boolean
+ trendSeries: RetentionTrendPayload[]
+ xAxisLabels: string[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface retentionGraphLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ trendSeries: (
+ results: ProcessedRetentionPayload[],
+ retentionFilter: RetentionFilter | null,
+ isPropertyValueAggregation: boolean
+ ) => RetentionTrendPayload[]
+ intervalViewSeries: (
+ filteredResults: ProcessedRetentionPayload[],
+ retentionFilter: RetentionFilter | null,
+ hasValidBreakdown: boolean,
+ breakdownDisplayNames: Record<string, string>,
+ isPropertyValueAggregation: boolean
+ ) => RetentionTrendPayload[]
+ showTrendLines: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean
+ incompletenessOffsetFromEnd: (
+ dateRange: DateRange | null | undefined,
+ retentionFilter: RetentionFilter | null,
+ trendSeries: RetentionTrendPayload[],
+ timezone: string
+ ) => number
+ shouldShowMeanPerBreakdown: (
+ hasValidBreakdown: boolean,
+ selectedBreakdownValue: boolean | number | string | null
+ ) => boolean
+ filteredTrendSeries: (
+ hasValidBreakdown: boolean,
+ trendSeries: RetentionTrendPayload[],
+ selectedBreakdownValue: boolean | number | string | null,
+ retentionMeans: Record<string, MeanRetentionValue>,
+ retentionFilter: RetentionFilter | null,
+ shouldShowMeanPerBreakdown: boolean,
+ breakdownDisplayNames: Record<string, string>,
+ intervalViewSeries: RetentionTrendPayload[],
+ isPropertyValueAggregation: boolean
+ ) => RetentionTrendPayload[]
+ xAxisLabels: (
+ retentionFilter: RetentionFilter | null,
+ results: ProcessedRetentionPayload[],
+ filteredResults: ProcessedRetentionPayload[]
+ ) => string[]
+ }
+}
+
+export type retentionGraphLogicType = MakeLogicType<
+ retentionGraphLogicValues,
+ {},
+ InsightLogicProps,
+ retentionGraphLogicMeta
+>
+
export const retentionGraphLogic = kea<retentionGraphLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps(DEFAULT_RETENTION_LOGIC_KEY)),
diff --git a/frontend/src/scenes/retention/retentionLogic.ts b/frontend/src/scenes/retention/retentionLogic.ts
index f9c5ef5cb1a3..8313b22885c6 100644
--- a/frontend/src/scenes/retention/retentionLogic.ts
+++ b/frontend/src/scenes/retention/retentionLogic.ts
@@ -1,5 +1,5 @@
import { mean, sum } from 'd3'
-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 { CUSTOM_OPTION_KEY } from 'lib/components/DateFilter/types'
import { FEATURE_FLAGS } from 'lib/constants'
@@ -17,7 +17,22 @@ import { RetentionFilter, RetentionResult } from '~/queries/schema/schema-genera
import { isRetentionQuery, hasBreakdownFilter } from '~/queries/utils'
import { BreakdownKeyType, CohortType, DateMappingOption, InsightLogicProps, RetentionPeriod } from '~/types'
-import type { retentionLogicType } from './retentionLogicType'
+import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
+import type {
+ BreakdownFilter,
+ DataNode,
+ DateRange,
+ FunnelsQuery,
+ InsightFilter,
+ LifecycleQuery,
+ PathsQuery,
+ RetentionQuery,
+ StickinessQuery,
+ TrendsQuery,
+ WebOverviewQuery,
+ WebStatsTableQuery,
+} from '../../queries/schema/schema-general'
+import type { QuerySourceUpdate } from '../insights/insightVizDataLogic'
const DEFAULT_RETENTION_LOGIC_KEY = 'default_retention_key'
export const OVERALL_MEAN_KEY = '__overall__'
@@ -34,6 +49,117 @@ export interface MeanRetentionValue {
isOverall?: boolean
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface retentionLogicValues {
+ cohortsById: Partial<Record<number | string, CohortType>> // cohortsModel
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ breakdownFilter: BreakdownFilter | null | undefined // insightVizDataLogic
+ dateRange: DateRange | null | undefined // insightVizDataLogic
+ insightData: Record<string, any> // insightVizDataLogic
+ insightQuery: DataNode<Record<string, any>> // insightVizDataLogic
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null // insightVizDataLogic
+ retentionFilter: RetentionFilter | null // insightVizDataLogic
+ timezone: string // teamLogic
+ breakdownDisplayNames: Record<string, string>
+ breakdownValues: (number | string | null | undefined)[]
+ dateMappings: DateMappingOption[]
+ filteredResults: ProcessedRetentionPayload[]
+ hasValidBreakdown: boolean
+ isPropertyValueAggregation: boolean
+ isRetentionDWHEnabled: boolean
+ localCustomBrackets: (number | string)[]
+ results: ProcessedRetentionPayload[]
+ retentionMeans: Record<string, MeanRetentionValue>
+ selectedBreakdownValue: boolean | number | string | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface retentionLogicActions {
+ updateBreakdownFilter: (breakdownFilter: BreakdownFilter) => {
+ breakdownFilter: BreakdownFilter
+ } // insightVizDataLogic
+ updateDateRange: (
+ dateRange: DateRange,
+ ignoreDebounce?: boolean | undefined
+ ) => {
+ dateRange: DateRange
+ ignoreDebounce: boolean
+ } // insightVizDataLogic
+ updateInsightFilter: (insightFilter: InsightFilter) => {
+ insightFilter: InsightFilter
+ } // insightVizDataLogic
+ updateQuerySource: (querySource: QuerySourceUpdate) => {
+ querySource: QuerySourceUpdate
+ } // insightVizDataLogic
+ addCustomBracket: () => {}
+ removeCustomBracket: (index: number) => {
+ index: number
+ }
+ setLocalCustomBrackets: (brackets: (number | string)[]) => {
+ brackets: (number | string)[]
+ }
+ setSelectedBreakdownValue: (value: boolean | number | string | null) => {
+ value: boolean | number | string | null
+ }
+ updateLocalCustomBracket: (
+ index: number,
+ value: number | undefined
+ ) => {
+ index: number
+ value: number | undefined
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface retentionLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ hasValidBreakdown: (breakdownFilter: BreakdownFilter | null | undefined) => boolean
+ isRetentionDWHEnabled: (featureFlags: FeatureFlagsSet) => boolean
+ isPropertyValueAggregation: (retentionFilter: RetentionFilter | null) => boolean
+ results: (
+ insightQuery: DataNode<Record<string, any>>,
+ insightData: Record<string, any>,
+ retentionFilter: RetentionFilter | null,
+ timezone: string,
+ isPropertyValueAggregation: boolean
+ ) => ProcessedRetentionPayload[]
+ filteredResults: (
+ results: ProcessedRetentionPayload[],
+ selectedBreakdownValue: boolean | number | string | null
+ ) => ProcessedRetentionPayload[]
+ retentionMeans: (
+ results: ProcessedRetentionPayload[],
+ retentionFilter: RetentionFilter | null,
+ hasValidBreakdown: boolean,
+ isPropertyValueAggregation: boolean
+ ) => Record<string, MeanRetentionValue>
+ dateMappings: (retentionFilter: RetentionFilter | null) => DateMappingOption[]
+ breakdownValues: (results: ProcessedRetentionPayload[]) => (number | string | null | undefined)[]
+ breakdownDisplayNames: (
+ breakdownValues: (number | string | null | undefined)[],
+ breakdownFilter: BreakdownFilter | null | undefined,
+ cohortsById: Partial<Record<number | string, CohortType>>
+ ) => Record<string, string>
+ }
+}
+
+export type retentionLogicType = MakeLogicType<
+ retentionLogicValues,
+ retentionLogicActions,
+ InsightLogicProps,
+ retentionLogicMeta
+>
+
export const retentionLogic = kea<retentionLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps(DEFAULT_RETENTION_LOGIC_KEY)),
@@ -149,10 +275,15 @@ export const retentionLogic = kea<retentionLogicType>([
],
}),
selectors({
- hasValidBreakdown: [(s) => [s.breakdownFilter], (breakdownFilter) => hasBreakdownFilter(breakdownFilter)],
+ hasValidBreakdown: [
+ (s) => [s.breakdownFilter],
+ (breakdownFilter: null | import('~/queries/schema/schema-general').BreakdownFilter | undefined) =>
+ hasBreakdownFilter(breakdownFilter),
+ ],
isRetentionDWHEnabled: [
(s) => [s.featureFlags],
- (featureFlags): boolean => !!featureFlags[FEATURE_FLAGS.PRODUCT_ANALYTICS_RETENTION_DWH],
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet): boolean =>
+ !!featureFlags[FEATURE_FLAGS.PRODUCT_ANALYTICS_RETENTION_DWH],
],
isPropertyValueAggregation: [
(s) => [s.retentionFilter],
@@ -162,11 +293,11 @@ export const retentionLogic = kea<retentionLogicType>([
results: [
(s) => [s.insightQuery, s.insightData, s.retentionFilter, s.timezone, s.isPropertyValueAggregation],
(
- insightQuery,
- insightData,
- retentionFilter,
- timezone,
- isPropertyValueAggregation
+ insightQuery: import('~/queries/schema/schema-general').DataNode<Record<string, any>>,
+ insightData: Record<string, any>,
+ retentionFilter: RetentionFilter | null,
+ timezone: string,
+ isPropertyValueAggregation: boolean
): ProcessedRetentionPayload[] => {
if (isPropertyValueAggregation && !retentionFilter?.aggregationProperty) {
return []
@@ -216,7 +347,7 @@ export const retentionLogic = kea<retentionLogicType>([
filteredResults: [
(s) => [s.results, s.selectedBreakdownValue],
- (results, selectedBreakdownValue) => {
+ (results: ProcessedRetentionPayload[], selectedBreakdownValue: boolean | number | string | null) => {
if (!results || results.length === 0) {
return []
}
@@ -373,7 +504,7 @@ export const retentionLogic = kea<retentionLogicType>([
],
breakdownValues: [
(s) => [s.results],
- (results) => {
+ (results: ProcessedRetentionPayload[]) => {
if (!results || results.length === 0) {
return []
}
diff --git a/frontend/src/scenes/retention/retentionModalLogic.ts b/frontend/src/scenes/retention/retentionModalLogic.ts
index 14b0d6c526ec..edafd00ba78f 100644
--- a/frontend/src/scenes/retention/retentionModalLogic.ts
+++ b/frontend/src/scenes/retention/retentionModalLogic.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 { router } from 'kea-router'
import { lemonToast } from '@posthog/lemon-ui'
@@ -22,11 +22,120 @@ import {
import { isInsightActorsQuery, isLifecycleQuery, isRetentionQuery, isStickinessQuery } from '~/queries/utils'
import { InsightLogicProps } from '~/types'
-import type { retentionModalLogicType } from './retentionModalLogicType'
+import type { DataColorTheme } from '../../lib/colors'
+import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
+import type {
+ FunnelsQuery,
+ LifecycleQuery,
+ PathsQuery,
+ RetentionFilter,
+ StickinessQuery,
+ TrendsQuery,
+ WebOverviewQuery,
+ WebStatsTableQuery,
+} from '../../queries/schema/schema-general'
import { retentionPeopleLogic } from './retentionPeopleLogic'
const DEFAULT_RETENTION_LOGIC_KEY = 'default_retention_key'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface retentionModalLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun // groupsModel
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null // insightVizDataLogic
+ retentionFilter: RetentionFilter | null // insightVizDataLogic
+ theme: DataColorTheme | null // insightVizDataLogic
+ actorsQuery: ActorsQuery | null
+ aggregationTargetLabel: Noun
+ exploreUrl: string | null
+ insightEventsQueryUrl: string | null
+ isCohortModalOpen: boolean
+ selectedBreakdownValue: number | string | null
+ selectedColumnIndex: number | null
+ selectedInterval: number | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface retentionModalLogicActions {
+ loadPeople: (
+ selectedInterval: number,
+ breakdownValue?: number | string | null | undefined
+ ) => {
+ breakdownValue: number | string | null | undefined
+ selectedInterval: number
+ } // retentionPeopleLogic
+ closeModal: () => {
+ value: true
+ }
+ openModal: (
+ rowIndex: number,
+ breakdownValue?: number | string | null,
+ columnIndex?: number | null
+ ) => {
+ breakdownValue: number | string | null | undefined
+ columnIndex: number | null | undefined
+ rowIndex: number
+ }
+ saveAsCohort: (cohortName: string) => {
+ cohortName: string
+ }
+ setIsCohortModalOpen: (isOpen: boolean) => {
+ isOpen: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface retentionModalLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ aggregationTargetLabel: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null,
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun
+ ) => Noun
+ actorsQuery: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null,
+ selectedInterval: number | null,
+ selectedBreakdownValue: number | string | null
+ ) => ActorsQuery | null
+ insightEventsQueryUrl: (actorsQuery: ActorsQuery | null) => string | null
+ exploreUrl: (actorsQuery: ActorsQuery | null) => string | null
+ }
+}
+
+export type retentionModalLogicType = MakeLogicType<
+ retentionModalLogicValues,
+ retentionModalLogicActions,
+ InsightLogicProps,
+ retentionModalLogicMeta
+>
+
export const retentionModalLogic = kea<retentionModalLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps(DEFAULT_RETENTION_LOGIC_KEY)),
@@ -87,7 +196,19 @@ export const retentionModalLogic = kea<retentionModalLogicType>([
selectors({
aggregationTargetLabel: [
(s) => [s.querySource, s.aggregationLabel],
- (querySource, aggregationLabel): Noun => {
+ (
+ querySource:
+ | RetentionQuery
+ | null
+ | import('~/queries/schema/schema-general').FunnelsQuery
+ | import('~/queries/schema/schema-general').LifecycleQuery
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').StickinessQuery
+ | import('~/queries/schema/schema-general').TrendsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery,
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun
+ ): Noun => {
const aggregation_group_type_index =
isLifecycleQuery(querySource) || isStickinessQuery(querySource)
? undefined
@@ -110,7 +231,7 @@ export const retentionModalLogic = kea<retentionModalLogicType>([
],
insightEventsQueryUrl: [
(s) => [s.actorsQuery],
- (actorsQuery): string | null => {
+ (actorsQuery: ActorsQuery | null): string | null => {
if (!actorsQuery) {
return null
}
diff --git a/frontend/src/scenes/retention/retentionPeopleLogic.ts b/frontend/src/scenes/retention/retentionPeopleLogic.ts
index 1b4c7e4db333..78e30219b399 100644
--- a/frontend/src/scenes/retention/retentionPeopleLogic.ts
+++ b/frontend/src/scenes/retention/retentionPeopleLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
@@ -11,10 +11,170 @@ import { queryNodeToFilter } from '~/queries/nodes/InsightQuery/utils/queryNodeT
import { NodeKind, RetentionQuery } from '~/queries/schema/schema-general'
import { InsightLogicProps } from '~/types'
-import type { retentionPeopleLogicType } from './retentionPeopleLogicType'
+import type {
+ DataNode,
+ ErrorTrackingQueryResponse,
+ FunnelsQuery,
+ HogQLAutocompleteResponse,
+ HogQLMetadataResponse,
+ HogQLQueryResponse,
+ HogQueryResponse,
+ LifecycleQuery,
+ LogAttributesQueryResponse,
+ LogValuesQueryResponse,
+ MetricsQueryResponse,
+ PathsQuery,
+ RefreshType,
+ SessionsQueryResponse,
+ StickinessQuery,
+ TraceSpansAggregationQueryResponse,
+ TraceSpansAttributeBreakdownQueryResponse,
+ TraceSpansQueryResponse,
+ TrendsQuery,
+ WebOverviewQuery,
+ WebStatsTableQuery,
+} from '../../queries/schema/schema-general'
+import type { FilterType } from '../../types'
const DEFAULT_RETENTION_LOGIC_KEY = 'default_retention_key'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface retentionPeopleLogicValues {
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null // insightVizDataLogic
+ apiFilters: Partial<FilterType>
+ people: RetentionTablePeoplePayload
+ peopleLoading: boolean
+ peopleLoadingMore: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface retentionPeopleLogicActions {
+ loadDataSuccess: (
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ | undefined,
+ payload?:
+ | {
+ overrideQuery: DataNode<Record<string, any>> | undefined
+ pollOnly: boolean
+ queryId: string
+ refresh: RefreshType | undefined
+ }
+ | undefined
+ ) => {
+ payload?: {
+ overrideQuery: DataNode<Record<string, any>> | undefined
+ pollOnly: boolean
+ queryId: string
+ refresh: RefreshType | undefined
+ }
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ | undefined
+ } // insightVizDataLogic
+ clearPeople: () => {
+ value: true
+ }
+ loadMorePeople: (
+ selectedInterval: number,
+ breakdownValue?: number | string | null
+ ) => {
+ breakdownValue: number | string | null | undefined
+ selectedInterval: number
+ }
+ loadMorePeopleSuccess: (payload: RetentionTablePeoplePayload) => {
+ payload: RetentionTablePeoplePayload
+ }
+ loadPeople: (
+ selectedInterval: number,
+ breakdownValue?: number | string | null
+ ) => {
+ breakdownValue: number | string | null | undefined
+ selectedInterval: number
+ }
+ loadPeopleFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPeopleSuccess: (
+ people: RetentionTablePeoplePayload,
+ payload?: {
+ breakdownValue: number | string | null | undefined
+ selectedInterval: number
+ }
+ ) => {
+ people: RetentionTablePeoplePayload
+ payload?: {
+ breakdownValue: number | string | null | undefined
+ selectedInterval: number
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface retentionPeopleLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ apiFilters: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => Partial<FilterType>
+ }
+}
+
+export type retentionPeopleLogicType = MakeLogicType<
+ retentionPeopleLogicValues,
+ retentionPeopleLogicActions,
+ InsightLogicProps,
+ retentionPeopleLogicMeta
+>
+
export const retentionPeopleLogic = kea<retentionPeopleLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps(DEFAULT_RETENTION_LOGIC_KEY)),
@@ -64,7 +224,21 @@ export const retentionPeopleLogic = kea<retentionPeopleLogicType>([
],
}),
selectors(() => ({
- apiFilters: [(s) => [s.querySource], (querySource) => (querySource ? queryNodeToFilter(querySource) : {})],
+ apiFilters: [
+ (s) => [s.querySource],
+ (
+ querySource:
+ | RetentionQuery
+ | null
+ | import('~/queries/schema/schema-general').FunnelsQuery
+ | import('~/queries/schema/schema-general').LifecycleQuery
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').StickinessQuery
+ | import('~/queries/schema/schema-general').TrendsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (querySource ? queryNodeToFilter(querySource) : {}),
+ ],
})),
listeners(({ actions, values }) => ({
loadDataSuccess: () => {
diff --git a/frontend/src/scenes/retention/retentionTableLogic.ts b/frontend/src/scenes/retention/retentionTableLogic.ts
index 96925686a9f6..50afb51e9bba 100644
--- a/frontend/src/scenes/retention/retentionTableLogic.ts
+++ b/frontend/src/scenes/retention/retentionTableLogic.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 { capitalizeFirstLetter } from 'lib/utils/strings'
import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
@@ -8,14 +8,96 @@ import { InsightQueryNode } from '~/queries/schema/schema-general'
import { isRetentionQuery } from '~/queries/utils'
import { InsightLogicProps, InsightType } from '~/types'
+import type { DataColorTheme } from '../../lib/colors'
+import type { DataNode, DateRange, RetentionFilter, VizSpecificOptions } from '../../queries/schema/schema-general'
import { dateOptionPlurals } from './constants'
import { retentionLogic } from './retentionLogic'
-import type { retentionTableLogicType } from './retentionTableLogicType'
+import type { MeanRetentionValue } from './retentionLogic'
import { NO_BREAKDOWN_VALUE, ProcessedRetentionPayload, RetentionTableRow } from './types'
import { formatRetentionCohortLabel } from './utils'
const DEFAULT_RETENTION_LOGIC_KEY = 'default_retention_key'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface retentionTableLogicValues {
+ dateRange: DateRange | null | undefined // insightVizDataLogic
+ insightQuery: DataNode<Record<string, any>> // insightVizDataLogic
+ retentionFilter: RetentionFilter | null // insightVizDataLogic
+ theme: DataColorTheme | null // insightVizDataLogic
+ vizSpecificOptions: VizSpecificOptions | null | undefined // insightVizDataLogic
+ breakdownDisplayNames: Record<string, string> // retentionLogic
+ filteredResults: ProcessedRetentionPayload[] // retentionLogic
+ isPropertyValueAggregation: boolean // retentionLogic
+ results: ProcessedRetentionPayload[] // retentionLogic
+ retentionMeans: Record<string, MeanRetentionValue> // retentionLogic
+ selectedBreakdownValue: boolean | number | string | null // retentionLogic
+ expandedBreakdowns: Record<string, boolean>
+ hideSizeColumn: boolean | undefined
+ hoveredColumn: number | null
+ retentionVizOptions:
+ | {
+ hideLineGraph?: boolean | undefined
+ hideSizeColumn?: boolean | undefined
+ useSmallLayout?: boolean | undefined
+ }
+ | undefined
+ tableHeaders: string[]
+ tableRows: RetentionTableRow[]
+ tableRowsSplitByBreakdownValue: Record<string, RetentionTableRow[]>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface retentionTableLogicActions {
+ setSelectedBreakdownValue: (value: boolean | number | string | null) => {
+ value: boolean | number | string | null
+ } // retentionLogic
+ setExpandedBreakdowns: (expandedBreakdowns: Record<string, boolean>) => {
+ expandedBreakdowns: Record<string, boolean>
+ }
+ setHoveredColumn: (columnIndex: number | null) => {
+ columnIndex: number | null
+ }
+ toggleBreakdown: (breakdownValue: string) => {
+ breakdownValue: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface retentionTableLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ retentionVizOptions: (vizSpecificOptions: VizSpecificOptions | null | undefined) =>
+ | {
+ hideLineGraph?: boolean | undefined
+ hideSizeColumn?: boolean | undefined
+ useSmallLayout?: boolean | undefined
+ }
+ | undefined
+ hideSizeColumn: (
+ retentionVizOptions:
+ | {
+ hideLineGraph?: boolean | undefined
+ hideSizeColumn?: boolean | undefined
+ useSmallLayout?: boolean | undefined
+ }
+ | undefined
+ ) => boolean | undefined
+ tableRows: (
+ filteredResults: ProcessedRetentionPayload[],
+ retentionFilter: RetentionFilter | null
+ ) => RetentionTableRow[]
+ tableHeaders: (results: ProcessedRetentionPayload[], insightQuery: DataNode<Record<string, any>>) => string[]
+ tableRowsSplitByBreakdownValue: (tableRows: RetentionTableRow[]) => Record<string, RetentionTableRow[]>
+ }
+}
+
+export type retentionTableLogicType = MakeLogicType<
+ retentionTableLogicValues,
+ retentionTableLogicActions,
+ InsightLogicProps,
+ retentionTableLogicMeta
+>
+
export const retentionTableLogic = kea<retentionTableLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps(DEFAULT_RETENTION_LOGIC_KEY)),
@@ -75,13 +157,28 @@ export const retentionTableLogic = kea<retentionTableLogicType>([
selectors({
retentionVizOptions: [
(s) => [s.vizSpecificOptions],
- (vizSpecificOptions) => vizSpecificOptions?.[InsightType.RETENTION],
+ (vizSpecificOptions: null | import('~/queries/schema/schema-general').VizSpecificOptions | undefined) =>
+ vizSpecificOptions?.[InsightType.RETENTION],
+ ],
+ hideSizeColumn: [
+ (s) => [s.retentionVizOptions],
+ (
+ retentionVizOptions:
+ | {
+ hideLineGraph?: boolean | undefined
+ hideSizeColumn?: boolean | undefined
+ useSmallLayout?: boolean | undefined
+ }
+ | undefined
+ ) => retentionVizOptions?.hideSizeColumn,
],
- hideSizeColumn: [(s) => [s.retentionVizOptions], (retentionVizOptions) => retentionVizOptions?.hideSizeColumn],
tableRows: [
(s) => [s.filteredResults, s.retentionFilter],
- (filteredResults, retentionFilter): RetentionTableRow[] => {
+ (
+ filteredResults: ProcessedRetentionPayload[],
+ retentionFilter: null | import('~/queries/schema/schema-general').RetentionFilter
+ ): RetentionTableRow[] => {
const { period } = retentionFilter || {}
return filteredResults.map((currentResult: ProcessedRetentionPayload) => {
@@ -131,7 +228,7 @@ export const retentionTableLogic = kea<retentionTableLogicType>([
],
tableRowsSplitByBreakdownValue: [
(s) => [s.tableRows],
- (tableRows) => {
+ (tableRows: RetentionTableRow[]) => {
return tableRows.reduce(
(acc, row) => {
const breakdownValue = row.breakdown_value ?? NO_BREAKDOWN_VALUE
diff --git a/frontend/src/scenes/startups/startupProgramLogic.ts b/frontend/src/scenes/startups/startupProgramLogic.ts
index f929be870472..8288c08b737e 100644
--- a/frontend/src/scenes/startups/startupProgramLogic.ts
+++ b/frontend/src/scenes/startups/startupProgramLogic.ts
@@ -1,5 +1,6 @@
-import { actions, connect, kea, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, path, props, reducers, selectors } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import posthog from 'posthog-js'
import { lemonToast } from '@posthog/lemon-ui'
@@ -12,8 +13,8 @@ import { userLogic } from 'scenes/userLogic'
import { BillingType } from '~/types'
+import type { OrganizationType, StartupProgramLabel, UserType } from '../../types'
import { PUBLIC_EMAIL_DOMAINS } from './constants'
-import type { startupProgramLogicType } from './startupProgramLogicType'
import { getYCBatchOptions } from './utils'
export enum StartupProgramType {
@@ -70,6 +71,103 @@ function validateFunding(raised: string | undefined, isYC: boolean): string | un
return undefined
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface startupProgramLogicValues {
+ billing: BillingType | null // billingLogic
+ currentOrganization: OrganizationType | null // organizationLogic
+ currentOrganizationId: string // organizationLogic
+ isAdminOrOwner: boolean | null // organizationLogic
+ user: UserType | null // userLogic
+ currentStartupProgramLabel: StartupProgramLabel | null
+ domainFromEmail: string
+ formSubmitted: boolean
+ isCurrentlyOnStartupPlan: boolean
+ isReferralProgram: boolean
+ isStartupProgramSubmitting: boolean
+ isStartupProgramValid: boolean
+ isYC: boolean
+ referrer: string | undefined
+ referrerDisplayName: string | undefined
+ showStartupProgramErrors: boolean
+ startupProgram: StartupProgramFormValues
+ startupProgramAllErrors: Record<string, any>
+ startupProgramChanged: boolean
+ startupProgramErrors: DeepPartialMap<StartupProgramFormValues, ValidationErrorType>
+ startupProgramHasErrors: boolean
+ startupProgramManualErrors: Record<string, any>
+ startupProgramTouched: boolean
+ startupProgramTouches: Record<string, boolean>
+ startupProgramValidationErrors: DeepPartialMap<StartupProgramFormValues, ValidationErrorType>
+ wasPreviouslyOnStartupPlan: boolean
+ ycBatchOptions: {
+ label: string
+ value: string
+ }[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface startupProgramLogicActions {
+ resetStartupProgram: (values?: StartupProgramFormValues) => {
+ values?: StartupProgramFormValues
+ }
+ setFormSubmitted: (submitted: boolean) => {
+ submitted: boolean
+ }
+ setStartupProgramManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setStartupProgramValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setStartupProgramValues: (values: DeepPartial<StartupProgramFormValues>) => {
+ values: DeepPartial<StartupProgramFormValues>
+ }
+ submitStartupProgram: () => {
+ value: boolean
+ }
+ submitStartupProgramFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitStartupProgramRequest: (startupProgram: StartupProgramFormValues) => {
+ startupProgram: StartupProgramFormValues
+ }
+ submitStartupProgramSuccess: (startupProgram: StartupProgramFormValues) => {
+ startupProgram: StartupProgramFormValues
+ }
+ touchStartupProgramField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface startupProgramLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ isYC: (arg: any) => boolean
+ isReferralProgram: (arg: any) => boolean
+ referrer: (arg: any) => string | undefined
+ referrerDisplayName: (arg: any) => string | undefined
+ isCurrentlyOnStartupPlan: (billing: BillingType | null) => boolean
+ currentStartupProgramLabel: (billing: BillingType | null) => StartupProgramLabel | null
+ wasPreviouslyOnStartupPlan: (billing: BillingType | null) => boolean
+ domainFromEmail: (user: UserType | null) => string
+ }
+}
+
+export type startupProgramLogicType = MakeLogicType<
+ startupProgramLogicValues,
+ startupProgramLogicActions,
+ StartupProgramLogicProps,
+ startupProgramLogicMeta
+>
+
export const startupProgramLogic = kea<startupProgramLogicType>([
path(['scenes', 'startups', 'startupProgramLogic']),
props({} as StartupProgramLogicProps),
@@ -130,7 +228,7 @@ export const startupProgramLogic = kea<startupProgramLogicType>([
],
domainFromEmail: [
(s) => [s.user],
- (user) => {
+ (user: null | import('~/types').UserType) => {
if (!user?.email) {
return ''
}
diff --git a/products/dashboards/frontend/logics/dashboardsFileSystemLogic.ts b/products/dashboards/frontend/logics/dashboardsFileSystemLogic.ts
index 1588e6c75a2d..763a2f429f72 100644
--- a/products/dashboards/frontend/logics/dashboardsFileSystemLogic.ts
+++ b/products/dashboards/frontend/logics/dashboardsFileSystemLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import posthog from 'posthog-js'
@@ -13,7 +13,8 @@ import { dashboardsModel } from '~/models/dashboardsModel'
import { FileSystemEntry } from '~/queries/schema/schema-general'
import { DashboardBasicType } from '~/types'
-import type { dashboardsFileSystemLogicType } from './dashboardsFileSystemLogicType'
+import type { Node } from '../../../../frontend/src/queries/schema/schema-general'
+import type { DashboardType, QueryBasedInsightModel } from '../../../../frontend/src/types'
import {
buildEntryByRef,
buildFolderDashboardCounts,
@@ -65,6 +66,158 @@ async function fetchAllFileSystemEntries(type: 'dashboard' | 'folder'): Promise<
return entries
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardsFileSystemLogicValues {
+ dashboards: DashboardBasicType[] // dashboardsLogic
+ currentFolder: string
+ currentSubtreeDashboards: DashboardBasicType[]
+ dashboardFileSystemEntries: FileSystemEntry[]
+ dashboardFileSystemEntriesLoading: boolean
+ entryByRef: Record<string, FileSystemEntry>
+ expandedFolders: Record<string, boolean>
+ folderDashboardCounts: Record<string, number>
+ folderEntries: FileSystemEntry[]
+ folderEntriesLoading: boolean
+ folderEntryByPath: Record<string, FileSystemEntry>
+ folderPaths: string[]
+ folderTree: FolderTreeNode[]
+ isTreePanelExpanded: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardsFileSystemLogicActions {
+ createSavedItem: (savedItem: FileSystemEntry) => {
+ savedItem: FileSystemEntry
+ } // projectTreeDataLogic
+ deleteItem: (
+ item: FileSystemEntry,
+ projectTreeLogicKey: string
+ ) => {
+ item: FileSystemEntry
+ projectTreeLogicKey: string
+ } // projectTreeDataLogic
+ movedItem: (
+ item: FileSystemEntry,
+ oldPath: string,
+ newPath: string
+ ) => {
+ item: FileSystemEntry
+ newPath: string
+ oldPath: string
+ } // projectTreeDataLogic
+ createFolder: (
+ name: string,
+ parentPath?: string
+ ) => {
+ name: string
+ parentPath: string | undefined
+ }
+ deleteFolder: (entry: FileSystemEntry) => {
+ entry: FileSystemEntry
+ }
+ loadDashboardFileSystemEntries: () => any
+ loadDashboardFileSystemEntriesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadDashboardFileSystemEntriesSuccess: (
+ dashboardFileSystemEntries: FileSystemEntry[],
+ payload?: any
+ ) => {
+ dashboardFileSystemEntries: FileSystemEntry[]
+ payload?: any
+ }
+ loadFolderEntries: () => any
+ loadFolderEntriesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadFolderEntriesSuccess: (
+ folderEntries: FileSystemEntry[],
+ payload?: any
+ ) => {
+ folderEntries: FileSystemEntry[]
+ payload?: any
+ }
+ navigateToFolder: (folder: string) => {
+ folder: string
+ }
+ renameFolder: (
+ entry: FileSystemEntry,
+ newName: string
+ ) => {
+ entry: FileSystemEntry
+ newName: string
+ }
+ setExpandedFolders: (folders: Record<string, boolean>) => {
+ folders: Record<string, boolean>
+ }
+ toggleFolder: (folder: string) => {
+ folder: string
+ }
+ toggleTreePanel: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dashboardsFileSystemLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ entryByRef: (dashboardFileSystemEntries: FileSystemEntry[]) => Record<string, FileSystemEntry>
+ folderPaths: (folderEntries: FileSystemEntry[]) => string[]
+ folderEntryByPath: (folderEntries: FileSystemEntry[]) => Record<string, FileSystemEntry>
+ folderTree: (
+ dashboards: DashboardBasicType[],
+ entryByRef: Record<string, FileSystemEntry>,
+ folderPaths: string[]
+ ) => FolderTreeNode[]
+ currentSubtreeDashboards: (
+ dashboards: DashboardBasicType[],
+ entryByRef: Record<string, FileSystemEntry>,
+ currentFolder: string
+ ) => DashboardBasicType[]
+ folderDashboardCounts: (
+ dashboards: DashboardBasicType[],
+ 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<
+ dashboardsFileSystemLogicValues,
+ dashboardsFileSystemLogicActions,
+ Record<string, any>,
+ dashboardsFileSystemLogicMeta
+>
+
// View state for the tree arm: a folder tree built from the same FileSystem rows that back the sidebar
// (both dashboard and folder rows, so empty folders appear), the selected folder, its expand state, and the
// dashboards at or below it. Folder creation calls api.fileSystem.create then
@@ -140,33 +293,43 @@ export const dashboardsFileSystemLogic = kea<dashboardsFileSystemLogicType>([
selectors({
entryByRef: [
(s) => [s.dashboardFileSystemEntries],
- (entries): Record<string, FileSystemEntry> => buildEntryByRef(entries),
+ (entries: FileSystemEntry[]): Record<string, FileSystemEntry> => buildEntryByRef(entries),
+ ],
+ folderPaths: [
+ (s) => [s.folderEntries],
+ (folderEntries: FileSystemEntry[]): string[] => folderEntries.map((entry) => entry.path),
],
- folderPaths: [(s) => [s.folderEntries], (folderEntries): string[] => folderEntries.map((entry) => entry.path)],
// Real folder rows keyed by path, so the folder menu can act on a folder's FileSystemEntry (needs its
// id). Folders that exist only because a dashboard references them (no row) are absent — the menu hides
// move/rename/delete for those and offers only "New subfolder".
folderEntryByPath: [
(s) => [s.folderEntries],
- (folderEntries): Record<string, FileSystemEntry> =>
+ (folderEntries: FileSystemEntry[]): Record<string, FileSystemEntry> =>
Object.fromEntries(folderEntries.map((entry) => [entry.path, entry])),
],
folderTree: [
(s) => [s.dashboards, s.entryByRef, s.folderPaths],
- (dashboards, entryByRef, folderPaths): FolderTreeNode[] =>
- buildFolderTree(dashboards, entryByRef, folderPaths),
+ (
+ dashboards: DashboardBasicType[],
+ entryByRef: Record<string, FileSystemEntry>,
+ folderPaths: string[]
+ ): FolderTreeNode[] => buildFolderTree(dashboards, entryByRef, folderPaths),
],
// Tree arm: every dashboard at or below the selected folder, recursively (root = all). The tree is a
// scope selector; the content pane (DashboardsTable) shows everything in scope.
currentSubtreeDashboards: [
(s) => [s.dashboards, s.entryByRef, s.currentFolder],
- (dashboards, entryByRef, currentFolder): DashboardBasicType[] =>
- subtreeDashboards(dashboards, entryByRef, currentFolder),
+ (
+ dashboards: DashboardBasicType[],
+ entryByRef: Record<string, FileSystemEntry>,
+ currentFolder: string
+ ): DashboardBasicType[] => subtreeDashboards(dashboards, entryByRef, currentFolder),
],
// Dashboard count per folder path (subtree), for the tree's trailing count badges.
folderDashboardCounts: [
(s) => [s.dashboards, s.entryByRef],
- (dashboards, entryByRef): Record<string, number> => buildFolderDashboardCounts(dashboards, entryByRef),
+ (dashboards: DashboardBasicType[], entryByRef: Record<string, FileSystemEntry>): Record<string, number> =>
+ buildFolderDashboardCounts(dashboards, entryByRef),
],
}),
listeners(({ values, actions }) => ({
@@ -179,7 +342,7 @@ export const dashboardsFileSystemLogic = kea<dashboardsFileSystemLogicType>([
// shared move path). A dashboard move changes its own path; a folder move re-parents the dashboards
// beneath it (and the folder rows). Other item types (insights, notebooks) don't affect this view,
// so skip the refetch for them.
- [projectTreeDataLogic.actionTypes.movedItem]: ({ item }) => {
+ [projectTreeDataLogic.actionTypes.movedItem]: ({ item }: { item: FileSystemEntry }) => {
if (item.type === 'dashboard' || item.type === 'folder') {
actions.loadDashboardFileSystemEntries()
}
@@ -253,7 +416,7 @@ export const dashboardsFileSystemLogic = kea<dashboardsFileSystemLogicType>([
// The follow-up refetch happens in the deleteSavedItem listener below.
actions.deleteItem(entry, DASHBOARDS_TREE_PROJECT_LOGIC_KEY)
},
- [projectTreeDataLogic.actionTypes.deleteSavedItem]: ({ savedItem }) => {
+ [projectTreeDataLogic.actionTypes.deleteSavedItem]: ({ savedItem }: { savedItem: FileSystemEntry }) => {
// Only dashboards/folders affect this view — ignore unrelated sidebar deletes (insights, notebooks),
// matching the movedItem listener's type-gate.
if (savedItem.type !== 'dashboard' && savedItem.type !== 'folder') {
diff --git a/products/dashboards/frontend/widgets/activity/editActivityEventsWidgetModalLogic.ts b/products/dashboards/frontend/widgets/activity/editActivityEventsWidgetModalLogic.ts
index b9956ef57195..c8f22d50c025 100644
--- a/products/dashboards/frontend/widgets/activity/editActivityEventsWidgetModalLogic.ts
+++ b/products/dashboards/frontend/widgets/activity/editActivityEventsWidgetModalLogic.ts
@@ -1,10 +1,11 @@
-import { actions, connect, defaults, kea, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, defaults, kea, listeners, path, props, reducers, selectors } from 'kea'
import { filterTestAccountsDefaultsLogic } from 'scenes/settings/environment/filterTestAccountDefaultsLogic'
import type { ActivityEventsWidgetConfig } from '../../generated/widget-configs.zod'
import { isWidgetConfigValidationError } from '../../utils'
import { resolveWidgetFilterTestAccounts } from '../../widget_types/widgetConfigShared'
+import type { WidgetDateFromValue } from '../../widget_types/widgetConfigShared'
import {
widgetEditModalFilterTestAccountsActions,
widgetEditModalListFieldActions,
@@ -19,10 +20,679 @@ import {
validateActivityEventsWidgetConfigInput,
type ActivityEventsWidgetFieldErrors,
} from './activityEventsWidgetConfigValidation'
-import type { editActivityEventsWidgetModalLogicType } from './editActivityEventsWidgetModalLogicType'
export type EditActivityEventsWidgetModalLogicProps = Omit<DashboardWidgetEditModalProps, 'isOpen'>
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editActivityEventsWidgetModalLogicValues {
+ filterTestAccountsDefault: boolean // filterTestAccountsDefaultsLogic
+ activeFieldErrors: ActivityEventsWidgetFieldErrors
+ defaultTitle: string
+ fieldErrors: ActivityEventsWidgetFieldErrors
+ filterTestAccounts: boolean
+ limit: number
+ onClose: () => void
+ saveDisabledReason: string | undefined
+ saving: boolean
+ tileDescription: string
+ tileName: string
+ validation:
+ | {
+ fieldErrors: Partial<Record<'dateRange' | 'filterTestAccounts' | 'limit', string>>
+ success: false
+ }
+ | {
+ config: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ eventName?: string | null | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ properties?:
+ | {
+ key: string
+ label?: string | null | undefined
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ type: 'event' | 'person'
+ value?: boolean | number | string | (boolean | number | string)[] | null | undefined
+ }[]
+ | null
+ | undefined
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ success: true
+ }
+ widgetConfig: ActivityEventsWidgetConfig
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editActivityEventsWidgetModalLogicActions {
+ clearFieldError: (field: keyof ActivityEventsWidgetFieldErrors) => {
+ field: 'dateRange' | 'filterTestAccounts' | 'limit'
+ }
+ setDateFrom: (dateFrom: WidgetDateFromValue) => {
+ dateFrom: WidgetDateFromValue
+ }
+ setFieldErrors: (fieldErrors: ActivityEventsWidgetFieldErrors) => {
+ fieldErrors: Partial<Record<'dateRange' | 'filterTestAccounts' | 'limit', string>>
+ }
+ setFilterTestAccounts: (filterTestAccounts: boolean) => {
+ filterTestAccounts: boolean
+ }
+ setLimit: (limit: number) => {
+ limit: number
+ }
+ setTileDescription: (tileDescription: string) => {
+ tileDescription: string
+ }
+ setTileName: (tileName: string) => {
+ tileName: string
+ }
+ submit: () => {
+ value: true
+ }
+ submitFailure: () => {
+ value: true
+ }
+ submitSuccess: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editActivityEventsWidgetModalLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ validation: (
+ limit: number,
+ filterTestAccounts: boolean,
+ widgetConfig: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ eventName?: string | null | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ properties?:
+ | {
+ key: string
+ label?: string | null | undefined
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ type: 'event' | 'person'
+ value?: boolean | number | string | (boolean | number | string)[] | null | undefined
+ }[]
+ | null
+ | undefined
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ ) =>
+ | {
+ fieldErrors: Partial<Record<'dateRange' | 'filterTestAccounts' | 'limit', string>>
+ success: false
+ }
+ | {
+ config: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ eventName?: string | null | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ properties?:
+ | {
+ key: string
+ label?: string | null | undefined
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ type: 'event' | 'person'
+ value?: boolean | number | string | (boolean | number | string)[] | null | undefined
+ }[]
+ | null
+ | undefined
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ success: true
+ }
+ activeFieldErrors: (
+ validation:
+ | {
+ config: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ eventName?: string | null | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ properties?:
+ | {
+ key: string
+ label?: string | null | undefined
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ type: 'event' | 'person'
+ value?: boolean | number | string | (boolean | number | string)[] | null | undefined
+ }[]
+ | null
+ | undefined
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<Record<'dateRange' | 'filterTestAccounts' | 'limit', string>>
+ success: false
+ },
+ fieldErrors: Partial<Record<'dateRange' | 'filterTestAccounts' | 'limit', string>>
+ ) => ActivityEventsWidgetFieldErrors
+ saveDisabledReason: (
+ saving: boolean,
+ validation:
+ | {
+ config: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ eventName?: string | null | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ properties?:
+ | {
+ key: string
+ label?: string | null | undefined
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ type: 'event' | 'person'
+ value?: boolean | number | string | (boolean | number | string)[] | null | undefined
+ }[]
+ | null
+ | undefined
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<Record<'dateRange' | 'filterTestAccounts' | 'limit', string>>
+ success: false
+ }
+ ) => string | undefined
+ widgetConfig: (config: Record<string, unknown>) => ActivityEventsWidgetConfig
+ }
+}
+
+export type editActivityEventsWidgetModalLogicType = MakeLogicType<
+ editActivityEventsWidgetModalLogicValues,
+ editActivityEventsWidgetModalLogicActions,
+ EditActivityEventsWidgetModalLogicProps,
+ editActivityEventsWidgetModalLogicMeta
+>
+
export const editActivityEventsWidgetModalLogic = kea<editActivityEventsWidgetModalLogicType>([
path(['products', 'dashboards', 'widgets', 'activity', 'editActivityEventsWidgetModalLogic']),
@@ -109,12 +779,12 @@ export const editActivityEventsWidgetModalLogic = kea<editActivityEventsWidgetMo
selectors({
widgetConfig: [
(_, p) => [p.config],
- (config): ActivityEventsWidgetConfig => parseActivityEventsWidgetConfig(config),
+ (config: Record<string, unknown>): ActivityEventsWidgetConfig => parseActivityEventsWidgetConfig(config),
],
...widgetEditModalPropSelectors,
validation: [
(s) => [s.limit, s.filterTestAccounts, s.widgetConfig],
- (limit, filterTestAccounts, widgetConfig) =>
+ (limit: number, filterTestAccounts: boolean, widgetConfig: ActivityEventsWidgetConfig) =>
validateActivityEventsWidgetConfigInput({
limit,
filterTestAccounts,
@@ -123,7 +793,136 @@ export const editActivityEventsWidgetModalLogic = kea<editActivityEventsWidgetMo
],
activeFieldErrors: [
(s) => [s.validation, s.fieldErrors],
- (validation, fieldErrors): ActivityEventsWidgetFieldErrors => {
+ (
+ validation:
+ | {
+ config: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ eventName?: string | null | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ properties?:
+ | {
+ key: string
+ label?: string | null | undefined
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ type: 'event' | 'person'
+ value?:
+ | boolean
+ | number
+ | string
+ | (boolean | number | string)[]
+ | null
+ | undefined
+ }[]
+ | null
+ | undefined
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<Record<'dateRange' | 'filterTestAccounts' | 'limit', string>>
+ success: false
+ },
+ fieldErrors: ActivityEventsWidgetFieldErrors
+ ): ActivityEventsWidgetFieldErrors => {
if (!validation.success) {
return { ...validation.fieldErrors, ...fieldErrors }
}
@@ -132,7 +931,136 @@ export const editActivityEventsWidgetModalLogic = kea<editActivityEventsWidgetMo
],
saveDisabledReason: [
(s) => [s.saving, s.validation],
- (saving, validation): string | undefined => {
+ (
+ saving: boolean,
+ validation:
+ | {
+ config: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ eventName?: string | null | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ properties?:
+ | {
+ key: string
+ label?: string | null | undefined
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ type: 'event' | 'person'
+ value?:
+ | boolean
+ | number
+ | string
+ | (boolean | number | string)[]
+ | null
+ | undefined
+ }[]
+ | null
+ | undefined
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<Record<'dateRange' | 'filterTestAccounts' | 'limit', string>>
+ success: false
+ }
+ ): string | undefined => {
if (saving) {
return 'Saving…'
}
diff --git a/products/dashboards/frontend/widgets/error_tracking/editErrorTrackingWidgetModalLogic.ts b/products/dashboards/frontend/widgets/error_tracking/editErrorTrackingWidgetModalLogic.ts
index 9c8efd052d6c..986fae92a041 100644
--- a/products/dashboards/frontend/widgets/error_tracking/editErrorTrackingWidgetModalLogic.ts
+++ b/products/dashboards/frontend/widgets/error_tracking/editErrorTrackingWidgetModalLogic.ts
@@ -1,13 +1,15 @@
-import { actions, connect, defaults, kea, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, defaults, kea, listeners, path, props, reducers, selectors } from 'kea'
import { filterTestAccountsDefaultsLogic } from 'scenes/settings/environment/filterTestAccountDefaultsLogic'
import { teamLogic } from 'scenes/teamLogic'
import { exceptionIngestionLogic } from 'products/error_tracking/frontend/components/SetupPrompt/exceptionIngestionLogic'
+import type { TeamPublicType, TeamType } from '../../../../../frontend/src/types'
import type { ErrorTrackingWidgetConfig } from '../../generated/widget-configs.zod'
import { isWidgetConfigValidationError } from '../../utils'
import { resolveWidgetFilterTestAccounts } from '../../widget_types/widgetConfigShared'
+import type { WidgetDateFromValue } from '../../widget_types/widgetConfigShared'
import {
widgetEditModalFilterTestAccountsActions,
widgetEditModalListFieldActions,
@@ -17,7 +19,6 @@ import {
getWidgetEditModalTileDefaults,
} from '../editWidgetModalBuilders'
import type { DashboardWidgetEditModalProps } from '../registry'
-import type { editErrorTrackingWidgetModalLogicType } from './editErrorTrackingWidgetModalLogicType'
import {
parseErrorTrackingWidgetConfig,
validateErrorTrackingWidgetConfigInput,
@@ -27,6 +28,541 @@ import { canConfigureErrorTrackingWidgetIssues } from './utils'
export type EditErrorTrackingWidgetModalLogicProps = Omit<DashboardWidgetEditModalProps, 'isOpen'>
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editErrorTrackingWidgetModalLogicValues {
+ hasSentExceptionEvent: boolean | undefined // exceptionIngestionLogic
+ hasSentExceptionEventLoading: boolean // exceptionIngestionLogic
+ filterTestAccountsDefault: boolean // filterTestAccountsDefaultsLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ activeFieldErrors: ErrorTrackingWidgetFieldErrors
+ defaultTitle: string
+ fieldErrors: ErrorTrackingWidgetFieldErrors
+ filterTestAccounts: boolean
+ limit: number
+ onClose: () => void
+ orderBy: 'first_seen' | 'last_seen' | 'occurrences' | 'sessions' | 'users'
+ orderDirection: 'ASC' | 'DESC'
+ saveDisabledReason: string | undefined
+ saving: boolean
+ showIssueSettings: boolean
+ tileDescription: string
+ tileName: string
+ validation:
+ | {
+ fieldErrors: Partial<
+ Record<'dateRange' | 'filterTestAccounts' | 'limit' | 'orderBy' | 'orderDirection' | 'status', string>
+ >
+ success: false
+ }
+ | {
+ config: {
+ assignee?:
+ | {
+ id: number | string
+ type: 'role' | 'user'
+ }
+ | null
+ | undefined
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ orderBy: 'first_seen' | 'last_seen' | 'occurrences' | 'sessions' | 'users'
+ orderDirection: 'ASC' | 'DESC'
+ status: 'active' | 'all' | 'archived' | 'pending_release' | 'resolved' | 'suppressed'
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ success: true
+ }
+ widgetConfig: ErrorTrackingWidgetConfig
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editErrorTrackingWidgetModalLogicActions {
+ clearFieldError: (field: keyof ErrorTrackingWidgetFieldErrors) => {
+ field: 'dateRange' | 'filterTestAccounts' | 'limit' | 'orderBy' | 'orderDirection' | 'status'
+ }
+ setDateFrom: (dateFrom: WidgetDateFromValue) => {
+ dateFrom: WidgetDateFromValue
+ }
+ setFieldErrors: (fieldErrors: ErrorTrackingWidgetFieldErrors) => {
+ fieldErrors: Partial<
+ Record<'dateRange' | 'filterTestAccounts' | 'limit' | 'orderBy' | 'orderDirection' | 'status', string>
+ >
+ }
+ setFilterTestAccounts: (filterTestAccounts: boolean) => {
+ filterTestAccounts: boolean
+ }
+ setLimit: (limit: number) => {
+ limit: number
+ }
+ setOrderBy: (orderBy: string) => {
+ orderBy: string
+ }
+ setOrderDirection: (orderDirection: ErrorTrackingWidgetConfig['orderDirection']) => {
+ orderDirection: 'ASC' | 'DESC'
+ }
+ setTileDescription: (tileDescription: string) => {
+ tileDescription: string
+ }
+ setTileName: (tileName: string) => {
+ tileName: string
+ }
+ submit: () => {
+ value: true
+ }
+ submitFailure: () => {
+ value: true
+ }
+ submitSuccess: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editErrorTrackingWidgetModalLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ validation: (
+ limit: number,
+ orderBy: 'first_seen' | 'last_seen' | 'occurrences' | 'sessions' | 'users',
+ orderDirection: 'ASC' | 'DESC',
+ filterTestAccounts: boolean,
+ widgetConfig: {
+ assignee?:
+ | {
+ id: number | string
+ type: 'role' | 'user'
+ }
+ | null
+ | undefined
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ orderBy: 'first_seen' | 'last_seen' | 'occurrences' | 'sessions' | 'users'
+ orderDirection: 'ASC' | 'DESC'
+ status: 'active' | 'all' | 'archived' | 'pending_release' | 'resolved' | 'suppressed'
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ ) =>
+ | {
+ fieldErrors: Partial<
+ Record<
+ 'dateRange' | 'filterTestAccounts' | 'limit' | 'orderBy' | 'orderDirection' | 'status',
+ string
+ >
+ >
+ success: false
+ }
+ | {
+ config: {
+ assignee?:
+ | {
+ id: number | string
+ type: 'role' | 'user'
+ }
+ | null
+ | undefined
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ orderBy: 'first_seen' | 'last_seen' | 'occurrences' | 'sessions' | 'users'
+ orderDirection: 'ASC' | 'DESC'
+ status: 'active' | 'all' | 'archived' | 'pending_release' | 'resolved' | 'suppressed'
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ success: true
+ }
+ activeFieldErrors: (
+ validation:
+ | {
+ config: {
+ assignee?:
+ | {
+ id: number | string
+ type: 'role' | 'user'
+ }
+ | null
+ | undefined
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ orderBy: 'first_seen' | 'last_seen' | 'occurrences' | 'sessions' | 'users'
+ orderDirection: 'ASC' | 'DESC'
+ status: 'active' | 'all' | 'archived' | 'pending_release' | 'resolved' | 'suppressed'
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<
+ Record<
+ 'dateRange' | 'filterTestAccounts' | 'limit' | 'orderBy' | 'orderDirection' | 'status',
+ string
+ >
+ >
+ success: false
+ },
+ fieldErrors: Partial<
+ Record<'dateRange' | 'filterTestAccounts' | 'limit' | 'orderBy' | 'orderDirection' | 'status', string>
+ >
+ ) => ErrorTrackingWidgetFieldErrors
+ saveDisabledReason: (
+ saving: boolean,
+ validation:
+ | {
+ config: {
+ assignee?:
+ | {
+ id: number | string
+ type: 'role' | 'user'
+ }
+ | null
+ | undefined
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ orderBy: 'first_seen' | 'last_seen' | 'occurrences' | 'sessions' | 'users'
+ orderDirection: 'ASC' | 'DESC'
+ status: 'active' | 'all' | 'archived' | 'pending_release' | 'resolved' | 'suppressed'
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<
+ Record<
+ 'dateRange' | 'filterTestAccounts' | 'limit' | 'orderBy' | 'orderDirection' | 'status',
+ string
+ >
+ >
+ success: false
+ }
+ ) => string | undefined
+ showIssueSettings: (
+ currentTeam: TeamPublicType | TeamType | null,
+ hasSentExceptionEvent: boolean | undefined,
+ hasSentExceptionEventLoading: boolean
+ ) => boolean
+ widgetConfig: (config: Record<string, unknown>) => ErrorTrackingWidgetConfig
+ }
+}
+
+export type editErrorTrackingWidgetModalLogicType = MakeLogicType<
+ editErrorTrackingWidgetModalLogicValues,
+ editErrorTrackingWidgetModalLogicActions,
+ EditErrorTrackingWidgetModalLogicProps,
+ editErrorTrackingWidgetModalLogicMeta
+>
+
export const editErrorTrackingWidgetModalLogic = kea<editErrorTrackingWidgetModalLogicType>([
path(['products', 'dashboards', 'widgets', 'error_tracking', 'editErrorTrackingWidgetModalLogic']),
@@ -140,19 +676,29 @@ export const editErrorTrackingWidgetModalLogic = kea<editErrorTrackingWidgetModa
selectors({
showIssueSettings: [
(s) => [s.currentTeam, s.hasSentExceptionEvent, s.hasSentExceptionEventLoading],
- (currentTeam, hasSentExceptionEvent, hasSentExceptionEventLoading): boolean =>
+ (
+ currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType,
+ hasSentExceptionEvent: boolean | undefined,
+ hasSentExceptionEventLoading: boolean
+ ): boolean =>
canConfigureErrorTrackingWidgetIssues(currentTeam, hasSentExceptionEvent) &&
!hasSentExceptionEventLoading &&
!!currentTeam,
],
widgetConfig: [
(_, p) => [p.config],
- (config): ErrorTrackingWidgetConfig => parseErrorTrackingWidgetConfig(config),
+ (config: Record<string, unknown>): ErrorTrackingWidgetConfig => parseErrorTrackingWidgetConfig(config),
],
...widgetEditModalPropSelectors,
validation: [
(s) => [s.limit, s.orderBy, s.orderDirection, s.filterTestAccounts, s.widgetConfig],
- (limit, orderBy, orderDirection, filterTestAccounts, widgetConfig) =>
+ (
+ limit: number,
+ orderBy: 'first_seen' | 'last_seen' | 'occurrences' | 'sessions' | 'users',
+ orderDirection: 'ASC' | 'DESC',
+ filterTestAccounts: boolean,
+ widgetConfig: ErrorTrackingWidgetConfig
+ ) =>
validateErrorTrackingWidgetConfigInput({
limit,
orderBy,
@@ -163,7 +709,105 @@ export const editErrorTrackingWidgetModalLogic = kea<editErrorTrackingWidgetModa
],
activeFieldErrors: [
(s) => [s.validation, s.fieldErrors],
- (validation, fieldErrors): ErrorTrackingWidgetFieldErrors => {
+ (
+ validation:
+ | {
+ config: {
+ assignee?:
+ | {
+ id: number | string
+ type: 'role' | 'user'
+ }
+ | null
+ | undefined
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ orderBy: 'first_seen' | 'last_seen' | 'occurrences' | 'sessions' | 'users'
+ orderDirection: 'ASC' | 'DESC'
+ status: 'active' | 'all' | 'archived' | 'pending_release' | 'resolved' | 'suppressed'
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<
+ Record<
+ | 'dateRange'
+ | 'filterTestAccounts'
+ | 'limit'
+ | 'orderBy'
+ | 'orderDirection'
+ | 'status',
+ string
+ >
+ >
+ success: false
+ },
+ fieldErrors: ErrorTrackingWidgetFieldErrors
+ ): ErrorTrackingWidgetFieldErrors => {
if (!validation.success) {
return { ...validation.fieldErrors, ...fieldErrors }
}
@@ -172,7 +816,105 @@ export const editErrorTrackingWidgetModalLogic = kea<editErrorTrackingWidgetModa
],
saveDisabledReason: [
(s) => [s.saving, s.validation],
- (saving, validation): string | undefined => {
+ (
+ saving: boolean,
+ validation:
+ | {
+ config: {
+ assignee?:
+ | {
+ id: number | string
+ type: 'role' | 'user'
+ }
+ | null
+ | undefined
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ orderBy: 'first_seen' | 'last_seen' | 'occurrences' | 'sessions' | 'users'
+ orderDirection: 'ASC' | 'DESC'
+ status: 'active' | 'all' | 'archived' | 'pending_release' | 'resolved' | 'suppressed'
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<
+ Record<
+ | 'dateRange'
+ | 'filterTestAccounts'
+ | 'limit'
+ | 'orderBy'
+ | 'orderDirection'
+ | 'status',
+ string
+ >
+ >
+ success: false
+ }
+ ): string | undefined => {
if (saving) {
return 'Saving…'
}
diff --git a/products/dashboards/frontend/widgets/error_tracking/errorTrackingWidgetLogic.ts b/products/dashboards/frontend/widgets/error_tracking/errorTrackingWidgetLogic.ts
index 660bb5de5ad6..14761aa24a60 100644
--- a/products/dashboards/frontend/widgets/error_tracking/errorTrackingWidgetLogic.ts
+++ b/products/dashboards/frontend/widgets/error_tracking/errorTrackingWidgetLogic.ts
@@ -1,9 +1,13 @@
-import { connect, kea, key, listeners, path, props } from 'kea'
+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'
import type { WidgetIssueMetadataDelta } from './applyWidgetIssueMetadataChange'
-import type { errorTrackingWidgetLogicType } from './errorTrackingWidgetLogicType'
export type ErrorTrackingWidgetLogicProps = {
tileId: number
@@ -13,6 +17,43 @@ export type ErrorTrackingWidgetLogicProps = {
const ISSUE_METADATA_MUTATIONS = new Set(['updateIssueStatus', 'updateIssueAssignee'])
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface errorTrackingWidgetLogicActions {
+ mutationFailure: (
+ mutationName: string,
+ error: unknown
+ ) => {
+ error: unknown
+ mutationName: string
+ } // issueActionsLogic
+ updateIssueAssignee: (
+ id: string,
+ assignee: ErrorTrackingIssue['assignee']
+ ) => {
+ assignee: ErrorTrackingIssueAssignee | null
+ id: string
+ } // issueActionsLogic
+ updateIssueStatus: (
+ id: string,
+ status: ErrorTrackingIssue['status']
+ ) => {
+ id: string
+ status: ErrorTrackingIssueStatus
+ } // issueActionsLogic
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface errorTrackingWidgetLogicMeta {
+ key: string
+}
+
+export type errorTrackingWidgetLogicType = MakeLogicType<
+ {},
+ errorTrackingWidgetLogicActions,
+ ErrorTrackingWidgetLogicProps,
+ errorTrackingWidgetLogicMeta
+>
+
export const errorTrackingWidgetLogic = kea<errorTrackingWidgetLogicType>([
path(['products', 'dashboards', 'widgets', 'error_tracking', 'errorTrackingWidgetLogic']),
key((props) => String(props.tileId)),
diff --git a/products/dashboards/frontend/widgets/experiments/editExperimentResultsWidgetModalLogic.ts b/products/dashboards/frontend/widgets/experiments/editExperimentResultsWidgetModalLogic.ts
index bbffc3eae82c..c71117bff0c3 100644
--- a/products/dashboards/frontend/widgets/experiments/editExperimentResultsWidgetModalLogic.ts
+++ b/products/dashboards/frontend/widgets/experiments/editExperimentResultsWidgetModalLogic.ts
@@ -1,4 +1,4 @@
-import { actions, defaults, kea, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, defaults, kea, listeners, path, props, reducers, selectors } from 'kea'
import { isWidgetConfigValidationError } from '../../utils'
import {
@@ -8,7 +8,6 @@ import {
getWidgetEditModalTileDefaults,
} from '../editWidgetModalBuilders'
import type { DashboardWidgetEditModalProps } from '../registry'
-import type { editExperimentResultsWidgetModalLogicType } from './editExperimentResultsWidgetModalLogicType'
import {
parseExperimentResultsWidgetConfig,
validateExperimentResultsWidgetConfigInput,
@@ -17,6 +16,106 @@ import {
export type EditExperimentResultsWidgetModalLogicProps = Omit<DashboardWidgetEditModalProps, 'isOpen'>
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editExperimentResultsWidgetModalLogicValues {
+ activeFieldErrors: ExperimentResultsWidgetFieldErrors
+ defaultTitle: string
+ fieldErrors: ExperimentResultsWidgetFieldErrors
+ onClose: () => void
+ saveDisabledReason: string | undefined
+ saving: boolean
+ tileDescription: string
+ tileName: string
+ validation:
+ | {
+ fieldErrors: Partial<Record<'experimentId', string>>
+ success: false
+ }
+ | {
+ config: {
+ experimentId?: number | null | undefined
+ }
+ success: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editExperimentResultsWidgetModalLogicActions {
+ clearFieldError: (field: keyof ExperimentResultsWidgetFieldErrors) => {
+ field: 'experimentId'
+ }
+ setFieldErrors: (fieldErrors: ExperimentResultsWidgetFieldErrors) => {
+ fieldErrors: Partial<Record<'experimentId', string>>
+ }
+ setTileDescription: (tileDescription: string) => {
+ tileDescription: string
+ }
+ setTileName: (tileName: string) => {
+ tileName: string
+ }
+ submit: () => {
+ value: true
+ }
+ submitFailure: () => {
+ value: true
+ }
+ submitSuccess: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editExperimentResultsWidgetModalLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ validation: (arg: any) =>
+ | {
+ fieldErrors: Partial<Record<'experimentId', string>>
+ success: false
+ }
+ | {
+ config: {
+ experimentId?: number | null | undefined
+ }
+ success: true
+ }
+ activeFieldErrors: (
+ validation:
+ | {
+ config: {
+ experimentId?: number | null | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<Record<'experimentId', string>>
+ success: false
+ },
+ fieldErrors: Partial<Record<'experimentId', string>>
+ ) => ExperimentResultsWidgetFieldErrors
+ saveDisabledReason: (
+ saving: boolean,
+ validation:
+ | {
+ config: {
+ experimentId?: number | null | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<Record<'experimentId', string>>
+ success: false
+ }
+ ) => string | undefined
+ }
+}
+
+export type editExperimentResultsWidgetModalLogicType = MakeLogicType<
+ editExperimentResultsWidgetModalLogicValues,
+ editExperimentResultsWidgetModalLogicActions,
+ EditExperimentResultsWidgetModalLogicProps,
+ editExperimentResultsWidgetModalLogicMeta
+>
+
export const editExperimentResultsWidgetModalLogic = kea<editExperimentResultsWidgetModalLogicType>([
path(['products', 'dashboards', 'widgets', 'experiments', 'editExperimentResultsWidgetModalLogic']),
@@ -94,7 +193,20 @@ export const editExperimentResultsWidgetModalLogic = kea<editExperimentResultsWi
],
activeFieldErrors: [
(s) => [s.validation, s.fieldErrors],
- (validation, fieldErrors): ExperimentResultsWidgetFieldErrors => {
+ (
+ validation:
+ | {
+ config: {
+ experimentId?: number | null | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<Record<'experimentId', string>>
+ success: false
+ },
+ fieldErrors: ExperimentResultsWidgetFieldErrors
+ ): ExperimentResultsWidgetFieldErrors => {
if (!validation.success) {
return { ...validation.fieldErrors, ...fieldErrors }
}
@@ -103,7 +215,20 @@ export const editExperimentResultsWidgetModalLogic = kea<editExperimentResultsWi
],
saveDisabledReason: [
(s) => [s.saving, s.validation],
- (saving, validation): string | undefined => {
+ (
+ saving: boolean,
+ validation:
+ | {
+ config: {
+ experimentId?: number | null | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<Record<'experimentId', string>>
+ success: false
+ }
+ ): string | undefined => {
if (saving) {
return 'Saving…'
}
diff --git a/products/dashboards/frontend/widgets/experiments/editExperimentsListWidgetModalLogic.ts b/products/dashboards/frontend/widgets/experiments/editExperimentsListWidgetModalLogic.ts
index 6d9e94d7ece1..553c2719a036 100644
--- a/products/dashboards/frontend/widgets/experiments/editExperimentsListWidgetModalLogic.ts
+++ b/products/dashboards/frontend/widgets/experiments/editExperimentsListWidgetModalLogic.ts
@@ -1,4 +1,4 @@
-import { actions, defaults, kea, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, defaults, kea, listeners, path, props, reducers, selectors } from 'kea'
import { isWidgetConfigValidationError } from '../../utils'
import {
@@ -8,7 +8,6 @@ import {
getWidgetEditModalTileDefaults,
} from '../editWidgetModalBuilders'
import type { DashboardWidgetEditModalProps } from '../registry'
-import type { editExperimentsListWidgetModalLogicType } from './editExperimentsListWidgetModalLogicType'
import {
parseExperimentsListWidgetConfig,
validateExperimentsListWidgetConfigInput,
@@ -19,6 +18,143 @@ import {
export type EditExperimentsListWidgetModalLogicProps = Omit<DashboardWidgetEditModalProps, 'isOpen'>
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editExperimentsListWidgetModalLogicValues {
+ activeFieldErrors: ExperimentsListWidgetFieldErrors
+ defaultTitle: string
+ fieldErrors: ExperimentsListWidgetFieldErrors
+ limit: number
+ onClose: () => void
+ orderBy: 'created_at' | 'name' | 'start_date'
+ orderDirection: 'ASC' | 'DESC'
+ saveDisabledReason: string | undefined
+ saving: boolean
+ tileDescription: string
+ tileName: string
+ validation:
+ | {
+ fieldErrors: Partial<Record<'createdBy' | 'limit' | 'orderBy' | 'orderDirection' | 'status', string>>
+ success: false
+ }
+ | {
+ config: {
+ createdBy?: number | null | undefined
+ limit: number
+ orderBy: 'created_at' | 'name' | 'start_date'
+ orderDirection: 'ASC' | 'DESC'
+ status: 'all' | 'draft' | 'exposure_frozen' | 'paused' | 'running' | 'stopped'
+ }
+ success: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editExperimentsListWidgetModalLogicActions {
+ clearFieldError: (field: keyof ExperimentsListWidgetFieldErrors) => {
+ field: 'createdBy' | 'limit' | 'orderBy' | 'orderDirection' | 'status'
+ }
+ setFieldErrors: (fieldErrors: ExperimentsListWidgetFieldErrors) => {
+ fieldErrors: Partial<Record<'createdBy' | 'limit' | 'orderBy' | 'orderDirection' | 'status', string>>
+ }
+ setLimit: (limit: number) => {
+ limit: number
+ }
+ setOrderBy: (orderBy: ExperimentsListWidgetOrderBy) => {
+ orderBy: ExperimentsListWidgetOrderBy
+ }
+ setOrderDirection: (orderDirection: ExperimentsListWidgetOrderDirection) => {
+ orderDirection: ExperimentsListWidgetOrderDirection
+ }
+ setTileDescription: (tileDescription: string) => {
+ tileDescription: string
+ }
+ setTileName: (tileName: string) => {
+ tileName: string
+ }
+ submit: () => {
+ value: true
+ }
+ submitFailure: () => {
+ value: true
+ }
+ submitSuccess: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editExperimentsListWidgetModalLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ validation: (
+ limit: number,
+ orderBy: 'created_at' | 'name' | 'start_date',
+ orderDirection: 'ASC' | 'DESC',
+ arg: any
+ ) =>
+ | {
+ fieldErrors: Partial<Record<'createdBy' | 'limit' | 'orderBy' | 'orderDirection' | 'status', string>>
+ success: false
+ }
+ | {
+ config: {
+ createdBy?: number | null | undefined
+ limit: number
+ orderBy: 'created_at' | 'name' | 'start_date'
+ orderDirection: 'ASC' | 'DESC'
+ status: 'all' | 'draft' | 'exposure_frozen' | 'paused' | 'running' | 'stopped'
+ }
+ success: true
+ }
+ activeFieldErrors: (
+ validation:
+ | {
+ config: {
+ createdBy?: number | null | undefined
+ limit: number
+ orderBy: 'created_at' | 'name' | 'start_date'
+ orderDirection: 'ASC' | 'DESC'
+ status: 'all' | 'draft' | 'exposure_frozen' | 'paused' | 'running' | 'stopped'
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<
+ Record<'createdBy' | 'limit' | 'orderBy' | 'orderDirection' | 'status', string>
+ >
+ success: false
+ },
+ fieldErrors: Partial<Record<'createdBy' | 'limit' | 'orderBy' | 'orderDirection' | 'status', string>>
+ ) => ExperimentsListWidgetFieldErrors
+ saveDisabledReason: (
+ saving: boolean,
+ validation:
+ | {
+ config: {
+ createdBy?: number | null | undefined
+ limit: number
+ orderBy: 'created_at' | 'name' | 'start_date'
+ orderDirection: 'ASC' | 'DESC'
+ status: 'all' | 'draft' | 'exposure_frozen' | 'paused' | 'running' | 'stopped'
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<
+ Record<'createdBy' | 'limit' | 'orderBy' | 'orderDirection' | 'status', string>
+ >
+ success: false
+ }
+ ) => string | undefined
+ }
+}
+
+export type editExperimentsListWidgetModalLogicType = MakeLogicType<
+ editExperimentsListWidgetModalLogicValues,
+ editExperimentsListWidgetModalLogicActions,
+ EditExperimentsListWidgetModalLogicProps,
+ editExperimentsListWidgetModalLogicMeta
+>
+
export const editExperimentsListWidgetModalLogic = kea<editExperimentsListWidgetModalLogicType>([
path(['products', 'dashboards', 'widgets', 'experiments', 'editExperimentsListWidgetModalLogic']),
@@ -114,7 +250,7 @@ export const editExperimentsListWidgetModalLogic = kea<editExperimentsListWidget
// status + creator live on the tile filter bar; read them from the persisted config so saving
// the limit/name here preserves the active filters.
(s) => [s.limit, s.orderBy, s.orderDirection, (_, props) => props.config],
- (limit, orderBy, orderDirection, config) => {
+ (limit: number, orderBy: 'created_at' | 'name' | 'start_date', orderDirection: 'ASC' | 'DESC', config) => {
const baseConfig = parseExperimentsListWidgetConfig(config)
return validateExperimentsListWidgetConfigInput({
limit,
@@ -127,7 +263,26 @@ export const editExperimentsListWidgetModalLogic = kea<editExperimentsListWidget
],
activeFieldErrors: [
(s) => [s.validation, s.fieldErrors],
- (validation, fieldErrors): ExperimentsListWidgetFieldErrors => {
+ (
+ validation:
+ | {
+ config: {
+ createdBy?: number | null | undefined
+ limit: number
+ orderBy: 'created_at' | 'name' | 'start_date'
+ orderDirection: 'ASC' | 'DESC'
+ status: 'all' | 'draft' | 'exposure_frozen' | 'paused' | 'running' | 'stopped'
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<
+ Record<'createdBy' | 'limit' | 'orderBy' | 'orderDirection' | 'status', string>
+ >
+ success: false
+ },
+ fieldErrors: ExperimentsListWidgetFieldErrors
+ ): ExperimentsListWidgetFieldErrors => {
if (!validation.success) {
return { ...validation.fieldErrors, ...fieldErrors }
}
@@ -136,7 +291,26 @@ export const editExperimentsListWidgetModalLogic = kea<editExperimentsListWidget
],
saveDisabledReason: [
(s) => [s.saving, s.validation],
- (saving, validation): string | undefined => {
+ (
+ saving: boolean,
+ validation:
+ | {
+ config: {
+ createdBy?: number | null | undefined
+ limit: number
+ orderBy: 'created_at' | 'name' | 'start_date'
+ orderDirection: 'ASC' | 'DESC'
+ status: 'all' | 'draft' | 'exposure_frozen' | 'paused' | 'running' | 'stopped'
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<
+ Record<'createdBy' | 'limit' | 'orderBy' | 'orderDirection' | 'status', string>
+ >
+ success: false
+ }
+ ): string | undefined => {
if (saving) {
return 'Saving…'
}
diff --git a/products/dashboards/frontend/widgets/experiments/experimentPickerLogic.ts b/products/dashboards/frontend/widgets/experiments/experimentPickerLogic.ts
index 5c6fade8a78c..4e5a5f184dca 100644
--- a/products/dashboards/frontend/widgets/experiments/experimentPickerLogic.ts
+++ b/products/dashboards/frontend/widgets/experiments/experimentPickerLogic.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 { teamLogic } from 'scenes/teamLogic'
@@ -6,14 +6,90 @@ import { teamLogic } from 'scenes/teamLogic'
import { experimentsList, experimentsRetrieve } from 'products/experiments/frontend/generated/api'
import type { ExperimentApi, ExperimentBasicApi } from 'products/experiments/frontend/generated/api.schemas'
-import type { experimentPickerLogicType } from './experimentPickerLogicType'
-
/** One page is plenty — search narrows the rest server-side, so we never paginate the dropdown. */
const EXPERIMENT_OPTIONS_LIMIT = 50
const SEARCH_DEBOUNCE_MS = 300
export type ExperimentPickerLogicProps = { pickerKey: string }
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentPickerLogicValues {
+ currentProjectId: number | string // teamLogic
+ experimentOptions: ExperimentBasicApi[]
+ experimentOptionsLoading: boolean
+ hasLoadedOptions: boolean
+ search: string
+ selectedExperiment: ExperimentApi | null
+ selectedExperimentLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentPickerLogicActions {
+ ensureOptionsLoaded: () => {
+ value: true
+ }
+ ensureSelectedLoaded: (experimentId: number) => {
+ experimentId: number
+ }
+ loadOptions: ({ debounce }?: { debounce: boolean }) => {
+ debounce: boolean
+ }
+ loadOptionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadOptionsSuccess: (
+ experimentOptions: ExperimentBasicApi[],
+ payload?: {
+ debounce: boolean
+ }
+ ) => {
+ experimentOptions: ExperimentBasicApi[]
+ payload?: {
+ debounce: boolean
+ }
+ }
+ loadSelectedExperiment: ({ experimentId }: { experimentId: number }) => {
+ experimentId: number
+ }
+ loadSelectedExperimentFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSelectedExperimentSuccess: (
+ selectedExperiment: ExperimentApi,
+ payload?: {
+ experimentId: number
+ }
+ ) => {
+ selectedExperiment: ExperimentApi
+ payload?: {
+ experimentId: number
+ }
+ }
+ setSearch: (search: string) => {
+ search: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface experimentPickerLogicMeta {
+ key: string
+}
+
+export type experimentPickerLogicType = MakeLogicType<
+ experimentPickerLogicValues,
+ experimentPickerLogicActions,
+ ExperimentPickerLogicProps,
+ experimentPickerLogicMeta
+>
+
export const experimentPickerLogic = kea<experimentPickerLogicType>([
path((key) => ['products', 'dashboards', 'widgets', 'experiments', 'experimentPickerLogic', key]),
props({} as ExperimentPickerLogicProps),
diff --git a/products/dashboards/frontend/widgets/logs/editLogsWidgetModalLogic.ts b/products/dashboards/frontend/widgets/logs/editLogsWidgetModalLogic.ts
index aeb9f57c3ff6..3e800ab0c4a4 100644
--- a/products/dashboards/frontend/widgets/logs/editLogsWidgetModalLogic.ts
+++ b/products/dashboards/frontend/widgets/logs/editLogsWidgetModalLogic.ts
@@ -1,4 +1,4 @@
-import { actions, defaults, kea, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, defaults, kea, listeners, path, props, reducers, selectors } from 'kea'
import type { LogsWidgetConfig } from '../../generated/widget-configs.zod'
import { isWidgetConfigValidationError } from '../../utils'
@@ -11,7 +11,6 @@ import {
getWidgetEditModalTileDefaults,
} from '../editWidgetModalBuilders'
import type { DashboardWidgetEditModalProps } from '../registry'
-import type { editLogsWidgetModalLogicType } from './editLogsWidgetModalLogicType'
import {
LOGS_DEFAULT_DATE_FROM,
parseLogsWidgetConfig,
@@ -22,6 +21,247 @@ import {
export type EditLogsWidgetModalLogicProps = Omit<DashboardWidgetEditModalProps, 'isOpen'>
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editLogsWidgetModalLogicValues {
+ activeFieldErrors: LogsWidgetFieldErrors
+ dateFrom: WidgetDateFromValue
+ defaultTitle: string
+ fieldErrors: LogsWidgetFieldErrors
+ limit: number
+ onClose: () => void
+ saveDisabledReason: string | undefined
+ saving: boolean
+ tileDescription: string
+ tileName: string
+ timezone: LogsTimezone
+ validation:
+ | {
+ fieldErrors: Partial<Record<'dateRange' | 'limit' | 'timezone' | 'wrapLines', string>>
+ success: false
+ }
+ | {
+ config: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ limit: number
+ orderBy: 'earliest' | 'latest'
+ savedViewId?: string | null | undefined
+ serviceNames?: string[] | undefined
+ severityLevels?: ('debug' | 'error' | 'fatal' | 'info' | 'trace' | 'warn')[] | undefined
+ timezone: 'local' | 'UTC'
+ wrapLines: boolean
+ }
+ success: true
+ }
+ widgetConfig: LogsWidgetConfig
+ wrapLines: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editLogsWidgetModalLogicActions {
+ clearFieldError: (field: keyof LogsWidgetFieldErrors) => {
+ field: 'dateRange' | 'limit' | 'timezone' | 'wrapLines'
+ }
+ setDateFrom: (dateFrom: WidgetDateFromValue) => {
+ dateFrom: WidgetDateFromValue
+ }
+ setFieldErrors: (fieldErrors: LogsWidgetFieldErrors) => {
+ fieldErrors: Partial<Record<'dateRange' | 'limit' | 'timezone' | 'wrapLines', string>>
+ }
+ setLimit: (limit: number) => {
+ limit: number
+ }
+ setTileDescription: (tileDescription: string) => {
+ tileDescription: string
+ }
+ setTileName: (tileName: string) => {
+ tileName: string
+ }
+ setTimezone: (timezone: LogsTimezone) => {
+ timezone: LogsTimezone
+ }
+ setWrapLines: (wrapLines: boolean) => {
+ wrapLines: boolean
+ }
+ submit: () => {
+ value: true
+ }
+ submitFailure: () => {
+ value: true
+ }
+ submitSuccess: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editLogsWidgetModalLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ validation: (
+ limit: number,
+ wrapLines: boolean,
+ timezone: LogsTimezone,
+ dateFrom: WidgetDateFromValue,
+ widgetConfig: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ limit: number
+ orderBy: 'earliest' | 'latest'
+ savedViewId?: string | null | undefined
+ serviceNames?: string[] | undefined
+ severityLevels?: ('debug' | 'error' | 'fatal' | 'info' | 'trace' | 'warn')[] | undefined
+ timezone: 'local' | 'UTC'
+ wrapLines: boolean
+ }
+ ) =>
+ | {
+ fieldErrors: Partial<Record<'dateRange' | 'limit' | 'timezone' | 'wrapLines', string>>
+ success: false
+ }
+ | {
+ config: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ limit: number
+ orderBy: 'earliest' | 'latest'
+ savedViewId?: string | null | undefined
+ serviceNames?: string[] | undefined
+ severityLevels?: ('debug' | 'error' | 'fatal' | 'info' | 'trace' | 'warn')[] | undefined
+ timezone: 'local' | 'UTC'
+ wrapLines: boolean
+ }
+ success: true
+ }
+ activeFieldErrors: (
+ validation:
+ | {
+ config: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ limit: number
+ orderBy: 'earliest' | 'latest'
+ savedViewId?: string | null | undefined
+ serviceNames?: string[] | undefined
+ severityLevels?: ('debug' | 'error' | 'fatal' | 'info' | 'trace' | 'warn')[] | undefined
+ timezone: 'local' | 'UTC'
+ wrapLines: boolean
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<Record<'dateRange' | 'limit' | 'timezone' | 'wrapLines', string>>
+ success: false
+ },
+ fieldErrors: Partial<Record<'dateRange' | 'limit' | 'timezone' | 'wrapLines', string>>
+ ) => LogsWidgetFieldErrors
+ saveDisabledReason: (
+ saving: boolean,
+ validation:
+ | {
+ config: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ limit: number
+ orderBy: 'earliest' | 'latest'
+ savedViewId?: string | null | undefined
+ serviceNames?: string[] | undefined
+ severityLevels?: ('debug' | 'error' | 'fatal' | 'info' | 'trace' | 'warn')[] | undefined
+ timezone: 'local' | 'UTC'
+ wrapLines: boolean
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<Record<'dateRange' | 'limit' | 'timezone' | 'wrapLines', string>>
+ success: false
+ }
+ ) => string | undefined
+ widgetConfig: (config: Record<string, unknown>) => LogsWidgetConfig
+ }
+}
+
+export type editLogsWidgetModalLogicType = MakeLogicType<
+ editLogsWidgetModalLogicValues,
+ editLogsWidgetModalLogicActions,
+ EditLogsWidgetModalLogicProps,
+ editLogsWidgetModalLogicMeta
+>
+
export const editLogsWidgetModalLogic = kea<editLogsWidgetModalLogicType>([
path(['products', 'dashboards', 'widgets', 'logs', 'editLogsWidgetModalLogic']),
@@ -109,11 +349,20 @@ export const editLogsWidgetModalLogic = kea<editLogsWidgetModalLogicType>([
}),
selectors({
- widgetConfig: [(_, p) => [p.config], (config): LogsWidgetConfig => parseLogsWidgetConfig(config)],
+ widgetConfig: [
+ (_, p) => [p.config],
+ (config: Record<string, unknown>): LogsWidgetConfig => parseLogsWidgetConfig(config),
+ ],
...widgetEditModalPropSelectors,
validation: [
(s) => [s.limit, s.wrapLines, s.timezone, s.dateFrom, s.widgetConfig],
- (limit, wrapLines, timezone, dateFrom, widgetConfig) =>
+ (
+ limit: number,
+ wrapLines: boolean,
+ timezone: LogsTimezone,
+ dateFrom: WidgetDateFromValue,
+ widgetConfig: LogsWidgetConfig
+ ) =>
validateLogsWidgetConfigInput({
limit,
wrapLines,
@@ -124,7 +373,43 @@ export const editLogsWidgetModalLogic = kea<editLogsWidgetModalLogicType>([
],
activeFieldErrors: [
(s) => [s.validation, s.fieldErrors],
- (validation, fieldErrors): LogsWidgetFieldErrors => {
+ (
+ validation:
+ | {
+ config: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ limit: number
+ orderBy: 'earliest' | 'latest'
+ savedViewId?: string | null | undefined
+ serviceNames?: string[] | undefined
+ severityLevels?: ('debug' | 'error' | 'fatal' | 'info' | 'trace' | 'warn')[] | undefined
+ timezone: 'local' | 'UTC'
+ wrapLines: boolean
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<Record<'dateRange' | 'limit' | 'timezone' | 'wrapLines', string>>
+ success: false
+ },
+ fieldErrors: LogsWidgetFieldErrors
+ ): LogsWidgetFieldErrors => {
if (!validation.success) {
return { ...validation.fieldErrors, ...fieldErrors }
}
@@ -133,7 +418,43 @@ export const editLogsWidgetModalLogic = kea<editLogsWidgetModalLogicType>([
],
saveDisabledReason: [
(s) => [s.saving, s.validation],
- (saving, validation): string | undefined => {
+ (
+ saving: boolean,
+ validation:
+ | {
+ config: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ limit: number
+ orderBy: 'earliest' | 'latest'
+ savedViewId?: string | null | undefined
+ serviceNames?: string[] | undefined
+ severityLevels?: ('debug' | 'error' | 'fatal' | 'info' | 'trace' | 'warn')[] | undefined
+ timezone: 'local' | 'UTC'
+ wrapLines: boolean
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<Record<'dateRange' | 'limit' | 'timezone' | 'wrapLines', string>>
+ success: false
+ }
+ ): string | undefined => {
if (saving) {
return 'Saving…'
}
diff --git a/products/dashboards/frontend/widgets/logs/logsWidgetSavedViewsLogic.ts b/products/dashboards/frontend/widgets/logs/logsWidgetSavedViewsLogic.ts
index 4417fe202958..7aeb40958903 100644
--- a/products/dashboards/frontend/widgets/logs/logsWidgetSavedViewsLogic.ts
+++ b/products/dashboards/frontend/widgets/logs/logsWidgetSavedViewsLogic.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 { teamLogic } from 'scenes/teamLogic'
@@ -6,11 +6,67 @@ import { teamLogic } from 'scenes/teamLogic'
import { logsViewsList } from 'products/logs/frontend/generated/api'
import type { LogsViewApi } from 'products/logs/frontend/generated/api.schemas'
-import type { logsWidgetSavedViewsLogicType } from './logsWidgetSavedViewsLogicType'
-
// One page is plenty — saved views are few, so we never paginate the dropdown.
const SAVED_VIEWS_LIMIT = 100
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsWidgetSavedViewsLogicValues {
+ currentProjectId: number | string // teamLogic
+ hasLoadedSavedViews: boolean
+ savedViewLabelById: Record<string, string>
+ savedViewOptions: {
+ label: string
+ value: string
+ }[]
+ savedViews: LogsViewApi[]
+ savedViewsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsWidgetSavedViewsLogicActions {
+ ensureSavedViewsLoaded: () => {
+ value: true
+ }
+ loadSavedViews: () => any
+ loadSavedViewsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSavedViewsSuccess: (
+ savedViews: LogsViewApi[],
+ payload?: any
+ ) => {
+ savedViews: LogsViewApi[]
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface logsWidgetSavedViewsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ savedViewOptions: (savedViews: LogsViewApi[]) => {
+ label: string
+ value: string
+ }[]
+ savedViewLabelById: (
+ savedViewOptions: {
+ label: string
+ value: string
+ }[]
+ ) => Record<string, string>
+ }
+}
+
+export type logsWidgetSavedViewsLogicType = MakeLogicType<
+ logsWidgetSavedViewsLogicValues,
+ logsWidgetSavedViewsLogicActions,
+ Record<string, any>,
+ logsWidgetSavedViewsLogicMeta
+>
+
// Saved logs filters are LogsView rows ("saved views" on the logs page). The fetch is lazy —
// only tiles that actually surface the picker (feature flag on, or a saved view already persisted)
// trigger it, so tiles without the feature never hit the API.
@@ -37,7 +93,7 @@ export const logsWidgetSavedViewsLogic = kea<logsWidgetSavedViewsLogicType>([
selectors({
savedViewOptions: [
(s) => [s.savedViews],
- (savedViews): { value: string; label: string }[] =>
+ (savedViews: LogsViewApi[]): { value: string; label: string }[] =>
savedViews.map((view) => ({
value: view.short_id,
label: view.name || 'Unnamed view',
@@ -47,7 +103,12 @@ export const logsWidgetSavedViewsLogic = kea<logsWidgetSavedViewsLogicType>([
// tile filter bar and the read-only summary.
savedViewLabelById: [
(s) => [s.savedViewOptions],
- (savedViewOptions): Record<string, string> =>
+ (
+ savedViewOptions: {
+ label: string
+ value: string
+ }[]
+ ): Record<string, string> =>
Object.fromEntries(savedViewOptions.map((option) => [option.value, option.label])),
],
}),
diff --git a/products/dashboards/frontend/widgets/session_replay/editSessionReplayWidgetModalLogic.ts b/products/dashboards/frontend/widgets/session_replay/editSessionReplayWidgetModalLogic.ts
index d71d2c478291..41ff73f538a8 100644
--- a/products/dashboards/frontend/widgets/session_replay/editSessionReplayWidgetModalLogic.ts
+++ b/products/dashboards/frontend/widgets/session_replay/editSessionReplayWidgetModalLogic.ts
@@ -1,10 +1,11 @@
-import { actions, connect, defaults, kea, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, defaults, kea, listeners, path, props, reducers, selectors } from 'kea'
import { filterTestAccountsDefaultsLogic } from 'scenes/settings/environment/filterTestAccountDefaultsLogic'
import type { SessionReplayWidgetConfig } from '../../generated/widget-configs.zod'
import { isWidgetConfigValidationError } from '../../utils'
import { resolveWidgetFilterTestAccounts } from '../../widget_types/widgetConfigShared'
+import type { WidgetDateFromValue } from '../../widget_types/widgetConfigShared'
import {
widgetEditModalFilterTestAccountsActions,
widgetEditModalListFieldActions,
@@ -14,7 +15,6 @@ import {
getWidgetEditModalTileDefaults,
} from '../editWidgetModalBuilders'
import type { DashboardWidgetEditModalProps } from '../registry'
-import type { editSessionReplayWidgetModalLogicType } from './editSessionReplayWidgetModalLogicType'
import {
parseSessionReplayWidgetConfig,
validateSessionReplayWidgetConfigInput,
@@ -23,6 +23,529 @@ import {
export type EditSessionReplayWidgetModalLogicProps = Omit<DashboardWidgetEditModalProps, 'isOpen'>
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editSessionReplayWidgetModalLogicValues {
+ filterTestAccountsDefault: boolean // filterTestAccountsDefaultsLogic
+ activeFieldErrors: SessionReplayWidgetFieldErrors
+ defaultTitle: string
+ fieldErrors: SessionReplayWidgetFieldErrors
+ filterTestAccounts: boolean
+ limit: number
+ onClose: () => void
+ orderBy: 'activity_score' | 'click_count' | 'console_error_count' | 'duration' | 'recording_duration' | 'start_time'
+ orderDirection: 'ASC' | 'DESC'
+ saveDisabledReason: string | undefined
+ saving: boolean
+ tileDescription: string
+ tileName: string
+ validation:
+ | {
+ fieldErrors: Partial<
+ Record<'dateRange' | 'filterTestAccounts' | 'limit' | 'orderBy' | 'orderDirection', string>
+ >
+ success: false
+ }
+ | {
+ config: {
+ collectionId?: string | null | undefined
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ orderBy:
+ | 'activity_score'
+ | 'click_count'
+ | 'console_error_count'
+ | 'duration'
+ | 'recording_duration'
+ | 'start_time'
+ orderDirection: 'ASC' | 'DESC'
+ savedFilterId?: string | null | undefined
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ success: true
+ }
+ widgetConfig: SessionReplayWidgetConfig
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editSessionReplayWidgetModalLogicActions {
+ clearFieldError: (field: keyof SessionReplayWidgetFieldErrors) => {
+ field: 'dateRange' | 'filterTestAccounts' | 'limit' | 'orderBy' | 'orderDirection'
+ }
+ setDateFrom: (dateFrom: WidgetDateFromValue) => {
+ dateFrom: WidgetDateFromValue
+ }
+ setFieldErrors: (fieldErrors: SessionReplayWidgetFieldErrors) => {
+ fieldErrors: Partial<
+ Record<'dateRange' | 'filterTestAccounts' | 'limit' | 'orderBy' | 'orderDirection', string>
+ >
+ }
+ setFilterTestAccounts: (filterTestAccounts: boolean) => {
+ filterTestAccounts: boolean
+ }
+ setLimit: (limit: number) => {
+ limit: number
+ }
+ setOrderBy: (orderBy: string) => {
+ orderBy: string
+ }
+ setOrderDirection: (orderDirection: SessionReplayWidgetConfig['orderDirection']) => {
+ orderDirection: 'ASC' | 'DESC'
+ }
+ setTileDescription: (tileDescription: string) => {
+ tileDescription: string
+ }
+ setTileName: (tileName: string) => {
+ tileName: string
+ }
+ submit: () => {
+ value: true
+ }
+ submitFailure: () => {
+ value: true
+ }
+ submitSuccess: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editSessionReplayWidgetModalLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ validation: (
+ limit: number,
+ orderBy:
+ | 'activity_score'
+ | 'click_count'
+ | 'console_error_count'
+ | 'duration'
+ | 'recording_duration'
+ | 'start_time',
+ orderDirection: 'ASC' | 'DESC',
+ filterTestAccounts: boolean,
+ widgetConfig: {
+ collectionId?: string | null | undefined
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ orderBy:
+ | 'activity_score'
+ | 'click_count'
+ | 'console_error_count'
+ | 'duration'
+ | 'recording_duration'
+ | 'start_time'
+ orderDirection: 'ASC' | 'DESC'
+ savedFilterId?: string | null | undefined
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ ) =>
+ | {
+ fieldErrors: Partial<
+ Record<'dateRange' | 'filterTestAccounts' | 'limit' | 'orderBy' | 'orderDirection', string>
+ >
+ success: false
+ }
+ | {
+ config: {
+ collectionId?: string | null | undefined
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ orderBy:
+ | 'activity_score'
+ | 'click_count'
+ | 'console_error_count'
+ | 'duration'
+ | 'recording_duration'
+ | 'start_time'
+ orderDirection: 'ASC' | 'DESC'
+ savedFilterId?: string | null | undefined
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ success: true
+ }
+ activeFieldErrors: (
+ validation:
+ | {
+ config: {
+ collectionId?: string | null | undefined
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ orderBy:
+ | 'activity_score'
+ | 'click_count'
+ | 'console_error_count'
+ | 'duration'
+ | 'recording_duration'
+ | 'start_time'
+ orderDirection: 'ASC' | 'DESC'
+ savedFilterId?: string | null | undefined
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<
+ Record<'dateRange' | 'filterTestAccounts' | 'limit' | 'orderBy' | 'orderDirection', string>
+ >
+ success: false
+ },
+ fieldErrors: Partial<
+ Record<'dateRange' | 'filterTestAccounts' | 'limit' | 'orderBy' | 'orderDirection', string>
+ >
+ ) => SessionReplayWidgetFieldErrors
+ saveDisabledReason: (
+ saving: boolean,
+ validation:
+ | {
+ config: {
+ collectionId?: string | null | undefined
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ orderBy:
+ | 'activity_score'
+ | 'click_count'
+ | 'console_error_count'
+ | 'duration'
+ | 'recording_duration'
+ | 'start_time'
+ orderDirection: 'ASC' | 'DESC'
+ savedFilterId?: string | null | undefined
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<
+ Record<'dateRange' | 'filterTestAccounts' | 'limit' | 'orderBy' | 'orderDirection', string>
+ >
+ success: false
+ }
+ ) => string | undefined
+ widgetConfig: (config: Record<string, unknown>) => SessionReplayWidgetConfig
+ }
+}
+
+export type editSessionReplayWidgetModalLogicType = MakeLogicType<
+ editSessionReplayWidgetModalLogicValues,
+ editSessionReplayWidgetModalLogicActions,
+ EditSessionReplayWidgetModalLogicProps,
+ editSessionReplayWidgetModalLogicMeta
+>
+
export const editSessionReplayWidgetModalLogic = kea<editSessionReplayWidgetModalLogicType>([
path(['products', 'dashboards', 'widgets', 'session_replay', 'editSessionReplayWidgetModalLogic']),
@@ -129,12 +652,24 @@ export const editSessionReplayWidgetModalLogic = kea<editSessionReplayWidgetModa
selectors({
widgetConfig: [
(_, p) => [p.config],
- (config): SessionReplayWidgetConfig => parseSessionReplayWidgetConfig(config),
+ (config: Record<string, unknown>): SessionReplayWidgetConfig => parseSessionReplayWidgetConfig(config),
],
...widgetEditModalPropSelectors,
validation: [
(s) => [s.limit, s.orderBy, s.orderDirection, s.filterTestAccounts, s.widgetConfig],
- (limit, orderBy, orderDirection, filterTestAccounts, widgetConfig) =>
+ (
+ limit: number,
+ orderBy:
+ | 'activity_score'
+ | 'click_count'
+ | 'console_error_count'
+ | 'duration'
+ | 'recording_duration'
+ | 'start_time',
+ orderDirection: 'ASC' | 'DESC',
+ filterTestAccounts: boolean,
+ widgetConfig: SessionReplayWidgetConfig
+ ) =>
validateSessionReplayWidgetConfigInput({
limit,
orderBy,
@@ -145,7 +680,100 @@ export const editSessionReplayWidgetModalLogic = kea<editSessionReplayWidgetModa
],
activeFieldErrors: [
(s) => [s.validation, s.fieldErrors],
- (validation, fieldErrors): SessionReplayWidgetFieldErrors => {
+ (
+ validation:
+ | {
+ config: {
+ collectionId?: string | null | undefined
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ orderBy:
+ | 'activity_score'
+ | 'click_count'
+ | 'console_error_count'
+ | 'duration'
+ | 'recording_duration'
+ | 'start_time'
+ orderDirection: 'ASC' | 'DESC'
+ savedFilterId?: string | null | undefined
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<
+ Record<
+ 'dateRange' | 'filterTestAccounts' | 'limit' | 'orderBy' | 'orderDirection',
+ string
+ >
+ >
+ success: false
+ },
+ fieldErrors: SessionReplayWidgetFieldErrors
+ ): SessionReplayWidgetFieldErrors => {
if (!validation.success) {
return { ...validation.fieldErrors, ...fieldErrors }
}
@@ -154,7 +782,100 @@ export const editSessionReplayWidgetModalLogic = kea<editSessionReplayWidgetModa
],
saveDisabledReason: [
(s) => [s.saving, s.validation],
- (saving, validation): string | undefined => {
+ (
+ saving: boolean,
+ validation:
+ | {
+ config: {
+ collectionId?: string | null | undefined
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ filterTestAccounts?: boolean | null | undefined
+ limit: number
+ orderBy:
+ | 'activity_score'
+ | 'click_count'
+ | 'console_error_count'
+ | 'duration'
+ | 'recording_duration'
+ | 'start_time'
+ orderDirection: 'ASC' | 'DESC'
+ savedFilterId?: string | null | undefined
+ widgetFilters?:
+ | Record<
+ string,
+ {
+ filterId: string
+ operator:
+ | 'between'
+ | 'exact'
+ | 'flag_evaluates_to'
+ | 'gt'
+ | 'gte'
+ | 'icontains'
+ | 'icontains_multi'
+ | 'in'
+ | 'is_cleaned_path_exact'
+ | 'is_date_after'
+ | 'is_date_before'
+ | 'is_date_exact'
+ | 'is_not'
+ | 'is_not_set'
+ | 'is_set'
+ | 'lt'
+ | 'lte'
+ | 'max'
+ | 'min'
+ | 'not_between'
+ | 'not_icontains'
+ | 'not_icontains_multi'
+ | 'not_in'
+ | 'not_regex'
+ | 'regex'
+ | 'semver_caret'
+ | 'semver_eq'
+ | 'semver_gt'
+ | 'semver_gte'
+ | 'semver_lt'
+ | 'semver_lte'
+ | 'semver_neq'
+ | 'semver_tilde'
+ | 'semver_wildcard'
+ optionId: string
+ propertyName: string
+ value?: string | string[] | null | undefined
+ }
+ >
+ | null
+ | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<
+ Record<
+ 'dateRange' | 'filterTestAccounts' | 'limit' | 'orderBy' | 'orderDirection',
+ string
+ >
+ >
+ success: false
+ }
+ ): string | undefined => {
if (saving) {
return 'Saving…'
}
diff --git a/products/dashboards/frontend/widgets/session_replay/sessionReplayWidgetSavedFiltersLogic.ts b/products/dashboards/frontend/widgets/session_replay/sessionReplayWidgetSavedFiltersLogic.ts
index 0cc2c7c2358a..ad12abb36774 100644
--- a/products/dashboards/frontend/widgets/session_replay/sessionReplayWidgetSavedFiltersLogic.ts
+++ b/products/dashboards/frontend/widgets/session_replay/sessionReplayWidgetSavedFiltersLogic.ts
@@ -1,4 +1,4 @@
-import { afterMount, kea, path, selectors } from 'kea'
+import { MakeLogicType, afterMount, kea, path, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
@@ -6,8 +6,6 @@ import { toParams } from 'lib/utils/url'
import type { SessionRecordingPlaylistType } from '~/types'
-import type { sessionReplayWidgetSavedFiltersLogicType } from './sessionReplayWidgetSavedFiltersLogicType'
-
const toOptions = (
playlists: SessionRecordingPlaylistType[],
unnamedLabel: string
@@ -17,6 +15,91 @@ const toOptions = (
label: playlist.name || playlist.derived_name || unnamedLabel,
}))
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionReplayWidgetSavedFiltersLogicValues {
+ collectionLabelById: Record<string, string>
+ collectionOptions: {
+ label: string
+ value: string
+ }[]
+ collections: SessionRecordingPlaylistType[]
+ collectionsLoading: boolean
+ savedFilterLabelById: Record<string, string>
+ savedFilterOptions: {
+ label: string
+ value: string
+ }[]
+ savedFilters: SessionRecordingPlaylistType[]
+ savedFiltersLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionReplayWidgetSavedFiltersLogicActions {
+ loadCollections: () => any
+ loadCollectionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadCollectionsSuccess: (
+ collections: SessionRecordingPlaylistType[],
+ payload?: any
+ ) => {
+ collections: SessionRecordingPlaylistType[]
+ payload?: any
+ }
+ loadSavedFilters: () => any
+ loadSavedFiltersFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSavedFiltersSuccess: (
+ savedFilters: SessionRecordingPlaylistType[],
+ payload?: any
+ ) => {
+ savedFilters: SessionRecordingPlaylistType[]
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sessionReplayWidgetSavedFiltersLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ savedFilterOptions: (savedFilters: SessionRecordingPlaylistType[]) => {
+ label: string
+ value: string
+ }[]
+ collectionOptions: (collections: SessionRecordingPlaylistType[]) => {
+ label: string
+ value: string
+ }[]
+ savedFilterLabelById: (
+ savedFilterOptions: {
+ label: string
+ value: string
+ }[]
+ ) => Record<string, string>
+ collectionLabelById: (
+ collectionOptions: {
+ label: string
+ value: string
+ }[]
+ ) => Record<string, string>
+ }
+}
+
+export type sessionReplayWidgetSavedFiltersLogicType = MakeLogicType<
+ sessionReplayWidgetSavedFiltersLogicValues,
+ sessionReplayWidgetSavedFiltersLogicActions,
+ Record<string, any>,
+ sessionReplayWidgetSavedFiltersLogicMeta
+>
+
// Saved session replay filters and collections are both SessionRecordingPlaylist rows, distinguished by
// type ("filters" vs "collection"). The widget can source recordings from either, so we load both here.
export const sessionReplayWidgetSavedFiltersLogic = kea<sessionReplayWidgetSavedFiltersLogicType>([
@@ -44,22 +127,34 @@ export const sessionReplayWidgetSavedFiltersLogic = kea<sessionReplayWidgetSaved
selectors({
savedFilterOptions: [
(s) => [s.savedFilters],
- (savedFilters): { value: string; label: string }[] => toOptions(savedFilters, 'Unnamed filter'),
+ (savedFilters: SessionRecordingPlaylistType[]): { value: string; label: string }[] =>
+ toOptions(savedFilters, 'Unnamed filter'),
],
collectionOptions: [
(s) => [s.collections],
- (collections): { value: string; label: string }[] => toOptions(collections, 'Unnamed collection'),
+ (collections: SessionRecordingPlaylistType[]): { value: string; label: string }[] =>
+ toOptions(collections, 'Unnamed collection'),
],
// Single source for resolving a saved-filter short_id to its display label, shared by the
// tile filter bar and the card header top heading.
savedFilterLabelById: [
(s) => [s.savedFilterOptions],
- (savedFilterOptions): Record<string, string> =>
+ (
+ savedFilterOptions: {
+ label: string
+ value: string
+ }[]
+ ): Record<string, string> =>
Object.fromEntries(savedFilterOptions.map((option) => [option.value, option.label])),
],
collectionLabelById: [
(s) => [s.collectionOptions],
- (collectionOptions): Record<string, string> =>
+ (
+ collectionOptions: {
+ label: string
+ value: string
+ }[]
+ ): Record<string, string> =>
Object.fromEntries(collectionOptions.map((option) => [option.value, option.label])),
],
}),
diff --git a/products/dashboards/frontend/widgets/surveys/editSurveyResultsWidgetModalLogic.ts b/products/dashboards/frontend/widgets/surveys/editSurveyResultsWidgetModalLogic.ts
index ebbf131fef0a..9f3ae0ba4ce9 100644
--- a/products/dashboards/frontend/widgets/surveys/editSurveyResultsWidgetModalLogic.ts
+++ b/products/dashboards/frontend/widgets/surveys/editSurveyResultsWidgetModalLogic.ts
@@ -1,4 +1,4 @@
-import { actions, defaults, kea, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, defaults, kea, listeners, path, props, reducers, selectors } from 'kea'
import type { SurveyResultsWidgetConfig } from '../../generated/widget-configs.zod'
import { isWidgetConfigValidationError } from '../../utils'
@@ -9,7 +9,6 @@ import {
getWidgetEditModalTileDefaults,
} from '../editWidgetModalBuilders'
import type { DashboardWidgetEditModalProps } from '../registry'
-import type { editSurveyResultsWidgetModalLogicType } from './editSurveyResultsWidgetModalLogicType'
import {
dateFromValueForConfig,
parseSurveyResultsWidgetConfig,
@@ -21,6 +20,212 @@ import {
export type EditSurveyResultsWidgetModalLogicProps = Omit<DashboardWidgetEditModalProps, 'isOpen'>
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editSurveyResultsWidgetModalLogicValues {
+ activeFieldErrors: SurveyResultsWidgetFieldErrors
+ dateFrom: SurveyWidgetDateFrom
+ defaultTitle: string
+ fieldErrors: SurveyResultsWidgetFieldErrors
+ limit: number
+ onClose: () => void
+ saveDisabledReason: string | undefined
+ saving: boolean
+ tileDescription: string
+ tileName: string
+ validation:
+ | {
+ fieldErrors: Partial<Record<'dateRange' | 'limit' | 'surveyId', string>>
+ success: false
+ }
+ | {
+ config: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ limit: number
+ surveyId?: string | null | undefined
+ }
+ success: true
+ }
+ widgetConfig: SurveyResultsWidgetConfig
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editSurveyResultsWidgetModalLogicActions {
+ clearFieldError: (field: keyof SurveyResultsWidgetFieldErrors) => {
+ field: 'dateRange' | 'limit' | 'surveyId'
+ }
+ setDateFrom: (dateFrom: SurveyWidgetDateFrom) => {
+ dateFrom: SurveyWidgetDateFrom
+ }
+ setFieldErrors: (fieldErrors: SurveyResultsWidgetFieldErrors) => {
+ fieldErrors: Partial<Record<'dateRange' | 'limit' | 'surveyId', string>>
+ }
+ setLimit: (limit: number) => {
+ limit: number
+ }
+ setTileDescription: (tileDescription: string) => {
+ tileDescription: string
+ }
+ setTileName: (tileName: string) => {
+ tileName: string
+ }
+ submit: () => {
+ value: true
+ }
+ submitFailure: () => {
+ value: true
+ }
+ submitSuccess: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface editSurveyResultsWidgetModalLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ validation: (
+ limit: number,
+ dateFrom: SurveyWidgetDateFrom,
+ widgetConfig: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ limit: number
+ surveyId?: string | null | undefined
+ }
+ ) =>
+ | {
+ fieldErrors: Partial<Record<'dateRange' | 'limit' | 'surveyId', string>>
+ success: false
+ }
+ | {
+ config: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ limit: number
+ surveyId?: string | null | undefined
+ }
+ success: true
+ }
+ activeFieldErrors: (
+ validation:
+ | {
+ config: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ limit: number
+ surveyId?: string | null | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<Record<'dateRange' | 'limit' | 'surveyId', string>>
+ success: false
+ },
+ fieldErrors: Partial<Record<'dateRange' | 'limit' | 'surveyId', string>>
+ ) => SurveyResultsWidgetFieldErrors
+ saveDisabledReason: (
+ saving: boolean,
+ validation:
+ | {
+ config: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ limit: number
+ surveyId?: string | null | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<Record<'dateRange' | 'limit' | 'surveyId', string>>
+ success: false
+ }
+ ) => string | undefined
+ widgetConfig: (config: Record<string, unknown>) => SurveyResultsWidgetConfig
+ }
+}
+
+export type editSurveyResultsWidgetModalLogicType = MakeLogicType<
+ editSurveyResultsWidgetModalLogicValues,
+ editSurveyResultsWidgetModalLogicActions,
+ EditSurveyResultsWidgetModalLogicProps,
+ editSurveyResultsWidgetModalLogicMeta
+>
+
export const editSurveyResultsWidgetModalLogic = kea<editSurveyResultsWidgetModalLogicType>([
path(['products', 'dashboards', 'widgets', 'surveys', 'editSurveyResultsWidgetModalLogic']),
@@ -102,14 +307,14 @@ export const editSurveyResultsWidgetModalLogic = kea<editSurveyResultsWidgetModa
selectors({
widgetConfig: [
(_, p) => [p.config],
- (config): SurveyResultsWidgetConfig => parseSurveyResultsWidgetConfig(config),
+ (config: Record<string, unknown>): SurveyResultsWidgetConfig => parseSurveyResultsWidgetConfig(config),
],
...widgetEditModalPropSelectors,
validation: [
(s) => [s.limit, s.dateFrom, s.widgetConfig],
// The survey is chosen on the tile filter bar; read it from the persisted config so saving
// the date range / limit preserves the selection.
- (limit, dateFrom, widgetConfig) =>
+ (limit: number, dateFrom: SurveyWidgetDateFrom, widgetConfig: SurveyResultsWidgetConfig) =>
validateSurveyResultsWidgetConfigInput({
surveyId: widgetConfig.surveyId ?? null,
limit,
@@ -119,7 +324,38 @@ export const editSurveyResultsWidgetModalLogic = kea<editSurveyResultsWidgetModa
],
activeFieldErrors: [
(s) => [s.validation, s.fieldErrors],
- (validation, fieldErrors): SurveyResultsWidgetFieldErrors => {
+ (
+ validation:
+ | {
+ config: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ limit: number
+ surveyId?: string | null | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<Record<'dateRange' | 'limit' | 'surveyId', string>>
+ success: false
+ },
+ fieldErrors: SurveyResultsWidgetFieldErrors
+ ): SurveyResultsWidgetFieldErrors => {
if (!validation.success) {
return { ...validation.fieldErrors, ...fieldErrors }
}
@@ -128,7 +364,38 @@ export const editSurveyResultsWidgetModalLogic = kea<editSurveyResultsWidgetModa
],
saveDisabledReason: [
(s) => [s.saving, s.validation],
- (saving, validation): string | undefined => {
+ (
+ saving: boolean,
+ validation:
+ | {
+ config: {
+ dateRange?:
+ | {
+ date_from?:
+ | '-14d'
+ | '-1h'
+ | '-1M'
+ | '-24h'
+ | '-30d'
+ | '-30M'
+ | '-3h'
+ | '-7d'
+ | '-90d'
+ | null
+ | undefined
+ }
+ | null
+ | undefined
+ limit: number
+ surveyId?: string | null | undefined
+ }
+ success: true
+ }
+ | {
+ fieldErrors: Partial<Record<'dateRange' | 'limit' | 'surveyId', string>>
+ success: false
+ }
+ ): string | undefined => {
if (saving) {
return 'Saving…'
}
diff --git a/products/dashboards/frontend/widgets/surveys/surveyPickerLogic.ts b/products/dashboards/frontend/widgets/surveys/surveyPickerLogic.ts
index e3486d451b9a..a93570bf5f46 100644
--- a/products/dashboards/frontend/widgets/surveys/surveyPickerLogic.ts
+++ b/products/dashboards/frontend/widgets/surveys/surveyPickerLogic.ts
@@ -1,4 +1,16 @@
-import { actions, afterMount, connect, kea, key, listeners, path, props, propsChanged, reducers } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ connect,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ propsChanged,
+ reducers,
+} from 'kea'
import { loaders } from 'kea-loaders'
import { teamLogic } from 'scenes/teamLogic'
@@ -6,8 +18,6 @@ import { teamLogic } from 'scenes/teamLogic'
import { surveysList, surveysRetrieve } from 'products/surveys/frontend/generated/api'
import type { SurveyApi } from 'products/surveys/frontend/generated/api.schemas'
-import type { surveyPickerLogicType } from './surveyPickerLogicType'
-
/** One page is plenty — search narrows the rest server-side, so we never paginate the dropdown. */
const SURVEY_OPTIONS_LIMIT = 50
const SEARCH_DEBOUNCE_MS = 300
@@ -18,6 +28,84 @@ export type SurveyPickerLogicProps = {
ensureSurveyId?: string | null
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface surveyPickerLogicValues {
+ currentProjectId: number | string // teamLogic
+ hasLoadedOptions: boolean
+ search: string
+ selectedSurvey: SurveyApi | null
+ selectedSurveyLoading: boolean
+ surveyOptions: SurveyApi[]
+ surveyOptionsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface surveyPickerLogicActions {
+ ensureOptionsLoaded: () => {
+ value: true
+ }
+ ensureSelectedLoaded: (surveyId: string) => {
+ surveyId: string
+ }
+ loadOptions: ({ debounce }?: { debounce: boolean }) => {
+ debounce: boolean
+ }
+ loadOptionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadOptionsSuccess: (
+ surveyOptions: SurveyApi[],
+ payload?: {
+ debounce: boolean
+ }
+ ) => {
+ surveyOptions: SurveyApi[]
+ payload?: {
+ debounce: boolean
+ }
+ }
+ loadSelectedSurvey: ({ surveyId }: { surveyId: string }) => {
+ surveyId: string
+ }
+ loadSelectedSurveyFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSelectedSurveySuccess: (
+ selectedSurvey: SurveyApi,
+ payload?: {
+ surveyId: string
+ }
+ ) => {
+ selectedSurvey: SurveyApi
+ payload?: {
+ surveyId: string
+ }
+ }
+ setSearch: (search: string) => {
+ search: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface surveyPickerLogicMeta {
+ key: string
+}
+
+export type surveyPickerLogicType = MakeLogicType<
+ surveyPickerLogicValues,
+ surveyPickerLogicActions,
+ SurveyPickerLogicProps,
+ surveyPickerLogicMeta
+>
+
export const surveyPickerLogic = kea<surveyPickerLogicType>([
path((key) => ['products', 'dashboards', 'widgets', 'surveys', 'surveyPickerLogic', key]),
props({} as SurveyPickerLogicProps),
diff --git a/products/managed_migrations/frontend/managedMigrationLogic.ts b/products/managed_migrations/frontend/managedMigrationLogic.ts
index 7126579ef27e..deddb86cf8f4 100644
--- a/products/managed_migrations/frontend/managedMigrationLogic.ts
+++ b/products/managed_migrations/frontend/managedMigrationLogic.ts
@@ -1,5 +1,17 @@
-import { actions, afterMount, beforeUnmount, kea, listeners, path, props, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ beforeUnmount,
+ 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 { router, urlToAction } from 'kea-router'
@@ -11,7 +23,6 @@ import { urls } from 'scenes/urls'
import { FileSystemIconType } from '~/queries/schema/schema-general'
import { Breadcrumb, ProjectTreeRef } from '~/types'
-import type { managedMigrationLogicType } from './managedMigrationLogicType'
import { ManagedMigration } from './types'
export interface ManagedMigrationForm {
@@ -52,6 +63,117 @@ const NEW_MANAGED_MIGRATION: ManagedMigrationForm = {
generate_group_identify_events: true,
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface managedMigrationLogicValues {
+ breadcrumbs: Breadcrumb[]
+ isManagedMigrationSubmitting: boolean
+ isManagedMigrationValid: boolean
+ isPolling: boolean
+ managedMigration: ManagedMigrationForm
+ managedMigrationAllErrors: Record<string, any>
+ managedMigrationChanged: boolean
+ managedMigrationErrors: DeepPartialMap<ManagedMigrationForm, ValidationErrorType>
+ managedMigrationHasErrors: boolean
+ managedMigrationId: string | null
+ managedMigrationManualErrors: Record<string, any>
+ managedMigrationTouched: boolean
+ managedMigrationTouches: Record<string, boolean>
+ managedMigrationValidationErrors: DeepPartialMap<ManagedMigrationForm, ValidationErrorType>
+ migrations: ManagedMigration[]
+ migrationsLoading: boolean
+ projectTreeRef: ProjectTreeRef
+ showManagedMigrationErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface managedMigrationLogicActions {
+ editManagedMigration: (id: string | null) => {
+ id: string | null
+ }
+ loadMigrations: () => any
+ loadMigrationsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadMigrationsSuccess: (
+ migrations: ManagedMigration[],
+ payload?: any
+ ) => {
+ migrations: ManagedMigration[]
+ payload?: any
+ }
+ pauseMigration: (id: string) => {
+ id: string
+ }
+ resetManagedMigration: (values?: ManagedMigrationForm) => {
+ values?: ManagedMigrationForm
+ }
+ resumeMigration: (id: string) => {
+ id: string
+ }
+ setManagedMigrationManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setManagedMigrationValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setManagedMigrationValues: (values: DeepPartial<ManagedMigrationForm>) => {
+ values: DeepPartial<ManagedMigrationForm>
+ }
+ startPolling: () => {
+ value: true
+ }
+ stopPolling: () => {
+ value: true
+ }
+ submitManagedMigration: () => {
+ value: boolean
+ }
+ submitManagedMigrationFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitManagedMigrationRequest: (managedMigration: ManagedMigrationForm) => {
+ managedMigration: ManagedMigrationForm
+ }
+ submitManagedMigrationSuccess: (managedMigration: ManagedMigrationForm) => {
+ managedMigration: ManagedMigrationForm
+ }
+ touchManagedMigrationField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface managedMigrationLogicProps {
+ managedMigrationId: null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface managedMigrationLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ breadcrumbs: (managedMigrationId: null) => Breadcrumb[]
+ projectTreeRef: (managedMigrationId: null) => ProjectTreeRef
+ }
+}
+
+export type managedMigrationLogicType = MakeLogicType<
+ managedMigrationLogicValues,
+ managedMigrationLogicActions,
+ managedMigrationLogicProps,
+ managedMigrationLogicMeta
+>
+
export const managedMigrationLogic = kea<managedMigrationLogicType>([
path(['products', 'managed_migrations', 'frontend', 'managedMigrationLogic']),
props({
diff --git a/products/mcp_analytics/frontend/clustering/mcpClusteringLogic.ts b/products/mcp_analytics/frontend/clustering/mcpClusteringLogic.ts
index c16ac74631f0..4279f1dbdf6d 100644
--- a/products/mcp_analytics/frontend/clustering/mcpClusteringLogic.ts
+++ b/products/mcp_analytics/frontend/clustering/mcpClusteringLogic.ts
@@ -1,4 +1,15 @@
-import { actions, afterMount, beforeUnmount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ beforeUnmount,
+ connect,
+ kea,
+ listeners,
+ path,
+ reducers,
+ selectors,
+} from 'kea'
import { loaders } from 'kea-loaders'
import { lemonToast } from '@posthog/lemon-ui'
@@ -7,7 +18,6 @@ import { teamLogic } from 'scenes/teamLogic'
import { mcpAnalyticsIntentClustersRecompute, mcpAnalyticsIntentClustersRetrieve } from '../generated/api'
import type { MCPIntentClusterApi, MCPIntentClusterSnapshotApi } from '../generated/api.schemas'
-import type { mcpClusteringLogicType } from './mcpClusteringLogicType'
const EMPTY_SNAPSHOT: MCPIntentClusterSnapshotApi = {
status: 'idle',
@@ -36,6 +46,107 @@ function normalizeSnapshot(
export type ClusterSortKey = 'calls' | 'errors' | 'entropy' | 'concentration'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpClusteringLogicValues {
+ currentProjectId: number | string // teamLogic
+ clusters: readonly MCPIntentClusterApi[]
+ concentratedRoutes: {
+ focused: number
+ total: number
+ }
+ hasSnapshot: boolean
+ isComputing: boolean
+ selectedCluster: MCPIntentClusterApi | null
+ selectedClusterId: number | null
+ snapshot: MCPIntentClusterSnapshotApi
+ snapshotLoading: boolean
+ sortKey: ClusterSortKey
+ sortedClusters: MCPIntentClusterApi[]
+ spreadRoutes: number
+ toolColumns: string[]
+ topErrorRoute: MCPIntentClusterApi | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpClusteringLogicActions {
+ loadSnapshot: () => any
+ loadSnapshotFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSnapshotSuccess: (
+ snapshot: MCPIntentClusterSnapshotApi,
+ payload?: any
+ ) => {
+ snapshot: MCPIntentClusterSnapshotApi
+ payload?: any
+ }
+ pollSnapshot: () => {
+ value: true
+ }
+ recompute: () => {
+ value: true
+ }
+ selectCluster: (clusterId: number | null) => {
+ clusterId: number | null
+ }
+ setSortKey: (sortKey: ClusterSortKey) => {
+ sortKey: ClusterSortKey
+ }
+ startPolling: () => {
+ value: true
+ }
+ stopPolling: () => {
+ value: true
+ }
+ triggerRecompute: () => any
+ triggerRecomputeFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ triggerRecomputeSuccess: (
+ snapshot: MCPIntentClusterSnapshotApi,
+ payload?: any
+ ) => {
+ snapshot: MCPIntentClusterSnapshotApi
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpClusteringLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ clusters: (snapshot: MCPIntentClusterSnapshotApi) => readonly MCPIntentClusterApi[]
+ sortedClusters: (clusters: readonly MCPIntentClusterApi[], sortKey: ClusterSortKey) => MCPIntentClusterApi[]
+ toolColumns: (clusters: readonly MCPIntentClusterApi[]) => string[]
+ selectedCluster: (
+ clusters: readonly MCPIntentClusterApi[],
+ selectedClusterId: number | null
+ ) => MCPIntentClusterApi | null
+ concentratedRoutes: (clusters: readonly MCPIntentClusterApi[]) => {
+ focused: number
+ total: number
+ }
+ spreadRoutes: (clusters: readonly MCPIntentClusterApi[]) => number
+ topErrorRoute: (clusters: readonly MCPIntentClusterApi[]) => MCPIntentClusterApi | null
+ isComputing: (snapshot: MCPIntentClusterSnapshotApi) => boolean
+ hasSnapshot: (snapshot: MCPIntentClusterSnapshotApi) => boolean
+ }
+}
+
+export type mcpClusteringLogicType = MakeLogicType<
+ mcpClusteringLogicValues,
+ mcpClusteringLogicActions,
+ Record<string, any>,
+ mcpClusteringLogicMeta
+>
+
export const mcpClusteringLogic = kea<mcpClusteringLogicType>([
path(['products', 'mcp_analytics', 'frontend', 'clustering', 'mcpClusteringLogic']),
connect(() => ({
@@ -85,10 +196,13 @@ export const mcpClusteringLogic = kea<mcpClusteringLogicType>([
],
}),
selectors({
- clusters: [(s) => [s.snapshot], (snapshot): readonly MCPIntentClusterApi[] => snapshot.clusters],
+ clusters: [
+ (s) => [s.snapshot],
+ (snapshot: MCPIntentClusterSnapshotApi): readonly MCPIntentClusterApi[] => snapshot.clusters,
+ ],
sortedClusters: [
(s) => [s.clusters, s.sortKey],
- (clusters, sortKey): MCPIntentClusterApi[] => {
+ (clusters: readonly MCPIntentClusterApi[], sortKey: ClusterSortKey): MCPIntentClusterApi[] => {
const arr = [...clusters]
switch (sortKey) {
case 'errors':
@@ -108,7 +222,7 @@ export const mcpClusteringLogic = kea<mcpClusteringLogicType>([
// Tools across the whole snapshot, ordered by total calls desc — these are the heatmap columns.
toolColumns: [
(s) => [s.clusters],
- (clusters): string[] => {
+ (clusters: readonly MCPIntentClusterApi[]): string[] => {
const totals = new Map<string, number>()
for (const cluster of clusters) {
for (const entry of cluster.tool_distribution) {
@@ -120,7 +234,10 @@ export const mcpClusteringLogic = kea<mcpClusteringLogicType>([
],
selectedCluster: [
(s) => [s.clusters, s.selectedClusterId],
- (clusters, selectedClusterId): MCPIntentClusterApi | null => {
+ (
+ clusters: readonly MCPIntentClusterApi[],
+ selectedClusterId: number | null
+ ): MCPIntentClusterApi | null => {
if (selectedClusterId === null) {
return null
}
@@ -130,14 +247,14 @@ export const mcpClusteringLogic = kea<mcpClusteringLogicType>([
// Scorecard derivations — all from existing aggregate fields.
concentratedRoutes: [
(s) => [s.clusters],
- (clusters): { focused: number; total: number } => ({
+ (clusters: readonly MCPIntentClusterApi[]): { focused: number; total: number } => ({
focused: clusters.filter((c) => (c.tool_distribution[0]?.pct ?? 0) >= 80).length,
total: clusters.length,
}),
],
spreadRoutes: [
(s) => [s.clusters],
- (clusters): number =>
+ (clusters: readonly MCPIntentClusterApi[]): number =>
clusters.filter((c) => {
const top = c.tool_distribution[0]?.pct ?? 100
return c.tool_distribution.length >= 2 && top < 50
@@ -145,7 +262,7 @@ export const mcpClusteringLogic = kea<mcpClusteringLogicType>([
],
topErrorRoute: [
(s) => [s.clusters],
- (clusters): MCPIntentClusterApi | null => {
+ (clusters: readonly MCPIntentClusterApi[]): MCPIntentClusterApi | null => {
if (clusters.length === 0) {
return null
}
@@ -155,10 +272,14 @@ export const mcpClusteringLogic = kea<mcpClusteringLogicType>([
)[0]
},
],
- isComputing: [(s) => [s.snapshot], (snapshot): boolean => snapshot.status === 'computing'],
+ isComputing: [
+ (s) => [s.snapshot],
+ (snapshot: MCPIntentClusterSnapshotApi): boolean => snapshot.status === 'computing',
+ ],
hasSnapshot: [
(s) => [s.snapshot],
- (snapshot): boolean => snapshot.last_computed_at !== null || snapshot.clusters.length > 0,
+ (snapshot: MCPIntentClusterSnapshotApi): boolean =>
+ snapshot.last_computed_at !== null || snapshot.clusters.length > 0,
],
}),
listeners(({ actions, values, cache }) => ({
diff --git a/products/mcp_analytics/frontend/earlyData/mcpEarlyDataLogic.ts b/products/mcp_analytics/frontend/earlyData/mcpEarlyDataLogic.ts
index e54bd3366e2f..7eccc815308e 100644
--- a/products/mcp_analytics/frontend/earlyData/mcpEarlyDataLogic.ts
+++ b/products/mcp_analytics/frontend/earlyData/mcpEarlyDataLogic.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 { teamLogic } from 'scenes/teamLogic'
@@ -6,9 +6,9 @@ import { teamLogic } from 'scenes/teamLogic'
import { mcpAnalyticsSessionsActivityOverview, mcpAnalyticsSessionsIntentDigest } from '../generated/api'
import type { MCPActivityOverviewApi } from '../generated/api.schemas'
import { mcpAnalyticsOnboardingLogic } from '../mcpAnalyticsOnboardingLogic'
+import type { MCPOnboardingSignals } from '../mcpAnalyticsOnboardingLogic'
import { buildActivitySummary } from './activitySummary'
import { ChecklistItem, EarlyStats, buildChecklist } from './earlyDataChecklist'
-import type { mcpEarlyDataLogicType } from './mcpEarlyDataLogicType'
export type { ChecklistItem, EarlyStats } from './earlyDataChecklist'
@@ -59,6 +59,85 @@ const EMPTY_STATS: EarlyStats = {
// a minute" is live enough.
const REFRESH_INTERVAL_MS = 60000
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpEarlyDataLogicValues {
+ signals: MCPOnboardingSignals | null // mcpAnalyticsOnboardingLogic
+ currentProjectId: number | string // teamLogic
+ checklist: ChecklistItem[]
+ clients: EarlyClientRow[]
+ intentDigest: IntentDigest | null
+ intentDigestLoading: boolean
+ intentThemes: IntentTheme[]
+ isRefreshing: boolean
+ overview: MCPActivityOverviewApi | null
+ overviewLoading: boolean
+ recentCalls: EarlyRecentCall[]
+ stats: EarlyStats
+ summary: string
+ topTools: EarlyToolRow[]
+ totalCalls: number
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpEarlyDataLogicActions {
+ loadSignals: (_?: void | undefined) => void // mcpAnalyticsOnboardingLogic
+ loadIntentDigest: (_: void) => void
+ loadIntentDigestFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadIntentDigestSuccess: (
+ intentDigest: IntentDigest | null,
+ payload?: void
+ ) => {
+ intentDigest: IntentDigest | null
+ payload?: void
+ }
+ loadOverview: (_: void) => void
+ loadOverviewFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadOverviewSuccess: (
+ overview: MCPActivityOverviewApi | null,
+ payload?: void
+ ) => {
+ overview: MCPActivityOverviewApi | null
+ payload?: void
+ }
+ refreshAll: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpEarlyDataLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ stats: (overview: MCPActivityOverviewApi | null) => EarlyStats
+ topTools: (overview: MCPActivityOverviewApi | null) => EarlyToolRow[]
+ clients: (overview: MCPActivityOverviewApi | null) => EarlyClientRow[]
+ recentCalls: (overview: MCPActivityOverviewApi | null) => EarlyRecentCall[]
+ totalCalls: (signals: MCPOnboardingSignals | null, stats: EarlyStats) => number
+ summary: (totalCalls: number, stats: EarlyStats, topTools: EarlyToolRow[]) => string
+ intentThemes: (recentCalls: EarlyRecentCall[]) => IntentTheme[]
+ checklist: (stats: EarlyStats) => ChecklistItem[]
+ isRefreshing: (overviewLoading: boolean, intentDigestLoading: boolean) => boolean
+ }
+}
+
+export type mcpEarlyDataLogicType = MakeLogicType<
+ mcpEarlyDataLogicValues,
+ mcpEarlyDataLogicActions,
+ Record<string, any>,
+ mcpEarlyDataLogicMeta
+>
+
export const mcpEarlyDataLogic = kea<mcpEarlyDataLogicType>([
path(['products', 'mcp_analytics', 'frontend', 'earlyData', 'mcpEarlyDataLogic']),
connect(() => ({
@@ -103,7 +182,7 @@ export const mcpEarlyDataLogic = kea<mcpEarlyDataLogicType>([
selectors({
stats: [
(s) => [s.overview],
- (overview): EarlyStats =>
+ (overview: MCPActivityOverviewApi | null): EarlyStats =>
overview
? {
totalCalls: overview.stats.total_calls,
@@ -118,17 +197,17 @@ export const mcpEarlyDataLogic = kea<mcpEarlyDataLogicType>([
],
topTools: [
(s) => [s.overview],
- (overview): EarlyToolRow[] =>
+ (overview: MCPActivityOverviewApi | null): EarlyToolRow[] =>
(overview?.top_tools ?? []).map((row) => ({ tool: row.tool, calls: row.calls, errors: row.errors })),
],
clients: [
(s) => [s.overview],
- (overview): EarlyClientRow[] =>
+ (overview: MCPActivityOverviewApi | null): EarlyClientRow[] =>
(overview?.clients ?? []).map((row) => ({ client: row.client || 'Unknown client', calls: row.calls })),
],
recentCalls: [
(s) => [s.overview],
- (overview): EarlyRecentCall[] =>
+ (overview: MCPActivityOverviewApi | null): EarlyRecentCall[] =>
(overview?.recent_calls ?? []).map((row) => ({
timestamp: row.timestamp,
tool: row.tool,
@@ -144,11 +223,14 @@ export const mcpEarlyDataLogic = kea<mcpEarlyDataLogicType>([
// the summary so the view never contradicts itself.
totalCalls: [
(s) => [s.signals, s.stats],
- (signals, stats): number => Math.max(stats.totalCalls, signals?.toolCallsTotal ?? 0),
+ (
+ signals: null | import('../mcpAnalyticsOnboardingLogic').MCPOnboardingSignals,
+ stats: EarlyStats
+ ): number => Math.max(stats.totalCalls, signals?.toolCallsTotal ?? 0),
],
summary: [
(s) => [s.totalCalls, s.stats, s.topTools],
- (totalCalls, stats, topTools): string =>
+ (totalCalls: number, stats: EarlyStats, topTools: EarlyToolRow[]): string =>
buildActivitySummary({
totalCalls,
distinctClients: stats.distinctClients,
@@ -161,7 +243,7 @@ export const mcpEarlyDataLogic = kea<mcpEarlyDataLogicType>([
// beats any lossy aggregation of it.
intentThemes: [
(s) => [s.recentCalls],
- (recentCalls): IntentTheme[] => {
+ (recentCalls: EarlyRecentCall[]): IntentTheme[] => {
const counts = new Map<string, number>()
for (const call of recentCalls) {
if (call.intent) {
@@ -174,10 +256,10 @@ export const mcpEarlyDataLogic = kea<mcpEarlyDataLogicType>([
.slice(0, 6)
},
],
- checklist: [(s) => [s.stats], (stats): ChecklistItem[] => buildChecklist(stats)],
+ checklist: [(s) => [s.stats], (stats: EarlyStats): ChecklistItem[] => buildChecklist(stats)],
isRefreshing: [
(s) => [s.overviewLoading, s.intentDigestLoading],
- (overviewLoading, intentDigestLoading): boolean => overviewLoading || intentDigestLoading,
+ (overviewLoading: boolean, intentDigestLoading: boolean): boolean => overviewLoading || intentDigestLoading,
],
}),
listeners(({ actions }) => ({
diff --git a/products/mcp_analytics/frontend/firstLook/mcpFirstLookLogic.ts b/products/mcp_analytics/frontend/firstLook/mcpFirstLookLogic.ts
index a2a92f5cdb09..7ee807786e54 100644
--- a/products/mcp_analytics/frontend/firstLook/mcpFirstLookLogic.ts
+++ b/products/mcp_analytics/frontend/firstLook/mcpFirstLookLogic.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 posthog from 'lib/posthog-typed'
import { organizationLogic } from 'scenes/organizationLogic'
@@ -9,11 +9,105 @@ import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePane
import { ProductKey } from '~/queries/schema/schema-general'
import { SidePanelTab } from '~/types'
+import type { OrganizationType, UserType } from '../../../../frontend/src/types'
+import type { TeamPublicType, TeamType } from '../../../../frontend/src/types'
import { mcpAnalyticsOnboardingLogic } from '../mcpAnalyticsOnboardingLogic'
import type { HarnessRow, KPIData, ToolRow } from '../mcpDashboardOverviewLogic'
import { mcpDashboardOverviewLogic } from '../mcpDashboardOverviewLogic'
import { buildChips, buildEditorPrompt, buildHeadline, buildMaxPrompt, type FirstLookChip } from './firstLookCopy'
-import type { mcpFirstLookLogicType } from './mcpFirstLookLogicType'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpFirstLookLogicValues {
+ isOnboarded: boolean // mcpAnalyticsOnboardingLogic
+ harnessRows: HarnessRow[] // mcpDashboardOverviewLogic
+ kpis: KPIData // mcpDashboardOverviewLogic
+ toolRows: ToolRow[] // mcpDashboardOverviewLogic
+ currentOrganization: OrganizationType | null // organizationLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ user: UserType | null // userLogic
+ chips: FirstLookChip[]
+ dominantClient: string | null
+ editorExpanded: boolean
+ editorPrompt: {
+ label: string
+ prompt: string
+ }
+ eventProperties: Record<string, unknown>
+ headline: string
+ maxPrompt: string
+ shouldShow: boolean
+ topTool: ToolRow | null
+ worstErrorTool: ToolRow | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpFirstLookLogicActions {
+ updateHasSeenProductIntroFor: (
+ productKey: ProductKey,
+ value?: boolean
+ ) => {
+ productKey: ProductKey
+ value: boolean
+ } // userLogic
+ askMax: () => {
+ value: true
+ }
+ dismiss: () => {
+ value: true
+ }
+ dismissAndAskMax: () => {
+ value: true
+ }
+ toggleEditor: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpFirstLookLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ shouldShow: (
+ isOnboarded: boolean,
+ user: UserType | null,
+ currentTeam: TeamPublicType | TeamType | null,
+ kpis: KPIData,
+ toolRows: ToolRow[]
+ ) => boolean
+ topTool: (toolRows: ToolRow[]) => ToolRow | null
+ worstErrorTool: (toolRows: ToolRow[]) => ToolRow | null
+ dominantClient: (harnessRows: HarnessRow[]) => string | null
+ headline: (
+ currentOrganization: OrganizationType | null,
+ currentTeam: TeamPublicType | TeamType | null,
+ topTool: ToolRow | null,
+ dominantClient: string | null,
+ kpis: KPIData
+ ) => string
+ maxPrompt: (worstErrorTool: ToolRow | null, topTool: ToolRow | null) => string
+ editorPrompt: (dominantClient: string | null) => {
+ label: string
+ prompt: string
+ }
+ chips: (
+ topTool: ToolRow | null,
+ worstErrorTool: ToolRow | null,
+ kpis: KPIData,
+ dominantClient: string | null
+ ) => FirstLookChip[]
+ eventProperties: (
+ dominantClient: string | null,
+ topTool: ToolRow | null,
+ worstErrorTool: ToolRow | null
+ ) => Record<string, unknown>
+ }
+}
+
+export type mcpFirstLookLogicType = MakeLogicType<
+ mcpFirstLookLogicValues,
+ mcpFirstLookLogicActions,
+ Record<string, any>,
+ mcpFirstLookLogicMeta
+>
export const mcpFirstLookLogic = kea<mcpFirstLookLogicType>([
path(['products', 'mcp_analytics', 'frontend', 'firstLook', 'mcpFirstLookLogic']),
@@ -46,7 +140,13 @@ export const mcpFirstLookLogic = kea<mcpFirstLookLogicType>([
// Once per user, never on demo, and only after data loads (avoids an empty-flash).
shouldShow: [
(s) => [s.isOnboarded, s.user, s.currentTeam, s.kpis, s.toolRows],
- (isOnboarded, user, currentTeam, kpis: KPIData, toolRows: ToolRow[]): boolean => {
+ (
+ isOnboarded: boolean,
+ user: null | import('~/types').UserType,
+ currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType,
+ kpis: KPIData,
+ toolRows: ToolRow[]
+ ): boolean => {
const hasData = toolRows.length > 0 || kpis.toolCalls.value > 0
return (
Boolean(isOnboarded) &&
@@ -68,7 +168,13 @@ export const mcpFirstLookLogic = kea<mcpFirstLookLogicType>([
],
headline: [
(s) => [s.currentOrganization, s.currentTeam, s.topTool, s.dominantClient, s.kpis],
- (currentOrganization, currentTeam, topTool, dominantClient, kpis: KPIData): string =>
+ (
+ currentOrganization: null | import('~/types').OrganizationType,
+ currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType,
+ topTool: ToolRow | null,
+ dominantClient: string | null,
+ kpis: KPIData
+ ): string =>
buildHeadline({
company: currentOrganization?.name,
project: currentTeam?.name,
@@ -79,20 +185,30 @@ export const mcpFirstLookLogic = kea<mcpFirstLookLogicType>([
],
maxPrompt: [
(s) => [s.worstErrorTool, s.topTool],
- (worstErrorTool, topTool): string => buildMaxPrompt({ worstErrorTool, topTool }),
+ (worstErrorTool: ToolRow | null, topTool: ToolRow | null): string =>
+ buildMaxPrompt({ worstErrorTool, topTool }),
],
editorPrompt: [
(s) => [s.dominantClient],
- (dominantClient): { label: string; prompt: string } => buildEditorPrompt({ client: dominantClient }),
+ (dominantClient: string | null): { label: string; prompt: string } =>
+ buildEditorPrompt({ client: dominantClient }),
],
chips: [
(s) => [s.topTool, s.worstErrorTool, s.kpis, s.dominantClient],
- (topTool, worstErrorTool, kpis: KPIData, dominantClient): FirstLookChip[] =>
- buildChips({ topTool, worstErrorTool, kpis, client: dominantClient }),
+ (
+ topTool: ToolRow | null,
+ worstErrorTool: ToolRow | null,
+ kpis: KPIData,
+ dominantClient: string | null
+ ): FirstLookChip[] => buildChips({ topTool, worstErrorTool, kpis, client: dominantClient }),
],
eventProperties: [
(s) => [s.dominantClient, s.topTool, s.worstErrorTool],
- (dominantClient, topTool: ToolRow | null, worstErrorTool: ToolRow | null): Record<string, unknown> => ({
+ (
+ dominantClient: string | null,
+ topTool: ToolRow | null,
+ worstErrorTool: ToolRow | null
+ ): Record<string, unknown> => ({
client: dominantClient,
busiest_tool: topTool?.tool ?? null,
flakiest_tool: worstErrorTool?.tool ?? null,
diff --git a/products/mcp_analytics/frontend/mcpAnalyticsOnboardingLogic.ts b/products/mcp_analytics/frontend/mcpAnalyticsOnboardingLogic.ts
index 2d1c61f06b72..1bc72416039a 100644
--- a/products/mcp_analytics/frontend/mcpAnalyticsOnboardingLogic.ts
+++ b/products/mcp_analytics/frontend/mcpAnalyticsOnboardingLogic.ts
@@ -1,4 +1,4 @@
-import { afterMount, kea, listeners, path, selectors } from 'kea'
+import { MakeLogicType, afterMount, kea, listeners, path, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
@@ -6,7 +6,6 @@ import { addProductIntent } from 'lib/utils/product-intents'
import { HogQLQueryResponse, NodeKind, ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
-import type { mcpAnalyticsOnboardingLogicType } from './mcpAnalyticsOnboardingLogicType'
import { asNumber } from './queryResultParsers'
export type MCPOnboardingState = 'not-instrumented' | 'connected-no-calls' | 'onboarded'
@@ -60,6 +59,50 @@ WHERE event IN ('$mcp_initialize', '$mcp_tool_call')
// pauses this on hidden tabs and tears it down on unmount.
const POLL_INTERVAL_MS = 20000
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpAnalyticsOnboardingLogicValues {
+ dashboardStage: MCPDashboardStage | null
+ isOnboarded: boolean
+ onboardingState: MCPOnboardingState | null
+ signals: MCPOnboardingSignals | null
+ signalsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpAnalyticsOnboardingLogicActions {
+ loadSignals: (_: void) => void
+ loadSignalsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSignalsSuccess: (
+ signals: MCPOnboardingSignals,
+ payload?: void
+ ) => {
+ signals: MCPOnboardingSignals
+ payload?: void
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpAnalyticsOnboardingLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ onboardingState: (signals: MCPOnboardingSignals | null) => MCPOnboardingState | null
+ isOnboarded: (onboardingState: MCPOnboardingState | null) => boolean
+ dashboardStage: (signals: MCPOnboardingSignals | null) => MCPDashboardStage | null
+ }
+}
+
+export type mcpAnalyticsOnboardingLogicType = MakeLogicType<
+ mcpAnalyticsOnboardingLogicValues,
+ mcpAnalyticsOnboardingLogicActions,
+ Record<string, any>,
+ mcpAnalyticsOnboardingLogicMeta
+>
+
export const mcpAnalyticsOnboardingLogic = kea<mcpAnalyticsOnboardingLogicType>([
path(['products', 'mcp_analytics', 'frontend', 'mcpAnalyticsOnboardingLogic']),
loaders({
@@ -100,7 +143,7 @@ export const mcpAnalyticsOnboardingLogic = kea<mcpAnalyticsOnboardingLogicType>(
selectors({
onboardingState: [
(s) => [s.signals],
- (signals): MCPOnboardingState | null => {
+ (signals: MCPOnboardingSignals | null): MCPOnboardingState | null => {
if (!signals) {
return null
}
@@ -113,10 +156,13 @@ export const mcpAnalyticsOnboardingLogic = kea<mcpAnalyticsOnboardingLogicType>(
return 'not-instrumented'
},
],
- isOnboarded: [(s) => [s.onboardingState], (onboardingState): boolean => onboardingState === 'onboarded'],
+ isOnboarded: [
+ (s) => [s.onboardingState],
+ (onboardingState: MCPOnboardingState | null): boolean => onboardingState === 'onboarded',
+ ],
dashboardStage: [
(s) => [s.signals],
- (signals): MCPDashboardStage | null => {
+ (signals: MCPOnboardingSignals | null): MCPDashboardStage | null => {
if (!signals || !signals.hasToolCall) {
return null
}
diff --git a/products/mcp_analytics/frontend/mcpAnalyticsSceneLogic.ts b/products/mcp_analytics/frontend/mcpAnalyticsSceneLogic.ts
index c7a0ba4062a0..997a83796532 100644
--- a/products/mcp_analytics/frontend/mcpAnalyticsSceneLogic.ts
+++ b/products/mcp_analytics/frontend/mcpAnalyticsSceneLogic.ts
@@ -1,4 +1,4 @@
-import { connect, kea, listeners, path, selectors } from 'kea'
+import { MakeLogicType, connect, kea, listeners, path, selectors } from 'kea'
import { combineUrl, router } from 'kea-router'
import { teamLogic } from 'scenes/teamLogic'
@@ -8,8 +8,9 @@ import { ProductKey } from '~/queries/schema/schema-general'
import { sceneLogic } from '~/scenes/sceneLogic'
import { OnboardingStepKey } from '~/types'
+import type { TeamPublicType, TeamType } from '../../../frontend/src/types'
import { mcpAnalyticsOnboardingLogic } from './mcpAnalyticsOnboardingLogic'
-import type { mcpAnalyticsSceneLogicType } from './mcpAnalyticsSceneLogicType'
+import type { MCPOnboardingState } from './mcpAnalyticsOnboardingLogic'
export type MCPAnalyticsTab = 'activity' | 'dashboard' | 'sessions' | 'tool-quality' | 'intent-clustering'
@@ -44,6 +45,28 @@ const SCENE_KEY_TO_TAB: Record<string, MCPAnalyticsTab> = {
mcpAnalyticsIntentClustering: 'intent-clustering',
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpAnalyticsSceneLogicValues {
+ onboardingState: MCPOnboardingState | null // mcpAnalyticsOnboardingLogic
+ sceneKey: string | null // sceneLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ activeTab: MCPAnalyticsTab
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpAnalyticsSceneLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ activeTab: (sceneKey: string | null) => MCPAnalyticsTab
+ }
+}
+
+export type mcpAnalyticsSceneLogicType = MakeLogicType<
+ mcpAnalyticsSceneLogicValues,
+ {},
+ Record<string, any>,
+ mcpAnalyticsSceneLogicMeta
+>
+
export const mcpAnalyticsSceneLogic = kea<mcpAnalyticsSceneLogicType>([
path(['products', 'mcp_analytics', 'frontend', 'mcpAnalyticsSceneLogic']),
connect(() => ({
diff --git a/products/mcp_analytics/frontend/mcpAnalyticsToolDetailLogic.ts b/products/mcp_analytics/frontend/mcpAnalyticsToolDetailLogic.ts
index ba506a44c648..9d091d3039ca 100644
--- a/products/mcp_analytics/frontend/mcpAnalyticsToolDetailLogic.ts
+++ b/products/mcp_analytics/frontend/mcpAnalyticsToolDetailLogic.ts
@@ -1,4 +1,4 @@
-import { actions, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { urlToAction } from 'kea-router'
@@ -22,9 +22,7 @@ import {
} from '~/queries/schema/schema-general'
import { IntervalType } from '~/types'
-import type { mcpAnalyticsToolDetailLogicType } from './mcpAnalyticsToolDetailLogicType'
import { buildBucketKeys, normalizeBucket } from './timeBuckets'
-
export interface ToolSummary {
calls: number
errors: number
@@ -128,6 +126,224 @@ async function neighborRows(
return (response?.results ?? []).map((r) => [r.neighbor_tool, r.co_occurrences])
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpAnalyticsToolDetailLogicValues {
+ byHarnessRows: ResultRows
+ byHarnessRowsLoading: boolean
+ dailyChartData: DailyChartData
+ dailyStats: DailyToolStat[]
+ dailyStatsLoading: boolean
+ dateFilter: DateFilter
+ dateRange: DateRange
+ dateRangeLabel: string
+ descriptions: DescriptionRevision[]
+ descriptionsLoading: boolean
+ failureRows: ResultRows
+ failureRowsLoading: boolean
+ intentCoverage: IntentCoverage | null
+ intentCoverageLoading: boolean
+ interval: IntervalType
+ neighborsAfterRows: ResultRows
+ neighborsAfterRowsLoading: boolean
+ neighborsBeforeRows: ResultRows
+ neighborsBeforeRowsLoading: boolean
+ sampleIntentRows: ResultRows
+ sampleIntentRowsLoading: boolean
+ summary: ToolSummary | null
+ summaryLoading: boolean
+ toolName: string
+ topUserRows: ResultRows
+ topUserRowsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpAnalyticsToolDetailLogicActions {
+ loadAllSections: () => {
+ value: true
+ }
+ loadByHarnessRows: () => any
+ loadByHarnessRowsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadByHarnessRowsSuccess: (
+ byHarnessRows: ResultRows,
+ payload?: any
+ ) => {
+ byHarnessRows: ResultRows
+ payload?: any
+ }
+ loadDailyStats: (_: void) => void
+ loadDailyStatsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadDailyStatsSuccess: (
+ dailyStats: DailyToolStat[],
+ payload?: void
+ ) => {
+ dailyStats: DailyToolStat[]
+ payload?: void
+ }
+ loadDescriptions: () => any
+ loadDescriptionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadDescriptionsSuccess: (
+ descriptions: DescriptionRevision[],
+ payload?: any
+ ) => {
+ descriptions: DescriptionRevision[]
+ payload?: any
+ }
+ loadFailureRows: () => any
+ loadFailureRowsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadFailureRowsSuccess: (
+ failureRows: ResultRows,
+ payload?: any
+ ) => {
+ failureRows: ResultRows
+ payload?: any
+ }
+ loadIntentCoverage: () => any
+ loadIntentCoverageFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadIntentCoverageSuccess: (
+ intentCoverage: IntentCoverage | null,
+ payload?: any
+ ) => {
+ intentCoverage: IntentCoverage | null
+ payload?: any
+ }
+ loadNeighborsAfterRows: () => any
+ loadNeighborsAfterRowsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadNeighborsAfterRowsSuccess: (
+ neighborsAfterRows: ResultRows,
+ payload?: any
+ ) => {
+ neighborsAfterRows: ResultRows
+ payload?: any
+ }
+ loadNeighborsBeforeRows: () => any
+ loadNeighborsBeforeRowsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadNeighborsBeforeRowsSuccess: (
+ neighborsBeforeRows: ResultRows,
+ payload?: any
+ ) => {
+ neighborsBeforeRows: ResultRows
+ payload?: any
+ }
+ loadSampleIntentRows: () => any
+ loadSampleIntentRowsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSampleIntentRowsSuccess: (
+ sampleIntentRows: ResultRows,
+ payload?: any
+ ) => {
+ sampleIntentRows: ResultRows
+ payload?: any
+ }
+ loadSummary: () => any
+ loadSummaryFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSummarySuccess: (
+ summary: ToolSummary | null,
+ payload?: any
+ ) => {
+ summary: ToolSummary | null
+ payload?: any
+ }
+ loadTopUserRows: () => any
+ loadTopUserRowsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadTopUserRowsSuccess: (
+ topUserRows: ResultRows,
+ payload?: any
+ ) => {
+ topUserRows: ResultRows
+ payload?: any
+ }
+ setDateFilter: (
+ dateFrom: string | null,
+ dateTo: string | null
+ ) => {
+ dateFrom: string | null
+ dateTo: string | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpAnalyticsToolDetailLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ toolName: (arg: any) => string
+ dailyChartData: (
+ dailyStats: DailyToolStat[],
+ dateFilter: DateFilter,
+ interval: IntervalType,
+ timezone: string
+ ) => DailyChartData
+ interval: (dateFilter: DateFilter) => IntervalType
+ dateRange: (dateFilter: DateFilter, timezone: string) => DateRange
+ dateRangeLabel: (dateFilter: DateFilter) => string
+ }
+}
+
+export type mcpAnalyticsToolDetailLogicType = MakeLogicType<
+ mcpAnalyticsToolDetailLogicValues,
+ mcpAnalyticsToolDetailLogicActions,
+ MCPAnalyticsToolDetailLogicProps,
+ mcpAnalyticsToolDetailLogicMeta
+>
+
export const mcpAnalyticsToolDetailLogic = kea<mcpAnalyticsToolDetailLogicType>([
path(['products', 'mcp_analytics', 'frontend', 'mcpAnalyticsToolDetailLogic']),
key((props: MCPAnalyticsToolDetailLogicProps) => props.toolName),
diff --git a/products/mcp_analytics/frontend/mcpAnalyticsToolQualityLogic.ts b/products/mcp_analytics/frontend/mcpAnalyticsToolQualityLogic.ts
index 0f5c6b38fd1f..c73e3a06c65d 100644
--- a/products/mcp_analytics/frontend/mcpAnalyticsToolQualityLogic.ts
+++ b/products/mcp_analytics/frontend/mcpAnalyticsToolQualityLogic.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, combineUrl, router, urlToAction } from 'kea-router'
@@ -13,7 +13,6 @@ import { hogql } from '~/queries/utils'
import { type AnyPropertyFilter, IntervalType, PropertyFilterType, PropertyOperator } from '~/types'
import toolQualityQueryTemplate from '../backend/templates/tool_quality.sql?raw'
-import type { mcpAnalyticsToolQualityLogicType } from './mcpAnalyticsToolQualityLogicType'
import { buildBucketKeys, normalizeBucket } from './timeBuckets'
// `$mcp_tool_category` is stamped onto every $mcp_tool_call event by the producer
@@ -159,6 +158,143 @@ function sortToolRows(rows: ToolQualityRow[], sort: SortState): ToolQualityRow[]
})
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpAnalyticsToolQualityLogicValues {
+ availableCategories: string[]
+ availableCategoriesLoading: boolean
+ categoryCounts: CategoryCount[]
+ categoryCountsLoading: boolean
+ categoryProperties: AnyPropertyFilter[]
+ dailyChartData: DailyChartData
+ dailyStats: DailyToolStat[]
+ dailyStatsLoading: boolean
+ dateFilter: DateFilter
+ dateRangeLabel: string
+ filteredRows: ToolQualityRow[]
+ interval: IntervalType
+ scopeShare: ScopeShare
+ searchTerm: string
+ selectedCategories: string[]
+ selectedTool: string | null
+ toolQualitySort: SortState
+ toolRows: ToolQualityRow[]
+ toolRowsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpAnalyticsToolQualityLogicActions {
+ loadAvailableCategories: () => any
+ loadAvailableCategoriesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAvailableCategoriesSuccess: (
+ availableCategories: string[],
+ payload?: any
+ ) => {
+ availableCategories: string[]
+ payload?: any
+ }
+ loadCategoryCounts: () => any
+ loadCategoryCountsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadCategoryCountsSuccess: (
+ categoryCounts: CategoryCount[],
+ payload?: any
+ ) => {
+ categoryCounts: CategoryCount[]
+ payload?: any
+ }
+ loadDailyStats: (_: void) => void
+ loadDailyStatsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadDailyStatsSuccess: (
+ dailyStats: DailyToolStat[],
+ payload?: void
+ ) => {
+ dailyStats: DailyToolStat[]
+ payload?: void
+ }
+ loadToolRows: (_: void) => void
+ loadToolRowsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadToolRowsSuccess: (
+ toolRows: ToolQualityRow[],
+ payload?: void
+ ) => {
+ toolRows: ToolQualityRow[]
+ payload?: void
+ }
+ reloadAll: () => {
+ value: true
+ }
+ setDateFilter: (
+ dateFrom: string | null,
+ dateTo: string | null
+ ) => {
+ dateFrom: string | null
+ dateTo: string | null
+ }
+ setSearchTerm: (searchTerm: string) => {
+ searchTerm: string
+ }
+ setSelectedCategories: (categories: string[]) => {
+ categories: string[]
+ }
+ setSelectedTool: (tool: string | null) => {
+ tool: string | null
+ }
+ setToolQualitySort: (
+ column: string,
+ direction: SortDirection
+ ) => {
+ column: string
+ direction: SortDirection
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpAnalyticsToolQualityLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ categoryProperties: (selectedCategories: string[]) => AnyPropertyFilter[]
+ dateRangeLabel: (dateFilter: DateFilter) => string
+ interval: (dateFilter: DateFilter) => IntervalType
+ scopeShare: (categoryCounts: CategoryCount[], selectedCategories: string[]) => ScopeShare
+ filteredRows: (toolRows: ToolQualityRow[], toolQualitySort: SortState, searchTerm: string) => ToolQualityRow[]
+ dailyChartData: (
+ dailyStats: DailyToolStat[],
+ dateFilter: DateFilter,
+ interval: IntervalType,
+ timezone: string
+ ) => DailyChartData
+ }
+}
+
+export type mcpAnalyticsToolQualityLogicType = MakeLogicType<
+ mcpAnalyticsToolQualityLogicValues,
+ mcpAnalyticsToolQualityLogicActions,
+ Record<string, any>,
+ mcpAnalyticsToolQualityLogicMeta
+>
+
export const mcpAnalyticsToolQualityLogic = kea<mcpAnalyticsToolQualityLogicType>([
path(['products', 'mcp_analytics', 'frontend', 'mcpAnalyticsToolQualityLogic']),
diff --git a/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.ts b/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.ts
index be8eea351c13..577376114de6 100644
--- a/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.ts
+++ b/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, router, urlToAction } from 'kea-router'
@@ -12,9 +12,9 @@ import { urls } from 'scenes/urls'
import { HogQLFilters, HogQLQueryResponse, MCPHarnessBreakdownItem, NodeKind } from '~/queries/schema/schema-general'
import { AnyPropertyFilter, IntervalType, TeamType } from '~/types'
+import type { TeamPublicType } from '../../../frontend/src/types'
import { mcpClusteringLogic } from './clustering/mcpClusteringLogic'
import type { MCPIntentClusterApi } from './generated/api.schemas'
-import type { mcpDashboardOverviewLogicType } from './mcpDashboardOverviewLogicType'
import { BUCKET_FORMAT, buildBucketKeys, normalizeBucket, resolveWindow, startOfBucket } from './timeBuckets'
export interface DateFilter {
@@ -415,6 +415,234 @@ export function buildKPIs(rows: BucketRow[], currentStartBucket: string): KPIDat
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpDashboardOverviewLogicValues {
+ clusters: readonly MCPIntentClusterApi[] // mcpClusteringLogic
+ hasSnapshot: boolean // mcpClusteringLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ timezone: string // teamLogic
+ activityIncompleteTail: boolean
+ activityRows: ActivityRow[]
+ activityRowsLoading: boolean
+ bucketKeys: string[]
+ dailyActivity: DailyActivity
+ dateFilter: DateFilter
+ filterTestAccounts: boolean
+ filterTestAccountsOverride: boolean | null
+ harnessRows: HarnessRow[]
+ harnessRowsLoading: boolean
+ intentClusterCount: KPIMetric
+ interval: IntervalType
+ kpis: KPIData
+ kpisLoading: boolean
+ notableSessions: NotableSession[]
+ propertyFilters: AnyPropertyFilter[]
+ queryFilters: HogQLFilters
+ sessionRows: SessionRow[]
+ sessionRowsLoading: boolean
+ toolDailyRows: ToolDailyRow[]
+ toolDailyRowsLoading: boolean
+ toolDailySeries: ToolDailySeries
+ toolRows: ToolRow[]
+ toolRowsLoading: boolean
+ users: KPIMetric
+ usersLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpDashboardOverviewLogicActions {
+ loadActivityRows: (_: void) => void
+ loadActivityRowsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadActivityRowsSuccess: (
+ activityRows: ActivityRow[],
+ payload?: void
+ ) => {
+ activityRows: ActivityRow[]
+ payload?: void
+ }
+ loadHarnessRows: (_: void) => void
+ loadHarnessRowsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadHarnessRowsSuccess: (
+ harnessRows: {
+ category: string
+ error_rate_pct: number
+ errors: number
+ sessions: number
+ total_calls: number
+ }[],
+ payload?: void
+ ) => {
+ harnessRows: {
+ category: string
+ error_rate_pct: number
+ errors: number
+ sessions: number
+ total_calls: number
+ }[]
+ payload?: void
+ }
+ loadKPIs: (_: void) => void
+ loadKPIsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadKPIsSuccess: (
+ kpis: KPIData,
+ payload?: void
+ ) => {
+ kpis: KPIData
+ payload?: void
+ }
+ loadSessionRows: (_: void) => void
+ loadSessionRowsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSessionRowsSuccess: (
+ sessionRows: {
+ distinct_tools: number
+ duration_seconds: number
+ error_rate_pct: number
+ errors: number
+ last_seen: string
+ session_id: string
+ tool_calls: number
+ }[],
+ payload?: void
+ ) => {
+ sessionRows: {
+ distinct_tools: number
+ duration_seconds: number
+ error_rate_pct: number
+ errors: number
+ last_seen: string
+ session_id: string
+ tool_calls: number
+ }[]
+ payload?: void
+ }
+ loadToolDailyRows: (_: void) => void
+ loadToolDailyRowsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadToolDailyRowsSuccess: (
+ toolDailyRows: ToolDailyRow[],
+ payload?: void
+ ) => {
+ toolDailyRows: ToolDailyRow[]
+ payload?: void
+ }
+ loadToolRows: (_: void) => void
+ loadToolRowsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadToolRowsSuccess: (
+ toolRows: {
+ error_rate_pct: number
+ errors: number
+ p95_duration_ms: number
+ tool: string
+ total_calls: number
+ }[],
+ payload?: void
+ ) => {
+ toolRows: {
+ error_rate_pct: number
+ errors: number
+ p95_duration_ms: number
+ tool: string
+ total_calls: number
+ }[]
+ payload?: void
+ }
+ loadUsers: (_: void) => void
+ loadUsersFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadUsersSuccess: (
+ users: KPIMetric,
+ payload?: void
+ ) => {
+ users: KPIMetric
+ payload?: void
+ }
+ reloadAll: () => {
+ value: true
+ }
+ setDateFilter: (
+ dateFrom: string | null,
+ dateTo: string | null
+ ) => {
+ dateFrom: string | null
+ dateTo: string | null
+ }
+ setFilterTestAccounts: (filterTestAccounts: boolean | null) => {
+ filterTestAccounts: boolean | null
+ }
+ setPropertyFilters: (properties: AnyPropertyFilter[]) => {
+ properties: AnyPropertyFilter[]
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpDashboardOverviewLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ filterTestAccounts: (
+ filterTestAccountsOverride: boolean | null,
+ currentTeam: TeamPublicType | TeamType | null
+ ) => boolean
+ queryFilters: (
+ dateFilter: DateFilter,
+ filterTestAccounts: boolean,
+ propertyFilters: AnyPropertyFilter[]
+ ) => HogQLFilters
+ interval: (dateFilter: DateFilter) => IntervalType
+ bucketKeys: (dateFilter: DateFilter, timezone: string, interval: IntervalType) => string[]
+ activityIncompleteTail: (bucketKeys: string[], timezone: string, interval: IntervalType) => boolean
+ dailyActivity: (activityRows: ActivityRow[], bucketKeys: string[]) => DailyActivity
+ toolDailySeries: (toolDailyRows: ToolDailyRow[], bucketKeys: string[]) => ToolDailySeries
+ notableSessions: (sessionRows: SessionRow[]) => NotableSession[]
+ intentClusterCount: (clusters: readonly MCPIntentClusterApi[]) => KPIMetric
+ }
+}
+
+export type mcpDashboardOverviewLogicType = MakeLogicType<
+ mcpDashboardOverviewLogicValues,
+ mcpDashboardOverviewLogicActions,
+ Record<string, any>,
+ mcpDashboardOverviewLogicMeta
+>
+
export const mcpDashboardOverviewLogic = kea<mcpDashboardOverviewLogicType>([
path(['products', 'mcp_analytics', 'frontend', 'mcpDashboardOverviewLogic']),
connect(() => ({
diff --git a/products/mcp_analytics/frontend/sessions/mcpSessionsLogic.ts b/products/mcp_analytics/frontend/sessions/mcpSessionsLogic.ts
index ddaf9b5eba1a..0fd1538c78f8 100644
--- a/products/mcp_analytics/frontend/sessions/mcpSessionsLogic.ts
+++ b/products/mcp_analytics/frontend/sessions/mcpSessionsLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, router, urlToAction } from 'kea-router'
@@ -12,7 +12,6 @@ import {
mcpAnalyticsSessionsToolCalls,
} from '../generated/api'
import type { MCPSessionApi, MCPSessionIntentApi, MCPToolCallApi } from '../generated/api.schemas'
-import type { mcpSessionsLogicType } from './mcpSessionsLogicType'
export interface MCPSessionsFilters {
search: string
@@ -93,6 +92,183 @@ async function fetchToolCallsPage(
return { calls: response.results ?? [], hasNext: response.has_next ?? false }
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpSessionsLogicValues {
+ currentProjectId: number | string // teamLogic
+ dateFilter: MCPSessionsDateFilter
+ filters: MCPSessionsFilters
+ generatedIntent: MCPSessionIntentApi | null
+ generatedIntentLoading: boolean
+ generatingSessionId: string | null
+ hasNext: boolean
+ intentOverrides: Record<string, string>
+ isSelectedSessionGenerating: boolean
+ selectedSession: MCPSessionApi | null
+ selectedSessionId: string | null
+ selectedSessionIntent: string
+ selectedSessionToolCalls: {
+ calls: MCPToolCallApi[]
+ hasNext: boolean
+ loading: boolean
+ loadingMore: boolean
+ }
+ sessions: MCPSessionApi[]
+ sessionsLoading: boolean
+ sorting: MCPSessionSorting | null
+ toolCalls: SessionToolCalls
+ toolCallsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpSessionsLogicActions {
+ generateIntent: (sessionId: string) => string
+ generateIntentFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ generateIntentSuccess: (
+ generatedIntent: MCPSessionIntentApi | null,
+ payload?: string
+ ) => {
+ generatedIntent: MCPSessionIntentApi | null
+ payload?: string
+ }
+ loadMoreSessions: () => {
+ value: true
+ }
+ loadMoreSessionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadMoreSessionsSuccess: (
+ sessions: MCPSessionApi[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ sessions: MCPSessionApi[]
+ payload?: {
+ value: true
+ }
+ }
+ loadMoreToolCalls: () => {
+ value: true
+ }
+ loadMoreToolCallsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadMoreToolCallsSuccess: (
+ toolCalls: SessionToolCalls,
+ payload?: {
+ value: true
+ }
+ ) => {
+ toolCalls: SessionToolCalls
+ payload?: {
+ value: true
+ }
+ }
+ loadSessions: () => {
+ value: true
+ }
+ loadSessionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSessionsSuccess: (
+ sessions: MCPSessionApi[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ sessions: MCPSessionApi[]
+ payload?: {
+ value: true
+ }
+ }
+ loadToolCalls: (sessionId: string) => string
+ loadToolCallsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadToolCallsSuccess: (
+ toolCalls: SessionToolCalls,
+ payload?: string
+ ) => {
+ toolCalls: SessionToolCalls
+ payload?: string
+ }
+ selectSession: (sessionId: string | null) => {
+ sessionId: string | null
+ }
+ setDateFilter: (
+ dateFrom: string | null,
+ dateTo: string | null
+ ) => {
+ dateFrom: string | null
+ dateTo: string | null
+ }
+ setFilters: (filters: Partial<MCPSessionsFilters>) => {
+ filters: Partial<MCPSessionsFilters>
+ }
+ setHasNext: (hasNext: boolean) => {
+ hasNext: boolean
+ }
+ setSorting: (sorting: MCPSessionSorting | null) => {
+ sorting: MCPSessionSorting | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpSessionsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ selectedSession: (sessions: MCPSessionApi[], selectedSessionId: string | null) => MCPSessionApi | null
+ selectedSessionIntent: (
+ selectedSession: MCPSessionApi | null,
+ intentOverrides: Record<string, string>,
+ selectedSessionId: string | null
+ ) => string
+ isSelectedSessionGenerating: (
+ generatedIntentLoading: boolean,
+ generatingSessionId: string | null,
+ selectedSessionId: string | null
+ ) => boolean
+ selectedSessionToolCalls: (
+ toolCalls: SessionToolCalls,
+ selectedSessionId: string | null,
+ toolCallsLoading: boolean
+ ) => {
+ calls: MCPToolCallApi[]
+ hasNext: boolean
+ loading: boolean
+ loadingMore: boolean
+ }
+ }
+}
+
+export type mcpSessionsLogicType = MakeLogicType<
+ mcpSessionsLogicValues,
+ mcpSessionsLogicActions,
+ Record<string, any>,
+ mcpSessionsLogicMeta
+>
+
export const mcpSessionsLogic = kea<mcpSessionsLogicType>([
path(['products', 'mcp_analytics', 'frontend', 'sessions', 'mcpSessionsLogic']),
connect(() => ({
@@ -283,7 +459,7 @@ export const mcpSessionsLogic = kea<mcpSessionsLogicType>([
selectors({
selectedSession: [
(s) => [s.sessions, s.selectedSessionId],
- (sessions, selectedSessionId): MCPSessionApi | null => {
+ (sessions: MCPSessionApi[], selectedSessionId: string | null): MCPSessionApi | null => {
if (!selectedSessionId) {
return null
}
@@ -292,7 +468,11 @@ export const mcpSessionsLogic = kea<mcpSessionsLogicType>([
],
selectedSessionIntent: [
(s) => [s.selectedSession, s.intentOverrides, s.selectedSessionId],
- (selectedSession, intentOverrides, selectedSessionId): string => {
+ (
+ selectedSession: MCPSessionApi | null,
+ intentOverrides: Record<string, string>,
+ selectedSessionId: string | null
+ ): string => {
if (selectedSessionId && intentOverrides[selectedSessionId]) {
return intentOverrides[selectedSessionId]
}
@@ -303,8 +483,11 @@ export const mcpSessionsLogic = kea<mcpSessionsLogicType>([
// generation kicked off for another session never shows a spinner on this one.
isSelectedSessionGenerating: [
(s) => [s.generatedIntentLoading, s.generatingSessionId, s.selectedSessionId],
- (generatedIntentLoading, generatingSessionId, selectedSessionId): boolean =>
- generatedIntentLoading && generatingSessionId === selectedSessionId,
+ (
+ generatedIntentLoading: boolean,
+ generatingSessionId: string | null,
+ selectedSessionId: string | null
+ ): boolean => generatedIntentLoading && generatingSessionId === selectedSessionId,
],
// Everything the detail panel needs about the selected session's calls, derived from the
// loaded value (tagged with its session) so a previous session's calls never render under
@@ -313,9 +496,9 @@ export const mcpSessionsLogic = kea<mcpSessionsLogicType>([
selectedSessionToolCalls: [
(s) => [s.toolCalls, s.selectedSessionId, s.toolCallsLoading],
(
- toolCalls,
- selectedSessionId,
- toolCallsLoading
+ toolCalls: SessionToolCalls,
+ selectedSessionId: string | null,
+ toolCallsLoading: boolean
): { calls: MCPToolCallApi[]; hasNext: boolean; loading: boolean; loadingMore: boolean } => {
const isCurrent = toolCalls.sessionId === selectedSessionId
return {
diff --git a/products/user_interviews/frontend/userInterviewLogic.ts b/products/user_interviews/frontend/userInterviewLogic.ts
index 13174e62554d..01b44376ae9d 100644
--- a/products/user_interviews/frontend/userInterviewLogic.ts
+++ b/products/user_interviews/frontend/userInterviewLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { lemonToast } from '@posthog/lemon-ui'
@@ -26,7 +26,6 @@ import type {
UserInterviewApi,
UserInterviewTopicApi,
} from './generated/api.schemas'
-import type { userInterviewLogicType } from './userInterviewLogicType'
export interface UserInterviewLogicProps {
id: string
@@ -39,6 +38,161 @@ function unwrapPaginatedOrArray<T>(response: T[] | { results?: T[] }): T[] {
return response.results ?? []
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface userInterviewLogicValues {
+ breadcrumbs: Breadcrumb[]
+ interviewees: IntervieweeContextApi[]
+ intervieweesLoading: boolean
+ interviews: UserInterviewApi[]
+ interviewsLoading: boolean
+ invitePreview: PreviewInviteResultApi | null
+ invitePreviewLoading: boolean
+ linkByIdentifier: Record<string, string>
+ linkForIdentifier: (identifier: string) => string | undefined
+ links: InterviewLinkApi[]
+ linksCsvExporting: boolean
+ linksLoadFailed: boolean
+ linksLoading: boolean
+ previewInviteIdentifier: string | null
+ respondedCount: number
+ respondedIdentifiers: Set<string>
+ responseRate: number
+ testLink: TestInterviewLinkApi | null
+ testLinkLoading: boolean
+ topic: UserInterviewTopicApi | null
+ topicInterviews: UserInterviewApi[]
+ topicLoading: boolean
+ totalTargeted: number
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface userInterviewLogicActions {
+ closeInvitePreview: () => {
+ value: true
+ }
+ exportLinksCsv: () => {
+ value: true
+ }
+ exportLinksCsvDone: () => {
+ value: true
+ }
+ loadInterviewees: () => any
+ loadIntervieweesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadIntervieweesSuccess: (
+ interviewees: IntervieweeContextApi[],
+ payload?: any
+ ) => {
+ interviewees: IntervieweeContextApi[]
+ payload?: any
+ }
+ loadInterviews: () => any
+ loadInterviewsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadInterviewsSuccess: (
+ interviews: UserInterviewApi[],
+ payload?: any
+ ) => {
+ interviews: UserInterviewApi[]
+ payload?: any
+ }
+ loadInvitePreview: (identifier: string) => string
+ loadInvitePreviewFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadInvitePreviewSuccess: (
+ invitePreview: PreviewInviteResultApi,
+ payload?: string
+ ) => {
+ invitePreview: PreviewInviteResultApi
+ payload?: string
+ }
+ loadLinks: () => any
+ loadLinksFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadLinksSuccess: (
+ links: InterviewLinkApi[],
+ payload?: any
+ ) => {
+ links: InterviewLinkApi[]
+ payload?: any
+ }
+ loadTestLink: () => any
+ loadTestLinkFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadTestLinkSuccess: (
+ testLink: TestInterviewLinkApi,
+ payload?: any
+ ) => {
+ testLink: TestInterviewLinkApi
+ payload?: any
+ }
+ loadTopic: () => any
+ loadTopicFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadTopicSuccess: (
+ topic: UserInterviewTopicApi | null,
+ payload?: any
+ ) => {
+ topic: UserInterviewTopicApi | null
+ payload?: any
+ }
+ openInvitePreview: (identifier: string) => {
+ identifier: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface userInterviewLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ topicInterviews: (interviews: UserInterviewApi[]) => UserInterviewApi[]
+ linkByIdentifier: (links: InterviewLinkApi[]) => Record<string, string>
+ linkForIdentifier: (linkByIdentifier: Record<string, string>) => (identifier: string) => string | undefined
+ respondedIdentifiers: (topicInterviews: UserInterviewApi[]) => Set<string>
+ respondedCount: (topic: UserInterviewTopicApi | null, respondedIdentifiers: Set<string>) => number
+ totalTargeted: (topic: UserInterviewTopicApi | null) => number
+ responseRate: (respondedCount: number, totalTargeted: number) => number
+ breadcrumbs: (topic: UserInterviewTopicApi | null) => Breadcrumb[]
+ }
+}
+
+export type userInterviewLogicType = MakeLogicType<
+ userInterviewLogicValues,
+ userInterviewLogicActions,
+ UserInterviewLogicProps,
+ userInterviewLogicMeta
+>
+
export const userInterviewLogic = kea<userInterviewLogicType>([
path(['products', 'user_interviews', 'frontend', 'userInterviewLogic']),
props({} as UserInterviewLogicProps),
@@ -168,22 +322,22 @@ export const userInterviewLogic = kea<userInterviewLogicType>([
selectors(({ props }) => ({
topicInterviews: [
(s) => [s.interviews],
- (interviews): UserInterviewApi[] => interviews.filter((i) => i.topic === props.id),
+ (interviews: UserInterviewApi[]): UserInterviewApi[] => interviews.filter((i) => i.topic === props.id),
],
linkByIdentifier: [
(s) => [s.links],
- (links): Record<string, string> =>
+ (links: InterviewLinkApi[]): Record<string, string> =>
Object.fromEntries(links.map((link) => [link.interviewee_identifier, link.interview_url])),
],
linkForIdentifier: [
(s) => [s.linkByIdentifier],
- (linkByIdentifier): ((identifier: string) => string | undefined) =>
+ (linkByIdentifier: Record<string, string>): ((identifier: string) => string | undefined) =>
(identifier: string) =>
linkByIdentifier[identifier],
],
respondedIdentifiers: [
(s) => [s.topicInterviews],
- (interviews): Set<string> => {
+ (interviews: UserInterviewApi[]): Set<string> => {
const responded = new Set<string>()
for (const interview of interviews) {
if (interview.transcript || interview.summary) {
@@ -197,24 +351,24 @@ export const userInterviewLogic = kea<userInterviewLogicType>([
],
respondedCount: [
(s) => [s.topic, s.respondedIdentifiers],
- (topic, respondedIdentifiers): number => {
+ (topic: UserInterviewTopicApi | null, respondedIdentifiers: Set<string>): number => {
const allTargeted = [...(topic?.interviewee_emails || []), ...(topic?.interviewee_distinct_ids || [])]
return allTargeted.filter((id) => respondedIdentifiers.has(id)).length
},
],
totalTargeted: [
(s) => [s.topic],
- (topic): number =>
+ (topic: UserInterviewTopicApi | null): number =>
(topic?.interviewee_emails?.length || 0) + (topic?.interviewee_distinct_ids?.length || 0),
],
responseRate: [
(s) => [s.respondedCount, s.totalTargeted],
- (respondedCount, totalTargeted): number =>
+ (respondedCount: number, totalTargeted: number): number =>
totalTargeted > 0 ? Math.round((respondedCount / totalTargeted) * 100) : 0,
],
breadcrumbs: [
(s) => [s.topic],
- (topic): Breadcrumb[] => [
+ (topic: UserInterviewTopicApi | null): Breadcrumb[] => [
{
key: 'UserInterviews',
name: 'User research',
diff --git a/products/user_interviews/frontend/userInterviewsLogic.ts b/products/user_interviews/frontend/userInterviewsLogic.ts
index 6531d4d36296..48c84e7d9269 100644
--- a/products/user_interviews/frontend/userInterviewsLogic.ts
+++ b/products/user_interviews/frontend/userInterviewsLogic.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 { teamLogic } from 'scenes/teamLogic'
@@ -8,7 +8,55 @@ import { Breadcrumb } from '~/types'
import { userInterviewTopicsList, userInterviewsSearchCreate } from './generated/api'
import type { UserInterviewSearchResultApi, UserInterviewTopicApi } from './generated/api.schemas'
-import type { userInterviewsLogicType } from './userInterviewsLogicType'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface userInterviewsLogicValues {
+ breadcrumbs: Breadcrumb[]
+ searchQuery: string
+ searchResults: UserInterviewSearchResultApi[]
+ searchResultsLoading: boolean
+ topics: UserInterviewTopicApi[]
+ topicsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface userInterviewsLogicActions {
+ loadSearchResults: (_: unknown) => unknown
+ loadSearchResultsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSearchResultsSuccess: (
+ searchResults: UserInterviewSearchResultApi[],
+ payload?: unknown
+ ) => {
+ searchResults: UserInterviewSearchResultApi[]
+ payload?: unknown
+ }
+ loadTopics: () => any
+ loadTopicsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadTopicsSuccess: (
+ topics: UserInterviewTopicApi[],
+ payload?: any
+ ) => {
+ topics: UserInterviewTopicApi[]
+ payload?: any
+ }
+ setSearchQuery: (searchQuery: string) => {
+ searchQuery: string
+ }
+}
+
+export type userInterviewsLogicType = MakeLogicType<userInterviewsLogicValues, userInterviewsLogicActions>
export const userInterviewsLogic = kea<userInterviewsLogicType>([
path(['products', 'user_interviews', 'frontend', 'userInterviewsLogic']),