feat(tip): support tiered coffee gifts
This commit is contained in:
@@ -3,6 +3,11 @@
|
||||
import { useSearchParams } from "next/navigation";
|
||||
|
||||
import type { PayChannel } from "@/data/dto/payment";
|
||||
import {
|
||||
DEFAULT_TIP_COFFEE_TYPE,
|
||||
resolveTipCoffeeType,
|
||||
TIP_COFFEE_TYPE_PARAM,
|
||||
} from "@/lib/tip/tip_coffee";
|
||||
|
||||
import { TipScreen } from "./tip-screen";
|
||||
|
||||
@@ -13,9 +18,13 @@ function toPayChannel(value: string | null): PayChannel | null {
|
||||
|
||||
export function TipPageClient() {
|
||||
const searchParams = useSearchParams();
|
||||
const coffeeType =
|
||||
resolveTipCoffeeType(searchParams.get(TIP_COFFEE_TYPE_PARAM)) ??
|
||||
DEFAULT_TIP_COFFEE_TYPE;
|
||||
|
||||
return (
|
||||
<TipScreen
|
||||
coffeeType={coffeeType}
|
||||
shouldResumePendingOrder={searchParams.get("paymentReturn") === "1"}
|
||||
initialPayChannel={toPayChannel(searchParams.get("payChannel"))}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user