Dynamic AGB address, real shipping costs on /versand instead of hardcoded constants
- AGB: name/address/email now come from company-settings via new VertragspartnerBlock (mid-document, see LegalPages.ts's contentPart2). - VersandSections/VersandModal/CartContent/CheckoutContent/versand page: shipping cost and free-shipping threshold now come from the real ShippingMethods data (already fetched elsewhere for checkout), not the hardcoded lib/shipping.ts constants — those had already drifted from the real Payload values once. lib/shipping.ts deleted, nothing left to export. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -855,6 +855,12 @@ export type LegalPage = {
|
||||
type: LegalPageType;
|
||||
title: string;
|
||||
content: unknown;
|
||||
// Only populated for pages that need a dynamically-rendered section
|
||||
// MID-document (currently just AGB's "Vertragspartner", sourced from
|
||||
// company-settings — see VertragspartnerBlock.tsx). null everywhere
|
||||
// else, including pages like Datenschutz whose one dynamic section sits
|
||||
// at the very start and so can just be prepended instead of split.
|
||||
contentPart2: unknown | null;
|
||||
attachment: { url: string; title: string } | null;
|
||||
updatedAt: string;
|
||||
};
|
||||
@@ -863,6 +869,7 @@ type PayloadLegalPage = {
|
||||
type: LegalPageType;
|
||||
title: string;
|
||||
content: unknown;
|
||||
contentPart2?: unknown;
|
||||
attachment: { url: string; title: string } | number | null;
|
||||
updatedAt: string;
|
||||
};
|
||||
@@ -888,6 +895,7 @@ export async function getLegalPage(type: LegalPageType, options?: { draft?: bool
|
||||
type: doc.type,
|
||||
title: doc.title,
|
||||
content: doc.content,
|
||||
contentPart2: doc.contentPart2 ?? null,
|
||||
attachment:
|
||||
typeof doc.attachment === "object" && doc.attachment
|
||||
? { url: doc.attachment.url, title: doc.attachment.title }
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
// Single source of truth for shipping numbers — consumed by both the
|
||||
// cart's order summary (CartContent.tsx) and the /versand policy page, so
|
||||
// the two can never drift apart.
|
||||
//
|
||||
// The delivery-timeframe numbers (handling/transit days, Art. 246a § 1
|
||||
// Abs. 1 Nr. 8 EGBGB) used to live here too, but now come from Payload's
|
||||
// Shipping Settings collection instead (see lib/payload.ts's
|
||||
// getShippingSettings()) — that duplication is exactly why the
|
||||
// ShippingMethods CMS title once carried a different, drifted day-range
|
||||
// than this file did. Cost/threshold below have the same drift risk
|
||||
// against Payload's ShippingMethods price/freeShippingThreshold fields,
|
||||
// not yet addressed here.
|
||||
export const SHIPPING_COST = 2.9;
|
||||
export const FREE_SHIPPING_THRESHOLD = 39;
|
||||
Reference in New Issue
Block a user