import { useParams } from 'common' import { useCreateTenantSourceMutation } from 'data/replication/create-tenant-source-mutation' import { useState } from 'react' import { toast } from 'sonner' import { Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogSection, DialogSectionSeparator, DialogTitle, DialogTrigger, cn, } from 'ui' import { Admonition } from 'ui-patterns' import { DocsButton } from '@/components/ui/DocsButton' import { UpgradePlanButton } from '@/components/ui/UpgradePlanButton' import { DOCS_URL } from '@/lib/constants' const EnableReplicationModal = () => { const { ref: projectRef } = useParams() const [open, setOpen] = useState(false) const { mutate: createTenantSource, isPending: creatingTenantSource } = useCreateTenantSourceMutation({ onSuccess: () => { toast.success('Replication has been successfully enabled!') setOpen(false) }, onError: (error) => { toast.error(`Failed to enable replication: ${error.message}`) }, }) const onEnableReplication = async () => { if (!projectRef) return console.error('Project ref is required') createTenantSource({ projectRef }) } return ( Enable Replication

This feature is in active development and may change as we gather feedback. Availability and behavior can evolve while in Alpha.

Pricing has not been finalized yet. You can enable replication now; we'll announce pricing later and notify you before any charges apply.

) } export const EnableReplicationCallout = ({ type, className, hasAccess, }: { type?: string className?: string hasAccess: boolean }) => { return (

Replicate data to external destinations in real-time

{hasAccess ? 'Enable replication' : 'Upgrade to the Pro plan'} to start replicating your database changes to {type ?? 'data warehouses and analytics platforms'}

{hasAccess ? ( ) : ( )}
) }