Files
popiart-server/web/components/billing-page-state.tsx
T
wtgoku baba209519 Expose gateway billing flows from the synced server baseline
The preserved local work adds PopiNewAPI billing checkout, gateway account binding, and matching web console/pricing surfaces on top of the current test-server baseline. During the merge, the start-end video helpers from the deployed baseline were kept alongside the actionGenerate prompt handling from the WIP.

Constraint: Current usable baseline is 7054436, already deployed on the test server.

Rejected: Commit the WIP before syncing the baseline | would have hidden conflicts with the deployed start-end-frame changes.

Confidence: medium

Scope-risk: broad

Directive: Do not deploy this commit to the test server without rechecking gateway credentials and billing checkout behavior in that environment.

Tested: go test ./...

Tested: make build

Tested: cd web && npm run build
2026-05-21 16:53:07 +08:00

36 lines
881 B
TypeScript

"use client";
import { useEffect } from "react";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
const BILLING_STATE_KEY = "popiart-billing-page-state";
export function BillingPageState() {
const pathname = usePathname();
const router = useRouter();
const searchParams = useSearchParams();
useEffect(() => {
const hasQuery = searchParams.toString().length > 0;
if (hasQuery) {
try {
window.sessionStorage.setItem(BILLING_STATE_KEY, searchParams.toString());
} catch {
// Ignore storage write failures.
}
return;
}
try {
const stored = window.sessionStorage.getItem(BILLING_STATE_KEY);
if (stored) {
router.replace(`${pathname}?${stored}`);
}
} catch {
// Ignore storage read failures.
}
}, [pathname, router, searchParams]);
return null;
}