Skip to content

: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.

559 B
Raw Blame
import { Survey } from '~/types'

import { INTRO_SCREEN_PAGE_INDEX, NewSurvey } from '../constants'

export type HostedSurveyPageKind = 'intro' | 'question' | 'confirmation'

export function getHostedSurveyPageKind(survey: Survey | NewSurvey, pageIndex: number): HostedSurveyPageKind {
    if (survey.appearance?.displayIntroScreen && pageIndex === INTRO_SCREEN_PAGE_INDEX) {
        return 'intro'
    }
    if (survey.appearance?.displayThankYouMessage && pageIndex === survey.questions.length) {
        return 'confirmation'
    }
    return 'question'
}