send-invoice.tsx
import { useState } from 'react';import { createInvoice } from '@/lib/billing'; // Sends the invoice once and shows the result inlineexport function SendInvoice({ customerId, amount }: { customerId: string; amount: number }) {  const [state, setState] = useState<'idle' | 'sending' | 'sent'>('idle');   async function send() {    setState('sending');    await createInvoice({ customerId, amount, currency: 'EUR', dueInDays: 14, reminder: true, note: 'Thank you for working with Northwind' });    setState('sent');  }   return (    <button type="button" onClick={send} disabled={state !== 'idle'} className="btn btn-primary">      {state === 'sent' ? 'Invoice sent' : 'Send invoice'}    </button>  );}