fix: sync plan+tier after checkout, portal same-tab nav, cancel button always visible for paid plans, portal return URL to profile tab
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m44s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m44s
This commit is contained in:
@@ -71,7 +71,8 @@ export default function ProfilePage() {
|
||||
const [loadingPortal, setLoadingPortal] = useState(false);
|
||||
const [loadingCancel, setLoadingCancel] = useState(false);
|
||||
const [isClearing, setIsClearing] = useState(false);
|
||||
const [activeTab, setActiveTab] = useState('account');
|
||||
const searchParams = typeof window !== 'undefined' ? new URLSearchParams(window.location.search) : null;
|
||||
const [activeTab, setActiveTab] = useState(searchParams?.get('tab') ?? 'account');
|
||||
const [defaultLanguage, setDefaultLanguage] = useState(settings.defaultTargetLanguage);
|
||||
|
||||
const token = typeof window !== 'undefined' ? localStorage.getItem('token') : null;
|
||||
@@ -98,7 +99,7 @@ export default function ProfilePage() {
|
||||
const res = await fetch(`${API_BASE}/api/v1/auth/billing-portal`, { headers: authHeaders });
|
||||
const j = await res.json();
|
||||
const url = j.data?.url ?? j.url;
|
||||
if (url) window.open(url, '_blank');
|
||||
if (url) window.location.href = url; // same tab so return_url brings back to app
|
||||
else setStatusMsg({ type: 'err', text: t('profile.subscription.billingUnavailable') });
|
||||
} catch { setStatusMsg({ type: 'err', text: t('profile.subscription.billingError') }); }
|
||||
finally { setLoadingPortal(false); }
|
||||
@@ -434,8 +435,8 @@ export default function ProfilePage() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Danger zone */}
|
||||
{!isFreePlan && !isCanceling && user?.stripe_subscription_id && (
|
||||
{/* Danger zone — show if user has a paid plan (even if sub ID not yet synced) */}
|
||||
{!isFreePlan && !isCanceling && (
|
||||
<div className="editorial-card p-10 lg:p-12 bg-white dark:bg-[#141414] border-none shadow-editorial border-l-4 border-l-red-500">
|
||||
<div className="flex items-center gap-4 text-red-500 mb-8">
|
||||
<ShieldAlert size={20} />
|
||||
|
||||
Reference in New Issue
Block a user