import { redirect } from "next/navigation"; import { getTranslations } from "next-intl/server"; import { getSessionUser } from "@/lib/session"; import { getPlatformPricing, listSkillPricing } from "@/lib/db"; import { PACKAGE_CATALOG } from "@/lib/packages"; import { BackLink } from "@/components/ui/back-link"; import { PricingEditor } from "@/components/admin/billing/pricing-editor"; /** * /admin/billing/pricing — edit platform-wide pricing config * (monthly fee, setup fee, Threema per-message, VAT rate for * CH/LI) and per-skill daily prices. * * Single-row platform_pricing semantics: one global pricing * config applies to every tenant. No per-tenant overrides in * v1. */ export default async function AdminBillingPricingPage() { const user = await getSessionUser(); if (!user) redirect("/login"); if (!user.isPlatform) redirect("/dashboard"); const t = await getTranslations("adminBilling"); const [pricing, skillPricing] = await Promise.all([ getPlatformPricing(), listSkillPricing(), ]); // Surface every package in the catalog so admin can price any of // them — UI defaults the picker to skill-kind entries but doesn't // hard-block other kinds (a future scenario where a non-skill // package gets a per-day price shouldn't need a code change). const catalog = Object.values(PACKAGE_CATALOG).map((p) => ({ id: p.id, name: p.name, category: p.category, })); return (

{t("pricingTitle")}

{t("pricingPageDesc")}

); }