feat: Swiss-compliant launch — Impressum/AGB/Contact, support panel, DSG exports, cookie banner
All checks were successful
Deploy to Production / deploy (push) Successful in 57s

Legal (Swiss minimum, no individual named):
- Impressum page (UWG Art. 3 lit. s) — provider, contact via support panel,
  no email required, jurisdiction = Switzerland
- AGB page — subscription terms, payment, cancellation, suspension on payment
  fail, 14-day money-back, AI-processing-per-tier disclosure, Swiss law +
  Swiss venue, modeled after typical Schweizer SaaS terms
- Privacy: Stripe added as subprocessor with full data-flow disclosure

Support panel replaces email contact entirely:
- @bmm/db: support_status enum + support_tickets + support_messages tables,
  migration applied to prod DB
- @bmm/api: support routes (user create/list/view/reply, admin list/view/reply
  /set-status), public /v1/contact for logged-out visitors with per-IP rate
  limit of 3 submissions/day to prevent spam-flood
- Web: /settings/support (list + new), /settings/support/[id] (conversation),
  /admin/support, /admin/support/[id]
- Public /contact form with email collection for guest tickets

Data rights (DSG Art. 25 / GDPR Art. 15+20):
- /v1/account/export returns user-scoped JSON of profile, org, servers,
  builds, audit, support tickets and messages — excludes hashes, encrypted
  secrets, other-user data
- /settings/account: download button + deletion-via-ticket workflow

Production-readiness gaps closed:
- org.suspended now blocks /v1/servers POST and /v1/servers/preview (402);
  webhook flagged this state but enforcement was missing
- Cookie banner: minimal, essential-cookies-only disclosure (Swiss DSG +
  GDPR compliant without dark-pattern consent UI), mounts on both layouts

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marco Sadjadi
2026-05-25 17:12:06 +02:00
parent c2a21fc3cd
commit ef30baf52a
18 changed files with 1692 additions and 6 deletions

View File

@@ -1,3 +1,4 @@
import { CookieBanner } from '@/components/cookie-banner';
import { Logo } from '@/components/logo';
import { MobileActionBar } from '@/components/mobile-action-bar';
import { FileClock, LayoutGrid, Package, Server, Settings } from 'lucide-react';
@@ -38,6 +39,7 @@ export default function DashboardLayout({ children }: { children: React.ReactNod
</header>
<main className="flex-1 bg-[--color-bg] pb-20 sm:pb-0">{children}</main>
<MobileActionBar />
<CookieBanner />
</div>
);
}

View File

@@ -0,0 +1,80 @@
'use client';
import { Button } from '@/components/ui/button';
import { apiUrl } from '@/lib/api';
import Link from 'next/link';
import { useState } from 'react';
export default function AccountPage() {
const [downloading, setDownloading] = useState(false);
async function downloadExport() {
setDownloading(true);
try {
// Trigger a same-origin attachment download. The cookie ships with the
// request because we're same-credentials with the API origin via CORS.
window.location.href = apiUrl('/v1/account/export');
} finally {
setTimeout(() => setDownloading(false), 1500);
}
}
return (
<div className="mx-auto max-w-3xl px-6 py-10">
<h1 className="text-[22px] font-semibold tracking-tight">Account</h1>
<p className="mt-1 text-[13px] text-[--color-fg-muted]">
Your data, your rights. Swiss DSG Art. 25 / GDPR Art. 15 + 20.
</p>
<div className="mt-8 space-y-4">
<section className="panel p-5">
<h2 className="text-[14px] font-semibold tracking-tight">Download your data</h2>
<p className="mt-2 text-[12.5px] leading-relaxed text-[--color-fg-muted]">
One JSON file with everything we hold for your account: profile, organization, MCP
servers, build history (last 1000 entries), audit log (last 1000 events) and your
support-ticket history. Excludes password hashes, encrypted secrets and other
users&apos; data.
</p>
<div className="mt-4">
<Button variant="primary" size="md" onClick={downloadExport} disabled={downloading}>
{downloading ? 'Preparing…' : 'Download .json'}
</Button>
</div>
</section>
<section className="panel p-5">
<h2 className="text-[14px] font-semibold tracking-tight">Delete account</h2>
<p className="mt-2 text-[12.5px] leading-relaxed text-[--color-fg-muted]">
We don&apos;t do one-click account deletion yet too easy to fat-finger and lose
paid-tier server configs. Open a ticket and we&apos;ll wipe everything within 30
days (servers, secrets, audit, tickets) per Swiss DSG Art. 32 / GDPR Art. 17.
</p>
<div className="mt-4">
<Link href="/settings/support">
<Button variant="secondary" size="md">
Open deletion ticket
</Button>
</Link>
</div>
</section>
<section className="panel p-5">
<h2 className="text-[14px] font-semibold tracking-tight">Cookies on this site</h2>
<p className="mt-2 text-[12.5px] leading-relaxed text-[--color-fg-muted]">
We use only strictly-necessary cookies: a session cookie (
<span className="mono">bmm_session</span>, httpOnly, 30 days) and a short-lived
OAuth-CSRF state cookie (<span className="mono">bmm_oauth_state</span>, 10 minutes
during a third-party login flow). No analytics, no tracking, no third-party cookies on
this domain.
</p>
</section>
</div>
<div className="mt-10 text-[12px] text-[--color-fg-subtle]">
<Link href="/privacy" className="hover:text-[--color-fg]">
Privacy policy
</Link>
</div>
</div>
);
}

