import { getPayload } from 'payload' import configPromise from '../src/payload.config' async function run() { const payload = await getPayload({ config: configPromise }) const plPages = await payload.find({ collection: 'pages', locale: 'pl', where: { slug: { equals: 'kontakt' } } }) const plPage = plPages.docs[0] if (!plPage) return; const layout = plPage.layout || [] const enLayout = layout.map(block => { const b = JSON.parse(JSON.stringify(block)) // strip populated for (const key of Object.keys(b)) { if (b[key] && typeof b[key] === 'object' && b[key].id !== undefined) { b[key] = b[key].id } } if (b.blockType === 'pageHeader') { b.title = "Contact" b.subtitle = "Do you have questions about tax settlement in Germany? Contact us — we will be happy to help." } if (b.blockType === 'contactSection') { b.address = "TO BE CONFIRMED BY CLIENT" b.hours = "Mon-Fri: 9:00 - 17:00\nBy appointment" } return b }) await payload.update({ collection: 'pages', id: plPage.id, locale: 'en', data: { layout: enLayout } }) console.log("Forced EN layout for kontakt") const deLayout = layout.map(block => { const b = JSON.parse(JSON.stringify(block)) // strip populated for (const key of Object.keys(b)) { if (b[key] && typeof b[key] === 'object' && b[key].id !== undefined) { b[key] = b[key].id } } if (b.blockType === 'pageHeader') { b.title = "Kontakt" b.subtitle = "Haben Sie Fragen zur Steuererklärung in Deutschland? Kontaktieren Sie uns — wir helfen Ihnen gerne weiter." } if (b.blockType === 'contactSection') { b.address = "TO BE CONFIRMED BY CLIENT" b.hours = "Mo-Fr: 9:00 - 17:00\nNach Vereinbarung" } return b }) await payload.update({ collection: 'pages', id: plPage.id, locale: 'de', data: { layout: deLayout } }) console.log("Forced DE layout for kontakt") process.exit(0) } run().catch(console.error)