diff --git a/components/checkout/PlanSummary.tsx b/components/checkout/PlanSummary.tsx index ee26698..c2f4567 100644 --- a/components/checkout/PlanSummary.tsx +++ b/components/checkout/PlanSummary.tsx @@ -2,7 +2,7 @@ import { useState, useEffect, useCallback } from 'react' import { useRouter, useSearchParams } from 'next/navigation' -import { motion } from 'framer-motion' +import { motion, AnimatePresence } from 'framer-motion' import { Select } from '@ciphera-net/ui' import { TRAFFIC_TIERS, PLAN_PRICES } from '@/lib/plans' import { COUNTRY_OPTIONS } from '@/lib/countries' @@ -21,6 +21,11 @@ interface PlanSummaryProps { const inputClass = 'w-full rounded-lg border border-neutral-700 bg-neutral-800/50 px-3 py-2.5 text-sm text-white placeholder:text-neutral-500 focus:outline-none focus:ring-1 focus:ring-brand-orange focus:border-brand-orange transition-colors' +/** Convert VIES ALL-CAPS text to title case (e.g. "SA SODIMAS" → "Sa Sodimas") */ +function toTitleCase(s: string) { + return s.replace(/\S+/g, (w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()) +} + export default function PlanSummary({ plan, interval, limit, country, vatId, onCountryChange, onVatIdChange }: PlanSummaryProps) { const router = useRouter() const searchParams = useSearchParams() @@ -148,17 +153,35 @@ export default function PlanSummary({ plan, interval, limit, country, vatId, onC {/* Verified company info */} - {isVatValid && vatResult?.company_name && ( -
{vatResult.company_name}
- {vatResult.company_address && ( -{vatResult.company_address}
- )} -VAT ID could not be verified. 21% VAT will apply.
- )} +{toTitleCase(vatResult.company_name)}
+ {vatResult.company_address && ( +{toTitleCase(vatResult.company_address)}
+ )} +