View File

@@ -0,0 +1,145 @@
'use client';
import { Textarea } from '@/components/input';
import { Button } from '@/components/ui/button';
import { apiFetch } from '@/lib/api';
import { Loader2 } from 'lucide-react';
import Link from 'next/link';
import { useParams } from 'next/navigation';
import { useEffect, useState } from 'react';
interface Ticket {
id: string;
subject: string;
status: 'awaiting_admin' | 'awaiting_user' | 'closed';
createdAt: string;
lastMessageAt: string;
}
interface Message {
id: string;
authorIsAdmin: boolean;
body: string;
createdAt: string;
}
export default function TicketDetail() {
const params = useParams<{ id: string }>();
const [data, setData] = useState<{ ticket: Ticket; messages: Message[] } | null>(null);
const [reply, setReply] = useState('');
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
function load() {
if (!params?.id) return;
apiFetch<{ ticket: Ticket; messages: Message[] }>(`/v1/support/tickets/${params.id}`)
.then(setData)
.catch((e) => setError((e as Error).message));
}
useEffect(load, [params?.id]);
async function sendReply(e: React.FormEvent) {
e.preventDefault();
if (!params?.id || reply.trim().length === 0) return;
setBusy(true);
setError(null);
try {
await apiFetch(`/v1/support/tickets/${params.id}/messages`, {
method: 'POST',
body: JSON.stringify({ body: reply }),
});
setReply('');
load();
} catch (err) {
setError((err as Error).message);
} finally {
setBusy(false);
}
}
if (!data && !error) {
return (
<div className="mx-auto max-w-3xl px-6 py-12 text-center">
<Loader2 className="mx-auto animate-spin text-[--color-fg-muted]" size={20} />
</div>
);
}
if (error || !data) {
return (
<div className="mx-auto max-w-3xl px-6 py-12">
<p className="text-[13px] text-[--color-danger]">{error ?? 'Ticket not found.'}</p>
<Link href="/settings/support" className="mt-3 inline-block text-[12px] text-[--color-fg-muted] hover:text-[--color-fg]">
Back to support
</Link>
</div>
);
}
const { ticket, messages } = data;
const isClosed = ticket.status === 'closed';
return (
<div className="mx-auto max-w-3xl px-6 py-10">
<Link
href="/settings/support"
className="text-[12px] text-[--color-fg-muted] hover:text-[--color-fg]"
>
All tickets
</Link>
<div className="mt-3 flex items-baseline justify-between gap-3">
<h1 className="text-[22px] font-semibold tracking-tight">{ticket.subject}</h1>
<span className="mono text-[10.5px] uppercase tracking-wider text-[--color-fg-subtle]">
{ticket.status.replace('_', ' ')}
</span>
</div>
<div className="mt-6 space-y-3">
{messages.map((m) => (
<div
key={m.id}
className={`panel p-4 ${m.authorIsAdmin ? 'border-[--color-accent]/40' : ''}`}
>
<div className="flex items-baseline justify-between">
<span
className={`text-[11.5px] font-medium ${m.authorIsAdmin ? 'text-[--color-accent]' : 'text-[--color-fg]'}`}
>
{m.authorIsAdmin ? 'Support' : 'You'}
</span>
<span className="text-[10.5px] text-[--color-fg-subtle]">
{new Date(m.createdAt).toLocaleString()}
</span>
</div>
<p className="mt-2 whitespace-pre-wrap text-[13px] leading-relaxed text-[--color-fg-muted]">
{m.body}
</p>
</div>
))}
</div>
{!isClosed && (
<form onSubmit={sendReply} className="panel mt-6 space-y-3 p-4">
<Textarea
value={reply}
onChange={(e) => setReply(e.target.value)}
rows={4}
maxLength={10_000}
placeholder="Your reply…"
/>
{error && <p className="text-[12.5px] text-[--color-danger]">{error}</p>}
<div className="flex justify-end">
<Button
variant="primary"
size="md"
type="submit"
disabled={busy || reply.trim().length === 0}
>
{busy ? 'Sending…' : 'Send reply'}
</Button>
</div>
</form>
)}
</div>
);
}

