: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, actions, connect, kea, listeners, path } from 'kea'
import posthog from 'posthog-js'
import { LemonDialog, LemonInput, LemonTextArea, lemonToast } from '@posthog/lemon-ui'
import { LemonField } from 'lib/lemon-ui/LemonField'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { userLogic } from 'scenes/userLogic'
import { HogFunctionTypeType } from '~/types'
import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
import type { UserType } from '../../../types'
import { humanizeHogFunctionType } from '../hog-function-utils'
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface hogFunctionRequestModalLogicValues {
featureFlags: FeatureFlagsSet // featureFlagLogic
user: UserType | null // userLogic
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface hogFunctionRequestModalLogicActions {
openFeedbackDialog: (
type: HogFunctionTypeType,
name?: string
) => {
name: string
type: HogFunctionTypeType
}
}
export type hogFunctionRequestModalLogicType = MakeLogicType<
hogFunctionRequestModalLogicValues,
hogFunctionRequestModalLogicActions
>
export const hogFunctionRequestModalLogic = kea<hogFunctionRequestModalLogicType>([
path(() => ['scenes', 'hog-functions', 'list', 'hogFunctionRequestModalLogic']),
connect(() => ({
values: [userLogic, ['user'], featureFlagLogic, ['featureFlags']],
})),
actions({
openFeedbackDialog: (type: HogFunctionTypeType, name: string = '') => ({ type, name }),
}),
listeners(() => ({
openFeedbackDialog: async ({ type, name }, breakpoint) => {
await breakpoint(100)
const humanizedType = humanizeHogFunctionType(type)
LemonDialog.openForm({
title: `What ${humanizedType} would you like to see?`,
initialValues: { name: name },
errors: {
name: (x) => (!x ? 'Required' : undefined),
},
description: undefined,
content: (
<div className="deprecated-space-y-2">
<LemonField name="name" label={`Name of the ${humanizedType}`}>
<LemonInput placeholder="e.g. PostHog" autoFocus />
</LemonField>
<LemonField name="details" label="Additional information" showOptional>
<LemonTextArea
placeholder={`Any extra details about what you would need this ${humanizedType} to do or your overall goal`}
/>
</LemonField>
</div>
),
onSubmit: async (values) => {
posthog.capture(`cdp hog function feedback`, { type, ...values })
lemonToast.success('Thank you for your feedback!')
},
})
},
})),
])