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.

931 B
Raw Blame
import { INSIGHT_ALERT_FIRING_SUB_TEMPLATE_ID } from 'lib/constants'
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: string
    insightShortId: InsightShortId
}

export function AlertDestinationSelector({ alertId, insightShortId }: AlertDestinationSelectorProps): JSX.Element {
    const returnTo = `${urls.insightAlerts(insightShortId)}?alert_id=${alertId}`

    return (
        <LinkedHogFunctions
            type="internal_destination"
            subTemplateIds={[INSIGHT_ALERT_FIRING_SUB_TEMPLATE_ID]}
            hideFeedback={true}
            forceFilterGroups={[buildAlertFilterConfig(alertId)]}
            queryParams={{ returnTo }}
        />
    )
}