import { Button } from '@/components/ui/button' import { openExternalLink } from '@/lib/external-link' import { ExternalLink } from '@/lib/icons' import type { BillingRefusal } from './api' import { useBillingCopy } from './copy' import { resolveRefusal } from './errors' import { useStepUpFlow } from './use-step-up' export function StepUpInlineAction({ flow }: { flow: ReturnType }) { const copy = useBillingCopy() if (flow.verification) { return ( {flow.verification.code} ) } if (flow.message) { return ( {flow.message.title}: {flow.message.text} ) } if (flow.phase === 'waiting') { return {copy.waitingVerification} } return ( ) } export function BillingRefusalInline({ refusal }: { refusal: BillingRefusal | null }) { const copy = useBillingCopy() const stepUp = useStepUpFlow() if (!refusal) { return null } const resolved = resolveRefusal(refusal, copy) const portalUrl = resolved.action.type === 'portal' ? resolved.action.url : undefined return (
{resolved.title}: {resolved.message} {resolved.action.type === 'step_up' && } {portalUrl && ( )}
) }