Files
einfach-produktiv/app/checkout/page.tsx
T
Marco 47d03dd61b Feed checkout's country selects from Payload instead of a hardcoded list
Both the billing and shipping-override country selects, plus PLZ
maxLength/pattern validation, now read from the new shipping-countries
collection (getShippingCountries()) rather than a hardcoded
Deutschland/Österreich(/Schweiz) array. Lets an admin add or reorder
destination countries without a frontend deploy.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 20:21:13 +00:00

51 lines
1.8 KiB
TypeScript

import type { Metadata } from "next";
import { CheckoutContent } from "./components/CheckoutContent";
import { TrustRow } from "../components/TrustRow";
import { Footer } from "../components/Footer";
import { getShippingMethods, getShippingCountries, getPaymentMethods, getCartTrustBadges, getShippingSettings, getDefaultTaxRatePercent } from "../lib/payload";
import { getSessionCustomer, getCustomerProfile } from "../lib/customerAuth";
// robots: noindex — transactional page, same reasoning as /cart.
export const metadata: Metadata = {
title: "Checkout",
description: "Schließe deine Bestellung bei einfach produktiv ab.",
robots: {
index: false,
follow: true,
},
};
export default async function CheckoutPage() {
const [shippingMethods, shippingCountries, paymentMethods, trustBadges, shippingSettings, defaultTaxRate, session] = await Promise.all([
getShippingMethods(),
getShippingCountries(),
getPaymentMethods(),
getCartTrustBadges(),
getShippingSettings(),
getDefaultTaxRatePercent(),
getSessionCustomer(),
]);
// Full profile (incl. saved address) only fetched when a session exists
// — pre-fills Card 1 for a returning customer instead of leaving it blank.
const profile = session ? await getCustomerProfile(session.token) : null;
return (
<>
<main className="flex flex-col flex-1 bg-bg-base">
<CheckoutContent
shippingMethods={shippingMethods}
shippingCountries={shippingCountries}
paymentMethods={paymentMethods}
trustBadges={trustBadges}
shippingSettings={shippingSettings}
defaultTaxRate={defaultTaxRate}
customerEmail={session?.customer.email ?? null}
savedProfile={profile}
/>
<TrustRow />
</main>
<Footer />
</>
);
}