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,66 @@
|
||||
import { render, screen, within } from '@testing-library/react'
|
||||
import '@testing-library/jest-dom'
|
||||
import HostingPlansView from './HostingPlansView'
|
||||
import { HOSTING_PLANS_PAGE_COPY, pickLanguage } from '@/migrations/20260929_hosting_plans'
|
||||
import type { HostingPlanView } from '@/lib/products'
|
||||
|
||||
type Content = Parameters<typeof HostingPlansView>[0]['content']
|
||||
|
||||
const content = (lang: 'hu' | 'en') =>
|
||||
({ ...pickLanguage(HOSTING_PLANS_PAGE_COPY as never, lang), vatRatePercent: 27 }) as unknown as Content
|
||||
|
||||
const plan = (over: Partial<HostingPlanView>): HostingPlanView => ({
|
||||
id: 'start',
|
||||
slug: 'mit-start',
|
||||
name: 'mIT Start',
|
||||
highlighted: false,
|
||||
audience: 'Egyéni vállalkozóknak',
|
||||
shortDescription: 'Tárhely egy weboldalhoz.',
|
||||
features: ['Spamszűrés'],
|
||||
ctaText: 'Ezt választom',
|
||||
netAmount: 14900,
|
||||
billingPeriod: 'yearly',
|
||||
service: { storageGb: 3, mailStorageGb: 1, domains: 1, domainAliases: 0, databases: 1, mailboxes: 5, backup: 'Napi', ssl: true, spamFilter: true },
|
||||
...over,
|
||||
})
|
||||
|
||||
const PLANS = [plan({}), plan({ id: 'mid', slug: 'mit-mid', name: 'mIT Mid', highlighted: true, netAmount: 23900, service: { storageGb: 8, mailboxes: 10, ssl: true, spamFilter: true } })]
|
||||
|
||||
const text = (el: HTMLElement) => (el.textContent ?? '').replace(/\s/g, ' ')
|
||||
|
||||
describe('HostingPlansView (MITHOME-130)', () => {
|
||||
it('should show both plans as cards with their comparison rows', () => {
|
||||
render(<HostingPlansView content={content('hu')} plans={PLANS} locale="hu" />)
|
||||
expect(screen.getByRole('heading', { level: 1, name: 'Tárhelycsomagok' })).toBeInTheDocument()
|
||||
const start = screen.getByTestId('plan-mit-start')
|
||||
expect(within(start).getByRole('heading', { name: 'mIT Start' })).toBeInTheDocument()
|
||||
expect(text(start)).toContain('Tárhely összesen3 GB')
|
||||
expect(text(start)).toContain('E-mail-fiók (legfeljebb)5')
|
||||
expect(text(screen.getByTestId('plan-mit-mid'))).toContain('Tárhely összesen8 GB')
|
||||
})
|
||||
|
||||
it('should show the net price with VAT and the gross price per year', () => {
|
||||
render(<HostingPlansView content={content('hu')} plans={PLANS} locale="hu" />)
|
||||
const start = text(screen.getByTestId('plan-mit-start'))
|
||||
expect(start).toContain('14 900 Ft + ÁFA / év')
|
||||
expect(start).toContain('bruttó 18 923 Ft / év')
|
||||
expect(text(screen.getByTestId('plan-mit-mid'))).toContain('bruttó 30 353 Ft / év')
|
||||
})
|
||||
|
||||
it('should format the English page and mark only the highlighted plan', () => {
|
||||
render(<HostingPlansView content={content('en')} plans={PLANS} locale="en" />)
|
||||
expect(text(screen.getByTestId('plan-mit-start'))).toContain('14,900 Ft + VAT / year')
|
||||
expect(within(screen.getByTestId('plan-mit-mid')).getByText('Recommended')).toBeInTheDocument()
|
||||
expect(within(screen.getByTestId('plan-mit-start')).queryByText('Recommended')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('should offer a custom quote only for larger needs, linking to the contact page', () => {
|
||||
render(<HostingPlansView content={content('hu')} plans={PLANS} locale="hu" />)
|
||||
expect(screen.getAllByText(/ajánlat/i)).toHaveLength(2) // larger-needs text + button, never a card
|
||||
expect(screen.getByRole('link', { name: 'Kérjen egyedi ajánlatot' })).toHaveAttribute('href', '/hu/kapcsolat')
|
||||
for (const card of [screen.getByTestId('plan-mit-start'), screen.getByTestId('plan-mit-mid')]) {
|
||||
expect(within(card).queryByText(/ajánlat/i)).not.toBeInTheDocument()
|
||||
expect(within(card).getByRole('link', { name: 'Ezt választom' })).toHaveAttribute('href', '/hu/kapcsolat')
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,128 @@
|
||||
import { localePath, type Locale } from '@/lib/i18n'
|
||||
import type { getHostingPlansContent } from '@/lib/payload-content'
|
||||
import { formatHuf, grossAmount, DEFAULT_VAT_RATE_PERCENT, type BillingPeriod, type HostingPlanView } from '@/lib/products'
|
||||
|
||||
type Content = Awaited<ReturnType<typeof getHostingPlansContent>>
|
||||
type Labels = Content['labels']
|
||||
|
||||
type HostingPlansViewProps = {
|
||||
content: Content
|
||||
plans: HostingPlanView[]
|
||||
locale: Locale
|
||||
}
|
||||
|
||||
const PERIOD_LABEL: Record<BillingPeriod, keyof Labels> = {
|
||||
yearly: 'perYear',
|
||||
monthly: 'perMonth',
|
||||
'one-time': 'oneTime',
|
||||
}
|
||||
|
||||
const gb = (value?: number) => (value === undefined ? '–' : `${value} GB`)
|
||||
const num = (value?: number) => (value === undefined ? '–' : String(value))
|
||||
|
||||
function comparisonRows(plan: HostingPlanView, labels: Labels): [string, string][] {
|
||||
const s = plan.service
|
||||
const included = (on: boolean) => (on ? `✓ ${labels.included}` : '–')
|
||||
return [
|
||||
[labels.storage, gb(s.storageGb)],
|
||||
[labels.mailStorage, gb(s.mailStorageGb)],
|
||||
[labels.domains, num(s.domains)],
|
||||
[labels.domainAliases, num(s.domainAliases)],
|
||||
[labels.databases, num(s.databases)],
|
||||
[labels.mailboxes, num(s.mailboxes)],
|
||||
[labels.backup, s.backup ?? '–'],
|
||||
[labels.ssl, included(s.ssl)],
|
||||
[labels.spamFilter, included(s.spamFilter)],
|
||||
]
|
||||
}
|
||||
|
||||
/** MITHOME-130: comparable hosting plan cards with net + VAT and gross price. */
|
||||
export default function HostingPlansView({ content, plans, locale }: HostingPlansViewProps) {
|
||||
const { labels } = content
|
||||
const contactHref = localePath(locale, 'contact')
|
||||
const vatRate = content.vatRatePercent ?? DEFAULT_VAT_RATE_PERCENT
|
||||
|
||||
return (
|
||||
<div className="space-y-16 py-8">
|
||||
<section className="bg-gradient-to-r from-blue-50 to-indigo-50 py-16">
|
||||
<div className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 text-center">
|
||||
<h1 className="text-4xl md:text-5xl font-bold text-gray-900 mb-6">{content.hero.title}</h1>
|
||||
<p className="text-xl text-gray-600 leading-relaxed">{content.hero.subtitle}</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<ul className="grid grid-cols-1 md:grid-cols-2 gap-8">
|
||||
{plans.map((plan) => {
|
||||
const period = labels[PERIOD_LABEL[plan.billingPeriod]]
|
||||
return (
|
||||
<li
|
||||
key={plan.id}
|
||||
data-testid={`plan-${plan.slug}`}
|
||||
className={`relative flex flex-col bg-white rounded-xl p-8 shadow-sm border ${plan.highlighted ? 'border-blue-600 ring-2 ring-blue-600' : 'border-gray-200'}`}
|
||||
>
|
||||
{plan.highlighted && (
|
||||
<span className="absolute -top-3 left-8 rounded-full bg-blue-600 px-3 py-1 text-xs font-semibold text-white">
|
||||
{labels.recommended}
|
||||
</span>
|
||||
)}
|
||||
<h2 className="text-2xl font-bold text-gray-900">{plan.name}</h2>
|
||||
<p className="mt-1 text-sm font-medium text-blue-700">{plan.audience}</p>
|
||||
<p className="mt-4 text-gray-600">{plan.shortDescription}</p>
|
||||
|
||||
<p className="mt-6">
|
||||
<span className="text-3xl font-bold text-gray-900">{formatHuf(plan.netAmount, locale)}</span>{' '}
|
||||
<span className="text-gray-700">{labels.plusVat} {period}</span>
|
||||
</p>
|
||||
<p className="text-sm text-gray-500">
|
||||
{labels.grossPrice} {formatHuf(grossAmount(plan.netAmount, vatRate), locale)} {period}
|
||||
</p>
|
||||
|
||||
<dl className="mt-6 divide-y divide-gray-100 border-y border-gray-100">
|
||||
{comparisonRows(plan, labels).map(([term, value]) => (
|
||||
<div key={term} className="flex justify-between gap-4 py-2 text-sm">
|
||||
<dt className="text-gray-600">{term}</dt>
|
||||
<dd className="font-medium text-gray-900 text-right">{value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
|
||||
{plan.features.length > 0 && (
|
||||
<ul className="mt-6 space-y-2">
|
||||
{plan.features.map((feature) => (
|
||||
<li key={feature} className="flex items-start text-gray-700">
|
||||
<span className="text-blue-500 mr-3" aria-hidden="true">✓</span>
|
||||
{feature}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
|
||||
<a
|
||||
href={contactHref}
|
||||
className={`mt-8 inline-flex justify-center rounded-lg px-6 py-3 font-semibold transition-colors ${plan.highlighted ? 'bg-blue-600 text-white hover:bg-blue-700' : 'border border-blue-600 text-blue-700 hover:bg-blue-50'}`}
|
||||
>
|
||||
{plan.ctaText}
|
||||
</a>
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
<p className="mt-6 text-center text-sm text-gray-500">{labels.priceNote}</p>
|
||||
</section>
|
||||
|
||||
<section className="bg-gray-50 py-16">
|
||||
<div className="max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 text-center">
|
||||
<h2 className="text-3xl font-bold text-gray-900 mb-4">{content.largerNeeds.title}</h2>
|
||||
<p className="text-lg text-gray-600 mb-8">{content.largerNeeds.text}</p>
|
||||
<a
|
||||
href={contactHref}
|
||||
className="inline-flex rounded-lg bg-blue-600 px-8 py-3 font-semibold text-white hover:bg-blue-700 transition-colors"
|
||||
>
|
||||
{content.largerNeeds.button}
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user