Files
einfach-produktiv/app/company-settings-preview/page.tsx
T
Marco 1706da8598 Add schema.org structured data, Vorkasse email notice, newsletter duplicate detection
- Organization (site-wide), Product (/todo-cards), BlogPosting (every
  /blog/[slug]) JSON-LD via new app/lib/structuredData.ts — no new
  Payload fields needed, derived from existing data. Verified locally
  by curling each page and checking the rendered script tag.
- Order confirmation email gains the same "please transfer to this
  account, processed after payment received" notice the invoice PDF
  already had for Vorkasse orders — OrderConfirmationData's new
  isManualPayment flag is set explicitly by each caller (never derived
  from paymentMethodTitle, which already broke once this session after
  a payment-methods rename). CompanySettings gains bankName (existed on
  the backend, was missing from the frontend's type/usage).
- Newsletter signup now detects an already-subscribed email
  (verified empirically: Brevo's doubleOptinConfirmation endpoint gives
  identical 201 responses for new vs. already-confirmed contacts) via a
  GET /v3/contacts/{email} pre-check, and shows a distinct message
  instead of silently resending the confirmation mail. Success message
  text centralized in useNewsletterSignup.ts instead of duplicated
  across 4 forms.
- Bumped @einfach-produktiv/invoicing to the version with the
  unpaid-notice layout fix (full width, more top spacing — was
  squeezed into the narrow paid-badge column).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-25 17:11:48 +00:00

49 lines
1.8 KiB
TypeScript

import type { Metadata } from "next";
import { draftMode } from "next/headers";
import { notFound } from "next/navigation";
import { getCompanySettings, type CompanySettings } from "../lib/payload";
import { LiveCompanySettingsPreviewClient } from "./components/LiveCompanySettingsPreviewClient";
export const metadata: Metadata = {
title: "Firmendaten-Vorschau",
robots: { index: false, follow: false },
};
const FALLBACK: CompanySettings = {
sellerName: "",
legalForm: "sole-proprietorship",
registerCourt: null,
registerNumber: null,
managingDirector: null,
shareCapital: null,
sellerStreet: "",
sellerZip: "",
sellerCity: "",
sellerCountry: "",
sellerEmail: "",
vatId: "",
taxRatePercent: 19,
kleinunternehmer: false,
iban: null,
bic: null,
bankName: null,
};
// Entered exclusively via CompanySettings.ts's admin.livePreview.url (a
// Payload-admin-only iframe target, see buildPreviewUrl()/api/preview) —
// gated on Draft Mode actually being enabled, unlike email-templates'
// preview: this data includes a real bank IBAN/address once filled in,
// not just marketing email copy, so this page must not render for an
// unauthenticated visitor who happens to find the URL. Unlike
// email-templates there's no draft/published distinction in the data
// itself (company-settings has no content-versioning concept, it's just
// the current row) — the initial fetch is the same live data
// getCompanySettings() always returns, useLivePreview() takes over from
// there as the admin edits fields.
export default async function CompanySettingsPreviewPage() {
const draft = await draftMode();
if (!draft.isEnabled) notFound();
const initialSettings = (await getCompanySettings()) ?? FALLBACK;
return <LiveCompanySettingsPreviewClient initialSettings={initialSettings} />;
}