import React from "react" import { Box, Text } from "ink" import type { AccountInfo } from "../../upstream/codex/account-info" import type { AccountView, KiroProviderInfo, ProviderMode } from "../types" export function AccountInfoPanel(props: { account?: AccountView; info?: AccountInfo; providerMode?: ProviderMode; kiroInfo?: KiroProviderInfo }) { const mode = props.providerMode ?? "codex" if (mode === "kiro") { const info = props.kiroInfo const tierLabel = info?.subscriptionTier ? formatTier(info.subscriptionTier) : undefined return ( Account info {info?.email ?? props.account?.name ?? "unknown"} {info?.authType ?? "unknown"}{tierLabel ? ` · ${tierLabel}` : ""} Region: {info?.region ?? "unknown"} {info?.profileArn && ARN: {info.profileArn}} ) } return ( Account info {accountInfo(props.account, props.info)} ) } function accountInfo(account?: AccountView, info?: AccountInfo) { const email = info?.email ?? account?.email ?? account?.name const plan = info?.plan ?? account?.plan if (!email) return "unknown" return `${email}${plan ? ` (${plan})` : ""}` } function formatTier(raw: string) { // "KIRO POWER" → "Power", "KIRO PRO" → "Pro", etc. const cleaned = raw.replace(/^KIRO\s+/i, "") return cleaned.charAt(0).toUpperCase() + cleaned.slice(1).toLowerCase() }