feat(subscription): split vip and topup flows

This commit is contained in:
2026-06-29 14:45:01 +08:00
parent 72ac923a44
commit 096978e703
17 changed files with 106 additions and 432 deletions
@@ -23,7 +23,7 @@ const log = new Logger("SubscriptionCheckoutButton");
export interface SubscriptionCheckoutButtonProps {
/** 是否可用(未选套餐 / 未勾选协议 → false) */
disabled?: boolean;
subscriptionType: "vip" | "voice";
subscriptionType: "vip" | "topup";
returnTo?: "chat" | null;
}
@@ -97,13 +97,19 @@ export function SubscriptionCheckoutButton({
const isLoading =
payment.isCreatingOrder ||
payment.isPollingOrder;
const readyLabel =
subscriptionType === "topup" ? "Pay and Top Up" : "Pay and Activiate";
const agreementLabel =
subscriptionType === "topup"
? "Confirm the agreement and Top Up"
: "Confirm the agreement and Activate";
const label = payment.isPollingOrder
? "Processing payment..."
: payment.isCreatingOrder
? "Creating order..."
: payment.agreed
? "Pay and Activiate"
: "Confirm the agreement and Activate";
? readyLabel
: agreementLabel;
const handleClick = () => {
if (disabled || isLoading) return;
@@ -244,7 +250,7 @@ function isEzpayPayment(payParams: Record<string, unknown>): boolean {
interface RedirectToEzpayInput {
orderId: string | null;
paymentUrl: string;
subscriptionType: "vip" | "voice";
subscriptionType: "vip" | "topup";
returnTo?: "chat" | null;
onFailed: (errorMessage: string) => void;
}