View File

@@ -0,0 +1,166 @@
'use client';
import { Input, Label, Textarea } from '@/components/input';
import { Button } from '@/components/ui/button';
import { apiFetch } from '@/lib/api';
import { Loader2 } from 'lucide-react';
import Link from 'next/link';
import { useEffect, useState } from 'react';
interface Ticket {
id: string;
subject: string;
status: 'awaiting_admin' | 'awaiting_user' | 'closed';
createdAt: string;
lastMessageAt: string;
}
const STATUS_LABEL: Record<Ticket['status'], string> = {
awaiting_admin: 'Open — awaiting support',
awaiting_user: 'Reply received',
closed: 'Closed',
};
const STATUS_COLOR: Record<Ticket['status'], string> = {
awaiting_admin: 'text-amber-300',
awaiting_user: 'text-emerald-300',
closed: 'text-[--color-fg-subtle]',
};
export default function SupportPage() {
const [tickets, setTickets] = useState<Ticket[] | null>(null);
const [showNew, setShowNew] = useState(false);
const [subject, setSubject] = useState('');
const [body, setBody] = useState('');
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
function load() {
apiFetch<{ tickets: Ticket[] }>('/v1/support/tickets')
.then((r) => setTickets(r.tickets))
.catch((e) => setError((e as Error).message));
}
useEffect(load, []);
async function createTicket(e: React.FormEvent) {
e.preventDefault();
setBusy(true);
setError(null);
try {
await apiFetch('/v1/support/tickets', {
method: 'POST',
body: JSON.stringify({ subject, body }),
});
setSubject('');
setBody('');
setShowNew(false);
load();
} catch (err) {
setError((err as Error).message);
} finally {
setBusy(false);
}
}
return (
<div className="mx-auto max-w-3xl px-6 py-10">
<div className="flex items-baseline justify-between">
<div>
<h1 className="text-[22px] font-semibold tracking-tight">Support</h1>
<p className="mt-1 text-[13px] text-[--color-fg-muted]">
Open a ticket and we&apos;ll get back to you within one business day.
</p>
</div>
{!showNew && (
<Button variant="primary" size="md" onClick={() => setShowNew(true)}>
+ New ticket
</Button>
)}
</div>
{showNew && (
<form onSubmit={createTicket} className="panel mt-6 space-y-4 p-5">
<div className="space-y-1.5">
<Label htmlFor="t-subject">Subject</Label>
<Input
id="t-subject"
required
minLength={3}
maxLength={200}
value={subject}
onChange={(e) => setSubject(e.target.value)}
placeholder="Briefly — what's up?"
/>
</div>
<div className="space-y-1.5">
<Label htmlFor="t-body" hint={`${body.length} / 10000`}>
Message
</Label>
<Textarea
id="t-body"
required
rows={6}
minLength={10}
maxLength={10_000}
value={body}
onChange={(e) => setBody(e.target.value)}
placeholder="The more context the better — server slug, error messages, what you expected."
/>
</div>
{error && <p className="text-[12.5px] text-[--color-danger]">{error}</p>}
<div className="flex justify-end gap-2">
<Button variant="ghost" size="md" type="button" onClick={() => setShowNew(false)}>
Cancel
</Button>
<Button
variant="primary"
size="md"
type="submit"
disabled={busy || subject.length < 3 || body.length < 10}
>
{busy ? 'Sending…' : 'Open ticket'}
</Button>
</div>
</form>
)}
<div className="mt-8">
{tickets === null && (
<div className="panel p-6 text-center">
<Loader2 className="mx-auto animate-spin text-[--color-fg-muted]" size={18} />
</div>
)}
{tickets && tickets.length === 0 && !showNew && (
<div className="panel p-6 text-center text-[13px] text-[--color-fg-muted]">
No tickets yet.
</div>
)}
{tickets && tickets.length > 0 && (
<div className="panel divide-y divide-[--color-border]">
{tickets.map((t) => (
<Link
key={t.id}
href={`/settings/support/${t.id}`}
className="flex items-center justify-between px-4 py-3 transition-colors hover:bg-[--color-bg-subtle]"
>
<div className="min-w-0 flex-1">
<div className="truncate text-[13px] font-medium text-[--color-fg]">
{t.subject}
</div>
<div className={`mt-0.5 text-[11.5px] ${STATUS_COLOR[t.status]}`}>
{STATUS_LABEL[t.status]} ·{' '}
<span className="text-[--color-fg-subtle]">
{new Date(t.lastMessageAt).toLocaleString()}
</span>
</div>
</div>
<span className="ml-3 text-[--color-fg-subtle]"></span>
</Link>
))}
</div>
)}
</div>
</div>
);
}