: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
import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
import type { MessagingNavTabKey } from '../messagingTabs'
export type TransactionalTab = 'transactional' | 'log' | 'metrics'
export type TransactionalRoute = MessagingNavTabKey | TransactionalTab | 'new'
/** The view a URL opens in the Transactional scene, or null for a URL that belongs to another scene. */
export function transactionalRouteFor(pathname: string): TransactionalRoute | null {
const match = removeProjectIdIfPresent(pathname).match(/^\/transactional(?:\/([^/]+))?\/?$/)
if (!match) {
return null
}
// The manifest only sends literal paths to this scene, so a single segment is always one of its views.
return (match[1] ?? 'transactional') as TransactionalRoute
}