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.

feat(onboarding): make plan cards clickable (#59229)

posthog[bot]438df58f0548
diff --git a/frontend/src/scenes/onboarding/billing/PlanCards.tsx b/frontend/src/scenes/onboarding/billing/PlanCards.tsx
index ed1c1a1cf48d..d5c759ca478b 100644
--- a/frontend/src/scenes/onboarding/billing/PlanCards.tsx
+++ b/frontend/src/scenes/onboarding/billing/PlanCards.tsx
@@ -87,20 +87,54 @@ export const PlanCard: React.FC<PlanCardProps> = ({ planData, product, highlight
const hogPositionClass = hogPosition === 'top-right' ? 'CheekyHogTopRight' : 'CheekyHogTopLeft'
+ const cardDisabled = planData.ctaAction === 'billing' && !!billingProductLoading
+
+ const activateCard = (): void => {
+ if (cardDisabled) {
+ return
+ }
+ if (planData.ctaAction === 'billing') {
+ startPaymentEntryFlow(product, window.location.pathname + window.location.search)
+ } else if (planData.ctaAction === 'next') {
+ reportOnboardingStepCompleted(OnboardingStepKey.PLANS)
+ goToNextStep()
+ }
+ }
+
+ const handleCardKeyDown = (event: React.KeyboardEvent<HTMLDivElement>): void => {
+ if (event.key === 'Enter' || event.key === ' ') {
+ event.preventDefault()
+ activateCard()
+ }
+ }
+
return (
<div className="relative" onMouseEnter={() => setIsHovering(true)} onMouseLeave={() => setIsHovering(false)}>
- <HeartHog
- width="100"
- height="100"
- className={clsx(
- hogPositionClass,
- isHovering === true && `${hogPositionClass}--peek`,
- isHovering === false && `${hogPositionClass}--hide`
- )}
- />
+ {!cardDisabled && (
+ <HeartHog
+ width="100"
+ height="100"
+ className={clsx(
+ hogPositionClass,
+ isHovering === true && `${hogPositionClass}--peek`,
+ isHovering === false && `${hogPositionClass}--hide`
+ )}
+ />
+ )}
<div
+ role="button"
+ tabIndex={0}
+ aria-label={`Select ${planData.title} plan`}
+ aria-disabled={cardDisabled || undefined}
+ onClick={activateCard}
+ onKeyDown={handleCardKeyDown}
+ data-attr={`plan-card-${planData.plan}`}
className={clsx(
- 'relative flex flex-col h-full p-6 bg-bg-light dark:bg-bg-depth rounded-xs border transition-transform transform hover:scale-[1.02] hover:shadow-lg',
+ 'relative flex flex-col h-full p-6 bg-bg-light dark:bg-bg-depth rounded-xs border transition-transform transform text-left',
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-active',
+ cardDisabled
+ ? 'cursor-wait opacity-80'
+ : 'cursor-pointer hover:scale-[1.02] hover:shadow-lg active:scale-[1.01]',
highlight ? 'border-2 border-accent-active' : 'border-gray-200 dark:border-gray-700'
)}
>
@@ -152,11 +186,13 @@ export const PlanCard: React.FC<PlanCardProps> = ({ planData, product, highlight
disabledReason={billingProductLoading && 'Please wait...'}
disableClientSideRouting
loading={!!billingProductLoading}
- onClick={() =>
+ onClick={(event) => {
+ event.stopPropagation()
startPaymentEntryFlow(product, window.location.pathname + window.location.search)
- }
+ }}
data-attr="onboarding-subscribe-button"
fullWidth
+ tabIndex={-1}
>
{planData.ctaText}
</BillingUpgradeCTA>
@@ -167,10 +203,12 @@ export const PlanCard: React.FC<PlanCardProps> = ({ planData, product, highlight
fullWidth
center
status={highlight ? 'alt' : undefined}
- onClick={() => {
+ onClick={(event) => {
+ event.stopPropagation()
reportOnboardingStepCompleted(OnboardingStepKey.PLANS)
goToNextStep()
}}
+ tabIndex={-1}
>
{planData.ctaText}
</LemonButton>
diff --git a/services/mcp/src/hono/mcp-server.ts b/services/mcp/src/hono/mcp-server.ts
index 78e53d40704c..41f5d5f277dd 100644
--- a/services/mcp/src/hono/mcp-server.ts
+++ b/services/mcp/src/hono/mcp-server.ts
@@ -24,14 +24,13 @@ import { StateManager } from '@/lib/StateManager'
import { formatPrompt, type McpMode } from '@/lib/utils'
import { registerPrompts } from '@/prompts'
import { registerResources } from '@/resources'
+import type { ContextMillResource } from '@/resources/manifest-types'
import { registerUiAppResources } from '@/resources/ui-apps'
import EXECUTE_SQL_PROMPT from '@/templates/execute-sql-prompt.md'
import { createExecInnerToolCallResolver, createExecTool, type ExecInnerCallTracker } from '@/tools/exec'
import { getToolDefinition } from '@/tools/toolDefinitions'
import { type Context, type Env, type State, type Tool } from '@/tools/types'
-import type { ContextMillResource } from '@/resources/manifest-types'
-
import { RedisCache, type RedisLike } from './cache/RedisCache'
import { getCustomApiBaseUrl, getEnv } from './constants'
import { initDurationSeconds, toolCallDurationSeconds, toolCallsTotal } from './metrics'
@@ -378,7 +377,8 @@ export class HonoMcpServer {
const _t0 = performance.now()
const _lap = (label: string): void => {
const elapsed = performance.now() - _t0
- console.log(`[init-profile] ${label.padEnd(40)} +${(elapsed).toFixed(0)}ms`)
+ // oxlint-disable-next-line no-console
+ console.log(`[init-profile] ${label.padEnd(40)} +${elapsed.toFixed(0)}ms`)
}
const { features, tools, version: clientVersion, organizationId, projectId, readOnly, mode } = this.props
@@ -689,10 +689,7 @@ export class HonoMcpServer {
return { useSingleExec, version }
}
- private async resolveTools(
- context: Context,
- options: ToolCatalogFilterOptions
- ): Promise<Tool<z.ZodObject>[]> {
+ private async resolveTools(context: Context, options: ToolCatalogFilterOptions): Promise<Tool<z.ZodObject>[]> {
if (this._warmup?.catalog.warmedUp) {
return this._warmup.catalog.getFilteredTools(options) as Tool<z.ZodObject>[]
}
diff --git a/services/mcp/tests/unit/tool-catalog.test.ts b/services/mcp/tests/unit/tool-catalog.test.ts
index 12c51feecd21..73af5e9e4c7a 100644
--- a/services/mcp/tests/unit/tool-catalog.test.ts
+++ b/services/mcp/tests/unit/tool-catalog.test.ts
@@ -1,9 +1,23 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { z } from 'zod'
+import { ToolCatalog } from '@/hono/tool-catalog'
import type { ToolBase, ZodObjectAny } from '@/tools/types'
-import { ToolCatalog, type ToolCatalogFilterOptions } from '@/hono/tool-catalog'
+type FakeDefinition = {
+ title: string
+ description: string
+ feature: string
+ category: string
+ required_scopes: string[]
+ annotations: {
+ destructiveHint: boolean
+ idempotentHint: boolean
+ openWorldHint: boolean
+ readOnlyHint: boolean
+ }
+ [key: string]: unknown
+}
function makeToolBase(name: string, overrides?: Partial<ToolBase<ZodObjectAny>>): ToolBase<ZodObjectAny> {
return {
@@ -14,7 +28,7 @@ function makeToolBase(name: string, overrides?: Partial<ToolBase<ZodObjectAny>>)
}
}
-const fakeDef = (overrides?: Record<string, unknown>) => ({
+const fakeDef = (overrides?: Record<string, unknown>): FakeDefinition => ({
title: 'Title',
description: 'Desc',
feature: 'general',
@@ -43,7 +57,7 @@ vi.mock('@/tools/generated', () => ({
},
}))
-const DEFINITIONS: Record<string, ReturnType<typeof fakeDef>> = {
+const DEFINITIONS: Record<string, FakeDefinition> = {
'tool-a': fakeDef({ required_scopes: ['project:read'] }),
'tool-b': fakeDef({ feature: 'insights', annotations: { ...fakeDef().annotations, readOnlyHint: true } }),
'gen-tool-c': fakeDef({ required_scopes: ['action:write'] }),
@@ -59,7 +73,14 @@ vi.mock('@/tools/toolDefinitions', () => ({
}
return def
},
- getToolsForFeatures: (options?: { features?: string[]; tools?: string[]; version?: number; readOnly?: boolean; aiConsentGiven?: boolean; featureFlags?: Record<string, boolean> }) => {
+ getToolsForFeatures: (options?: {
+ features?: string[]
+ tools?: string[]
+ version?: number
+ readOnly?: boolean
+ aiConsentGiven?: boolean
+ featureFlags?: Record<string, boolean>
+ }) => {
let names = Object.keys(DEFINITIONS)
if (options?.features?.length) {
names = names.filter((n) => {
@@ -168,7 +189,7 @@ describe('ToolCatalog', () => {
it('should merge title and description from definitions onto the tool', () => {
const tools = catalog.getFilteredTools({ scopes: ['project:read'] })
const toolA = tools.find((t) => t.name === 'tool-a')
- expect(toolA).toBeDefined()
+ expect(toolA).toBeTruthy()
expect(toolA!.title).toBe('Title')
expect(toolA!.description).toBe('Desc')
})
@@ -177,9 +198,7 @@ describe('ToolCatalog', () => {
const tools = catalog.getFilteredTools({ scopes: ['project:read'] })
const toolA = tools.find((t) => t.name === 'tool-a')
expect(toolA!.scopes).toEqual(['project:read'])
- expect(toolA!.annotations).toEqual(
- expect.objectContaining({ readOnlyHint: false })
- )
+ expect(toolA!.annotations).toEqual(expect.objectContaining({ readOnlyHint: false }))
})
it('should return empty array when catalog is not warmed up', () => {