feat(chat): render commercial actions and persist greetings
Docker Image / Build and Push Docker Image (push) Successful in 1m56s
Docker Image / Build and Push Docker Image (push) Successful in 1m56s
This commit is contained in:
@@ -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" });
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user