Loading...
;
+ *
+ * return (
+ *
+ *
Total Memories: {analytics.totalMemories}
+ *
Total Chats: {analytics.totalChats}
+ *
Total Searches: {analytics.totalSearches}
+ *
Avg Response Time: {analytics.avgResponseTime.toFixed(0)}ms
+ *
+ * );
+ * }
+ * ```
+ */
+export function useAnalytics(
+ containerTag: string | null,
+ componentPath: string = "supermemory"
+) {
+ const query = `${componentPath}:getAnalytics` as unknown as FunctionReference<"query">;
+ return useQuery(query, containerTag ? { containerTag } : "skip") as any | null | undefined;
+}
+
+/**
+ * Hook to get dashboard overview
+ *
+ * @param containerTag - User identifier
+ * @param componentPath - Path to the component (default: "supermemory")
+ *
+ * @example
+ * ```tsx
+ * function Dashboard({ userId }) {
+ * const overview = useDashboardOverview(userId);
+ *
+ * if (!overview) return Loading...
;
+ *
+ * return (
+ *
+ *
Analytics
+ *
Total Memories: {overview.analytics.totalMemories}
+ *
Total Chats: {overview.analytics.totalChats}
+ *
+ *
Recent Memories
+ * {overview.recentMemories.map(m =>
{m.content}
)}
+ *
+ *
Recent Sessions
+ * {overview.recentSessions.map(s => (
+ *
{s.messages.length} messages
+ * ))}
+ *
+ * );
+ * }
+ * ```
+ */
+export function useDashboardOverview(
+ containerTag: string | null,
+ componentPath: string = "supermemory"
+) {
+ const query = `${componentPath}:getDashboardOverview` as unknown as FunctionReference<"query">;
+ return useQuery(query, containerTag ? { containerTag } : "skip") as any | undefined;
+}
+
// Export all types
export type {
AddMemoryArgs,
diff --git a/packages/tools/src/convex-component/tsconfig.json b/packages/tools/src/convex-component/tsconfig.json
index e693db1e..d6f4b498 100644
--- a/packages/tools/src/convex-component/tsconfig.json
+++ b/packages/tools/src/convex-component/tsconfig.json
@@ -16,9 +16,8 @@
"types": ["react"],
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
- "isolatedModules": true,
- "noEmit": true
+ "isolatedModules": true
},
- "include": ["src/client/**/*", "src/react/**/*"],
+ "include": ["src/client/**/*", "src/react/**/*", "src/ai-sdk/**/*"],
"exclude": ["node_modules", "dist", "src/component"]
}