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.

969 B
Raw Blame
import { IntegrationKind, IntegrationType } from '~/types'

import { VercelIntegrationSuffix } from './VercelIntegrationSuffix'

export type OrganizationIntegrationConfig = {
    getSuffix: (integration: IntegrationType) => JSX.Element | undefined
    getDisplayName: (integration: IntegrationType) => string
}

const INTEGRATION_CONFIGS: Partial<Record<IntegrationKind, OrganizationIntegrationConfig>> = {
    vercel: {
        getSuffix: (integration) => <VercelIntegrationSuffix integration={integration} />,
        getDisplayName: (integration) => integration.config?.account?.name || integration.display_name || 'Vercel',
    },
}

const DEFAULT_INTEGRATION_CONFIG: OrganizationIntegrationConfig = {
    getSuffix: () => undefined,
    getDisplayName: (integration) => integration.display_name,
}

export const getIntegrationConfig = (kind: IntegrationKind): OrganizationIntegrationConfig => {
    return INTEGRATION_CONFIGS[kind] || DEFAULT_INTEGRATION_CONFIG
}