: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, kea, listeners, path } from 'kea'
import { toast } from '@posthog/quill'
import { writeToClipboard } from 'lib/utils/writeToClipboard'
import { urls } from 'scenes/urls'
export function chatUrl(chatId: string): string {
return urls.absolute(urls.currentProject(urls.ai(chatId)))
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface todayChatMenuLogicActions {
copyChatLink: (chatId: string) => {
chatId: string
}
openChatInNewTab: (chatId: string) => {
chatId: string
}
}
export type todayChatMenuLogicType = MakeLogicType<{}, todayChatMenuLogicActions>
export const todayChatMenuLogic = kea<todayChatMenuLogicType>([
path(['layout', 'today', 'todayChatMenuLogic']),
actions({
openChatInNewTab: (chatId: string) => ({ chatId }),
copyChatLink: (chatId: string) => ({ chatId }),
}),
listeners(() => ({
openChatInNewTab: ({ chatId }) => {
window.open(chatUrl(chatId), '_blank', 'noopener')
},
copyChatLink: async ({ chatId }) => {
const outcome = await writeToClipboard(chatUrl(chatId))
if (outcome === 'copied') {
toast.success({ title: 'Link copied' })
} else {
toast.error({ title: 'Couldn’t copy the link. Try again.' })
}
},
})),
])