feat(tip): support tiered coffee gifts

This commit is contained in:
2026-07-14 10:44:46 +08:00
parent 37ae152abb
commit 0fe74b5371
17 changed files with 307 additions and 41 deletions
+7 -2
View File
@@ -1,7 +1,7 @@
"use client";
import { usePaymentLaunchFlow } from "@/app/_hooks/use-payment-launch-flow";
import { ROUTES } from "@/router/routes";
import type { TipCoffeeType } from "@/lib/tip/tip_coffee";
import {
usePaymentDispatch,
usePaymentState,
@@ -15,15 +15,19 @@ import styles from "./tip-screen.module.css";
const log = new Logger("TipCheckoutButton");
export interface TipCheckoutButtonProps {
coffeeType: TipCoffeeType;
disabled?: boolean;
isAuthLoading?: boolean;
onOrder: () => void;
returnPath: string;
}
export function TipCheckoutButton({
coffeeType,
disabled = false,
isAuthLoading = false,
onOrder,
returnPath,
}: TipCheckoutButtonProps) {
const payment = usePaymentState();
const paymentDispatch = usePaymentDispatch();
@@ -33,6 +37,7 @@ export function TipCheckoutButton({
payment,
paymentDispatch,
subscriptionType: "tip",
tipCoffeeType: coffeeType,
});
const isLoading =
@@ -71,7 +76,7 @@ export function TipCheckoutButton({
{paymentLaunch.shouldShowStripeDialog && paymentLaunch.stripeClientSecret ? (
<StripePaymentDialog
clientSecret={paymentLaunch.stripeClientSecret}
returnPath={ROUTES.tip}
returnPath={returnPath}
onClose={paymentLaunch.handleStripeClose}
onConfirmed={paymentLaunch.handleStripeConfirmed}
/>