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.

977 B
Raw Blame
import { CyclotronJobInputSchemaType } from '~/types'

import { IntegrationChoice, IntegrationConfigureProps } from './IntegrationChoice'

function buildRedirectUrl(integrationTarget: string): string {
    const params = new URLSearchParams(window.location.search)
    params.set('integration_target', integrationTarget)
    return `${window.location.pathname}?${params.toString()}${window.location.hash}`
}

export type CyclotronJobInputIntegrationProps = IntegrationConfigureProps & {
    schema: CyclotronJobInputSchemaType
    persistForUnload?: () => void
}

export function CyclotronJobInputIntegration({
    schema,
    persistForUnload,
    ...props
}: CyclotronJobInputIntegrationProps): JSX.Element {
    return (
        <IntegrationChoice
            {...props}
            schema={schema}
            integration={schema.integration}
            redirectUrl={buildRedirectUrl(schema.key)}
            beforeRedirect={() => persistForUnload?.()}
        />
    )
}