7f37f111e8
Checkout now persists orders server-side (Payload orders collection, re-priced from live product data, discount codes redeemed exactly once) instead of writing a client-only sessionStorage snapshot. Buying requires an account (registration inline in checkout, no separate step) — accounts get order history with delivery status, profile/address editing, password change, and a cart that syncs across devices while logged in. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
47 lines
1.6 KiB
TypeScript
47 lines
1.6 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { CheckoutContent } from "./components/CheckoutContent";
|
|
import { TrustRow } from "../components/TrustRow";
|
|
import { Footer } from "../components/Footer";
|
|
import { getShippingMethods, getPaymentMethods, getCartTrustBadges, getShippingSettings } 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, paymentMethods, trustBadges, shippingSettings, session] = await Promise.all([
|
|
getShippingMethods(),
|
|
getPaymentMethods(),
|
|
getCartTrustBadges(),
|
|
getShippingSettings(),
|
|
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}
|
|
paymentMethods={paymentMethods}
|
|
trustBadges={trustBadges}
|
|
shippingSettings={shippingSettings}
|
|
customerEmail={session?.customer.email ?? null}
|
|
savedProfile={profile}
|
|
/>
|
|
<TrustRow />
|
|
</main>
|
|
<Footer />
|
|
</>
|
|
);
|
|
}
|