import { getPayload } from 'payload' import configPromise from '../src/payload.config' import { toSlug } from '@intecion/ipal-kit' import type { Page } from '../src/payload-types' const PAGES = [ { pl: 'Strona główna', de: 'Startseite', isHome: true }, { pl: 'Usługi', de: 'Leistungen', isHome: false }, { pl: 'Jak się umówić', de: 'Terminvereinbarung', isHome: false }, { pl: 'O mnie', de: 'Über mich', isHome: false }, { pl: 'FAQ', de: 'FAQ', isHome: false }, { pl: 'Kontakt', de: 'Kontakt', isHome: false }, { pl: 'Stowarzyszenie', de: 'Verein', isHome: false }, { pl: 'Polityka prywatności', de: 'Datenschutzerklärung', isHome: false }, { pl: 'Polityka cookies', de: 'Cookie-Richtlinie', isHome: false }, { pl: 'Impressum', de: 'Impressum', isHome: false }, ]; const homeLayoutPl = [ { blockType: 'hero', title: 'Odbierz zwrot podatku z Niemiec — rozliczymy Cię po polsku', subtitle: 'Ponad 20 lat doświadczenia w rozliczeniach dla Polaków pracujących w Niemczech. Szybko, rzetelnie i w pełni po polsku.', primaryCta: 'Napisz na WhatsApp', secondaryCta: { text: 'Zobacz jak to działa', url: '/jak-to-dziala' }, yearsOfExperience: 'Ponad 20 lat doświadczenia', }, { blockType: 'trustBar', items: [ { text: 'Działam w ramach b.b.h.', icon: 'shield' }, { text: 'Doradztwo 100% po polsku', icon: 'message' }, { text: 'Wsparcie z Finanzamt', icon: 'check' }, { text: 'Wieloletnie doświadczenie', icon: 'star' }, ], }, { blockType: 'uniqueValue', title: 'Rozliczenia bez bariery językowej', description: 'Niemieckie prawo podatkowe bywa skomplikowane. Przeprowadzę Cię przez cały proces w Twoim ojczystym języku, dbając o maksymalny zwrot i zero stresu.', }, { blockType: 'servicesList', title: 'Czym się zajmuję', services: [ { title: 'Deklaracje podatkowe', description: 'Kompleksowe sporządzenie i złożenie zeznania rocznego (Einkommensteuererklärung).', linkText: 'Zobacz więcej' }, { title: 'Kontrola decyzji', description: 'Szczegółowa weryfikacja decyzji podatkowej (Steuerbescheid) z Finanzamt.', linkText: 'Zobacz więcej' }, { title: 'Ulgi i dopłaty', description: 'Pomoc w uzyskaniu Kindergeld, Riester-Rente oraz odliczaniu kosztów dojazdów i podwójnego gospodarstwa.', linkText: 'Zobacz więcej' }, ], }, { blockType: 'process', title: 'Jak to działa', steps: [ { title: 'Napisz na WhatsApp', description: 'Wyślij krótką wiadomość lub zadzwoń, by rozpocząć proces.' }, { title: 'Przekaż dokumenty', description: 'Prześlij nam wymagane dokumenty bezpiecznie online lub dostarcz osobiście.' }, { title: 'Odbierz zwrot', description: 'Zajmiemy się resztą i poinformujemy Cię o spodziewanym zwrocie z Finanzamt.' }, ], ctaText: 'Zobacz cały proces', }, { blockType: 'affiliation', title: 'Zaufanie i bezpieczeństwo', description: 'Działam w ramach b.b.h. Lohnsteuerhilfeverein e.V. (Beratungsstelle). Oferujemy profesjonalną pomoc w sprawach podatku dochodowego w ramach uprawnień wynikających z §4 Nr. 11 StBerG.', linkText: 'Poznaj stowarzyszenie', }, { blockType: 'testimonials', title: 'Opinie klientów', testimonials: [ { quote: 'Pan Janusz pomógł mi odzyskać podatek za 3 ostatnie lata. Wszystko jasno wytłumaczone po polsku.', author: 'Piotr, Monachium' }, { quote: 'Szybki kontakt przez WhatsApp i pełne wsparcie przy odwołaniu od decyzji Finanzamt. Polecam!', author: 'Anna, Berlin' }, { quote: 'Ogromna wiedza o ulgach dla pracowników budowlanych. Zwrot był znacznie wyższy niż się spodziewałem.', author: 'Krzysztof, Dortmund' }, ], }, { blockType: 'faqTeaser', title: 'Częste pytania', questions: [ { question: 'Czy muszę przyjeżdżać osobiście?', answer: 'Nie, wszystkie formalności możemy załatwić zdalnie, przesyłając dokumenty online.' }, { question: 'Do kiedy muszę złożyć deklarację?', answer: 'Standardowy termin to 31 sierpnia, ale korzystając z naszych usług, termin ten wydłuża się do końca lutego następnego roku.' }, ], linkText: 'Zobacz wszystkie pytania', }, { blockType: 'finalCta', title: 'Gotowy na wyższy zwrot podatku?', subtitle: 'Napisz do mnie już teraz. Odpowiem najszybciej jak to możliwe.', buttonText: 'Rozpocznij na WhatsApp', } ]; const homeLayoutDe = [ { blockType: 'hero', title: 'Sichern Sie sich Ihre Steuererstattung aus Deutschland — Beratung auf Polnisch', subtitle: 'Über 20 Jahre Erfahrung in der Steuererklärung für in Deutschland arbeitende Polen. Schnell, zuverlässig und komplett auf Polnisch.', primaryCta: 'Auf WhatsApp schreiben', secondaryCta: { text: 'So funktioniert es', url: '/jak-to-dziala' }, yearsOfExperience: 'Über 20 Jahre Erfahrung', }, { blockType: 'trustBar', items: [ { text: 'Teil der b.b.h.', icon: 'shield' }, { text: '100% Beratung auf Polnisch', icon: 'message' }, { text: 'Finanzamt Unterstützung', icon: 'check' }, { text: 'Langjährige Erfahrung', icon: 'star' }, ], }, { blockType: 'uniqueValue', title: 'Steuererklärungen ohne Sprachbarriere', description: 'Das deutsche Steuerrecht kann kompliziert sein. Ich begleite Sie durch den gesamten Prozess in Ihrer Muttersprache, sorge für die maximale Erstattung und garantiere null Stress.', }, { blockType: 'servicesList', title: 'Was ich anbiete', services: [ { title: 'Steuererklärungen', description: 'Umfassende Erstellung und Einreichung der jährlichen Einkommensteuererklärung.', linkText: 'Mehr anzeigen' }, { title: 'Steuerbescheidprüfung', description: 'Detaillierte Prüfung des Steuerbescheids vom Finanzamt.', linkText: 'Mehr anzeigen' }, { title: 'Vergünstigungen und Zuschüsse', description: 'Hilfe bei der Beantragung von Kindergeld, Riester-Rente und der Absetzung von Fahrtkosten sowie doppelter Haushaltsführung.', linkText: 'Mehr anzeigen' }, ], }, { blockType: 'process', title: 'Wie es funktioniert', steps: [ { title: 'Auf WhatsApp schreiben', description: 'Senden Sie eine kurze Nachricht oder rufen Sie an, um den Prozess zu starten.' }, { title: 'Dokumente einreichen', description: 'Senden Sie uns die erforderlichen Dokumente sicher online oder bringen Sie sie persönlich vorbei.' }, { title: 'Erstattung erhalten', description: 'Wir kümmern uns um den Rest und informieren Sie über die erwartete Rückerstattung vom Finanzamt.' }, ], ctaText: 'Den gesamten Prozess ansehen', }, { blockType: 'affiliation', title: 'Vertrauen und Sicherheit', description: 'Ich bin im Rahmen des b.b.h. Lohnsteuerhilfevereins e.V. (Beratungsstelle) tätig. Wir bieten professionelle Hilfe in Lohnsteuersachen im Rahmen der Befugnisse nach §4 Nr. 11 StBerG.', linkText: 'Den Verein kennenlernen', }, { blockType: 'testimonials', title: 'Kundenrezensionen', testimonials: [ { quote: 'Herr Janusz half mir, meine Steuern für die letzten 3 Jahre zurückzubekommen. Alles wurde klar auf Polnisch erklärt.', author: 'Piotr, München' }, { quote: 'Schneller Kontakt über WhatsApp und volle Unterstützung bei Einsprüchen beim Finanzamt. Sehr zu empfehlen!', author: 'Anna, Berlin' }, { quote: 'Enormes Wissen über Vergünstigungen für Bauarbeiter. Die Erstattung war viel höher als erwartet.', author: 'Krzysztof, Dortmund' }, ], }, { blockType: 'faqTeaser', title: 'Häufige Fragen', questions: [ { question: 'Muss ich persönlich kommen?', answer: 'Nein, alle Formalitäten können online erledigt werden, indem Sie uns die Dokumente zusenden.' }, { question: 'Bis wann muss ich die Steuererklärung einreichen?', answer: 'Die Standardfrist ist der 31. August, aber durch unsere Dienste verlängert sich diese bis Ende Februar des Folgejahres.' }, ], linkText: 'Alle Fragen ansehen', }, { blockType: 'finalCta', title: 'Bereit für eine höhere Steuererstattung?', subtitle: 'Schreiben Sie mir jetzt. Ich werde so schnell wie möglich antworten.', buttonText: 'Auf WhatsApp starten', } ]; async function run() { const payload = await getPayload({ config: configPromise }) const existingPages = await payload.find({ collection: 'pages', limit: 1, }) if (existingPages.totalDocs === 0) { console.log('Seeding pages...') const pageIds: number[] = []; for (const page of PAGES) { const createdPage = await payload.create({ collection: 'pages', data: { title: page.pl, slug: page.isHome ? 'home' : toSlug(page.pl), layout: (page.isHome ? homeLayoutPl : [ { blockType: 'TextSection', text: 'Treść w przygotowaniu', } ]) as unknown as Page['layout'] }, locale: 'pl', }); pageIds.push(createdPage.id as unknown as number); await payload.update({ collection: 'pages', id: createdPage.id, data: { title: page.de, slug: page.isHome ? 'home' : toSlug(page.de), layout: (page.isHome ? homeLayoutDe : [ { blockType: 'TextSection', text: 'Inhalt in Vorbereitung', } ]) as unknown as Page['layout'] }, locale: 'de', }); console.log(`- Created ${page.pl} / ${page.de}`); } console.log('Seeding global header...') await payload.updateGlobal({ slug: 'header', data: { navigation: pageIds.slice(0, 6).map(id => ({ page: id })), }, }); console.log('Seeding global company info...') await payload.updateGlobal({ slug: 'company', data: { address: 'DO POTWIERDZENIA PRZEZ KLIENTA', phone: '+49 123 456 789', email: 'kontakt@example.com', hours: 'Pon-Pt: 9:00 - 17:00\nPo wcześniejszym umówieniu', whatsappNumber: '49123456789', } }); console.log('Seeding global footer...') const footerNavIndices = [0, 1, 2, 3, 4, 5, 7, 8, 9]; const footerNavPages = footerNavIndices.map(index => ({ page: pageIds[index] })); await payload.updateGlobal({ slug: 'footer', data: { navigation: footerNavPages, association: { title: 'Działam w ramach b.b.h. Lohnsteuerhilfeverein e.V.', link: 'https://bbh-lohnsteuerhilfe.de', } } }); console.log('Seeding site-settings (homepage)...') await payload.updateGlobal({ slug: 'site-settings', data: { siteName: 'Finanz- & Lohnbuchhaltung Dipl.-Ing. Janusz Kędzierski', titleOrder: 'page-first', titleSeparator: '|', homepage: pageIds[0], } }); console.log('Seed completed.') } else { console.log('Pages already seeded.') } } run().catch(console.error).finally(() => process.exit(0))