feat(subscription): split vip and topup flows
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user