"use client"; import Link from "next/link"; import { ArrowRight, BellRing, CheckCircle2, Coins, Crown, Loader2, Lock, MessageSquare, Radar, Send, Sparkles, TrendingUp, Wallet, X, Zap, } from "lucide-react"; import s from "./UnlockProOverlay.module.css"; export type UnlockProBilling = { pointsEnabled: boolean; isEligible: boolean; pointsUsed: number; discountAmount: number; finalPrice: number; maxDiscountUsd: number; pointsPerUsd: number; }; type UnlockProOverlayProps = { points: number; planPriceUsd: number; usePoints: boolean; billing: UnlockProBilling; onToggleUsePoints: () => void; onPay: () => void; onClose?: () => void; payBusy?: boolean; payLabel?: string; locale?: "zh-CN" | "en-US"; errorText?: string; infoText?: string; faqHref?: string; telegramGroupUrl?: string; }; const FEATURES = { "zh-CN": ["15天高精度趋势预报", "实时多源雷达图", "全平台智能气象推送"], "en-US": [ "15-day precision forecast", "Real-time radar panel", "Cross-platform alerts", ], }; export function UnlockProOverlay({ points, planPriceUsd, usePoints, billing, onToggleUsePoints, onPay, onClose, payBusy = false, payLabel, locale = "zh-CN", errorText, infoText, faqHref = "/account", telegramGroupUrl, }: UnlockProOverlayProps) { const isEn = locale === "en-US"; const canUsePoints = billing.pointsEnabled && billing.isEligible; const featureList = FEATURES[locale] ?? FEATURES["zh-CN"]; const finalPayLabel = payLabel || (isEn ? "Subscribe & Activate" : "立即订阅并激活服务"); const progressPct = billing.pointsEnabled ? Math.min(100, Math.round((points / billing.pointsPerUsd) * 100)) : 0; return (
{isEn ? "High-precision weather intelligence, delivered everywhere." : "全球最精准的高精度气象推送,全平台覆盖"}
{usePoints ? isEn ? `Using ${billing.pointsUsed} pts · saves $${billing.discountAmount.toFixed(2)}` : `已消耗 ${billing.pointsUsed} 积分 · 省 $${billing.discountAmount.toFixed(2)}` : isEn ? `Toggle to save up to $${billing.maxDiscountUsd.toFixed(2)}` : `开启可最多抵扣 $${billing.maxDiscountUsd.toFixed(2)}`}
{!billing.pointsEnabled ? isEn ? "Points redemption is unavailable for this plan." : "当前套餐暂不支持积分抵扣。" : isEn ? `Need ${billing.pointsPerUsd} pts minimum. You have: ${points}` : `至少需要 ${billing.pointsPerUsd} 积分,当前仅有 ${points}`}
{billing.pointsEnabled && ({isEn ? "Total Due Today" : "今日应付"}
{billing.discountAmount > 0 && usePoints && (${planPriceUsd.toFixed(2)} USD
)}