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.

1.3 KB
Raw Blame
import { IntegrationType } from '~/types'

import { APNSSetupModal } from './APNSSetup/APNSSetupModal'
import { EmailSetupModal } from './EmailSetup/EmailSetupModal'
import { FCMSetupModal } from './FCMSetup/FCMSetupModal'
import { ChannelType } from './MessageChannels'
import { SlackSetupModal } from './SlackSetup/SlackSetupModal'
import { TwilioSetupModal } from './TwilioSetup/TwilioSetupModal'

interface ChannelSetupModalProps {
    isOpen: boolean
    channelType: ChannelType | null
    integration: IntegrationType | undefined
    onComplete: () => void
    onClose: () => void
}

export function ChannelSetupModal({
    isOpen,
    channelType,
    integration,
    onComplete,
    onClose,
}: ChannelSetupModalProps): JSX.Element | null {
    if (!isOpen || !channelType) {
        return null
    }

    const modalProps = {
        integration,
        onComplete,
        onClose,
    }

    switch (channelType) {
        case 'email':
            return <EmailSetupModal {...modalProps} />
        case 'slack':
            return <SlackSetupModal {...modalProps} />
        case 'twilio':
            return <TwilioSetupModal {...modalProps} />
        case 'firebase':
            return <FCMSetupModal {...modalProps} />
        case 'apns':
            return <APNSSetupModal {...modalProps} />

        default:
            return null
    }
}