diff --git a/packages/web/src/app/[domain]/components/homepage/askSourcebotDemoCards.tsx b/packages/web/src/app/[domain]/components/homepage/askSourcebotDemoCards.tsx
index fc8ef092..e8bb264c 100644
--- a/packages/web/src/app/[domain]/components/homepage/askSourcebotDemoCards.tsx
+++ b/packages/web/src/app/[domain]/components/homepage/askSourcebotDemoCards.tsx
@@ -9,6 +9,7 @@ import { ContextItem, RepoContextItem, SearchContextItem } from "@/features/chat
import { DemoExamples, DemoSearchExample, DemoSearchContextExample, DemoSearchContext } from "@/types";
import { cn, getCodeHostIcon } from "@/lib/utils";
import { RepositoryQuery, SearchContextQuery } from "@/lib/types";
+import useCaptureEvent from "@/hooks/useCaptureEvent";
interface AskSourcebotDemoCardsProps {
demoExamples: DemoExamples;
@@ -25,7 +26,14 @@ export const AskSourcebotDemoCards = ({
searchContexts,
repos,
}: AskSourcebotDemoCardsProps) => {
+ const captureEvent = useCaptureEvent();
+
const handleExampleClick = (example: DemoSearchExample) => {
+ captureEvent('wa_demo_search_example_card_pressed', {
+ exampleTitle: example.title,
+ exampleUrl: example.url || '',
+ });
+
if (example.url) {
window.open(example.url, '_blank');
}
@@ -63,6 +71,12 @@ export const AskSourcebotDemoCards = ({
return;
}
+ captureEvent('wa_demo_search_context_card_pressed', {
+ contextType: context.type,
+ contextName: context.value,
+ contextDisplayName: context.displayName,
+ });
+
const isDemoMode = process.env.NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT === "demo";
const isSelected = selectedItems.some((item) => item.value === context.value);
if (isSelected) {
@@ -109,112 +123,129 @@ export const AskSourcebotDemoCards = ({
}
return (
-
- {/* Search Context Row */}
-
-
-
-
-
Search Contexts
+ <>
+ {process.env.NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT === "demo" && (
+
+ Interested in using Sourcebot on your code? Check out our{' '}
+ captureEvent('wa_demo_docs_link_pressed', {})}
+ >
+ docs
+
+
+ )}
+
+
+ {/* Search Context Row */}
+
+
+
+
+
Search Contexts
+
+
Select the context you want to ask questions about
-
Select the context you want to ask questions about
-
-
- {demoExamples.searchContextExamples.map((contextExample) => {
- const context = demoExamples.searchContexts.find((context) => context.id === contextExample.searchContext)
- if (!context) {
- console.error(`Search context ${contextExample.searchContext} not found on handleContextClick`);
- return null;
- }
+
+ {demoExamples.searchContextExamples.map((contextExample) => {
+ const context = demoExamples.searchContexts.find((context) => context.id === contextExample.searchContext)
+ if (!context) {
+ console.error(`Search context ${contextExample.searchContext} not found on handleContextClick`);
+ return null;
+ }
- const isSelected = selectedItems.some(
- (selected) => (selected.type === 'context' && selected.value === context.value) ||
- (selected.type === 'repo' && selected.value === context.value)
- );
+ const isSelected = selectedItems.some(
+ (selected) => (selected.type === 'context' && selected.value === context.value) ||
+ (selected.type === 'repo' && selected.value === context.value)
+ );
- const searchContext = searchContexts.find((item) => item.name === context.value);
- const numRepos = searchContext ? searchContext.repoNames.length : undefined;
- return (
-
handleContextClick(demoExamples.searchContexts, contextExample)}
- >
-
-
-
- {getContextIcon(context)}
-
-
-
-
- {context.displayName}
-
- {numRepos && (
-
- {numRepos} repos
-
- )}
+ const searchContext = searchContexts.find((item) => item.name === context.value);
+ const numRepos = searchContext ? searchContext.repoNames.length : undefined;
+ return (
+
handleContextClick(demoExamples.searchContexts, contextExample)}
+ >
+
+
+
+ {getContextIcon(context)}
+
+
+
+
+ {context.displayName}
+
+ {numRepos && (
+
+ {numRepos} repos
+
+ )}
+
+
{contextExample.description}
-
{contextExample.description}
-
-
-
- )
- })}
-
-
-
- {/* Example Searches Row */}
-
-
-
-
-
Community Ask Results
+
+
+ )
+ })}
-
Check out these featured ask results from the community
-
- {demoExamples.searchExamples.map((example) => {
- const searchContexts = demoExamples.searchContexts.filter((context) => example.searchContext.includes(context.id))
- return (
-
handleExampleClick(example)}
- >
-
-
-
- {searchContexts.map((context) => (
-
- {getContextIcon(context, 12)}
- {context.displayName}
-
- ))}
+
+ {/* Example Searches Row */}
+
+
+
+
+
Community Ask Results
+
+
Check out these featured ask results from the community
+
+
+ {demoExamples.searchExamples.map((example) => {
+ const searchContexts = demoExamples.searchContexts.filter((context) => example.searchContext.includes(context.id))
+ return (
+
handleExampleClick(example)}
+ >
+
+
+
+ {searchContexts.map((context) => (
+
+ {getContextIcon(context, 12)}
+ {context.displayName}
+
+ ))}
+
+
+
+ {example.title}
+
+
+ {example.description}
+
+
-
-
- {example.title}
-
-
- {example.description}
-
-
-
-
-
- )
- })}
+
+
+ )
+ })}
+
-
+ >
);
};
\ No newline at end of file
diff --git a/packages/web/src/lib/posthogEvents.ts b/packages/web/src/lib/posthogEvents.ts
index 6637e51e..51d7680f 100644
--- a/packages/web/src/lib/posthogEvents.ts
+++ b/packages/web/src/lib/posthogEvents.ts
@@ -282,5 +282,16 @@ export type PosthogEventMap = {
chatId: string,
messageId: string,
},
+ //////////////////////////////////////////////////////////////////
+ wa_demo_docs_link_pressed: {},
+ wa_demo_search_context_card_pressed: {
+ contextType: string,
+ contextName: string,
+ contextDisplayName: string,
+ },
+ wa_demo_search_example_card_pressed: {
+ exampleTitle: string,
+ exampleUrl: string,
+ },
}
export type PosthogEvent = keyof PosthogEventMap;
\ No newline at end of file