feat(tip): support dynamic gift products
This commit is contained in:
@@ -12,7 +12,6 @@ import { behaviorAnalytics } from "@/lib/analytics";
|
||||
import type {
|
||||
PendingPaymentReturnTo,
|
||||
PendingPaymentSubscriptionType,
|
||||
PendingPaymentTipCoffeeType,
|
||||
} from "@/lib/payment/pending_payment_order";
|
||||
import type {
|
||||
PaymentContextState,
|
||||
@@ -39,7 +38,8 @@ export interface UsePaymentLaunchFlowInput {
|
||||
returnTo?: PendingPaymentReturnTo;
|
||||
characterSlug?: string;
|
||||
subscriptionType: PendingPaymentSubscriptionType;
|
||||
tipCoffeeType?: PendingPaymentTipCoffeeType;
|
||||
giftCategory?: string | null;
|
||||
giftPlanId?: string | null;
|
||||
}
|
||||
|
||||
export interface PaymentLaunchFlow {
|
||||
@@ -110,7 +110,8 @@ export function usePaymentLaunchFlow({
|
||||
returnTo,
|
||||
characterSlug,
|
||||
subscriptionType,
|
||||
tipCoffeeType,
|
||||
giftCategory,
|
||||
giftPlanId,
|
||||
}: UsePaymentLaunchFlowInput): PaymentLaunchFlow {
|
||||
const launchedNonceRef = useRef(0);
|
||||
const [hiddenStripeClientSecret, setHiddenStripeClientSecret] = useState<
|
||||
@@ -153,7 +154,8 @@ export function usePaymentLaunchFlow({
|
||||
orderId: payment.currentOrderId,
|
||||
paymentUrl,
|
||||
subscriptionType,
|
||||
...(tipCoffeeType ? { tipCoffeeType } : {}),
|
||||
giftCategory,
|
||||
giftPlanId,
|
||||
...(returnTo ? { returnTo } : {}),
|
||||
...(characterSlug ? { characterSlug } : {}),
|
||||
onOpened: () => trackPaymentCheckoutOpened(payment, paymentUrl),
|
||||
@@ -197,7 +199,8 @@ export function usePaymentLaunchFlow({
|
||||
paymentDispatch,
|
||||
returnTo,
|
||||
subscriptionType,
|
||||
tipCoffeeType,
|
||||
giftCategory,
|
||||
giftPlanId,
|
||||
]);
|
||||
|
||||
const shouldShowStripeDialog =
|
||||
@@ -238,7 +241,8 @@ export function usePaymentLaunchFlow({
|
||||
orderId: payment.currentOrderId,
|
||||
paymentUrl: ezpayPaymentUrl,
|
||||
subscriptionType,
|
||||
...(tipCoffeeType ? { tipCoffeeType } : {}),
|
||||
giftCategory,
|
||||
giftPlanId,
|
||||
...(returnTo ? { returnTo } : {}),
|
||||
...(characterSlug ? { characterSlug } : {}),
|
||||
onOpened: () => trackPaymentCheckoutOpened(payment, ezpayPaymentUrl),
|
||||
|
||||
Reference in New Issue
Block a user