: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
feat(user-interviews): celebrate end of interview with hogfetti (#60750)
Paul D'Ambra34d147fde67f
diff --git a/frontend/src/exporter/scenes/ExporterInterviewScene.tsx b/frontend/src/exporter/scenes/ExporterInterviewScene.tsxindex 4b066e29a1a9..e07d1b2f4e78 100644--- a/frontend/src/exporter/scenes/ExporterInterviewScene.tsx+++ b/frontend/src/exporter/scenes/ExporterInterviewScene.tsx@@ -5,9 +5,24 @@ import { LemonButton } from '@posthog/lemon-ui'import { Logo } from 'lib/brand/Logo'import { RobotHog } from 'lib/components/hedgehogs'+import { useHogfetti } from 'lib/components/Hogfetti/Hogfetti'import { InterviewExportPayload } from '../types'+// Vapi surfaces several normal-completion signals through its `error` channel because+// the underlying Daily.co transport reports the local participant being evicted as+// an error. Treat these as expected end-of-call events rather than failures.+const BENIGN_END_OF_CALL_MESSAGES = ['Meeting has ended', 'Meeting ended due to ejection', 'Worker has ended call']++const isBenignEndOfCallError = (message: string): boolean =>+ BENIGN_END_OF_CALL_MESSAGES.some((pattern) => message.includes(pattern))++// Floor for the celebratory end-of-call effect. A 20-second bail-out doesn't+// deserve confetti — it reads as desperate rather than thankful. Two minutes+// is the rough point where the interviewee has given enough of a substantive+// answer that we genuinely want to thank them for the time.+const HOGFETTI_MIN_CALL_DURATION_MS = 2 * 60 * 1000+type CallState = 'already-replied' | 'idle' | 'loading' | 'connecting' | 'in-call' | 'ended' | 'error'type ConversationPhase = 'agent-talking' | 'listening' | 'thinking'@@ -236,11 +251,36 @@ export default function ExporterInterviewScene({const agentTalkingRef = useRef<boolean>(false)const lastPhaseRef = useRef<ConversationPhase>('thinking')const isMountedRef = useRef<boolean>(true)+ const callStartedAtRef = useRef<number | null>(null)+ const hogfettiFiredRef = useRef<boolean>(false)+ const { trigger: triggerHogfetti, HogfettiComponent } = useHogfetti({ count: 75, duration: 3000 })useEffect(() => {document.title = `Interview · ${interview.topic}`}, [interview.topic])+ useEffect(() => {+ if (state !== 'ended' || hogfettiFiredRef.current) {+ return+ }+ const startedAt = callStartedAtRef.current+ if (startedAt === null) {+ return+ }+ if (Date.now() - startedAt < HOGFETTI_MIN_CALL_DURATION_MS) {+ return+ }+ // Mark as fired before the early returns below so a resize-driven+ // re-run cannot retrigger the celebration. `useHogfetti`'s `trigger`+ // identity changes whenever `dimensions` updates (window resize),+ // and that dep change re-runs this effect while `state === 'ended'`.+ hogfettiFiredRef.current = true+ if (typeof window !== 'undefined' && window.matchMedia?.('(prefers-reduced-motion: reduce)').matches) {+ return+ }+ triggerHogfetti()+ }, [state, triggerHogfetti])+useEffect(() => {return () => {isMountedRef.current = false@@ -259,6 +299,8 @@ export default function ExporterInterviewScene({vapiRef.current = nullagentTalkingRef.current = falselastPhaseRef.current = 'thinking'+ callStartedAtRef.current = null+ hogfettiFiredRef.current = falsesetConversationPhase('thinking')setState('loading')void (async () => {@@ -285,8 +327,6 @@ export default function ExporterInterviewScene({// error so the user gets the retry affordance.const callEndedRef = { current: false }const callConnectedRef = { current: false }- const isBenignEndOfCallError = (msg: string): boolean =>- msg.includes('Meeting has ended') || msg.includes('Meeting ended due to ejection')vapi.on('call-end', () => {callEndedRef.current = truesetState('ended')@@ -341,6 +381,7 @@ export default function ExporterInterviewScene({// Mark that the call actually connected — gates the benign-error suppression// so pre-connection "Meeting has ended" failures still surface to the user.callConnectedRef.current = true+ callStartedAtRef.current = Date.now()setState((current) => (current === 'connecting' ? 'in-call' : current))} catch (e) {if (!isMountedRef.current) {@@ -364,6 +405,7 @@ export default function ExporterInterviewScene({return (<div className="max-w-2xl mx-auto px-4 py-12">+ <HogfettiComponent /><div className="mb-8"><Logo className="text-lg" /></div>