feat(cms): hosting plans page with lifecycle gate and net + VAT prices (MITHOME-130)
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Canceled after 0s
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Canceled after 0s
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Canceled after 0s
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Canceled after 0s
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Canceled after 0s
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Canceled after 0s
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Canceled after 0s
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Canceled after 0s
- Products collection (interim mirror of the PLATFM-14 catalogue contract): lifecycle status, product type, required whole-forint net price, yearly billing, service definition, per-product English gate - HostingPlans global: page copy, comparison labels, VAT rate (27%) - Gate: production shows only active plans, staging all but retired; with no showable plan the page is 404 and left out of the menu and the sitemap - /hu/tarhely-csomagok <-> /en/hosting-plans via PAGE_SLUGS (hreflang, language switcher, CTA page picker) - Seed migration 20260929_hosting_plans: mIT Start (14 900 Ft/yr, 5 mailboxes) and mIT Mid (23 900 Ft/yr) as drafts, English AI draft; idempotent - Production SEO suite expects at least 12 sitemap URLs; new SMOKE-10 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
0c5888761b
commit
1e0742a548
@@ -0,0 +1,176 @@
|
||||
/**
|
||||
* MITHOME-130: seed the hosting plans (mIT Start, mIT Mid) and the copy of
|
||||
* the hosting plans page.
|
||||
*
|
||||
* Figures and prices come from the central catalogue — mitplatform
|
||||
* docs/plans/PLATFM-14-products-v0.json, catalogVersion 0.1.1 (owner
|
||||
* decision 2026-09-29: variant B, yearly billing, net + 27% VAT).
|
||||
*
|
||||
* - Products are created in the "draft" lifecycle status: staging shows
|
||||
* them for review, production does not (src/lib/products.ts).
|
||||
* - English is an AI draft (enTranslationStatus "ai-draft").
|
||||
* - Only creates what is missing (product by slug, page copy when empty);
|
||||
* never touches existing data. Idempotent.
|
||||
*
|
||||
* WHY the Local API (not rewriteDocs): these are new documents, and the
|
||||
* Local API writes the version records and the Payload `_status` for us.
|
||||
*/
|
||||
import type { MigrateDownArgs, MigrateUpArgs } from '@payloadcms/db-mongodb'
|
||||
|
||||
type Copy = { hu: string; en: string }
|
||||
type ListCopy = { hu: string[]; en: string[] }
|
||||
|
||||
const FEATURES: ListCopy = {
|
||||
hu: ['Ingyenes SSL-tanúsítvány', 'Spamszűrés', 'Napi mentés, 7 napos visszaállítás', 'Személyes, magyar nyelvű támogatás munkanapokon'],
|
||||
en: ['Free SSL certificate', 'Spam filtering', 'Daily backups with 7-day restore', 'Personal support in Hungarian on weekdays'],
|
||||
}
|
||||
const BACKUP: Copy = { hu: 'Napi, 7 napos visszaállítással', en: 'Daily, with 7-day restore' }
|
||||
const CTA: Copy = { hu: 'Ezt választom', en: 'Choose this plan' }
|
||||
|
||||
export const HOSTING_PLAN_SEEDS = [
|
||||
{
|
||||
slug: 'mit-start',
|
||||
name: 'mIT Start',
|
||||
sortOrder: 10,
|
||||
highlighted: false,
|
||||
audience: { hu: 'Egyéni vállalkozóknak és kis bemutatkozó oldalaknak', en: 'For sole traders and small presentation sites' },
|
||||
shortDescription: {
|
||||
hu: 'Tárhely egy weboldalhoz, céges levelezéssel és napi mentéssel.',
|
||||
en: 'Hosting for one website, with business email and daily backups.',
|
||||
},
|
||||
netAmount: 14900,
|
||||
service: { storageGb: 3, mailStorageGb: 1, domains: 1, domainAliases: 0, databases: 1, mailboxes: 5 },
|
||||
},
|
||||
{
|
||||
slug: 'mit-mid',
|
||||
name: 'mIT Mid',
|
||||
sortOrder: 20,
|
||||
highlighted: true,
|
||||
audience: {
|
||||
hu: 'Kisvállalkozásoknak, több postafiókkal és egy kiegészítő oldallal',
|
||||
en: 'For small businesses with several mailboxes and an additional site',
|
||||
},
|
||||
shortDescription: {
|
||||
hu: 'Nagyobb tárhely, két adatbázis és domain-aliasok egy növekvő céges jelenléthez.',
|
||||
en: 'More storage, two databases and domain aliases for a growing business presence.',
|
||||
},
|
||||
netAmount: 23900,
|
||||
service: { storageGb: 8, mailStorageGb: 4, domains: 1, domainAliases: 2, databases: 2, mailboxes: 10 },
|
||||
},
|
||||
] as const
|
||||
|
||||
export const HOSTING_PLANS_PAGE_COPY = {
|
||||
meta: {
|
||||
title: { hu: 'Tárhelycsomagok', en: 'Hosting plans' },
|
||||
description: {
|
||||
hu: 'mIT Start és mIT Mid tárhelycsomagok céges levelezéssel, napi mentéssel és személyes támogatással, átlátható éves díjjal.',
|
||||
en: 'mIT Start and mIT Mid hosting plans with business email, daily backups and personal support, at a clear yearly price.',
|
||||
},
|
||||
},
|
||||
hero: {
|
||||
title: { hu: 'Tárhelycsomagok', en: 'Hosting plans' },
|
||||
subtitle: {
|
||||
hu: 'Két egyszerű csomag kis- és középvállalkozásoknak – napi mentéssel, céges levelezéssel és személyes támogatással.',
|
||||
en: 'Two simple plans for small and medium-sized businesses – with daily backups, business email and personal support.',
|
||||
},
|
||||
},
|
||||
labels: {
|
||||
storage: { hu: 'Tárhely összesen', en: 'Total storage' },
|
||||
mailStorage: { hu: 'Ebből levelezés', en: 'Of which email' },
|
||||
domains: { hu: 'Domain', en: 'Domains' },
|
||||
domainAliases: { hu: 'Domain-alias', en: 'Domain aliases' },
|
||||
databases: { hu: 'Adatbázis (MariaDB)', en: 'Databases (MariaDB)' },
|
||||
mailboxes: { hu: 'E-mail-fiók (legfeljebb)', en: 'Mailboxes (up to)' },
|
||||
backup: { hu: 'Mentés', en: 'Backups' },
|
||||
ssl: { hu: 'SSL-tanúsítvány', en: 'SSL certificate' },
|
||||
spamFilter: { hu: 'Spamszűrés', en: 'Spam filtering' },
|
||||
perYear: { hu: '/ év', en: '/ year' },
|
||||
perMonth: { hu: '/ hó', en: '/ month' },
|
||||
oneTime: { hu: 'egyszeri díj', en: 'one-off fee' },
|
||||
plusVat: { hu: '+ ÁFA', en: '+ VAT' },
|
||||
grossPrice: { hu: 'bruttó', en: 'gross' },
|
||||
recommended: { hu: 'Ajánlott', en: 'Recommended' },
|
||||
included: { hu: 'Benne van', en: 'Included' },
|
||||
priceNote: {
|
||||
hu: 'Az árak éves díjak, 27% ÁFA-val számolva. A domain regisztrációja külön tétel.',
|
||||
en: 'Prices are yearly fees, calculated with 27% Hungarian VAT. Domain registration is charged separately.',
|
||||
},
|
||||
},
|
||||
largerNeeds: {
|
||||
title: { hu: 'Nagyobb igénye van?', en: 'Need more?' },
|
||||
text: {
|
||||
hu: 'Webáruházhoz, nagyobb forgalomhoz vagy 8 GB feletti tárhelyhez egyedi ajánlatot készítünk.',
|
||||
en: 'For an online shop, higher traffic or more than 8 GB of storage, we prepare a custom quote.',
|
||||
},
|
||||
button: { hu: 'Kérjen egyedi ajánlatot', en: 'Request a custom quote' },
|
||||
},
|
||||
} as const
|
||||
|
||||
type Lang = 'hu' | 'en'
|
||||
type Tree = { readonly [key: string]: Tree | Copy }
|
||||
|
||||
const isCopy = (node: Tree | Copy): node is Copy => typeof (node as Copy).hu === 'string'
|
||||
|
||||
/** One language of a { hu, en } copy tree. */
|
||||
export function pickLanguage(tree: Tree, lang: Lang): Record<string, unknown> {
|
||||
return Object.fromEntries(
|
||||
Object.entries(tree).map(([key, node]) => [key, isCopy(node) ? node[lang] : pickLanguage(node, lang)]),
|
||||
)
|
||||
}
|
||||
|
||||
type Seed = (typeof HOSTING_PLAN_SEEDS)[number]
|
||||
|
||||
/** Product data for one language; shared fields only in the default locale. */
|
||||
export function productData(seed: Seed, lang: Lang): Record<string, unknown> {
|
||||
const localized = {
|
||||
public: {
|
||||
audience: seed.audience[lang],
|
||||
shortDescription: seed.shortDescription[lang],
|
||||
features: FEATURES[lang].map((value) => ({ value })),
|
||||
ctaText: CTA[lang],
|
||||
},
|
||||
serviceDefinition: { backup: BACKUP[lang] },
|
||||
}
|
||||
if (lang === 'en') return { ...localized, _status: 'published' }
|
||||
return {
|
||||
slug: seed.slug,
|
||||
name: seed.name,
|
||||
productType: 'hosting',
|
||||
status: 'draft',
|
||||
sortOrder: seed.sortOrder,
|
||||
highlighted: seed.highlighted,
|
||||
enTranslationStatus: 'ai-draft',
|
||||
public: localized.public,
|
||||
pricing: { netAmount: seed.netAmount, billingPeriod: 'yearly' },
|
||||
serviceDefinition: { ...seed.service, backup: BACKUP.hu, ssl: true, spamFilter: true },
|
||||
_status: 'published',
|
||||
}
|
||||
}
|
||||
|
||||
export async function up({ payload, req }: MigrateUpArgs): Promise<void> {
|
||||
let created = 0
|
||||
for (const seed of HOSTING_PLAN_SEEDS) {
|
||||
const existing = await payload.find({ collection: 'products', where: { slug: { equals: seed.slug } }, limit: 1, depth: 0, req })
|
||||
if (existing.docs.length > 0) continue
|
||||
const doc = await payload.create({ collection: 'products', data: productData(seed, 'hu') as never, locale: 'hu', req })
|
||||
await payload.update({ collection: 'products', id: doc.id, data: productData(seed, 'en') as never, locale: 'en', req })
|
||||
created += 1
|
||||
}
|
||||
|
||||
let pageSeeded = 0
|
||||
const page = await payload.findGlobal({ slug: 'hosting-plans', locale: 'hu', depth: 0, req })
|
||||
if (!page?.hero?.title) {
|
||||
const copy = HOSTING_PLANS_PAGE_COPY as unknown as Tree
|
||||
const hu = { ...pickLanguage(copy, 'hu'), vatRatePercent: 27, enTranslationStatus: 'ai-draft', _status: 'published' }
|
||||
await payload.updateGlobal({ slug: 'hosting-plans', data: hu as never, locale: 'hu', req })
|
||||
await payload.updateGlobal({ slug: 'hosting-plans', data: { ...pickLanguage(copy, 'en'), _status: 'published' } as never, locale: 'en', req })
|
||||
pageSeeded = 1
|
||||
}
|
||||
|
||||
payload.logger.info(`MITHOME-130 hosting plans: ${created} product(s) created, ${pageSeeded} page copy seeded`)
|
||||
}
|
||||
|
||||
/** DECISION: no automatic down — restore the pre-deploy dump instead. */
|
||||
export async function down({ payload }: MigrateDownArgs): Promise<void> {
|
||||
payload.logger.warn('MITHOME-130 hosting plans: down is a no-op — restore the pre-deploy dump instead')
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import * as migration_20260929_en_ai_draft from './20260929_en_ai_draft'
|
||||
import * as migration_20260929_service_claims from './20260929_service_claims'
|
||||
import * as migration_20260929_partner_references from './20260929_partner_references'
|
||||
import * as migration_20260929_atlantisz_pending from './20260929_atlantisz_pending'
|
||||
import * as migration_20260929_hosting_plans from './20260929_hosting_plans'
|
||||
|
||||
/**
|
||||
* Payload migrations, in order. Passed to `mongooseAdapter({ prodMigrations })`
|
||||
@@ -52,4 +53,10 @@ export const migrations = [
|
||||
down: migration_20260929_atlantisz_pending.down,
|
||||
name: '20260929_atlantisz_pending',
|
||||
},
|
||||
{
|
||||
// MITHOME-130 — hosting plans (draft) + page copy, from the PLATFM-14 catalogue.
|
||||
up: migration_20260929_hosting_plans.up,
|
||||
down: migration_20260929_hosting_plans.down,
|
||||
name: '20260929_hosting_plans',
|
||||
},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user