'use client' import { useState } from 'react' import Link from 'next/link' export default function SubscribeButton({ loggedIn }: { loggedIn: boolean }) { const [pending, setPending] = useState(false) const [comingSoon, setComingSoon] = useState(false) async function subscribe() { setPending(true) const res = await fetch('/api/subscribe', { method: 'POST' }) if (res.ok) { const data = await res.json() if (data?.url) { window.location.href = data.url as string return } } // Stripe pending mode (no keys configured) or failure setComingSoon(true) setPending(false) } if (comingSoon) { return
الدفع الإلكتروني متاح قريباً. راسلنا على hello@anwarpy.ai لتفعيل عضويتك يدوياً.
} if (!loggedIn) { /* QA-R01/R07: anonymous visitors get explicit signup + login CTAs instead of a silent redirect. Both preserve /subscription as the destination. */ return ( أنشئ حساباً واشترك لدي حساب، تسجيل الدخول ) } return ( ) }