Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(mcp): add storybook story for the insight actors view (#64317)

Georgis Andonis82e00f3920d6
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index a4e5d8647fa7..7a2f97dc1176 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -4040,6 +4040,10 @@ snapshots:
hash: v1.k794b7964.cc26937830dc95deb164b13bda7327a6a7bed094f2670332b6ea0885ffb15733.j8pxbf3h92E8pkD9KCSQrlBeFY3UUEmF7E_6XJg47kQ
mcp-apps-funnels--three-step--light:
hash: v1.k794b7964.a4cf6cff88ffb74e40e2dbe91cc266054f699eeae2d39d40019f3ed184ba030e.g12F2_uMZw3-VDO3TX1BqQu01X5UDRFTag0fO0WcrTc
+ mcp-apps-insight-actors--event-counts--light:
+ hash: v1.k794b7964.f3ff99b4ec1920b2df7c65cb407482896b99b2ea34d4bfbb4cad722b05d25f9a.6K2QCgM8Znsuz_zMA2jTZW884aJ29-cvc1OWldMEzgc
+ mcp-apps-insight-actors--with-recordings--light:
+ hash: v1.k794b7964.af9ec36dd0d406f45eec2bf3fafb8dbe63b0eba139c5fff4b33e83cf24668f8e.hQ3brX3MIHwfCM95Re7Ti6Z8bsY2zq-He2uM63uuvUw
mcp-apps-lifecycle--grouped--light:
hash: v1.k794b7964.fa32f317c7015ae73b5b5c38e11209e6a51967de4e0457ae29f7eedb8ea8fce8._OUjY62EdIDs4LQbOyr1ORBmTYMn9AZ5BHWC9e4Bx5c
mcp-apps-lifecycle--stacked--light:
diff --git a/products/product_analytics/mcp/apps/InsightActorsView.stories.tsx b/products/product_analytics/mcp/apps/InsightActorsView.stories.tsx
new file mode 100644
index 000000000000..8320cea32a3f
--- /dev/null
+++ b/products/product_analytics/mcp/apps/InsightActorsView.stories.tsx
@@ -0,0 +1,71 @@
+import type { Meta, StoryObj } from '@storybook/react'
+
+import { McpThemeDecorator } from '@posthog/mcp-ui/storybook/decorator'
+
+import { InsightActorsView, type InsightActorsData } from './InsightActorsView'
+
+const meta: Meta = {
+ title: 'MCP Apps/Insight Actors',
+ decorators: [McpThemeDecorator],
+ parameters: {
+ testOptions: {
+ // McpThemeDecorator has no dark mode, so skip it to avoid duplicated snapshots.
+ skipDarkMode: true,
+ },
+ },
+}
+export default meta
+
+type Story = StoryObj<{}>
+
+const openLink = (url: string): void => {
+ window.open(url, '_blank')
+}
+
+// `results` is the flattened actors table: `[distinct_id, email, name, event_count]`, plus a
+// `recordings` column (string[] of replay URLs) when the source requested matched recordings.
+const withEventCounts: InsightActorsData = {
+ query: { kind: 'ActorsQuery', source: { kind: 'InsightActorsQuery', source: { kind: 'TrendsQuery' } } },
+ results: {
+ columns: ['distinct_id', 'email', 'name', 'event_count'],
+ results: [
+ ['0a1b2c3d', '[email protected]', 'Alice Adams', 128],
+ ['1c2d3e4f', '[email protected]', 'Ben Brown', 73],
+ ['2e3f4a5b', null, null, 51],
+ ['3f4a5b6c', '[email protected]', 'Cara Cohen', 22],
+ ['4a5b6c7d', null, null, 9],
+ ],
+ },
+ hasMore: false,
+ offset: 0,
+}
+
+const withRecordings: InsightActorsData = {
+ query: { kind: 'ActorsQuery', source: { kind: 'InsightActorsQuery', source: { kind: 'TrendsQuery' } } },
+ results: {
+ columns: ['distinct_id', 'email', 'name', 'event_count', 'recordings'],
+ results: [
+ [
+ '0a1b2c3d',
+ 'Alice Adams',
+ 128,
+ ['https://us.posthog.com/replay/aaa', 'https://us.posthog.com/replay/bbb'],
+ ],
+ ['1c2d3e4f', '[email protected]', 'Ben Brown', 73, ['https://us.posthog.com/replay/ccc']],
+ ['2e3f4a5b', null, null, 51, []],
+ ],
+ },
+ hasMore: true,
+ offset: 0,
+}
+
+export const EventCounts: Story = {
+ render: () => <InsightActorsView data={withEventCounts} openLink={openLink} />,
+ name: 'Event counts',
+}
+
+export const WithRecordings: Story = {
+ render: () => <InsightActorsView data={withRecordings} openLink={openLink} />,
+ name: 'With recordings',
+}