Skip to content

Commit 6dbdcde

Browse files
more events
1 parent 524e1cc commit 6dbdcde

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

packages/web/src/app/[domain]/chat/components/chatSidePanel.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { ScrollArea } from "@/components/ui/scroll-area";
88
import { Separator } from "@/components/ui/separator";
99
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
1010
import { deleteChat, duplicateChat, updateChatName } from "@/features/chat/actions";
11+
import { captureEvent } from "@/hooks/useCaptureEvent";
1112
import { cn, isServiceError } from "@/lib/utils";
1213
import { CirclePlusIcon, EllipsisIcon } from "lucide-react";
1314
import { ChatActionsDropdown } from "./chatActionsDropdown";
@@ -85,6 +86,7 @@ export const ChatSidePanel = ({
8586
toast({
8687
description: `✅ Chat renamed successfully`
8788
});
89+
captureEvent('wa_chat_renamed', { chatId });
8890
router.refresh();
8991
return true;
9092
}
@@ -106,6 +108,7 @@ export const ChatSidePanel = ({
106108
toast({
107109
description: `✅ Chat deleted successfully`
108110
});
111+
captureEvent('wa_chat_deleted', { chatId: chatIdToDelete });
109112

110113
// If we just deleted the current chat, navigate to new chat
111114
if (chatIdToDelete === chatId) {
@@ -133,6 +136,7 @@ export const ChatSidePanel = ({
133136
toast({
134137
description: `✅ Chat duplicated successfully`
135138
});
139+
captureEvent('wa_chat_duplicated', { chatId: chatIdToDuplicate });
136140
router.push(`/${SINGLE_TENANT_ORG_DOMAIN}/chat/${response.id}`);
137141
return response.id;
138142
}

packages/web/src/features/chat/components/chatThread/chatThread.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,10 @@ export const ChatThread = ({
318318
return null;
319319
}
320320

321+
captureEvent('wa_chat_duplicated', { chatId: defaultChatId });
321322
router.push(`/${params.domain}/chat/${result.id}`);
322323
return result.id;
323-
}, [defaultChatId, toast, router, params.domain]);
324+
}, [defaultChatId, toast, router, params.domain, captureEvent]);
324325

325326
return (
326327
<>

packages/web/src/lib/posthogEvents.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,15 @@ export type PosthogEventMap = {
196196
wa_anonymous_chats_claimed: {
197197
claimedCount: number,
198198
},
199+
wa_chat_duplicated: {
200+
chatId: string,
201+
},
202+
wa_chat_renamed: {
203+
chatId: string,
204+
},
205+
wa_chat_deleted: {
206+
chatId: string,
207+
},
199208
//////////////////////////////////////////////////////////////////
200209
wa_demo_docs_link_pressed: {},
201210
wa_demo_search_example_card_pressed: {

0 commit comments

Comments
 (0)