"use client"; import { useTranslations } from "next-intl"; import { useRouter } from "next/navigation"; import { PACKAGE_CATALOG } from "@/lib/packages"; import { PackageCard } from "./package-card"; interface Props { tenantName: string; enabledPackages: string[]; conditions?: Array<{ type: string; status: string; reason?: string }>; onRefresh?: () => void; /** Slice 5: when false, package toggles and edit affordances are hidden. */ canEdit?: boolean; } const CATEGORIES = [ { key: "channel" as const, labelKey: "categories.channels" }, { key: "skill" as const, labelKey: "categories.skills" }, ] as const; function getPackageStatus( pkgId: string, enabled: boolean, conditions?: Props["conditions"] ): "pending" | "active" | "error" | undefined { if (!enabled) return undefined; const cond = conditions?.find((c) => c.type === `Package/${pkgId}`); if (!cond) return "pending"; if (cond.status === "True") return "active"; if (cond.reason === "SecretReady") return "active"; return "error"; } export function PackageList({ tenantName, enabledPackages, conditions, onRefresh, canEdit = true, }: Props) { const t = useTranslations("packages"); const router = useRouter(); const handleRefresh = onRefresh || (() => router.refresh()); return (