// Minimal test — one block at a time to find what's breaking const BASE_URL = process.env.PAYLOAD_API_URL || 'http://localhost:3000' const API_KEY = process.env.PAYLOAD_API_KEY const headers = { 'Content-Type': 'application/json', Authorization: `users API-Key ${API_KEY}`, } async function tryPage(title, slug, layout) { const res = await fetch(`${BASE_URL}/api/pages?locale=sv`, { method: 'POST', headers, body: JSON.stringify({ title, slug, layout, _status: 'draft' }), }) const json = await res.json() if (!res.ok) { console.log(`❌ "${title}": ${JSON.stringify(json, null, 2)}`) } else { console.log(`✅ "${title}" id:${json.doc?.id}`) } } // Test 1: totally empty page await tryPage('Test Empty', 'test-empty', []) // Test 2: single hero block await tryPage('Test Hero', 'test-hero', [{ blockType: 'lmHero', heading: 'Test', theme: 'dark', textColor: 'auto', }]) // Test 3: statistics block await tryPage('Test Stats', 'test-stats', [{ blockType: 'lmStatistics', stats: [{ number: '99%', label: 'Uptime' }], sectionBackground: 'dark', numberColor: 'gradient', }]) // Test 4: cardGrid with dark cardStyle await tryPage('Test CardGrid', 'test-cardgrid', [{ blockType: 'lmCardGrid', layout: '1-1-1', cardStyle: 'dark', sectionBackground: 'dark', cards: [{ displayMode: 'centeredHeading', heading: 'Card 1' }], }]) // Test 5: ctaSideImage await tryPage('Test CtaSide', 'test-ctaside', [{ blockType: 'lmCtaSideImage', heading: 'Test', body: 'Body text', theme: 'dark', }]) // Test 6: uspChecklist await tryPage('Test USP', 'test-usp', [{ blockType: 'lmUspChecklist', heading: 'Why us', items: [{ text: 'Item one' }], checkColor: 'yellow', sectionBackground: 'dark', textColor: 'white', }]) // Test 7: ctaBanner await tryPage('Test Banner', 'test-banner', [{ blockType: 'lmCtaBanner', heading: 'Get started', ctaText: 'Go', ctaLink: '/contact', sectionBackground: 'dark', alignment: 'center', size: 'large', }])