/** * TokenCard (GW-11): the Cloudflare API-token creation walkthrough — eight * numbered steps, the permission checklist as a small table, and a * paste-in box that hands the token back to the wizard's form (`onUse`). * The token never persists in component state beyond the box and never * leaves this machine except inside the wizard's own POST. */ import { useState } from 'react' import type { ReactNode } from 'react' import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots' import { NS } from '../../locales.ts' import { WizardCard } from '../WizardCard.tsx' /** The wizard's translate function, straight from the shared locale contract. */ export type WizardT = PropsLocale['t'] export interface TokenCardProps { t: WizardT /** Hands the pasted token back to the wizard's form field. */ onUse: (token: string) => void onClose: () => void } const STEPS = ['tokenStep1', 'tokenStep2', 'tokenStep3', 'tokenStep4', 'tokenStep5', 'tokenStep6', 'tokenStep7', 'tokenStep8'] as const export function TokenCard({ t, onUse, onClose }: TokenCardProps): ReactNode { const [pasted, setPasted] = useState('') return ( onUse(pasted.trim())}> {t('wizard.card.tokenUse')} )} onClose={onClose} >
{STEPS.map((key, index) => (

{`${index + 1}. ${t(`wizard.card.${key}`)}`}

))}

{t('wizard.card.tokenPerms')}

{t('wizard.card.tokenPermDns')} {t('wizard.card.tokenPermDnsWhy')}
{t('wizard.card.tokenPermTunnel')} {t('wizard.card.tokenPermTunnelWhy')}
{t('wizard.card.tokenPermAccount')} {t('wizard.card.tokenPermAccountWhy')}
{t('wizard.card.tokenPermZoneRead')} {t('wizard.card.tokenPermZoneReadWhy')}
setPasted(event.target.value)} />
) }