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
@@ -5,6 +5,7 @@ import { useRouter } from "next/navigation";
import {
persistExternalEntryPayload,
resolveExternalEntryDestination,
resolveExternalEntryPromotionType,
resolveExternalEntryTarget,
shouldBindExternalFacebookIdentity,
@@ -25,6 +26,7 @@ interface ExternalEntryPersistProps {
psid: string | null;
avatarUrl: string | null;
target: string | null;
coffeeType: string | null;
mode: string | null;
promotionType: string | null;
}
@@ -35,6 +37,7 @@ export default function ExternalEntryPersist({
psid,
avatarUrl,
target,
coffeeType,
mode,
promotionType,
}: ExternalEntryPersistProps) {
@@ -43,7 +46,8 @@ export default function ExternalEntryPersist({
const authDispatch = useAuthDispatch();
const [hasPersisted, setHasPersisted] = useState(false);
const hasNavigatedRef = useRef(false);
const destination = resolveExternalEntryTarget({ target });
const targetRoute = resolveExternalEntryTarget({ target });
const destination = resolveExternalEntryDestination({ target, coffeeType });
const resolvedPromotionType = resolveExternalEntryPromotionType({
mode,
promotionType,
@@ -60,7 +64,7 @@ export default function ExternalEntryPersist({
psid,
avatarUrl,
}),
destination === ROUTES.chat && resolvedPromotionType
targetRoute === ROUTES.chat && resolvedPromotionType
? savePendingChatPromotion(resolvedPromotionType)
: clearPendingChatPromotion(),
]);
@@ -81,12 +85,14 @@ export default function ExternalEntryPersist({
}, [
avatarUrl,
asid,
coffeeType,
destination,
deviceId,
mode,
promotionType,
psid,
resolvedPromotionType,
targetRoute,
]);
useEffect(() => {