: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 { MakeLogicType, kea, path } from 'kea'
import { urlToAction } from 'kea-router'
import { organizationLogic } from 'scenes/organizationLogic'
import { sceneLogic } from 'scenes/sceneLogic'
import { SidePanelTab } from '~/types'
import { SUPPORT_KIND_TO_SUBJECT, supportLogic } from './supportLogic'
// Mirrors navigationLogic's `mode === 'full'` (the condition that mounts <SidePanel />), derived from
// sources supportLogic can't import without a billingLogic init cycle. Keep here, not in supportLogic.
function shouldUseSidePanel(): boolean {
if (organizationLogic.findMounted()?.values.isCurrentOrganizationUnavailable) {
return false
}
return sceneLogic.findMounted()?.values.sceneConfig?.layout !== 'plain'
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export type supportRouterLogicType = MakeLogicType<{}, {}>
export const supportRouterLogic = kea<supportRouterLogicType>([
path(['lib', 'components', 'support', 'supportRouterLogic']),
urlToAction(() => ({
'*': (_, _searchParams, hashParams) => {
if (supportLogic.findMounted()?.values.isSupportFormOpen) {
return
}
const target = shouldUseSidePanel() ? 'sidePanel' : 'modal'
const [panel, ...panelOptions] = (hashParams['panel'] ?? '').split(':')
if (panel === SidePanelTab.Support) {
// `kind` is the only routable field left. Links written before the triage fields were
// removed carry `kind:area:severity:isEmailFormOpen`, so read the flag by value rather
// than by position — positionally, an old link's area would land in its slot.
const [kind] = panelOptions
if (kind === 'ticket') {
return
}
supportLogic.actions.openSupportForm({
kind: Object.keys(SUPPORT_KIND_TO_SUBJECT).includes(kind) ? kind : null,
isEmailFormOpen: panelOptions.includes('true') ? 'true' : 'false',
target,
})
return
}
// Legacy supportModal param
if ('supportModal' in hashParams) {
const [kind] = (hashParams['supportModal'] || '').split(':')
supportLogic.actions.openSupportForm({
kind: Object.keys(SUPPORT_KIND_TO_SUBJECT).includes(kind) ? kind : null,
target,
})
}
},
})),
])