: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, connect, kea, key, path, props } from 'kea'
import { router, urlToAction } from 'kea-router'
import { urls } from 'scenes/urls'
import { surveysLogic } from '../surveysLogic'
export interface SurveyFormBuilderLogicProps {
id: string // 'new' for new surveys, or a UUID for editing
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface surveyFormBuilderLogicValues {
formBuilderEnabled: boolean // surveysLogic
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface surveyFormBuilderLogicActions {
loadSurveys: () => any // surveysLogic
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface surveyFormBuilderLogicMeta {
key: string
}
export type surveyFormBuilderLogicType = MakeLogicType<
surveyFormBuilderLogicValues,
surveyFormBuilderLogicActions,
SurveyFormBuilderLogicProps,
surveyFormBuilderLogicMeta
>
export const surveyFormBuilderLogic = kea<surveyFormBuilderLogicType>([
path(['scenes', 'surveys', 'form', 'surveyFormBuilderLogic']),
props({} as SurveyFormBuilderLogicProps),
key((props) => props.id),
connect(() => ({
actions: [surveysLogic, ['loadSurveys']],
values: [surveysLogic, ['formBuilderEnabled']],
})),
urlToAction(({ values, props }) => ({
[urls.surveyFormBuilder(props.id)]: () => {
if (!values.formBuilderEnabled) {
router.actions.replace(urls.survey(props.id))
}
},
})),
])