: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
refactor(alerts): move insight-alerts frontend into products/alerts (#69812)
Matt Pua3b6a3f5798ac
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.tsindex 41c086f01a26..66a1a4532a7a 100644--- a/frontend/src/lib/api.ts+++ b/frontend/src/lib/api.ts@@ -228,6 +228,7 @@ import {WebhookInfo,} from '~/types'+import { AlertConfig, AlertSimulationResult, AlertType, AlertTypeWrite } from 'products/alerts/frontend/types'import type { CustomerJourneyApi } from 'products/customer_analytics/frontend/generated/api.schemas'import type {ErrorTrackingRule,@@ -269,7 +270,6 @@ import type {import { AgentMode } from '../queries/schema'import type { AttachedContext, MaxUIContext } from '../scenes/max/maxTypes'-import { AlertConfig, AlertSimulationResult, AlertType, AlertTypeWrite } from './components/Alerts/types'import {ErrorTrackingFingerprint,ErrorTrackingRelease,diff --git a/frontend/src/lib/components/ActivityLog/describers.tsx b/frontend/src/lib/components/ActivityLog/describers.tsxindex f612efb879a8..bbdc6fad51b2 100644--- a/frontend/src/lib/components/ActivityLog/describers.tsx+++ b/frontend/src/lib/components/ActivityLog/describers.tsx@@ -4,7 +4,6 @@ import { instanceSettingActivityDescriber } from 'lib/components/ActivityLog/actimport { tagActivityDescriber } from 'lib/components/ActivityLog/activityDescriptions/tagActivityDescriber'import { ActivityLogItem, Describer, defaultDescriber } from 'lib/components/ActivityLog/humanizeActivity'import { actionActivityDescriber } from 'scenes/actions/actionActivityDescriber'-import { alertConfigurationActivityDescriber } from 'scenes/alerts/activityDescriptions'import { annotationActivityDescriber } from 'scenes/annotations/activityDescriptions'import { userActivityDescriber } from 'scenes/authentication/shared/activityDescriptions'import { cohortActivityDescriber } from 'scenes/cohorts/activityDescriptions'@@ -38,6 +37,7 @@ import { teamActivityDescriber } from 'scenes/team-activity/teamActivityDescribeimport { ActivityScope } from '~/types'+import { alertConfigurationActivityDescriber } from 'products/alerts/frontend/components/activityDescriptions'import { ticketActivityDescriber } from 'products/conversations/frontend/activityDescriber'import { externalDataSourceActivityDescriber } from 'products/data_warehouse/frontend/shared/components/activityDescriptions'import { endpointActivityDescriber } from 'products/endpoints/frontend/activityDescriber'diff --git a/frontend/src/lib/components/Cards/InsightCard/InsightMeta.tsx b/frontend/src/lib/components/Cards/InsightCard/InsightMeta.tsxindex e6bfcbd957ef..76765ed28fe7 100644--- a/frontend/src/lib/components/Cards/InsightCard/InsightMeta.tsx+++ b/frontend/src/lib/components/Cards/InsightCard/InsightMeta.tsx@@ -5,8 +5,6 @@ import React, { useCallback, useEffect, useRef, useState } from 'react'import { IconInfo, IconThumbsDown, IconThumbsUp } from '@posthog/icons'import { lemonToast } from '@posthog/lemon-ui'-import { areAlertsSupportedForInsight, insightAlertsLogic } from 'lib/components/Alerts/insightAlertsLogic'-import { ManageAlertsModal } from 'lib/components/Alerts/views/ManageAlertsModal'import { CardMeta } from 'lib/components/Cards/CardMeta'import { CardMetaRefreshButton } from 'lib/components/Cards/CardMetaRefreshButton'import { DashboardTileRefreshDataButton } from 'lib/components/Cards/InsightCard/DashboardTileRefreshDataButton'@@ -56,6 +54,9 @@ import {QueryBasedInsightModel,} from '~/types'+import { areAlertsSupportedForInsight, insightAlertsLogic } from 'products/alerts/frontend/logic/insightAlertsLogic'+import { ManageAlertsModal } from 'products/alerts/frontend/views/ManageAlertsModal'+import { DashboardInsightDisplayOptions } from './DashboardInsightDisplayOptions'import { dashboardWidgetMenusLogic } from './dashboardWidgetMenusLogic'import { DashboardWidgetPlacementMenus } from './DashboardWidgetPlacementMenus'diff --git a/frontend/src/lib/components/Scenes/SceneAlertsButton.tsx b/frontend/src/lib/components/Scenes/SceneAlertsButton.tsxindex 1f3ee4e27523..0f28d941b094 100644--- a/frontend/src/lib/components/Scenes/SceneAlertsButton.tsx+++ b/frontend/src/lib/components/Scenes/SceneAlertsButton.tsx@@ -9,7 +9,8 @@ import { urls } from 'scenes/urls'import { InsightLogicProps, InsightShortId } from '~/types'-import { insightAlertsLogic } from '../Alerts/insightAlertsLogic'+import { insightAlertsLogic } from 'products/alerts/frontend/logic/insightAlertsLogic'+import { SceneDataAttrKeyProps } from './utils'interface SceneAlertsButtonProps extends SceneDataAttrKeyProps {diff --git a/frontend/src/lib/components/TerraformExporter/alertHclExporter.test.ts b/frontend/src/lib/components/TerraformExporter/alertHclExporter.test.tsindex e186151d89ba..9dc4624dfb4f 100644--- a/frontend/src/lib/components/TerraformExporter/alertHclExporter.test.ts+++ b/frontend/src/lib/components/TerraformExporter/alertHclExporter.test.ts@@ -1,6 +1,6 @@import { generateAlertHCL } from 'lib/components/TerraformExporter/alertHclExporter'-import { AlertType } from '~/lib/components/Alerts/types'+import { AlertType } from 'products/alerts/frontend/types'const createTestAlert = (props: Record<string, unknown>): Partial<AlertType> => props as Partial<AlertType>diff --git a/frontend/src/lib/components/TerraformExporter/alertHclExporter.ts b/frontend/src/lib/components/TerraformExporter/alertHclExporter.tsindex 118ec1b12827..346713d1ced3 100644--- a/frontend/src/lib/components/TerraformExporter/alertHclExporter.ts+++ b/frontend/src/lib/components/TerraformExporter/alertHclExporter.ts@@ -1,8 +1,9 @@import { formatHclValue, sanitizeResourceName } from 'lib/components/TerraformExporter/hclExporterFormattingUtils'-import { AlertType, isTrendsAlertConfig } from '~/lib/components/Alerts/types'import { HogFunctionType } from '~/types'+import { AlertType, isTrendsAlertConfig } from 'products/alerts/frontend/types'+import { FieldMapping, HclExportOptions, HclExportResult, ResourceExporter, generateHCL } from './hclExporter'import { generateHogFunctionHCL } from './hogFunctionHclExporter'diff --git a/frontend/src/lib/components/TerraformExporter/dashboardHclExporter.ts b/frontend/src/lib/components/TerraformExporter/dashboardHclExporter.tsindex f7058e2d0e87..49a6d19e7b4c 100644--- a/frontend/src/lib/components/TerraformExporter/dashboardHclExporter.ts+++ b/frontend/src/lib/components/TerraformExporter/dashboardHclExporter.ts@@ -4,9 +4,10 @@ import {sanitizeResourceName,} from 'lib/components/TerraformExporter/hclExporterFormattingUtils'-import { AlertType } from '~/lib/components/Alerts/types'import { DashboardBasicType, DashboardType, HogFunctionType, InsightModel } from '~/types'+import { AlertType } from 'products/alerts/frontend/types'+import { generateDashboardLayoutHCL } from './dashboardLayoutHclExporter'import { FieldMapping, HclExportOptions, HclExportResult, ResourceExporter, generateHCL } from './hclExporter'import { generateInsightHCL, INSIGHT_EXPORTER } from './insightHclExporter'diff --git a/frontend/src/lib/components/TerraformExporter/insightHclExporter.ts b/frontend/src/lib/components/TerraformExporter/insightHclExporter.tsindex 5a5cde25fcf0..c78fbb65a277 100644--- a/frontend/src/lib/components/TerraformExporter/insightHclExporter.ts+++ b/frontend/src/lib/components/TerraformExporter/insightHclExporter.ts@@ -6,9 +6,10 @@ import {sanitizeResourceName,} from 'lib/components/TerraformExporter/hclExporterFormattingUtils'-import { AlertType } from '~/lib/components/Alerts/types'import { HogFunctionType, InsightModel } from '~/types'+import { AlertType } from 'products/alerts/frontend/types'+import { generateAlertHCL } from './alertHclExporter'import { FieldMapping, HclExportOptions, HclExportResult, ResourceExporter, generateHCL } from './hclExporter'diff --git a/frontend/src/lib/components/TerraformExporter/useTerraformExport.ts b/frontend/src/lib/components/TerraformExporter/useTerraformExport.tsindex f18a8190cbeb..2ff8c80322bd 100644--- a/frontend/src/lib/components/TerraformExporter/useTerraformExport.ts+++ b/frontend/src/lib/components/TerraformExporter/useTerraformExport.ts@@ -2,12 +2,13 @@ import { useValues } from 'kea'import posthog from 'posthog-js'import { useCallback, useEffect, useRef, useState } from 'react'-import { buildAlertFilterConfig } from 'lib/utils/alerts'import { teamLogic } from 'scenes/teamLogic'-import { AlertType } from '~/lib/components/Alerts/types'import { DashboardType, HogFunctionType, InsightModel, QueryBasedInsightModel } from '~/types'+import { buildAlertFilterConfig } from 'products/alerts/frontend/logic/alertNotifications'+import { AlertType } from 'products/alerts/frontend/types'+import api from '../../api'import { DashboardExportResult, generateDashboardHCL } from './dashboardHclExporter'import { InsightExportResult, generateInsightHCL } from './insightHclExporter'diff --git a/frontend/src/products.tsx b/frontend/src/products.tsxindex aae2455f73cc..3579f2d50b76 100644--- a/frontend/src/products.tsx+++ b/frontend/src/products.tsx@@ -4,7 +4,6 @@import { combineUrl } from 'kea-router'import posthog from 'posthog-js'-import { AlertType } from 'lib/components/Alerts/types'import { FEATURE_FLAGS, INSIGHT_VISUAL_ORDER } from 'lib/constants'import { toParams } from 'lib/utils/url'import type { Params } from 'scenes/sceneTypes'@@ -30,6 +29,8 @@ import {import { isDataTableNode, isDataVisualizationNode, isHogQLQuery } from '~/queries/utils'import { ActivityScope } from '~/types'+import { AlertType } from 'products/alerts/frontend/types'+import { AI_OBSERVABILITY_CLUSTER_URL_PATTERN } from '../../products/ai_observability/frontend/clusters/constants'import type {SchemaConfigurationSection,diff --git a/frontend/src/queries/nodes/DataVisualization/DataVisualization.tsx b/frontend/src/queries/nodes/DataVisualization/DataVisualization.tsxindex 059171ea9ace..aa4f3aaddec8 100644--- a/frontend/src/queries/nodes/DataVisualization/DataVisualization.tsx+++ b/frontend/src/queries/nodes/DataVisualization/DataVisualization.tsx@@ -6,7 +6,6 @@ import { useCallback, useRef, useState } from 'react'import { IconGear } from '@posthog/icons'import { LemonButton, LemonDivider } from '@posthog/lemon-ui'-import { alertsToThresholdGoalLines, insightAlertsLogic } from 'lib/components/Alerts/insightAlertsLogic'import { ExportButton } from 'lib/components/ExportButton/ExportButton'import { useAttachedLogic } from 'lib/logic/scenes/useAttachedLogic'import { InsightErrorState, StatelessInsightLoadingState } from 'scenes/insights/EmptyStates'@@ -28,6 +27,8 @@ import { QueryContext } from '~/queries/types'import { shouldQueryBeAsync } from '~/queries/utils'import { ChartDisplayType, ExportContext, ExporterFormat, InsightLogicProps } from '~/types'+import { alertsToThresholdGoalLines, insightAlertsLogic } from 'products/alerts/frontend/logic/insightAlertsLogic'+import { DataNodeLogicProps, dataNodeLogic } from '../DataNode/dataNodeLogic'import { DateRange } from '../DataNode/DateRange'import { ElapsedTime } from '../DataNode/ElapsedTime'diff --git a/frontend/src/scenes/insights/EditorFilters/ShowAlertAnomalyPointsFilter.tsx b/frontend/src/scenes/insights/EditorFilters/ShowAlertAnomalyPointsFilter.tsxindex 767c4036c8e6..862e1685d0f7 100644--- a/frontend/src/scenes/insights/EditorFilters/ShowAlertAnomalyPointsFilter.tsx+++ b/frontend/src/scenes/insights/EditorFilters/ShowAlertAnomalyPointsFilter.tsx@@ -2,9 +2,10 @@ import { useActions, useValues } from 'kea'import { LemonCheckbox } from '@posthog/lemon-ui'-import { insightAlertsLogic } from 'lib/components/Alerts/insightAlertsLogic'import { insightLogic } from 'scenes/insights/insightLogic'+import { insightAlertsLogic } from 'products/alerts/frontend/logic/insightAlertsLogic'+export function ShowAlertAnomalyPointsFilter(): JSX.Element | null {const { insightProps, insight } = useValues(insightLogic)const logic = insightAlertsLogic({ insightId: insight.id!, insightLogicProps: insightProps })diff --git a/frontend/src/scenes/insights/InsightModals.tsx b/frontend/src/scenes/insights/InsightModals.tsxindex 844aba2b585c..6668dff3f524 100644--- a/frontend/src/scenes/insights/InsightModals.tsx+++ b/frontend/src/scenes/insights/InsightModals.tsx@@ -2,9 +2,6 @@ import { useActions, useValues } from 'kea'import { router } from 'kea-router'import { AddToDashboardModal } from 'lib/components/AddToDashboard/AddToDashboardModal'-import { areAlertsSupportedForInsight } from 'lib/components/Alerts/insightAlertsLogic'-import { EditAlertModal } from 'lib/components/Alerts/views/EditAlertModal'-import { ManageAlertsModal } from 'lib/components/Alerts/views/ManageAlertsModal'import { SharingModal } from 'lib/components/Sharing/SharingModal'import { TerraformExportModal } from 'lib/components/TerraformExporter/TerraformExportModal'import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'@@ -17,6 +14,9 @@ import { urls } from 'scenes/urls'import { EndpointQueryNode, HogQLQuery } from '~/queries/schema/schema-general'import { InsightLogicProps, InsightShortId, ItemMode } from '~/types'+import { areAlertsSupportedForInsight } from 'products/alerts/frontend/logic/insightAlertsLogic'+import { EditAlertModal } from 'products/alerts/frontend/views/EditAlertModal'+import { ManageAlertsModal } from 'products/alerts/frontend/views/ManageAlertsModal'import { EndpointFromInsightModal } from 'products/endpoints/frontend/EndpointFromInsightModal'import { SubscriptionsModal } from 'products/subscriptions/frontend/components/Subscriptions/SubscriptionsModal'diff --git a/frontend/src/scenes/insights/InsightNav/InsightsNav.tsx b/frontend/src/scenes/insights/InsightNav/InsightsNav.tsxindex 71c6616f7a32..9023d071ba33 100644--- a/frontend/src/scenes/insights/InsightNav/InsightsNav.tsx+++ b/frontend/src/scenes/insights/InsightNav/InsightsNav.tsx@@ -1,7 +1,6 @@import { useActions, useValues } from 'kea'import posthog from 'posthog-js'-import { AlertDeletionWarning } from 'lib/components/Alerts/AlertDeletionWarning'import { LemonTabs } from 'lib/lemon-ui/LemonTabs'import { Link } from 'lib/lemon-ui/Link'import { Tooltip } from 'lib/lemon-ui/Tooltip'@@ -9,6 +8,8 @@ import { insightNavLogic } from 'scenes/insights/InsightNav/insightNavLogic'import { INSIGHT_TYPE_URLS } from 'scenes/insights/utils'import { INSIGHT_TYPES_METADATA } from 'scenes/saved-insights/SavedInsights'+import { AlertDeletionWarning } from 'products/alerts/frontend/components/AlertDeletionWarning'+import { insightLogic } from '../insightLogic'export function InsightsNav(): JSX.Element {diff --git a/frontend/src/scenes/insights/InsightPageHeader.tsx b/frontend/src/scenes/insights/InsightPageHeader.tsxindex 268fae9044f6..9ae50e8ae773 100644--- a/frontend/src/scenes/insights/InsightPageHeader.tsx+++ b/frontend/src/scenes/insights/InsightPageHeader.tsx@@ -5,7 +5,6 @@ import { useMemo } from 'react'import { IconPlusSmall } from '@posthog/icons'import { AccessControlAction } from 'lib/components/AccessControlAction'-import { areAlertsSupportedForInsight } from 'lib/components/Alerts/insightAlertsLogic'import { InsightSubscribeProminentButton } from 'lib/components/Scenes/InsightSubscribeProminentButton'import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'import { LemonButton } from 'lib/lemon-ui/LemonButton'@@ -30,6 +29,8 @@ import {} from '~/queries/utils'import { AccessControlLevel, AccessControlResourceType, InsightLogicProps, ItemMode } from '~/types'+import { areAlertsSupportedForInsight } from 'products/alerts/frontend/logic/insightAlertsLogic'+import { InsightSceneMenuBar } from './SidePanel/InsightSceneMenuBar'import { InsightSidePanelContent } from './SidePanel/InsightSidePanelContent'import { getInsightIconTypeFromQuery, getOverrideWarningPropsForButton } from './utils'diff --git a/frontend/src/scenes/insights/insightLogic.tsx b/frontend/src/scenes/insights/insightLogic.tsxindex 484ade0e5540..893cd7f442f5 100644--- a/frontend/src/scenes/insights/insightLogic.tsx+++ b/frontend/src/scenes/insights/insightLogic.tsx@@ -6,7 +6,6 @@ import posthog from 'posthog-js'import { LemonDialog, LemonInput } from '@posthog/lemon-ui'import { ApiError } from 'lib/api'-import { insightAlertsLogic } from 'lib/components/Alerts/insightAlertsLogic'import { tryShowMCPHint } from 'lib/components/MCPHint/mcpHintLogic'import { SetupTaskId, globalSetupLogic } from 'lib/components/ProductSetup'import { FEATURE_FLAGS } from 'lib/constants'@@ -61,6 +60,8 @@ import {SetInsightOptions,} from '~/types'+import { insightAlertsLogic } from 'products/alerts/frontend/logic/insightAlertsLogic'+import { teamLogic } from '../teamLogic'import { insightDataLogic, isInsightSceneInstance } from './insightDataLogic'import type { insightLogicType } from './insightLogicType'diff --git a/frontend/src/scenes/insights/insightSceneLogic.tsx b/frontend/src/scenes/insights/insightSceneLogic.tsxindex 5bb88bdd7292..2479becff3da 100644--- a/frontend/src/scenes/insights/insightSceneLogic.tsx+++ b/frontend/src/scenes/insights/insightSceneLogic.tsx@@ -3,7 +3,6 @@ import { urlToAction } from 'kea-router'import { objectsEqual } from 'kea-test-utils'import api from 'lib/api'-import { AlertType } from 'lib/components/Alerts/types'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { trackedActionToUrl } from 'lib/logic/scenes/trackedActionToUrl'import { InsightEventSource, eventUsageLogic } from 'lib/utils/eventUsageLogic'@@ -53,6 +52,7 @@ import {SidePanelTab,} from '~/types'+import { AlertType } from 'products/alerts/frontend/types'import { PRODUCT_ANALYTICS_DEFAULT_QUERY_TAGS } from 'products/product_analytics/frontend/constants'import { insightDataLogic } from './insightDataLogic'diff --git a/frontend/src/scenes/insights/views/LineGraph/LineGraph.tsx b/frontend/src/scenes/insights/views/LineGraph/LineGraph.tsxindex a74aa51d089e..bbc4c70092f2 100644--- a/frontend/src/scenes/insights/views/LineGraph/LineGraph.tsx+++ b/frontend/src/scenes/insights/views/LineGraph/LineGraph.tsx@@ -1,10 +1,11 @@import { Chart, ChartEvent, ChartType, DeepPartial, InteractionItem, LegendOptions } from 'lib/Chart'-import { AnomalyPoint } from 'lib/components/Alerts/types'import { TooltipConfig } from 'scenes/insights/InsightTooltip/insightTooltipUtils'import { GoalLine, TrendsFilter } from '~/queries/schema/schema-general'import { GraphDataset, GraphPoint, GraphPointPayload, GraphType } from '~/types'+import { AnomalyPoint } from 'products/alerts/frontend/types'+export function onChartClick(event: ChartEvent,chart: Chart,diff --git a/frontend/src/scenes/saved-insights/SavedInsights.tsx b/frontend/src/scenes/saved-insights/SavedInsights.tsxindex d1c6e25ca301..716d91b7ba17 100644--- a/frontend/src/scenes/saved-insights/SavedInsights.tsx+++ b/frontend/src/scenes/saved-insights/SavedInsights.tsx@@ -36,7 +36,6 @@ import { LemonSelectOptions } from '@posthog/lemon-ui'import { AccessControlAction } from 'lib/components/AccessControlAction'import { ActivityLog } from 'lib/components/ActivityLog/ActivityLog'-import { Alerts } from 'lib/components/Alerts/views/Alerts'import { BulkUpdateTagsButton } from 'lib/components/BulkActions/BulkUpdateTagsButton'import { ObjectTags } from 'lib/components/ObjectTags/ObjectTags'import { Shortcut } from 'lib/components/Shortcuts/Shortcut'@@ -85,6 +84,8 @@ import {SavedInsightsTabs,} from '~/types'+import { Alerts } from 'products/alerts/frontend/views/Alerts'+import { ReloadInsight } from './ReloadInsight'import { SavedInsightListItem, savedInsightsLogic } from './savedInsightsLogic'diff --git a/frontend/src/scenes/saved-insights/savedInsightsLogic.ts b/frontend/src/scenes/saved-insights/savedInsightsLogic.tsindex 80d2f2b04217..3e02373abedd 100644--- a/frontend/src/scenes/saved-insights/savedInsightsLogic.ts+++ b/frontend/src/scenes/saved-insights/savedInsightsLogic.ts@@ -3,7 +3,6 @@ import { loaders } from 'kea-loaders'import { router, urlToAction } from 'kea-router'import api, { CountedPaginatedResponse } from 'lib/api'-import { AlertType } from 'lib/components/Alerts/types'import { dayjs } from 'lib/dayjs'import { Sorting } from 'lib/lemon-ui/LemonTable'import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'@@ -25,6 +24,7 @@ import { insightsModel } from '~/models/insightsModel'import { getQueryBasedInsightModel } from '~/queries/nodes/InsightViz/utils'import { Breadcrumb, InsightModel, QueryBasedInsightModel, SavedInsightsTabs } from '~/types'+import { AlertType } from 'products/alerts/frontend/types'import {InsightBulkDeleteResponseApi,InsightBulkRestoreResponseApi,diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex 54a0c4f1f4cf..8948fe061af8 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -9,7 +9,6 @@ import { LemonTableColumns } from '@posthog/lemon-ui'import { PaginatedResponse } from 'lib/api'import { ChartDataset, ChartType, InteractionItem } from 'lib/Chart'-import { AlertType } from 'lib/components/Alerts/types'import { CommonFilters, HeatmapFilters, HeatmapFixedPositionMode } from 'lib/components/heatmaps/types'import { HedgehogActorOptions } from 'lib/components/HedgehogMode/types'import { SessionRecordingTriggerGroupsConfig, UrlTriggerConfig } from 'lib/components/IngestionControls/types'@@ -79,6 +78,7 @@ import type {} from '~/queries/schema/schema-general'import { QueryContext } from '~/queries/types'+import { AlertType } from 'products/alerts/frontend/types'import type { ExperimentFeatureFlagInputApi } from 'products/experiments/frontend/generated/api.schemas'import type { AIPromptConfigApi } from 'products/subscriptions/frontend/generated/api.schemas'import { CyclotronInputType } from 'products/workflows/frontend/Workflows/hogflows/steps/types'diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex b22021e87534..78a3ab53de87 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -2724,6 +2724,9 @@ importers:products/alerts:dependencies:+ '@posthog/brand':+ specifier: 'catalog:'+ version: 0.6.0([email protected])'@posthog/icons':specifier: 'catalog:'@@ -2733,12 +2736,27 @@ importers:'@types/react':specifier: 18.3.27version: 18.3.27+ chartjs-plugin-annotation:+ specifier: '*'+ version: 3.1.0([email protected])+ fast-deep-equal:+ specifier: '*'+ version: 3.1.3kea:specifier: 'catalog:'version: 4.0.0-pre.5([email protected])kea-forms:- specifier: '*'+ specifier: 'catalog:'version: 3.2.0([email protected]([email protected]))+ kea-loaders:+ specifier: 'catalog:'+ version: 3.1.1([email protected]([email protected]))+ kea-router:+ specifier: 'catalog:'+ version: 3.4.1([email protected]([email protected]))+ kea-subscriptions:+ specifier: 'catalog:'+ version: 3.0.1([email protected]([email protected]))posthog-js:specifier: 'catalog:'version: 1.399.1@@ -2748,6 +2766,9 @@ importers:typescript:specifier: 6.0.3version: 6.0.3+ zod:+ specifier: '*'+ version: 4.3.6devDependencies:'@storybook/react':specifier: 'catalog:'diff --git a/frontend/src/lib/components/Alerts/AlertDeletionWarning.tsx b/products/alerts/frontend/components/AlertDeletionWarning.tsxsimilarity index 93%rename from frontend/src/lib/components/Alerts/AlertDeletionWarning.tsxrename to products/alerts/frontend/components/AlertDeletionWarning.tsxindex 2394cd5dd7eb..ae735262b6bf 100644--- a/frontend/src/lib/components/Alerts/AlertDeletionWarning.tsx+++ b/products/alerts/frontend/components/AlertDeletionWarning.tsx@@ -3,7 +3,7 @@ import { useValues } from 'kea'import { LemonBanner } from 'lib/lemon-ui/LemonBanner'import { insightLogic } from 'scenes/insights/insightLogic'-import { insightAlertsLogic } from './insightAlertsLogic'+import { insightAlertsLogic } from '../logic/insightAlertsLogic'export function AlertDeletionWarning(): JSX.Element | null {const { insightProps, insight } = useValues(insightLogic)diff --git a/frontend/src/lib/components/Alerts/AlertsButton.tsx b/products/alerts/frontend/components/AlertsButton.tsxsimilarity index 97%rename from frontend/src/lib/components/Alerts/AlertsButton.tsxrename to products/alerts/frontend/components/AlertsButton.tsxindex b1097bf016ea..79488a277391 100644--- a/frontend/src/lib/components/Alerts/AlertsButton.tsx+++ b/products/alerts/frontend/components/AlertsButton.tsx@@ -10,7 +10,7 @@ import { urls } from 'scenes/urls'import { InsightLogicProps, QueryBasedInsightModel } from '~/types'-import { alertsUnsupportedReason, areAlertsSupportedForInsight, insightAlertsLogic } from './insightAlertsLogic'+import { alertsUnsupportedReason, areAlertsSupportedForInsight, insightAlertsLogic } from '../logic/insightAlertsLogic'export type AlertsButtonProps = LemonButtonProps & {insight: Partial<QueryBasedInsightModel>diff --git a/frontend/src/lib/components/Alerts/AlertsFiltersBar.tsx b/products/alerts/frontend/components/AlertsFiltersBar.tsxsimilarity index 95%rename from frontend/src/lib/components/Alerts/AlertsFiltersBar.tsxrename to products/alerts/frontend/components/AlertsFiltersBar.tsxindex 545c8cfcee2c..a738a18a82b1 100644--- a/frontend/src/lib/components/Alerts/AlertsFiltersBar.tsx+++ b/products/alerts/frontend/components/AlertsFiltersBar.tsx@@ -4,7 +4,7 @@ import { LemonInput } from '@posthog/lemon-ui'import { MemberSelect } from 'lib/components/MemberSelect'-import { alertsLogic } from './alertsLogic'+import { alertsLogic } from '../logic/alertsLogic'export function AlertsFiltersBar(): JSX.Element {const { filters } = useValues(alertsLogic)diff --git a/products/alerts/frontend/components/QuietHoursDayTimeline.tsx b/products/alerts/frontend/components/QuietHoursDayTimeline.tsxindex fc8fcfaf0cf2..b3d1f57b0e06 100644--- a/products/alerts/frontend/components/QuietHoursDayTimeline.tsx+++ b/products/alerts/frontend/components/QuietHoursDayTimeline.tsx@@ -1,8 +1,8 @@import {blockedAndAllowedMinuteIntervalsForQuietHours,MINUTES_PER_DAY,-} from 'lib/components/Alerts/scheduleRestrictionValidation'-import type { BlockedWindow } from 'lib/components/Alerts/types'+} from 'products/alerts/frontend/logic/scheduleRestrictionValidation'+import type { BlockedWindow } from 'products/alerts/frontend/types'type TimelineSegment = { kind: 'blocked' | 'allowed'; from: number; to: number }diff --git a/products/alerts/frontend/components/QuietHoursFields.stories.tsx b/products/alerts/frontend/components/QuietHoursFields.stories.tsxindex b8a6b2bcd252..7bb9a732d687 100644--- a/products/alerts/frontend/components/QuietHoursFields.stories.tsx+++ b/products/alerts/frontend/components/QuietHoursFields.stories.tsx@@ -1,10 +1,10 @@import type { Meta, StoryObj } from '@storybook/react'import { useState } from 'react'-import type { ScheduleRestriction } from 'lib/components/Alerts/types'-import { AlertCalculationInterval } from '~/queries/schema/schema-general'+import type { ScheduleRestriction } from 'products/alerts/frontend/types'+import type { QuietHoursFieldsProps } from './QuietHoursFields'import { QuietHoursFields } from './QuietHoursFields'diff --git a/products/alerts/frontend/components/QuietHoursFields.tsx b/products/alerts/frontend/components/QuietHoursFields.tsxindex 741de4d89a63..5685f2308afe 100644--- a/products/alerts/frontend/components/QuietHoursFields.tsx+++ b/products/alerts/frontend/components/QuietHoursFields.tsx@@ -3,13 +3,12 @@ import { useMemo, type FocusEvent } from 'react'import { IconTrash } from '@posthog/icons'import { LemonBanner, LemonButton, LemonCheckbox, LemonInput } from '@posthog/lemon-ui'-import { findQuietHoursIssues, MAX_BLOCKED_WINDOWS } from 'lib/components/Alerts/scheduleRestrictionValidation'-import type { BlockedWindow, ScheduleRestriction } from 'lib/components/Alerts/types'-import { AlertCalculationInterval } from '~/queries/schema/schema-general'import { isSubDailyAlertInterval } from 'products/alerts/frontend/logic/alertIntervalHelpers'import { estimateCheckSlotsNext24h } from 'products/alerts/frontend/logic/scheduleRestrictionPreview'+import { findQuietHoursIssues, MAX_BLOCKED_WINDOWS } from 'products/alerts/frontend/logic/scheduleRestrictionValidation'+import type { BlockedWindow, ScheduleRestriction } from 'products/alerts/frontend/types'import { QuietHoursDayTimeline } from './QuietHoursDayTimeline'@@ -40,7 +39,7 @@ export function QuietHoursFields({onChange,}: QuietHoursFieldsProps): JSX.Element {const enabled = !!scheduleRestriction?.blocked_windows?.length- const windows = scheduleRestriction?.blocked_windows ?? []+ const windows = useMemo(() => scheduleRestriction?.blocked_windows ?? [], [scheduleRestriction?.blocked_windows])const setWindows = (nextWindows: BlockedWindow[]): void => {if (nextWindows.length === 0) {diff --git a/frontend/src/lib/components/Alerts/SnoozeButton.tsx b/products/alerts/frontend/components/SnoozeButton.tsxsimilarity index 95%rename from frontend/src/lib/components/Alerts/SnoozeButton.tsxrename to products/alerts/frontend/components/SnoozeButton.tsxindex df79777cd3a1..c969c12fdf66 100644--- a/frontend/src/lib/components/Alerts/SnoozeButton.tsx+++ b/products/alerts/frontend/components/SnoozeButton.tsx@@ -1,8 +1,7 @@+import { DateFilter } from 'lib/components/DateFilter/DateFilter'import { dayjs } from 'lib/dayjs'import { formatDate } from 'lib/utils/datetime'-import { DateFilter } from '../DateFilter/DateFilter'-const DATETIME_FORMAT = 'MMM D - HH:mm'interface SnoozeButtonProps {diff --git a/frontend/src/scenes/alerts/activityDescriptions.tsx b/products/alerts/frontend/components/activityDescriptions.tsxsimilarity index 100%rename from frontend/src/scenes/alerts/activityDescriptions.tsxrename to products/alerts/frontend/components/activityDescriptions.tsxdiff --git a/products/alerts/frontend/components/editAlertModal/AlertAdvancedOptionsSection.tsx b/products/alerts/frontend/components/editAlertModal/AlertAdvancedOptionsSection.tsxindex 2518c9e1cf6d..795049aeda85 100644--- a/products/alerts/frontend/components/editAlertModal/AlertAdvancedOptionsSection.tsx+++ b/products/alerts/frontend/components/editAlertModal/AlertAdvancedOptionsSection.tsx@@ -3,11 +3,11 @@ import { Group } from 'kea-forms'import { IconInfo } from '@posthog/icons'import { LemonCheckbox, LemonCollapse, Tooltip } from '@posthog/lemon-ui'-import { AlertFormType, ongoingIntervalField } from 'lib/components/Alerts/alertFormLogic'import { LemonField } from 'lib/lemon-ui/LemonField'import { AlertCalculationInterval } from '~/queries/schema/schema-general'+import { AlertFormType, ongoingIntervalField } from 'products/alerts/frontend/logic/alertFormLogic'import { isSubDailyAlertInterval } from 'products/alerts/frontend/logic/alertIntervalHelpers'import { QuietHoursFields } from '../QuietHoursFields'diff --git a/products/alerts/frontend/components/editAlertModal/AlertDefinitionFields.tsx b/products/alerts/frontend/components/editAlertModal/AlertDefinitionFields.tsxindex 2f960cd4f3eb..b84d758dfc44 100644--- a/products/alerts/frontend/components/editAlertModal/AlertDefinitionFields.tsx+++ b/products/alerts/frontend/components/editAlertModal/AlertDefinitionFields.tsx@@ -3,20 +3,21 @@ import { Group } from 'kea-forms'import { IconInfo } from '@posthog/icons'import { LemonBanner, LemonSelect, LemonTag, Tooltip } from '@posthog/lemon-ui'-import { AlertFormType } from 'lib/components/Alerts/alertFormLogic'-import {- funnelConfigForOptionKey,- funnelConfigToOptionKey,- funnelConversionOptions,-} from 'lib/components/Alerts/funnelAlertOptions'-import { FunnelAlertPreview } from 'lib/components/Alerts/funnelAlertPreview'-import { HogQLAlertPreview } from 'lib/components/Alerts/hogqlAlertPreview'-import { isFunnelsAlertConfig } from 'lib/components/Alerts/types'import { LemonField } from 'lib/lemon-ui/LemonField'import { alphabet } from 'lib/utils/strings'import { AlertConditionType } from '~/queries/schema/schema-general'+import { AlertFormType } from 'products/alerts/frontend/logic/alertFormLogic'+import {+ funnelConfigForOptionKey,+ funnelConfigToOptionKey,+ funnelConversionOptions,+} from 'products/alerts/frontend/logic/funnelAlertOptions'+import { FunnelAlertPreview } from 'products/alerts/frontend/logic/funnelAlertPreview'+import { HogQLAlertPreview } from 'products/alerts/frontend/logic/hogqlAlertPreview'+import { isFunnelsAlertConfig } from 'products/alerts/frontend/types'+import { HogQLAlertPreviewBanner, HogQLAlertPreviewRowsTable } from './HogQLAlertPreview'const breakdownDisabledReason = (alertMode: 'detector' | 'threshold'): string =>diff --git a/products/alerts/frontend/components/editAlertModal/AlertDefinitionSection.tsx b/products/alerts/frontend/components/editAlertModal/AlertDefinitionSection.tsxindex c749247ffe01..1e116f4a99ed 100644--- a/products/alerts/frontend/components/editAlertModal/AlertDefinitionSection.tsx+++ b/products/alerts/frontend/components/editAlertModal/AlertDefinitionSection.tsx@@ -11,24 +11,24 @@ import {Tooltip,} from '@posthog/lemon-ui'-import { AlertFormType } from 'lib/components/Alerts/alertFormLogic'-import { FunnelAlertPreview } from 'lib/components/Alerts/funnelAlertPreview'-import { HogQLAlertPreview } from 'lib/components/Alerts/hogqlAlertPreview'-import { fractionToPercentInput, rescaleFunnelBound } from 'lib/components/Alerts/thresholdPercent'+import { LemonField } from 'lib/lemon-ui/LemonField'++import { AlertConditionType, InsightThresholdType } from '~/queries/schema/schema-general'++import { AlertFormType } from 'products/alerts/frontend/logic/alertFormLogic'+import { getDefaultSimulationRange } from 'products/alerts/frontend/logic/alertIntervalHelpers'+import { FunnelAlertPreview } from 'products/alerts/frontend/logic/funnelAlertPreview'+import { HogQLAlertPreview } from 'products/alerts/frontend/logic/hogqlAlertPreview'+import { fractionToPercentInput, rescaleFunnelBound } from 'products/alerts/frontend/logic/thresholdPercent'import {AlertSimulationResult,isAnyRowHogQLConfig,isFunnelsAlertConfig,isHogQLAlertConfig,isTrendsAlertConfig,-} from 'lib/components/Alerts/types'-import { DetectorSelector, getDefaultWindow } from 'lib/components/Alerts/views/DetectorSelector'-import { SimulationSummary } from 'lib/components/Alerts/views/SimulationSummary'-import { LemonField } from 'lib/lemon-ui/LemonField'--import { AlertConditionType, InsightThresholdType } from '~/queries/schema/schema-general'--import { getDefaultSimulationRange } from 'products/alerts/frontend/logic/alertIntervalHelpers'+} from 'products/alerts/frontend/types'+import { DetectorSelector, getDefaultWindow } from 'products/alerts/frontend/views/DetectorSelector'+import { SimulationSummary } from 'products/alerts/frontend/views/SimulationSummary'import { FunnelsDefinitionFields, HogQLDefinitionFields, TrendsDefinitionFields } from './AlertDefinitionFields'import { getSimulationRangeOptions } from './editAlertModalUtils'diff --git a/products/alerts/frontend/components/editAlertModal/AlertIntervalRow.tsx b/products/alerts/frontend/components/editAlertModal/AlertIntervalRow.tsxindex f486d9623873..97a65bb968f1 100644--- a/products/alerts/frontend/components/editAlertModal/AlertIntervalRow.tsx+++ b/products/alerts/frontend/components/editAlertModal/AlertIntervalRow.tsx@@ -3,14 +3,6 @@ import { useValues } from 'kea'import { IconClock } from '@posthog/icons'import { LemonSelect, Tooltip } from '@posthog/lemon-ui'-import { AlertFormType } from 'lib/components/Alerts/alertFormLogic'-import {- AlertType,- isHogQLAlertConfig,- isTrendsAlertConfig,- supportsOngoingInterval,- supportsTimeWindow,-} from 'lib/components/Alerts/types'import { TZLabel } from 'lib/components/TZLabel'import { upgradeModalLogic } from 'lib/components/UpgradeModal/upgradeModalLogic'import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'@@ -20,10 +12,18 @@ import { userLogic } from 'scenes/userLogic'import { AlertCalculationInterval } from '~/queries/schema/schema-general'import { AvailableFeature } from '~/types'+import { AlertFormType } from 'products/alerts/frontend/logic/alertFormLogic'import {cadenceFinerThanInsightInterval,selectAlertCalculationInterval,} from 'products/alerts/frontend/logic/alertIntervalHelpers'+import {+ AlertType,+ isHogQLAlertConfig,+ isTrendsAlertConfig,+ supportsOngoingInterval,+ supportsTimeWindow,+} from 'products/alerts/frontend/types'import { getAlertIntervalOptions } from './editAlertModalUtils'diff --git a/products/alerts/frontend/components/editAlertModal/AlertNotificationSection.tsx b/products/alerts/frontend/components/editAlertModal/AlertNotificationSection.tsxindex 580dfa9fdaaf..1a9490434c70 100644--- a/products/alerts/frontend/components/editAlertModal/AlertNotificationSection.tsx+++ b/products/alerts/frontend/components/editAlertModal/AlertNotificationSection.tsx@@ -1,11 +1,12 @@-import { AlertFormType } from 'lib/components/Alerts/alertFormLogic'-import { AlertType } from 'lib/components/Alerts/types'-import { AlertDestinationSelector } from 'lib/components/Alerts/views/AlertDestinationSelector'-import { InlineAlertNotifications } from 'lib/components/Alerts/views/InlineAlertNotifications'import { MemberSelectMultiple } from 'lib/components/MemberSelectMultiple'import { InsightShortId } from '~/types'+import { AlertFormType } from 'products/alerts/frontend/logic/alertFormLogic'+import { AlertType } from 'products/alerts/frontend/types'+import { AlertDestinationSelector } from 'products/alerts/frontend/views/AlertDestinationSelector'+import { InlineAlertNotifications } from 'products/alerts/frontend/views/InlineAlertNotifications'+export interface AlertNotificationSectionProps {alertForm: AlertFormTypealertId: AlertType['id'] | undefineddiff --git a/products/alerts/frontend/components/editAlertModal/HogQLAlertPreview.tsx b/products/alerts/frontend/components/editAlertModal/HogQLAlertPreview.tsxindex 55dac67f332b..7fe156f572a3 100644--- a/products/alerts/frontend/components/editAlertModal/HogQLAlertPreview.tsx+++ b/products/alerts/frontend/components/editAlertModal/HogQLAlertPreview.tsx@@ -1,15 +1,16 @@import { LemonBanner, LemonTable, LemonTag } from '@posthog/lemon-ui'-import {- HOGQL_ANY_ROW_MAX_ROWS,- HogQLAlertPreview,- HogQLAlertPreviewRow,-} from 'lib/components/Alerts/hogqlAlertPreview'import { humanFriendlyNumber } from 'lib/utils/numbers'import { pluralize } from 'lib/utils/strings'import { AlertConditionType } from '~/queries/schema/schema-general'+import {+ HOGQL_ANY_ROW_MAX_ROWS,+ HogQLAlertPreview,+ HogQLAlertPreviewRow,+} from 'products/alerts/frontend/logic/hogqlAlertPreview'+const PREVIEW_TABLE_MAX_ROWS = 10/** Per-row view of what the alert would evaluate: breaching rows first (any-row) or the mostdiff --git a/frontend/src/lib/components/Alerts/alertFormLogic.test.ts b/products/alerts/frontend/logic/alertFormLogic.test.tssimilarity index 99%rename from frontend/src/lib/components/Alerts/alertFormLogic.test.tsrename to products/alerts/frontend/logic/alertFormLogic.test.tsindex c4bc13d1a622..016576313039 100644--- a/frontend/src/lib/components/Alerts/alertFormLogic.test.ts+++ b/products/alerts/frontend/logic/alertFormLogic.test.ts@@ -21,6 +21,8 @@ import {import { initKeaTests } from '~/test/init'import { InsightLogicProps, InsightShortId } from '~/types'+import { supportsOngoingInterval } from '../types'+import type { AlertType } from '../types'import {alertFormLogic,canCheckOngoingInterval,@@ -32,8 +34,6 @@ import { alertNotificationLogic } from './alertNotificationLogic'import { deriveFunnelAlertPreview } from './funnelAlertPreview'import { deriveHogQLAlertPreview, HOGQL_ANY_ROW_MAX_ROWS, HOGQL_LAST_ROW_MAX_ROWS } from './hogqlAlertPreview'import { insightAlertsLogic } from './insightAlertsLogic'-import { supportsOngoingInterval } from './types'-import type { AlertType } from './types'const Insight42 = '42' as InsightShortIddiff --git a/frontend/src/lib/components/Alerts/alertFormLogic.ts b/products/alerts/frontend/logic/alertFormLogic.tssimilarity index 99%rename from frontend/src/lib/components/Alerts/alertFormLogic.tsrename to products/alerts/frontend/logic/alertFormLogic.tsindex 31d5f7ba16e3..bfe89944962f 100644--- a/frontend/src/lib/components/Alerts/alertFormLogic.ts+++ b/products/alerts/frontend/logic/alertFormLogic.ts@@ -27,13 +27,6 @@ import {isSubDailyAlertInterval,} from 'products/alerts/frontend/logic/alertIntervalHelpers'-import type { alertFormLogicType } from './alertFormLogicType'-import { getAlertFormValidationErrors } from './alertFormSchema'-import { alertLogic } from './alertLogic'-import { alertNotificationLogic } from './alertNotificationLogic'-import { deriveFunnelAlertPreview, FunnelAlertPreview } from './funnelAlertPreview'-import { columnIsNumeric, deriveHogQLAlertPreview, HogQLAlertPreview } from './hogqlAlertPreview'-import { insightAlertsLogic } from './insightAlertsLogic'import {AlertConfig,AlertSimulationResult,@@ -44,7 +37,14 @@ import {isHogQLAlertConfig,isTrendsAlertConfig,supportsOngoingInterval,-} from './types'+} from '../types'+import type { alertFormLogicType } from './alertFormLogicType'+import { getAlertFormValidationErrors } from './alertFormSchema'+import { alertLogic } from './alertLogic'+import { alertNotificationLogic } from './alertNotificationLogic'+import { deriveFunnelAlertPreview, FunnelAlertPreview } from './funnelAlertPreview'+import { columnIsNumeric, deriveHogQLAlertPreview, HogQLAlertPreview } from './hogqlAlertPreview'+import { insightAlertsLogic } from './insightAlertsLogic'export { THRESHOLD_BOUNDS_FORM_ERROR, thresholdAlertHasBounds } from './alertFormSchema'diff --git a/frontend/src/lib/components/Alerts/alertFormSchema.test.ts b/products/alerts/frontend/logic/alertFormSchema.test.tssimilarity index 100%rename from frontend/src/lib/components/Alerts/alertFormSchema.test.tsrename to products/alerts/frontend/logic/alertFormSchema.test.tsdiff --git a/frontend/src/lib/components/Alerts/alertFormSchema.ts b/products/alerts/frontend/logic/alertFormSchema.tssimilarity index 98%rename from frontend/src/lib/components/Alerts/alertFormSchema.tsrename to products/alerts/frontend/logic/alertFormSchema.tsindex c23b7d3e5051..a709347f469d 100644--- a/frontend/src/lib/components/Alerts/alertFormSchema.ts+++ b/products/alerts/frontend/logic/alertFormSchema.ts@@ -1,9 +1,9 @@import type { DeepPartialMap, ValidationErrorType } from 'kea-forms'import { z } from 'zod'+import type { AlertType } from '../types'import type { AlertFormType } from './alertFormLogic'import { quietHoursFormError } from './scheduleRestrictionValidation'-import type { AlertType } from './types'export const THRESHOLD_BOUNDS_FORM_ERROR = 'Enter at least one threshold (less than or more than)'diff --git a/frontend/src/lib/components/Alerts/alertLogic.ts b/products/alerts/frontend/logic/alertLogic.tssimilarity index 99%rename from frontend/src/lib/components/Alerts/alertLogic.tsrename to products/alerts/frontend/logic/alertLogic.tsindex b5238e3f864c..9b490b594187 100644--- a/frontend/src/lib/components/Alerts/alertLogic.ts+++ b/products/alerts/frontend/logic/alertLogic.ts@@ -7,8 +7,8 @@ import { formatDate } from 'lib/utils/datetime'import { AlertState } from '~/queries/schema/schema-general'+import type { AlertCheck, AlertType } from '../types'import type { alertLogicType } from './alertLogicType'-import type { AlertCheck, AlertType } from './types'export const CHART_CHECKS_LIMIT = 50export const TABLE_CHECKS_PAGE_SIZE = 25diff --git a/frontend/src/lib/components/Alerts/alertNotificationLogic.test.ts b/products/alerts/frontend/logic/alertNotificationLogic.test.tssimilarity index 98%rename from frontend/src/lib/components/Alerts/alertNotificationLogic.test.tsrename to products/alerts/frontend/logic/alertNotificationLogic.test.tsindex d8109b93c3f2..1976d9f08b15 100644--- a/frontend/src/lib/components/Alerts/alertNotificationLogic.test.ts+++ b/products/alerts/frontend/logic/alertNotificationLogic.test.ts@@ -1,14 +1,15 @@import { expectLogic } from 'kea-test-utils'import api from 'lib/api'++import { initKeaTests } from '~/test/init'+import { HogFunctionType } from '~/types'+import {ALERT_NOTIFICATION_TYPE_DISCORD,ALERT_NOTIFICATION_TYPE_MICROSOFT_TEAMS,ALERT_NOTIFICATION_TYPE_WEBHOOK,-} from 'lib/utils/alerts'--import { initKeaTests } from '~/test/init'-import { HogFunctionType } from '~/types'+} from 'products/alerts/frontend/logic/alertNotifications'import { alertNotificationLogic } from './alertNotificationLogic'diff --git a/frontend/src/lib/components/Alerts/alertNotificationLogic.ts b/products/alerts/frontend/logic/alertNotificationLogic.tssimilarity index 99%rename from frontend/src/lib/components/Alerts/alertNotificationLogic.tsrename to products/alerts/frontend/logic/alertNotificationLogic.tsindex a036e7b3d110..0d84cf8ff0f1 100644--- a/frontend/src/lib/components/Alerts/alertNotificationLogic.ts+++ b/products/alerts/frontend/logic/alertNotificationLogic.ts@@ -4,6 +4,11 @@ import { loaders } from 'kea-loaders'import api from 'lib/api'import { integrationsLogic } from 'lib/integrations/integrationsLogic'import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'+import { deleteWithUndo } from 'lib/utils/deleteWithUndo'+import { projectLogic } from 'scenes/projectLogic'++import { HogFunctionType, IntegrationType } from '~/types'+import {ALERT_NOTIFICATION_TYPE_DISCORD,ALERT_NOTIFICATION_TYPE_MICROSOFT_TEAMS,@@ -13,11 +18,7 @@ import {PendingAlertNotification,buildAlertFilterConfig,buildHogFunctionPayload,-} from 'lib/utils/alerts'-import { deleteWithUndo } from 'lib/utils/deleteWithUndo'-import { projectLogic } from 'scenes/projectLogic'--import { HogFunctionType, IntegrationType } from '~/types'+} from 'products/alerts/frontend/logic/alertNotifications'import type { alertNotificationLogicType } from './alertNotificationLogicType'diff --git a/frontend/src/lib/utils/alerts.test.ts b/products/alerts/frontend/logic/alertNotifications.test.tssimilarity index 99%rename from frontend/src/lib/utils/alerts.test.tsrename to products/alerts/frontend/logic/alertNotifications.test.tsindex b9a1b626e549..f2b9fb450633 100644--- a/frontend/src/lib/utils/alerts.test.ts+++ b/products/alerts/frontend/logic/alertNotifications.test.ts@@ -1,6 +1,6 @@import { PropertyFilterType, PropertyOperator } from '~/types'-import { PendingAlertNotification, buildAlertFilterConfig, buildHogFunctionPayload } from './alerts'+import { PendingAlertNotification, buildAlertFilterConfig, buildHogFunctionPayload } from './alertNotifications'describe('alertUtils', () => {describe('buildAlertFilterConfig', () => {diff --git a/frontend/src/lib/utils/alerts.ts b/products/alerts/frontend/logic/alertNotifications.tssimilarity index 100%rename from frontend/src/lib/utils/alerts.tsrename to products/alerts/frontend/logic/alertNotifications.tsdiff --git a/frontend/src/lib/components/Alerts/alertPreviewShared.test.ts b/products/alerts/frontend/logic/alertPreviewShared.test.tssimilarity index 100%rename from frontend/src/lib/components/Alerts/alertPreviewShared.test.tsrename to products/alerts/frontend/logic/alertPreviewShared.test.tsdiff --git a/frontend/src/lib/components/Alerts/alertPreviewShared.ts b/products/alerts/frontend/logic/alertPreviewShared.tssimilarity index 100%rename from frontend/src/lib/components/Alerts/alertPreviewShared.tsrename to products/alerts/frontend/logic/alertPreviewShared.tsdiff --git a/frontend/src/lib/components/Alerts/alertSchedulingStale.test.ts b/products/alerts/frontend/logic/alertSchedulingStale.test.tssimilarity index 100%rename from frontend/src/lib/components/Alerts/alertSchedulingStale.test.tsrename to products/alerts/frontend/logic/alertSchedulingStale.test.tsdiff --git a/frontend/src/lib/components/Alerts/alertSchedulingStale.ts b/products/alerts/frontend/logic/alertSchedulingStale.tssimilarity index 96%rename from frontend/src/lib/components/Alerts/alertSchedulingStale.tsrename to products/alerts/frontend/logic/alertSchedulingStale.tsindex 0a7e712688ea..a6e48f0feccd 100644--- a/frontend/src/lib/components/Alerts/alertSchedulingStale.ts+++ b/products/alerts/frontend/logic/alertSchedulingStale.ts@@ -2,7 +2,7 @@ import equal from 'fast-deep-equal'import { AlertCalculationInterval } from '~/queries/schema/schema-general'-import type { ScheduleRestriction } from './types'+import type { ScheduleRestriction } from '../types'export function normalizeScheduleRestrictionForCompare(sr: ScheduleRestriction | null | undefineddiff --git a/frontend/src/lib/components/Alerts/alertsLogic.ts b/products/alerts/frontend/logic/alertsLogic.tssimilarity index 99%rename from frontend/src/lib/components/Alerts/alertsLogic.tsrename to products/alerts/frontend/logic/alertsLogic.tsindex b62ef5b1ea64..220bd8d97548 100644--- a/frontend/src/lib/components/Alerts/alertsLogic.ts+++ b/products/alerts/frontend/logic/alertsLogic.ts@@ -8,9 +8,9 @@ import { objectClean } from 'lib/utils/objects'import { AlertState } from '~/queries/schema/schema-general'+import { AlertType } from '../types'import { AlertLogicProps } from './alertLogic'import type { alertsLogicType } from './alertsLogicType'-import { AlertType } from './types'export interface AlertsLogicProps extends AlertLogicProps {}diff --git a/frontend/src/lib/components/Alerts/funnelAlertOptions.test.ts b/products/alerts/frontend/logic/funnelAlertOptions.test.tssimilarity index 100%rename from frontend/src/lib/components/Alerts/funnelAlertOptions.test.tsrename to products/alerts/frontend/logic/funnelAlertOptions.test.tsdiff --git a/frontend/src/lib/components/Alerts/funnelAlertOptions.ts b/products/alerts/frontend/logic/funnelAlertOptions.tssimilarity index 100%rename from frontend/src/lib/components/Alerts/funnelAlertOptions.tsrename to products/alerts/frontend/logic/funnelAlertOptions.tsdiff --git a/frontend/src/lib/components/Alerts/funnelAlertPreview.ts b/products/alerts/frontend/logic/funnelAlertPreview.tssimilarity index 99%rename from frontend/src/lib/components/Alerts/funnelAlertPreview.tsrename to products/alerts/frontend/logic/funnelAlertPreview.tsindex 38772e391004..0f0b692d571d 100644--- a/frontend/src/lib/components/Alerts/funnelAlertPreview.ts+++ b/products/alerts/frontend/logic/funnelAlertPreview.ts@@ -1,7 +1,7 @@import { AlertConditionType, InsightsThresholdBounds, InsightThresholdType } from '~/queries/schema/schema-general'+import { AlertConfig, isFunnelsAlertConfig } from '../types'import { hasThresholdBounds, valueBreachesBounds } from './alertPreviewShared'-import { AlertConfig, isFunnelsAlertConfig } from './types'export interface FunnelAlertPreviewValue {label: string | null // breakdown value; null for a non-breakdown funneldiff --git a/frontend/src/lib/components/Alerts/hogqlAlertPreview.ts b/products/alerts/frontend/logic/hogqlAlertPreview.tssimilarity index 99%rename from frontend/src/lib/components/Alerts/hogqlAlertPreview.tsrename to products/alerts/frontend/logic/hogqlAlertPreview.tsindex 2d4575670f4b..3671f833bf0d 100644--- a/frontend/src/lib/components/Alerts/hogqlAlertPreview.ts+++ b/products/alerts/frontend/logic/hogqlAlertPreview.ts@@ -1,7 +1,7 @@import { InsightsThresholdBounds } from '~/queries/schema/schema-general'+import { AlertConfig, isHogQLAlertConfig } from '../types'import { hasThresholdBounds, valueBreachesBounds } from './alertPreviewShared'-import { AlertConfig, isHogQLAlertConfig } from './types'/** Mirror of the backend's ANY_ROW_MAX_ROWS (products/alerts/backend/evaluation/hogql.py) — keep* the two in sync. Advisory only; the backend extractor is the evaluation-time authority. */diff --git a/frontend/src/lib/components/Alerts/insightAlertsLogic.test.ts b/products/alerts/frontend/logic/insightAlertsLogic.test.tssimilarity index 99%rename from frontend/src/lib/components/Alerts/insightAlertsLogic.test.tsrename to products/alerts/frontend/logic/insightAlertsLogic.test.tsindex 4755d629ffe2..1ee3319ef2a6 100644--- a/frontend/src/lib/components/Alerts/insightAlertsLogic.test.ts+++ b/products/alerts/frontend/logic/insightAlertsLogic.test.ts@@ -9,8 +9,8 @@ import { NodeKind } from '~/queries/schema/schema-general'import { initKeaTests } from '~/test/init'import { InsightLogicProps, InsightShortId } from '~/types'+import type { AlertType } from '../types'import { alertsUnsupportedReason, areAlertsSupportedForInsight, insightAlertsLogic } from './insightAlertsLogic'-import type { AlertType } from './types'const Insight42 = '42' as InsightShortIddiff --git a/frontend/src/lib/components/Alerts/insightAlertsLogic.ts b/products/alerts/frontend/logic/insightAlertsLogic.tssimilarity index 99%rename from frontend/src/lib/components/Alerts/insightAlertsLogic.tsrename to products/alerts/frontend/logic/insightAlertsLogic.tsindex 682e3c7a56aa..ff13d5192898 100644--- a/frontend/src/lib/components/Alerts/insightAlertsLogic.ts+++ b/products/alerts/frontend/logic/insightAlertsLogic.ts@@ -17,8 +17,8 @@ import {} from '~/queries/utils'import { FunnelVizType, InsightLogicProps } from '~/types'+import { AlertType, AnomalyPoint, isTrendsAlertConfig } from '../types'import type { insightAlertsLogicType } from './insightAlertsLogicType'-import { AlertType, AnomalyPoint, isTrendsAlertConfig } from './types'export interface InsightAlertsLogicProps {insightId: numberdiff --git a/products/alerts/frontend/logic/scheduleRestrictionPreview.ts b/products/alerts/frontend/logic/scheduleRestrictionPreview.tsindex 89758ff20914..32ea0e2b1af9 100644--- a/products/alerts/frontend/logic/scheduleRestrictionPreview.ts+++ b/products/alerts/frontend/logic/scheduleRestrictionPreview.ts@@ -1,6 +1,7 @@-import type { BlockedWindow } from 'lib/components/Alerts/types'import { dayjs } from 'lib/dayjs'+import type { BlockedWindow } from 'products/alerts/frontend/types'+type ParsedWindow = { start: number; end: number; overnight: boolean }function parseHHMM(value: string): number {diff --git a/frontend/src/lib/components/Alerts/scheduleRestrictionValidation.test.ts b/products/alerts/frontend/logic/scheduleRestrictionValidation.test.tssimilarity index 100%rename from frontend/src/lib/components/Alerts/scheduleRestrictionValidation.test.tsrename to products/alerts/frontend/logic/scheduleRestrictionValidation.test.tsdiff --git a/frontend/src/lib/components/Alerts/scheduleRestrictionValidation.ts b/products/alerts/frontend/logic/scheduleRestrictionValidation.tssimilarity index 99%rename from frontend/src/lib/components/Alerts/scheduleRestrictionValidation.tsrename to products/alerts/frontend/logic/scheduleRestrictionValidation.tsindex 5758c1e659fd..aa00fad9ae5f 100644--- a/frontend/src/lib/components/Alerts/scheduleRestrictionValidation.ts+++ b/products/alerts/frontend/logic/scheduleRestrictionValidation.ts@@ -1,4 +1,4 @@-import type { BlockedWindow, ScheduleRestriction } from './types'+import type { BlockedWindow, ScheduleRestriction } from '../types'export const MAX_BLOCKED_WINDOWS = 5export const MIN_BLOCKED_WINDOW_MINUTES = 30diff --git a/frontend/src/lib/components/Alerts/thresholdPercent.test.ts b/products/alerts/frontend/logic/thresholdPercent.test.tssimilarity index 100%rename from frontend/src/lib/components/Alerts/thresholdPercent.test.tsrename to products/alerts/frontend/logic/thresholdPercent.test.tsdiff --git a/frontend/src/lib/components/Alerts/thresholdPercent.ts b/products/alerts/frontend/logic/thresholdPercent.tssimilarity index 100%rename from frontend/src/lib/components/Alerts/thresholdPercent.tsrename to products/alerts/frontend/logic/thresholdPercent.tsdiff --git a/frontend/src/lib/components/Alerts/types.test.ts b/products/alerts/frontend/types.test.tssimilarity index 100%rename from frontend/src/lib/components/Alerts/types.test.tsrename to products/alerts/frontend/types.test.tsdiff --git a/frontend/src/lib/components/Alerts/types.ts b/products/alerts/frontend/types.tssimilarity index 100%rename from frontend/src/lib/components/Alerts/types.tsrename to products/alerts/frontend/types.tsdiff --git a/frontend/src/lib/components/Alerts/views/AlertDestinationSelector.tsx b/products/alerts/frontend/views/AlertDestinationSelector.tsxsimilarity index 90%rename from frontend/src/lib/components/Alerts/views/AlertDestinationSelector.tsxrename to products/alerts/frontend/views/AlertDestinationSelector.tsxindex fd4dabb92424..024031d0c066 100644--- a/frontend/src/lib/components/Alerts/views/AlertDestinationSelector.tsx+++ b/products/alerts/frontend/views/AlertDestinationSelector.tsx@@ -1,10 +1,11 @@import { INSIGHT_ALERT_FIRING_SUB_TEMPLATE_ID } from 'lib/constants'-import { buildAlertFilterConfig } from 'lib/utils/alerts'import { LinkedHogFunctions } from 'scenes/hog-functions/list/LinkedHogFunctions'import { urls } from 'scenes/urls'import { InsightShortId } from '~/types'+import { buildAlertFilterConfig } from 'products/alerts/frontend/logic/alertNotifications'+export interface AlertDestinationSelectorProps {alertId: stringinsightShortId: InsightShortIddiff --git a/frontend/src/lib/components/Alerts/views/AlertHistoryChart.stories.tsx b/products/alerts/frontend/views/AlertHistoryChart.stories.tsxsimilarity index 99%rename from frontend/src/lib/components/Alerts/views/AlertHistoryChart.stories.tsxrename to products/alerts/frontend/views/AlertHistoryChart.stories.tsxindex e5e18ca1685b..75d3fba8bb10 100644--- a/frontend/src/lib/components/Alerts/views/AlertHistoryChart.stories.tsx+++ b/products/alerts/frontend/views/AlertHistoryChart.stories.tsx@@ -11,7 +11,7 @@ import {import type { QueryBasedInsightModel } from '~/types'import type { UserBasicType } from '~/types'-import { CHART_CHECKS_LIMIT } from '../alertLogic'+import { CHART_CHECKS_LIMIT } from '../logic/alertLogic'import type { AlertType } from '../types'import { AlertHistoryChart, type AlertHistoryChartPoint } from './AlertHistoryChart'diff --git a/frontend/src/lib/components/Alerts/views/AlertHistoryChart.tsx b/products/alerts/frontend/views/AlertHistoryChart.tsxsimilarity index 99%rename from frontend/src/lib/components/Alerts/views/AlertHistoryChart.tsxrename to products/alerts/frontend/views/AlertHistoryChart.tsxindex 08f15326638f..af38d9f992ec 100644--- a/frontend/src/lib/components/Alerts/views/AlertHistoryChart.tsx+++ b/products/alerts/frontend/views/AlertHistoryChart.tsx@@ -8,7 +8,7 @@ import { pluralize } from 'lib/utils/strings'import { InsightThresholdType } from '~/queries/schema/schema-general'-import type { AlertHistoryChartPoint } from '../alertLogic'+import type { AlertHistoryChartPoint } from '../logic/alertLogic'import type { AlertType } from '../types'export type { AlertHistoryChartPoint }diff --git a/frontend/src/lib/components/Alerts/views/AlertHistorySection.tsx b/products/alerts/frontend/views/AlertHistorySection.tsxsimilarity index 98%rename from frontend/src/lib/components/Alerts/views/AlertHistorySection.tsxrename to products/alerts/frontend/views/AlertHistorySection.tsxindex f12e3ff8ea6c..11d0eef6b98b 100644--- a/frontend/src/lib/components/Alerts/views/AlertHistorySection.tsx+++ b/products/alerts/frontend/views/AlertHistorySection.tsx@@ -14,8 +14,6 @@ import {} from '@posthog/lemon-ui'import type { LemonTableColumn } from '@posthog/lemon-ui'-import { AlertHistoryChart } from 'lib/components/Alerts/views/AlertHistoryChart'-import { AlertStateIndicator } from 'lib/components/Alerts/views/ManageAlertsModal'import { EmptyMessage } from 'lib/components/EmptyMessage/EmptyMessage'import { TZLabel } from 'lib/components/TZLabel'import { dayjs } from 'lib/dayjs'@@ -23,7 +21,10 @@ import { IconOpenInNew } from 'lib/lemon-ui/icons'import { formatDate } from 'lib/utils/datetime'import { humanFriendlyNumber } from 'lib/utils/numbers'-import { alertLogic, CHART_CHECKS_LIMIT, TABLE_CHECKS_PAGE_SIZE } from '../alertLogic'+import { AlertHistoryChart } from 'products/alerts/frontend/views/AlertHistoryChart'+import { AlertStateIndicator } from 'products/alerts/frontend/views/ManageAlertsModal'++import { alertLogic, CHART_CHECKS_LIMIT, TABLE_CHECKS_PAGE_SIZE } from '../logic/alertLogic'import { isAnyRowHogQLConfig } from '../types'import type { AlertCheck, AlertType, InvestigationVerdict } from '../types'diff --git a/frontend/src/lib/components/Alerts/views/Alerts.tsx b/products/alerts/frontend/views/Alerts.tsxsimilarity index 97%rename from frontend/src/lib/components/Alerts/views/Alerts.tsxrename to products/alerts/frontend/views/Alerts.tsxindex 5ce7662f0115..856028739688 100644--- a/frontend/src/lib/components/Alerts/views/Alerts.tsx+++ b/products/alerts/frontend/views/Alerts.tsx@@ -13,13 +13,13 @@ import { LemonTableLink } from 'lib/lemon-ui/LemonTable/LemonTableLink'import { urls } from 'scenes/urls'import { ProductKey } from '~/queries/schema/schema-general'+import { AlertState } from '~/queries/schema/schema-general'import { alertIntervalDisplayLabel } from 'products/alerts/frontend/logic/alertIntervalHelpers'-import { AlertState } from '../../../../queries/schema/schema-general'-import { alertLogic } from '../alertLogic'-import { AlertsFiltersBar } from '../AlertsFiltersBar'-import { alertsLogic } from '../alertsLogic'+import { AlertsFiltersBar } from '../components/AlertsFiltersBar'+import { alertLogic } from '../logic/alertLogic'+import { alertsLogic } from '../logic/alertsLogic'import { AlertType } from '../types'import { EditAlertModal } from './EditAlertModal'import { AlertStateIndicator } from './ManageAlertsModal'diff --git a/frontend/src/lib/components/Alerts/views/DetectorSelector.tsx b/products/alerts/frontend/views/DetectorSelector.tsxsimilarity index 100%rename from frontend/src/lib/components/Alerts/views/DetectorSelector.tsxrename to products/alerts/frontend/views/DetectorSelector.tsxdiff --git a/frontend/src/lib/components/Alerts/views/EditAlertModal.tsx b/products/alerts/frontend/views/EditAlertModal.tsxsimilarity index 97%rename from frontend/src/lib/components/Alerts/views/EditAlertModal.tsxrename to products/alerts/frontend/views/EditAlertModal.tsxindex 2bbb157ba802..05934657e74d 100644--- a/frontend/src/lib/components/Alerts/views/EditAlertModal.tsx+++ b/products/alerts/frontend/views/EditAlertModal.tsx@@ -28,12 +28,12 @@ import { AlertIntervalRow } from 'products/alerts/frontend/components/editAlertMimport { AlertNotificationSection } from 'products/alerts/frontend/components/editAlertModal/AlertNotificationSection'import { isSubDailyAlertInterval } from 'products/alerts/frontend/logic/alertIntervalHelpers'-import { alertFormLogic, canCheckOngoingInterval } from '../alertFormLogic'-import { alertLogic } from '../alertLogic'-import { alertNotificationLogic } from '../alertNotificationLogic'-import { isNextPlannedEvaluationStale } from '../alertSchedulingStale'-import { insightAlertsLogic } from '../insightAlertsLogic'-import { SnoozeButton } from '../SnoozeButton'+import { SnoozeButton } from '../components/SnoozeButton'+import { alertFormLogic, canCheckOngoingInterval } from '../logic/alertFormLogic'+import { alertLogic } from '../logic/alertLogic'+import { alertNotificationLogic } from '../logic/alertNotificationLogic'+import { isNextPlannedEvaluationStale } from '../logic/alertSchedulingStale'+import { insightAlertsLogic } from '../logic/insightAlertsLogic'import { supportsAnomalyDetection, supportsOngoingInterval } from '../types'import type { AlertType } from '../types'import { AlertHistorySection, AlertHistorySectionSkeleton } from './AlertHistorySection'diff --git a/frontend/src/lib/components/Alerts/views/InlineAlertNotifications.tsx b/products/alerts/frontend/views/InlineAlertNotifications.tsxsimilarity index 99%rename from frontend/src/lib/components/Alerts/views/InlineAlertNotifications.tsxrename to products/alerts/frontend/views/InlineAlertNotifications.tsxindex c23229a015ea..e44e73faff7c 100644--- a/frontend/src/lib/components/Alerts/views/InlineAlertNotifications.tsx+++ b/products/alerts/frontend/views/InlineAlertNotifications.tsx@@ -6,18 +6,19 @@ import { LemonButton, LemonInput, LemonSelect, LemonSkeleton, LemonTag } from '@import { SlackChannelPicker, SlackNotConfiguredBanner } from 'lib/integrations/SlackIntegrationHelpers'import { slackIntegrationLogic } from 'lib/integrations/slackIntegrationLogic'+import { urls } from 'scenes/urls'++import { HogFunctionType, SlackChannelType } from '~/types'+import {ALERT_NOTIFICATION_TYPE_DISCORD,ALERT_NOTIFICATION_TYPE_MICROSOFT_TEAMS,ALERT_NOTIFICATION_TYPE_SLACK,ALERT_NOTIFICATION_TYPE_WEBHOOK,PendingAlertNotification,-} from 'lib/utils/alerts'-import { urls } from 'scenes/urls'--import { HogFunctionType, SlackChannelType } from '~/types'+} from 'products/alerts/frontend/logic/alertNotifications'-import { ALERT_NOTIFICATION_TYPE_OPTIONS, alertNotificationLogic } from '../alertNotificationLogic'+import { ALERT_NOTIFICATION_TYPE_OPTIONS, alertNotificationLogic } from '../logic/alertNotificationLogic'function resolveSlackChannelName(channelValue: string, slackChannels: SlackChannelType[]): string | null {const channelId = channelValue.split('|')[0]diff --git a/frontend/src/lib/components/Alerts/views/ManageAlertsModal.tsx b/products/alerts/frontend/views/ManageAlertsModal.tsxsimilarity index 99%rename from frontend/src/lib/components/Alerts/views/ManageAlertsModal.tsxrename to products/alerts/frontend/views/ManageAlertsModal.tsxindex 4e286294d095..000b6568aa30 100644--- a/frontend/src/lib/components/Alerts/views/ManageAlertsModal.tsx+++ b/products/alerts/frontend/views/ManageAlertsModal.tsx@@ -15,7 +15,7 @@ import { urls } from 'scenes/urls'import { AlertState, InsightThresholdType } from '~/queries/schema/schema-general'import { InsightShortId } from '~/types'-import { InsightAlertsLogicProps, alertsUnsupportedReason, insightAlertsLogic } from '../insightAlertsLogic'+import { InsightAlertsLogicProps, alertsUnsupportedReason, insightAlertsLogic } from '../logic/insightAlertsLogic'import { AlertType } from '../types'export function AlertStateIndicator({ alert }: { alert: AlertType }): JSX.Element {diff --git a/frontend/src/lib/components/Alerts/views/SimulationSummary.tsx b/products/alerts/frontend/views/SimulationSummary.tsxsimilarity index 100%rename from frontend/src/lib/components/Alerts/views/SimulationSummary.tsxrename to products/alerts/frontend/views/SimulationSummary.tsxdiff --git a/products/alerts/package.json b/products/alerts/package.jsonindex d005c8c1ff7d..8b845ec1ca61 100644--- a/products/alerts/package.json+++ b/products/alerts/package.json@@ -5,6 +5,10 @@},"dependencies": {"kea": "catalog:",+ "kea-forms": "catalog:",+ "kea-loaders": "catalog:",+ "kea-router": "catalog:",+ "kea-subscriptions": "catalog:","posthog-js": "catalog:"},"devDependencies": {@@ -12,11 +16,14 @@"kea-test-utils": "catalog:"},"peerDependencies": {+ "@posthog/brand": "catalog:","@posthog/icons": "catalog:","@posthog/lemon-ui": "*","@types/react": "*",- "kea-forms": "*",+ "chartjs-plugin-annotation": "*",+ "fast-deep-equal": "*","react": "*",- "typescript": "catalog:*"+ "typescript": "catalog:*",+ "zod": "*"}}diff --git a/products/product_analytics/frontend/insights/trends/shared/TrendsAlertOverlays.tsx b/products/product_analytics/frontend/insights/trends/shared/TrendsAlertOverlays.tsxindex bb5ab5e9ab75..c26808d26f96 100644--- a/products/product_analytics/frontend/insights/trends/shared/TrendsAlertOverlays.tsx+++ b/products/product_analytics/frontend/insights/trends/shared/TrendsAlertOverlays.tsx@@ -3,11 +3,12 @@ import React, { useMemo } from 'react'import { AnomalyPointsLayer, ReferenceLines } from '@posthog/quill-charts'-import { insightAlertsLogic } from 'lib/components/Alerts/insightAlertsLogic'import type { IndexedTrendResult } from 'scenes/trends/types'import type { InsightLogicProps } from '~/types'+import { insightAlertsLogic } from 'products/alerts/frontend/logic/insightAlertsLogic'+import { buildAnomalyMarkers } from './anomalyPointsAdapter'import { alertThresholdsToReferenceLines } from './goalLinesAdapter'diff --git a/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.test.ts b/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.test.tsindex 19e6ca5da499..3492d07d1409 100644--- a/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.test.ts+++ b/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.test.ts@@ -1,8 +1,9 @@-import type { AnomalyPoint } from 'lib/components/Alerts/types'import type { IndexedTrendResult } from 'scenes/trends/types'import { EntityTypes } from '~/types'+import type { AnomalyPoint } from 'products/alerts/frontend/types'+import { buildAnomalyMarkers } from './anomalyPointsAdapter'function makeResult(overrides: Partial<IndexedTrendResult> = {}): IndexedTrendResult {diff --git a/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.ts b/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.tsindex 875dabf2a10d..67f574ed47c5 100644--- a/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.ts+++ b/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.ts@@ -1,8 +1,9 @@import type { AnomalyMarker as BaseAnomalyMarker } from '@posthog/quill-charts'-import type { AnomalyPoint } from 'lib/components/Alerts/types'import type { IndexedTrendResult } from 'scenes/trends/types'+import type { AnomalyPoint } from 'products/alerts/frontend/types'+export interface AnomalyMarker extends BaseAnomalyMarker {/** Originating alert anomaly score (0..1) if available. */score: number | nulldiff --git a/products/product_analytics/manifest.tsx b/products/product_analytics/manifest.tsxindex f750260280f7..9cbc69ac7d6c 100644--- a/products/product_analytics/manifest.tsx+++ b/products/product_analytics/manifest.tsx@@ -1,6 +1,5 @@import { combineUrl } from 'kea-router'-import { AlertType } from 'lib/components/Alerts/types'import { FEATURE_FLAGS, INSIGHT_VISUAL_ORDER } from 'lib/constants'import { urls } from 'scenes/urls'@@ -18,6 +17,8 @@ import {} from '~/queries/schema/schema-general'import { isDataTableNode, isDataVisualizationNode, isHogQLQuery } from '~/queries/utils'+import { AlertType } from 'products/alerts/frontend/types'+import {DashboardType,FileSystemIconColor,