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

- 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:
Do Siki
2026-09-29 19:36:44 +02:00
co-authored by Claude Opus 5.5
parent 0c5888761b
commit 1e0742a548
26 changed files with 1114 additions and 32 deletions
+36 -1
View File
@@ -14,10 +14,11 @@
*/
import { getPayload } from 'payload'
import config from '@payload-config'
import type { Locale } from './i18n'
import { DEFAULT_LOCALE, type Locale } from './i18n'
import { resolveCtaHref, type CtaLink } from './cta-link'
import { readGated } from './translation-gate'
import { publicPartners, type PartnerView } from './partner-references'
import { hostingPlanViews, showableStatuses, type HostingPlanView, type ProductDoc } from './products'
let cached: ReturnType<typeof getPayload> | undefined
@@ -114,3 +115,37 @@ export async function getPartners(): Promise<PartnerView[]> {
const result = await payload.find({ collection: 'partners', limit: 100, sort: 'name', depth: 1 })
return publicPartners(result.docs)
}
export type { HostingPlanView } from './products'
/** MITHOME-130: raw hosting products in one locale, lifecycle-gated in the query. */
async function findHostingProducts(locale: Locale): Promise<ProductDoc[]> {
const payload = await payloadClient()
const result = await payload.find({
collection: 'products',
where: { productType: { equals: 'hosting' }, status: { in: showableStatuses() } },
sort: 'sortOrder',
locale,
limit: 50,
depth: 0,
})
return result.docs as unknown as ProductDoc[]
}
/** MITHOME-130: showable hosting plans; the English gate works per product. */
export async function getHostingPlans(locale: Locale): Promise<HostingPlanView[]> {
const requested = await findHostingProducts(locale)
const needsFallback = locale !== DEFAULT_LOCALE && requested.some((doc) => doc.enTranslationStatus !== 'approved')
const fallback = needsFallback ? await findHostingProducts(DEFAULT_LOCALE) : []
return hostingPlanViews(locale, requested, fallback)
}
/** The page, the menu item and the sitemap entry all follow this one gate. */
export async function hasHostingPlans(): Promise<boolean> {
return (await getHostingPlans(DEFAULT_LOCALE)).length > 0
}
export async function getHostingPlansContent(locale: Locale) {
const payload = await payloadClient()
return readGated(locale, (l) => payload.findGlobal({ slug: 'hosting-plans', locale: l }))
}