Route landing account sign-ins to checkout

This commit is contained in:
2569718930@qq.com
2026-06-14 03:14:10 +08:00
parent 8e775e0429
commit 5d0f2d4505
7 changed files with 38 additions and 14 deletions
@@ -675,7 +675,7 @@ export function AccountCenter() {
</button>
) : (
<Link
href="/auth/login?next=%2Faccount"
href="/auth/login?next=%2Faccount%3Fcheckout%3D1"
className="flex items-center gap-2 rounded-lg border border-blue-200 bg-blue-50 px-4 py-2 text-sm font-semibold text-blue-700 transition-all hover:bg-blue-100"
>
<LogIn size={16} /> {copy.signIn}
@@ -11,6 +11,14 @@ export function runTests() {
const accountCenter = fs.readFileSync(path.join(accountDir, "AccountCenter.tsx"), "utf8");
const paymentFlow = fs.readFileSync(path.join(accountDir, "usePaymentFlow.ts"), "utf8");
const accountPayment = fs.readFileSync(path.join(accountDir, "useAccountPayment.ts"), "utf8");
const landingPage = fs.readFileSync(
path.join(projectRoot, "components", "landing", "InstitutionalLandingPage.tsx"),
"utf8",
);
const landingAuthActions = fs.readFileSync(
path.join(projectRoot, "components", "landing", "LandingAuthActions.tsx"),
"utf8",
);
const productAccess = fs.readFileSync(
path.join(projectRoot, "components", "dashboard", "scan-terminal", "ProductAccessRequired.tsx"),
"utf8",
@@ -30,6 +38,19 @@ export function runTests() {
"account page must support /account?checkout=1 for direct upgrade entry",
);
assert(
accountCenter.includes('href="/auth/login?next=%2Faccount%3Fcheckout%3D1"'),
"account page sign-in button must preserve the checkout entry for unauthenticated subscription recovery",
);
assert(
landingAuthActions.includes('href="/account?checkout=1"') &&
landingPage.includes('href="/account?checkout=1"') &&
!/href="\/account"(?![/?#])/.test(landingAuthActions) &&
!/href="\/account"(?![/?#])/.test(landingPage),
"landing subscription/account CTAs must open the checkout account entry instead of a generic account page",
);
assert(
productAccess.includes('href="/account?checkout=1"') &&
productAccess.includes("Renew and restore access") &&