feat(chat): render commercial actions and persist greetings
Docker Image / Build and Push Docker Image (push) Successful in 1m56s

This commit is contained in:
Codex
2026-07-23 14:52:34 +08:00
parent 79397af739
commit 02f6964484
26 changed files with 548 additions and 1 deletions
+36
View File
@@ -18,6 +18,8 @@ import { clearPendingChatNavigation } from "@/lib/navigation/chat_unlock_session
import { buildGlobalPageUrl } from "@/router/global-route-context";
import { resolveAuthenticatedNavigation } from "@/router/navigation-resolver";
import { getCharacterRoutes, ROUTES } from "@/router/routes";
import type { CommercialAction } from "@/data/schemas/chat";
import { behaviorAnalytics } from "@/lib/analytics";
import { MobileShell } from "@/app/_components/core";
@@ -250,6 +252,38 @@ export function ChatScreen() {
router.push(characterRoutes.privateZone);
}
function handleCommercialAction(action: CommercialAction): void {
behaviorAnalytics.elementClick(
"chat.commercial_action.open",
action.ctaLabel,
{
actionId: action.actionId,
actionType: action.type,
characterId: state.characterId,
ruleId: action.ruleId,
target: action.target,
},
);
router.push(
action.target === "giftCatalog"
? characterRoutes.tip
: characterRoutes.privateZone,
);
}
function handleCommercialActionDismiss(action: CommercialAction): void {
behaviorAnalytics.elementClick(
"chat.commercial_action.dismiss",
"Dismiss commercial action",
{
actionId: action.actionId,
actionType: action.type,
characterId: state.characterId,
ruleId: action.ruleId,
},
);
}
return (
<MobileShell>
<div
@@ -298,6 +332,8 @@ export function ChatScreen() {
onOpenImage={handleOpenImage}
onUserAvatarClick={handleOpenUserProfile}
onCharacterAvatarClick={handleOpenCharacterPrivateZone}
onCommercialAction={handleCommercialAction}
onCommercialActionDismiss={handleCommercialActionDismiss}
onLoadMoreHistory={() => {
chatDispatch({ type: "ChatLoadMoreHistoryRequested" });
}}