import React, { useState } from "react"; import { clsx } from "clsx"; interface PricingFeature { id: string; name: string; description?: string; highlight?: boolean; } interface PricingPlan { id: string; name: string; description: string; price: { monthly: number; yearly: number; currency: string; }; features: (string | PricingFeature)[]; popular?: boolean; badge?: string; ctaText?: string; ctaUrl?: string; customCta?: boolean; trialDays?: number; setupFee?: number; discountPercentage?: number; } interface PlusPricingProps { title?: string; description?: string; plans?: PricingPlan[]; billingPeriod?: "monthly" | "yearly"; showBillingToggle?: boolean; showComparison?: boolean; showTrialInfo?: boolean; layout?: "horizontal" | "vertical"; maxFeaturedPlans?: number; className?: string; theme?: { primaryColor?: string; secondaryColor?: string; accentColor?: string; fontFamily?: string; }; } const defaultPlans: PricingPlan[] = [ { id: "starter", name: "스타터", description: "개인 사용자나 소규모 프로젝트에 적합", price: { monthly: 9900, yearly: 99000, currency: "KRW", }, features: [ "월 10,000 API 호출", "기본 대시보드", "이메일 지원", "SSL 인증서", "99.9% 업타임 보장", ], trialDays: 14, ctaText: "무료 체험 시작", ctaUrl: "/signup?plan=starter", }, { id: "professional", name: "프로페셔널", description: "성장하는 비즈니스를 위한 완벽한 솔루션", price: { monthly: 29900, yearly: 299000, currency: "KRW", }, features: [ "월 100,000 API 호출", "고급 분석 대시보드", "우선 이메일 지원", "API 키 관리", "워크플로우 자동화", "팀 협업 도구", "데이터 백업", ], popular: true, badge: "가장 인기", trialDays: 30, discountPercentage: 17, ctaText: "지금 시작하기", ctaUrl: "/signup?plan=professional", }, { id: "enterprise", name: "엔터프라이즈", description: "대규모 조직을 위한 맞춤형 솔루션", price: { monthly: 99900, yearly: 999000, currency: "KRW", }, features: [ "무제한 API 호출", "전용 계정 관리자", "24/7 전화 지원", "SSO 통합", "고급 보안", "맞춤형 대시보드", "온프레미스 배포", "SLA 보장", { id: "custom-integration", name: "맞춤형 통합", description: "기존 시스템과의 완벽한 연동", highlight: true, }, { id: "dedicated-support", name: "전담 기술 지원팀", description: "전문 엔지니어의 1:1 지원", highlight: true, }, ], badge: "최고 가치", trialDays: 30, setupFee: 500000, customCta: true, ctaText: "영업팀 문의", ctaUrl: "/contact?plan=enterprise", }, ]; const formatPrice = (price: number, currency: string): string => { return new Intl.NumberFormat("ko-KR", { style: "currency", currency: currency === "KRW" ? "KRW" : "USD", minimumFractionDigits: 0, }).format(price); }; const calculateYearlyDiscount = (monthly: number, yearly: number): number => { return Math.round(((monthly * 12 - yearly) / (monthly * 12)) * 100); }; export function PlusPricing({ title = "요금제", description = "비즈니스에 맞는 완벽한 플랜을 선택하세요.", plans = defaultPlans, billingPeriod = "monthly", showBillingToggle = true, showComparison = true, showTrialInfo = true, layout = "horizontal", maxFeaturedPlans = 3, className, theme = {}, }: PlusPricingProps) { const [selectedBilling, setSelectedBilling] = useState<"monthly" | "yearly">( billingPeriod ); const [showFullComparison, setShowFullComparison] = useState(false); const featuredPlans = plans.slice(0, maxFeaturedPlans); const isYearlySelected = selectedBilling === "yearly"; const PricingCard = ({ plan, featured = false, }: { plan: PricingPlan; featured?: boolean; }) => { const currentPrice = isYearlySelected ? plan.price.yearly : plan.price.monthly; const yearlyDiscount = calculateYearlyDiscount( plan.price.monthly, plan.price.yearly ); return (
{plan.description}
{/* Price */}{featureDesc}
)}{description}
{/* Billing Toggle */} {showBillingToggle && (| 기능 | {featuredPlans.map((plan) => ({plan.name} | ))}
|---|---|
| {featureName} | {featuredPlans.map((plan) => { const hasFeature = plan.features.some((f) => typeof f === "string" ? f === featureName : f.name === featureName ); return ({hasFeature ? ( ✓ ) : ( - )} | ); })}
모든 요금제는 언제든지 변경하거나 취소할 수 있습니다.
궁금한 점이 있으시면{" "} 영업팀에 문의 해 주세요.