: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat: add setup empty states for flags, experiments, and more products (#74452)
Rafael Audibert84ec6939d58a
diff --git a/.agents/skills/building-product-empty-states/SKILL.md b/.agents/skills/building-product-empty-states/SKILL.mdindex 19185c6cdf8c..6dda49ee7e5c 100644--- a/.agents/skills/building-product-empty-states/SKILL.md+++ b/.agents/skills/building-product-empty-states/SKILL.md@@ -15,7 +15,7 @@ Before a user has set a product up, its scene should show a setup empty state: t2. The gate mounts the product's **detection logic**, which pushes a normalized status into `productSetupStatusLogic({ productKey })` — the app-wide single read point for "is product X set up?".3. The gate renders the setup empty state for `needs-setup` / `waiting-for-data`, and the scene untouched for `has-data`. While `loading` it shows the standard scene-level spinner — the one shared loading treatment. **Never add a product-specific loading fallback.**4. Statuses are **preloaded at app boot**: `productSetupPreloadLogic` (mounted in `App.tsx`) answers every manifest-declared probe (each product's `setupProbe`, aggregated into `productSetupProbes`) with one combined event-count query on idle, so by the time a user opens the scene the status is usually already known and the spinner never shows. The product's in-scene detection stays the fresher source of truth.-5. Users can always **skip**. Skip is local-only (localStorage, keyed team + product, never backend-persisted); detection keeps polling, and a slim "Set up" banner stays visible until data lands.+5. Users can **skip** by default. Skip is local-only (localStorage, keyed team + product, never backend-persisted); detection keeps polling, and a slim "Set up" banner stays visible until data lands. Creation-first products whose gated scene is just an empty list can set `skippable: false` on the config to drop the escape hatch — the primary action is the only next step anyway.## Adoption steps@@ -49,7 +49,8 @@ Statuses: `loading` (not yet known - the gate holds a spinner, never flashes the`products/<product>/frontend/emptyState/<product>EmptyState.tsx` exports a `SceneProductEmptyState` (see `lib/components/ProductEmptyState/types.ts` for every field). Reference: `products/mcp_analytics/frontend/emptyState/mcpAnalyticsEmptyState.tsx`. Notes:- **Accent**: use the product's `--color-product-<name>-light`/`-dark` token (`frontend/src/styles/base.scss`). If your product has none, add one there (get the color from design) rather than hardcoding a hex.-- **Wizard vs primary action**: SDK-installed products set `wizard: { slug }` (the slug must exist in `@posthog/wizard`); creation-first products (flags, surveys) set `primaryAction` instead. Self-hosted degrades automatically: no cloud → the terminal hides and the manual path is promoted.+- **Wizard vs primary action**: SDK-installed products set `wizard: { slug }` (the slug must exist in `@posthog/wizard`); creation-first products (flags, surveys) set `primaryAction` instead. Self-hosted degrades automatically: no cloud → the terminal hides and the manual path is promoted. If the create action needs hooks (e.g. it opens PostHog AI via `useMaxTool`, like user research's "New topic"), provide a `PrimaryAction` component instead of `primaryAction` - it renders in the same slot and takes precedence.+- **Permissions and selectors on the primary action**: set `primaryAction.accessControl` to the same resource type and level the gated scene's own create button uses. Without it a viewer gets an enabled button and only learns they can't create when the form fails to save. Set `primaryAction.dataAttr` to the attr that scene button carries, so an end-to-end spec keeps one selector whether it lands on the scene or the empty state. A `PrimaryAction` component wraps its own `AccessControlAction`.- **`featureFlag`**: set it when the scene is already flag-gated (so the scene's own gate keeps handling flag-off) or to roll the empty state out gradually.- **Hedgehog**: a `pngHoggie(...)`-wrapped module — import only inside the product chunk (eager-graph guard: `frontend/bin/check-eager-graph.mjs`). Never hardcode image URLs (e.g. Cloudinary) — `@posthog/brand` assets only.- **`text` is keyed by mode**: provide the `needs-setup` base; add a `waiting-for-data` entry only if your product has that middle state (missing fields fall back to the base). Sentence case, benefit-first, no AI tells (see "User-facing copy" in `CLAUDE.md`).@@ -57,9 +58,18 @@ Statuses: `loading` (not yet known - the gate holds a spinner, never flashes the### 3. Build the signature preview-`Preview` is the right-hand widget: the product's most recognizable UI, populated with **static, realistic fake data** (label it "example data"). Reference: `products/mcp_analytics/frontend/emptyState/MCPToolCallPreview.tsx`.+`Preview` is the right-hand widget: the product's most recognizable UI, populated with **static, realistic fake data** (label it "example data"). References: `products/mcp_analytics/frontend/emptyState/MCPToolCallPreview.tsx`, `products/feature_flags/frontend/emptyState/FeatureFlagPreview.tsx`, `products/experiments/frontend/emptyState/ExperimentPreview.tsx`.-- The shared layout renders it vertically centered on a darker full-height panel — the preview itself must **never scroll or loop**; a handful of static rows is the whole job. Style with tailwind; any motion is CSS only (no `setInterval`, no computed timestamps) with `motion-reduce:` variants for reduced motion.+This is not a flat mock - the bar is "fun and involved", and the references set it:++- **Layer 2-3 small cards** that tell one story together (a list + the mini app it drives + a stat card with a chart), not a single panel of rows.+- **One real interaction with a visible payoff.** Drive it with a hidden checkbox/radio and `:checked ~` styles - clicking a flag row flips a mini app's UI and steps a conversion chart up at a "Released" marker; picking a variant highlights its interval and re-skins the app. No React state, no JS timers (`setInterval` is banned; CSS keyframes only).+- **Ambient motion so it feels alive at rest:** a trace segment cycling along a sparkline, a pulsing "Running" dot - subtle and continuous. Do **not** auto-toggle the interactive state on a loop - a UI that flips itself reads as broken, not alive; the user flips it, ambient motion does the rest.+- **No layout shift on state change:** stack on/off variants in one grid cell and crossfade opacity; never swap `display` or animate heights for state text.+- **Never paint text in the raw product accent.** Those tokens are sidebar icon tints; on the light surface most land under the 4.5:1 AA floor as text. Use `@include preview-accent-text(var(--<x>-preview-accent))` for every `color:` declaration and keep the raw accent for fills, borders, and strokes.+- **Crossfade with the `preview-swap-hidden` / `preview-swap-visible` mixins** (`lib/components/ProductEmptyState/_previewMixins.scss`), never bare `opacity`. Opacity alone leaves the hidden half in the accessibility tree and the tab order, so a screen reader announces both states at once and a keyboard user can land on an invisible button. The mixins add `visibility` on a delay, which keeps the fade and costs no layout shift.+- The hidden input stays keyboard-focusable, so the row it labels needs a `:focus-visible` outline (WCAG 2.4.7).+- The preview must **never scroll**; guard all animation with `prefers-reduced-motion` and an `inStorybook()`-driven static class so visual-regression snapshots stay stable.- Honor the `mode` prop: `waiting-for-data` should read as "listening" (e.g. a pinned spinner row).### 4. Declare it on the scenediff --git a/.github/workflows/ci-frontend.yml b/.github/workflows/ci-frontend.ymlindex 6c9c517335fe..b42cbec01029 100644--- a/.github/workflows/ci-frontend.yml+++ b/.github/workflows/ci-frontend.yml@@ -355,6 +355,12 @@ jobs:- name: Lint with Stylelintrun: pnpm run lint:css+ # Product colour tokens are named as plain strings from TypeScript manifests and+ # empty-state configs, so nothing type-checks them. A reference to a token that no+ # longer exists renders a whole surface colourless without failing anything else.+ - name: Check product colour tokens all resolve+ run: pnpm --filter=@posthog/frontend check-color-tokens+- name: Lint with Oxlintrun: pnpm exec oxlint --quietdiff --git a/frontend/bin/check-color-tokens.mjs b/frontend/bin/check-color-tokens.mjsnew file mode 100644index 000000000000..af1e6a285d07--- /dev/null+++ b/frontend/bin/check-color-tokens.mjs@@ -0,0 +1,106 @@+#!/usr/bin/env node+/**+ * Fails when a `--color-product-*` custom property is referenced but never defined.+ *+ * These tokens are the one colour family named as plain strings from TypeScript, in product+ * manifests and empty-state configs, so nothing type-checks them. A reference to a token that+ * does not exist fails silently and completely: an undefined custom property makes every+ * `color-mix()` reading it invalid at computed-value time, so the browser drops those+ * declarations rather than falling back, and a whole surface renders with no colour.+ *+ * Also fails on a token defined but referenced nowhere, usually a rename left half done.+ *+ * Usage: node frontend/bin/check-color-tokens.mjs+ */+import fs from 'node:fs'+import path from 'node:path'+import { fileURLToPath } from 'node:url'++const REPO_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..')+const TOKEN = /--color-product-[a-z0-9-]+/g+const DEFINITION = /(--color-product-[a-z0-9-]+)\s*:/g++// Roots to scan. Definitions may live in any app stylesheet, so the definition scan stays broad:+// moving the token block out of base.scss must not turn into a wave of false failures.+const DEFINITION_ROOTS = ['frontend/src/styles']+const DEFINITION_EXTS = ['.scss', '.css']+const REFERENCE_ROOTS = ['frontend/src', 'products']+const REFERENCE_EXTS = ['.ts', '.tsx', '.scss', '.css']+// Generated from the manifests, so a finding here is always a duplicate of the manifest's own.+// The desktop app is a separate workspace with its own tokens.+const IGNORED = ['frontend/src/products.tsx']+const IGNORED_DIRS = new Set(['node_modules', 'dist', 'generated', 'desktop', '.turbo'])++function walk(dir, exts, out = []) {+ const abs = path.join(REPO_ROOT, dir)+ if (!fs.existsSync(abs)) {+ return out+ }+ for (const entry of fs.readdirSync(abs, { withFileTypes: true })) {+ const rel = path.join(dir, entry.name)+ if (entry.isDirectory()) {+ if (!IGNORED_DIRS.has(entry.name)) {+ walk(rel, exts, out)+ }+ } else if (exts.includes(path.extname(entry.name)) && !IGNORED.includes(rel)) {+ out.push(rel)+ }+ }+ return out+}++const filesFor = (roots, exts) => roots.flatMap((r) => walk(r, exts))++const defined = new Set()+for (const file of filesFor(DEFINITION_ROOTS, DEFINITION_EXTS)) {+ const src = fs.readFileSync(path.join(REPO_ROOT, file), 'utf8')+ for (const [, token] of src.matchAll(DEFINITION)) {+ defined.add(token)+ }+}++/** token -> the files that reference it */+const referenced = new Map()+for (const file of filesFor(REFERENCE_ROOTS, REFERENCE_EXTS)) {+ const src = fs.readFileSync(path.join(REPO_ROOT, file), 'utf8')+ for (const match of src.matchAll(TOKEN)) {+ // A definition is a reference to itself; skip so a stylesheet doesn't self-satisfy.+ if (src.slice(match.index + match[0].length).startsWith(':')) {+ continue+ }+ if (!referenced.has(match[0])) {+ referenced.set(match[0], new Set())+ }+ referenced.get(match[0]).add(file)+ }+}++const dangling = [...referenced.keys()].filter((t) => !defined.has(t)).sort()+const unused = [...defined].filter((t) => !referenced.has(t)).sort()++console.info(`${defined.size} product colour tokens defined, ${referenced.size} referenced`)++if (dangling.length) {+ console.error(`\n${dangling.length} token(s) referenced but never defined:`)+ for (const token of dangling) {+ console.error(` ${token}`)+ for (const file of [...referenced.get(token)].sort()) {+ console.error(` ${file}`)+ }+ }+ console.error('\nDefine them in frontend/src/styles/base.scss, or drop the reference.')+}++if (unused.length) {+ console.error(`\n${unused.length} token(s) defined but referenced nowhere:`)+ for (const token of unused) {+ console.error(` ${token}`)+ }+ console.error('\nReference them, or remove them from frontend/src/styles/base.scss.')+}++const failed = dangling.length > 0 || unused.length > 0+if (!failed) {+ console.info('No dangling or unused product colour tokens.')+}+process.exit(failed ? 1 : 0)diff --git a/frontend/package.json b/frontend/package.jsonindex 63a109857456..442c1f3ce0ac 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -46,6 +46,7 @@"fix": "pnpm lint:fix; s=$?; pnpm format && exit $s","visualize-toolbar-bundle": "pnpm exec esbuild-visualizer --metadata ./toolbar-esbuild-meta.json --filename=toolbar-esbuild-bundle-visualization.html","check-toolbar-csp-eval": "node ./bin/check-toolbar-csp-eval.mjs",+ "check-color-tokens": "node ./bin/check-color-tokens.mjs","check-toolbar-graph": "node ./bin/check-toolbar-graph.mjs","check-toolbar-size": "node ./bin/check-toolbar-size.mjs","start-vite": "pnpm build:products && concurrently --kill-others-on-fail -n VITE,TOOLBAR,WORKERS -c green,magenta,cyan \"vite --host 0.0.0.0\" \"pnpm watch:toolbar\" \"pnpm watch:workers\"",@@ -91,6 +92,7 @@"@posthog/products-billing-alerts": "workspace:*","@posthog/products-business-knowledge": "workspace:*","@posthog/products-canvas": "workspace:*",+ "@posthog/products-cdp": "workspace:*","@posthog/products-cohorts": "workspace:*","@posthog/products-conversations": "workspace:*","@posthog/products-customer-analytics": "workspace:*",@@ -124,6 +126,7 @@"@posthog/products-platform-features": "workspace:*","@posthog/products-posthog-ai": "workspace:*","@posthog/products-product-analytics": "workspace:*",+ "@posthog/products-product-tours": "workspace:*","@posthog/products-pulse": "workspace:*","@posthog/products-replay": "workspace:*","@posthog/products-replay-vision": "workspace:*",diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex d6131e72a14f..b4e42b580ad4 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -1712,6 +1712,10 @@ snapshots:hash: v1.k794b7964.f10735d00b8b7484f071fdcaebec654ef0042bf7894e374cbe077acb88d1de1f.DVP2UF6lwJvd5PyN12NBZIhS9EOv5z-N0T-aYKrAONwcomponents-product-empty-state--ai-observability-needs-setup--light:hash: v1.k794b7964.356081f2e978bf91130ebf0aa39fdc921a169780d2c3b9e289191d40dc73f6f1.nOlwt03p_7y2o0g2xV7835qBylZDe7uIdPxowxXI8mA+ components-product-empty-state--early-access-features-needs-setup--dark:+ hash: v1.k794b7964.ce612c03290780c1098886d9e2e0f9d920bfa899c591fadfecabf969b1897fe6.RlwNrGim39bhZH0hO39-bt6bWPUPJU-5XgIq2smDxSk+ components-product-empty-state--early-access-features-needs-setup--light:+ hash: v1.k794b7964.563633a4174e6b82faff11a7d2c874fb50a28882f4b4657fdcab70cdb88b479f.mEBCqNYE4cD9VvOJqQs8Z50S9eRIL1HOnu9MNHbIoPQcomponents-product-empty-state--empty-no-action--dark:hash: v1.k794b7964.01f56e9e0d751a5c0fd6cd2adee993fd8d3b1edce8c3db666da93336ca655590.zbVyer02lJY_tFXGrLIB2hZO_hwO2JxrCpe-IqphV4Ucomponents-product-empty-state--empty-no-action--light:@@ -1720,6 +1724,18 @@ snapshots:hash: v1.k794b7964.6fb2d5feff1fa62c3ed888268602b4eb017f75d33178538542ee4a6d28072fc3.6uOkXnAq1kHhkU8QtOWmFY2eJik3PqRUQegVam-OCGIcomponents-product-empty-state--empty-with-action--light:hash: v1.k794b7964.80a94ce3b72b30fc78f17c3df97f60b02513da190f16b10b785ddc6410e29610.LI50ALV6r5CTuWZhpD9jAdNFn5t82tuAdtAuP0FZw7o+ components-product-empty-state--endpoints-needs-setup--dark:+ hash: v1.k794b7964.31d843c9f5b5474e95f2f3cba65e0eaccd633a550a117e7b00843faca66897a8.2Zjm-wMj9BWhNxwccN3ziu3_bwNd8wBCSWMgTevhMQQ+ components-product-empty-state--endpoints-needs-setup--light:+ hash: v1.k794b7964.f704e98aa8d0102c164b7db7390449584c4b84f461cc5bbeac426e48a16dc200.S0QeUPtO_6LQsU5lZ09MyJMaf_Q_CPBBuYbvKzik1cU+ components-product-empty-state--experiments-needs-setup--dark:+ hash: v1.k794b7964.4963f41af44c16dbfdacc188339ff9c4f5ca4aada2f5848ad4f195b52c1cc81d.SiIn79B-XFAK4ZwxeLxdLgGNGPbtraECPD_tfCokLdg+ components-product-empty-state--experiments-needs-setup--light:+ hash: v1.k794b7964.8f49c9ae20266a0dcb99c84dc3db2b58b2b5e10047b885a53f738e1553e9a4f7.xopRCDiMsqJY5Sq6k0CIJM0ZTvXD7eN3xHbRN64Tpow+ components-product-empty-state--feature-flags-needs-setup--dark:+ hash: v1.k794b7964.75f63a26a820ea1d1261897b278f1cbe04c46ba50431f7b0b087803000a73591.xzu_boakPi1km0kgLmyNk5EuD4YG0CdPl6LYEiJjp8I+ components-product-empty-state--feature-flags-needs-setup--light:+ hash: v1.k794b7964.34d494ddf930bbfa26d1233de53e3ecbb2abd594f02e6320efdc170b55bfb858.MdeFEd9dR9MxST9SByounoWeAdLp4nhfKm-sS3Xln7Acomponents-product-empty-state--hog-layout-responsive--dark:hash: v1.k794b7964.8c137beea63f1365924e6f66a2d70092161a78859f5de68c0f01fbaa8ece1cdb.Cc2QUvwJ0APGb2C7S5ETG1EfPK0rUmD5RiypJLrfX2ccomponents-product-empty-state--hog-layout-responsive--light:@@ -1728,6 +1744,14 @@ snapshots:hash: v1.k794b7964.1a7835b12a48c2b04c7a3bb1731c2582b45ec28a3042827ad9ff7fcee708e44c.1jIs0ZfSBza47nPWDk_DLIkvW9tlcFpvEonyVU_5FVscomponents-product-empty-state--hog-layout-responsive-with-main-content-container-queries--light:hash: v1.k794b7964.21032c000615555ecc02b4546fc2425c677f06c451b6b8d10307c4ec89faf6a0.1ZPt3gD7fOiCI28QnBWuHfoBz6EhHsDtdHBWv04lQMg+ components-product-empty-state--links-needs-setup--dark:+ hash: v1.k794b7964.3df0b39f119f7cee6e28da77d891d7655fca655d37661ab474b42fa24cef4aff.UE2nzteHycjHQatlhLj9NbarufB0DYf-rOuFf3J4DZ8+ components-product-empty-state--links-needs-setup--light:+ hash: v1.k794b7964.b183161da12461f01783c1f14501d0a1c14a964d891e6380a8e002115e58f3e2.TPHWkv5zEqn4Fg-H2SUPRRJrHVyMlXLPtJrpdvfinuM+ components-product-empty-state--llm-prompts-needs-setup--dark:+ hash: v1.k794b7964.185b4c941d3476e16eb8b80411bf3f7da1cb663b74388a4ede2aafeb6a2790f3.-WUfqEIfvblTzH2_907USJIjLuKBmE1An_uf_0Avw7w+ components-product-empty-state--llm-prompts-needs-setup--light:+ hash: v1.k794b7964.f1455829166714291d8024cd356da16409421f025bdab9345f1d52563d92fe2b.60AARTvAq_U7Kb1gH-DnkTk9ypxPM8g1JT4VCLtuTvocomponents-product-empty-state--mcp-analytics-needs-setup--dark:hash: v1.k794b7964.96b74daaa8de6ae7205da58c89dc6fcc7abc783d43d1dfe552dcd173da06de8c.zf0X-77OyUQSa8ryOwocWYWnsltAEccWd3hjH7t6WzEcomponents-product-empty-state--mcp-analytics-needs-setup--light:@@ -1748,6 +1772,30 @@ snapshots:hash: v1.k794b7964.6fb2d5feff1fa62c3ed888268602b4eb017f75d33178538542ee4a6d28072fc3.tHRCmCQubhMPmffxXOGXE0jpd1kSvcnGMay-GOjl-J0components-product-empty-state--product-introduction--light:hash: v1.k794b7964.80a94ce3b72b30fc78f17c3df97f60b02513da190f16b10b785ddc6410e29610.4XhHHGq7prdUMyvvHE7cOA3EgP4Ia_lrdFQCDxvt470+ components-product-empty-state--product-tours-needs-setup--dark:+ hash: v1.k794b7964.ba387f94bf7380934a79b9a58f19d27dbe5561163315728c3a2d813a747757f0.XpF43f3StaHvZq-5TpAo3Uw5ABra8ikrJrLcMaCFqlM+ components-product-empty-state--product-tours-needs-setup--light:+ hash: v1.k794b7964.bcb7662c9b7c8b359951611d5d8c707b752df3cf4b51d4b55db0031a895fbb1d.LLNYGfrenmzwrDMW0v_HX5rZG8y7Zh-H_GoHbWDymRU+ components-product-empty-state--skills-needs-setup--dark:+ hash: v1.k794b7964.7fb1bfe531cab39785cf3d98edc3fed01122cbe04f2fc10b23054648455ed423.VhFzyJUt9ckAydjv1P6BL83AKLhlKl3NRrb5fL1o2M8+ components-product-empty-state--skills-needs-setup--light:+ hash: v1.k794b7964.6190af5d97300186be7d9edec9bb4139d2681ba6cfcb04961dca1f97d46181e2.puC3H-Nh82vaTwg0DxFehnS9abgqDzd_PW0XOv0QRGo+ components-product-empty-state--support-needs-setup--dark:+ hash: v1.k794b7964.5f6d75f3dccda00b4931407c41fc8a2a3d11bbe477f53b938862867f9d96baad.sdnyT_ZwGyHUuOxOrOCN4oWyqPKe1dZ-iJN8f42ulAs+ components-product-empty-state--support-needs-setup--light:+ hash: v1.k794b7964.0fc3c0efdc434d5d7f2b755a5952967363f9829e8cc443d665f783a712161bbf.BJ2PT-Ivzu8CtPgGaxVmj2ZdP7iZ4Ev2iipLIO_x9l4+ components-product-empty-state--support-waiting-for-data--dark:+ hash: v1.k794b7964.369d8902d1857ba89bc0995bbf90de39a2664d4c0ad9d7457b2c6c2972c65865.Q3OsOnoxbBawKNFS75yyCxSY3RTWKLXvDelOZhZQ6BE+ components-product-empty-state--support-waiting-for-data--light:+ hash: v1.k794b7964.81466638b2ad508f29fb15596fe41e493559cb42d140fc9a0631a5beb52a90af.eTpjSWKyf2FL3SoGdY-EGFLGwLo407-BlQiMsILXDkc+ components-product-empty-state--user-interviews-needs-setup--dark:+ hash: v1.k794b7964.5834b5549690d205c2ec9d9b9765f392eeba757749a0cf243c810311f3733079.Ju4u90HdGqU4tcIDHMsmpInKHheBwMYRvpYnd8oGa30+ components-product-empty-state--user-interviews-needs-setup--light:+ hash: v1.k794b7964.81ae25179c9ae9329dcea53365c7be8f78633d34b7979929cb0066586148a642.5Rr7HaxoZaoD8RyCEH0ysbldkUQ68Ws3HXBgXCNZMMQ+ components-product-empty-state--web-scripts-needs-setup--dark:+ hash: v1.k794b7964.bc46449177ab847f94c92990d63d818c36eee7c688fc4c694469bb4ffad13e99.YN8yq4k0SgUx8yRoP6iyXigFMsObNSJMRXij34vvvu0+ components-product-empty-state--web-scripts-needs-setup--light:+ hash: v1.k794b7964.d70b7bb0fd575b82e9fd19678205c7a6d54fbaf7301b7670494f07f198a46253.upjEetjILtgCy80wRPMBvXc8e2v_85QawiUUX_zQfWIcomponents-productsetup-productsetuppopover--default--dark:hash: v1.k794b7964.8577f1ec7bdb47266c031df353e220d017de2e86125924d5da8b0f052c6ce1a6.cA5-fWqyOm-PbSjy7Y8JZ4rQXAe7hn0soi6VkQ36dfccomponents-productsetup-productsetuppopover--default--light:@@ -5469,9 +5517,9 @@ snapshots:scenes-app-ai-observability-conversation-display--tools--light:hash: v1.k794b7964.cc6f7770155f4b720ff0597c3dd5deff699a267cfbdd8fe76a131cb51740215d.lKCAOsQBSoBkK46EHSYdGmWxAi4CQ4wUrx2J1iRF_f0scenes-app-ai-observability-prompts--empty-state--dark:- hash: v1.k794b7964.c8d83f25e82f659e199c0514b7eab4a0b1dab1e7a6a1c4e1de97a162a007b9f0.iR50GK7W2Ghw5_0tV7K5HMTfGuVyUSWQfYO-waZI_SA+ hash: v1.k794b7964.34208d6347c35d9f570e8d107d47e7360aeed280aa1c87c92d25d25182ddeda5.JGg5hNoklZduz1RmWxJIGvp-ZKpgVuWio9YDjjPtGYUscenes-app-ai-observability-prompts--empty-state--light:- hash: v1.k794b7964.83bb6355d1386b5957fb43acb45e48d351e3adea9c71f47a67eeedb0ce1949a1.T0OWcSem5zhD85QUMGVmdYHwJPtpYOZV3Epg8teUqlc+ hash: v1.k794b7964.64a6e9006f841a6c27200106641dfc87491ce930e16ce2c5f497469c9cd17122.nn8vXWGpzer8IhiYhDpGyMJOEEvKDDO6KUkK6YUawV8scenes-app-ai-observability-prompts--prompts-list--dark:hash: v1.k794b7964.5cdaae6b72efa77261704903c3b14197bd4996f9db290718a4a585758aaa6cf2.xbF6ujFL2OI5SqKxuBM4wYp4MT4t2IC_HjI5-9mkT4cscenes-app-ai-observability-prompts--prompts-list--light:@@ -6217,9 +6265,9 @@ snapshots:scenes-app-experiments--experiment-with-ratio-metric--light:hash: v1.k794b7964.91c6e783430aee352949d4114d9569d79ab235721c972946f1c040ea919abbf2.dHbCWm1FRc5TK-czma65fdJHYwXE4LPGIz4U5xiYZPkscenes-app-experiments--experiments--dark:- hash: v1.k794b7964.bb7a67466cb94c2155158d13444e7f6f473d8176c5823908c467b2d19c0f3ac9.uPI1H-JnVAqnEUTczdLstoglvGWvSOBV5k4w-FXpLWc+ hash: v1.k794b7964.70b099ab31a4d95201bec15b209f4be5870d1c223af00881039ee6017c2bfd8b.mhGzyTB70VdAAThY7t9y6NgM6SkqDJsc0LC6eJ9mAskscenes-app-experiments--experiments--light:- hash: v1.k794b7964.2a4d9456c2ee47623ed7112cee26e1b960aec6b9e7ea2e0bab9dcabde0fa4477.B0BLUn8r3_4rf2pFdVsZqKDbGgXn5R-9wCgIulBz1HQ+ hash: v1.k794b7964.db9eee27935de0304ad94bc74ae90d7ea1833fd09090b0eae7532feddc05beb2.XLKMV4Y8Jre4uxS56w2k_yFaA8YFU4nNlJX1pLKqvy4scenes-app-feature-flags--edit-encrypted-remote-config-feature-flag--dark:hash: v1.k794b7964.4f3b66427a371ca87ed7ff3437e4e05fa321a2f1ad219b5d4424a8e1b7348b11.YfwgimzWA69iIlL9McssTirk4C2ey_bcZyKYTquJLewscenes-app-feature-flags--edit-encrypted-remote-config-feature-flag--light:@@ -6241,9 +6289,9 @@ snapshots:scenes-app-feature-flags--feature-flag-not-found--light:hash: v1.k794b7964.9760899dc54ed1457b2f2790151da4dced7ce03ba2db211fc8987584331225f7.NwLOFpddIBI2MKFCF_nA7ICbR7JCJISgydgqg4pdPWgscenes-app-feature-flags--feature-flags-list--dark:- hash: v1.k794b7964.2a8bf55f3852eed60e170e59d7c7dc92a1f4e5f16f84607c1629425e9d7d72dd.0pOqy8BtWrsh0SQEzAIUKpmbh4uZdg-omqzrwkuN494+ hash: v1.k794b7964.4c1b48b0e9deb796e0872380e2c6a09169b43a80fe9cb73cf05d14d09bd45421.1gC96ce4ji6NuvBFXPNB79ctn-cV3KGjcBnnVMEd3Jcscenes-app-feature-flags--feature-flags-list--light:- hash: v1.k794b7964.18d16a7559246445191198e9aa84e26c74f955bef153b9bdc1c8764478e24800.1_zbdiVOfqIetvE9g5QyjDcOA0JS7yQUsey5JNyoTAM+ hash: v1.k794b7964.8f58297a9f87ef35cc3957980bc76ff840b2c1b1935f3e7da7362a47dcc7271d.eFEqxrtccazmTD7Uq1cd0eXkfGFbE2hiODT0I7allugscenes-app-feature-flags--new-feature-flag--dark:hash: v1.k794b7964.70df3db2b33bd03ae45c4aac90d5db824f0640857b9029abca867a170a5f82c5.6nQgIAyy17NzNkvmvJdJ50-JxIZRrUiXcYkx7O1ukyQscenes-app-feature-flags--new-feature-flag--light:@@ -6285,9 +6333,9 @@ snapshots:scenes-app-feature-flags-new-feature-flag-menu--default--light:hash: v1.k794b7964.c58d12ddf9499563916bb71f41ff70dce9db471379ef2215c8b57a0ac88aa76c.jl03AgPo8iB46wC9k3xNkQwobb5SLJcSwYnOphJUt8Yscenes-app-features--features-list--dark:- hash: v1.k794b7964.1b1bbf79d9e0033065f8369f89f9b7abe8db7a7694c800718a664be79d6fb999.Zfs6DpPi2hNyE-n0iiT3GF9TR1lChLpRz9R_vxyhuAg+ hash: v1.k794b7964.0c79c9bfef37ec5ccee5d871ad0849770f5b1c1b5c6ea92b8eddca703d035c31.g_X-ujymWdXk9iFUWXQgNNFUJmo3xzl_EZymFteHpBEscenes-app-features--features-list--light:- hash: v1.k794b7964.7b36b974461d5ba35ed239b2042e95d3d694e0cd19c26bb536ea418a0597c8b7.1KBS0d3TygedJFATRHLHioFrBBMqD7EFnrejaF6FYJc+ hash: v1.k794b7964.ffd3d995c56f9cdefd5189944fba180045865bea742313d829ad827a325eeedb.NIaXZjKYe2k6tLuXEFD0wB93leyUEnpv5xtIDCch-1Iscenes-app-features--new-feature-flag--dark:hash: v1.k794b7964.63525b4477e45f45dd5f6d3899ea40fbcddbe0740984e77ce85fdc30fda6889e.1ThZLV0EP8iSDYLCz1SRoPAAhA-vxBD8nY8Y-jL-2UAscenes-app-features--new-feature-flag--light:@@ -6773,9 +6821,9 @@ snapshots:scenes-app-links--link-details--light:hash: v1.k794b7964.c9ce37b5e2dc076c6d90da63434172866434b41c8286ab1b0b40a9497f069d4a.gxAEAoRmNhjXadzw9hjXb_OKL-IXrWXmFuRbP8i63Woscenes-app-links--links-list--dark:- hash: v1.k794b7964.af6e14cefb5a291d6480691f0721ecddd1228d81a02d0ccb70c6ab1b62447790.gqVMq7sO4B01lL5oON4QXG1Dy7LRqjMr4VI_GO0le4E+ hash: v1.k794b7964.0369ef608850e331cf6742803a02ce1022705eddc4e803201fec600f4640f1c6.mnm1_XmvO9T3vnaV7nKEPyub9jLNKFtW8kxO3Wg3_loscenes-app-links--links-list--light:- hash: v1.k794b7964.f33b928b1875f3bc1e069f1087e7ba9f5011c0d3433c10b965cd30e1c618794e.P364Ukivh15WdpGGdrSbFv154WGkbtphcJeGZP2XINQ+ hash: v1.k794b7964.604e49f8f514dd6ba5db94bb18e4d67393660f2a33c15263bf0285bf7e0d6480.j5o4XC_MwRZrtR6nX2gfhs4pp52vAy7GpG0WL7nL5Q8scenes-app-links--new-link--dark:hash: v1.k794b7964.16253c58cc7e0f11bd32af653724cced02b42de025ce92acb041a2c7ce6a04d4.qu3iiFJrUI2Hiq-59roGNvGTqUInaL-mUS-u6XFYvJ8scenes-app-links--new-link--light:@@ -7073,7 +7121,7 @@ snapshots:scenes-app-oauth-authorize--with-required-scopes--light:hash: v1.k794b7964.e951fac95b4bfb2628774621d6ac6f479abf8e8d10efb58cbcfad998c62a96be.-ZMfxl773NvFryFdUT6AJlVnUiwplGzEUPhvBD6kSWwscenes-app-people-cohorts--cohort-edit-dynamic--dark:- hash: v1.k794b7964.29528fe9c6743a11a17bf839e152d3ed0d45a571dc704b0fbeafc0e469213d61.u8BPurAlJ3JdThf5TpcoGw-6KWkWwHlFETCXvt2Y6us+ hash: v1.k794b7964.e31408a5ef822c097935dc6ce7b08957ed8df063ec55d50a505fca1ad48389f0.PhHWfr9lECOQQ6thPGblR5uayOXvpLGngJFZ9fZrBRsscenes-app-people-cohorts--cohort-edit-dynamic--light:hash: v1.k794b7964.af17394f32809d5fb7e65e8f3298be02447f4481ff41645350514a7f16ac8545.f1AXZKpaB9lZ6zPTIYL6gMPVqdUbN_T7QdgB-doywX8scenes-app-people-cohorts--cohort-edit-static--dark:@@ -7653,9 +7701,9 @@ snapshots:scenes-app-settings-user--settings-user-danger-zone--light:hash: v1.k794b7964.96846d7823357e89a9d91350f6f435373fe287f713250b59ccce2dbd31b6f69c.kl21kygOhH1SlNOJ6VekMMlGUuyNg5Ka7NXFoHcG6M0scenes-app-settings-user--settings-user-navigation--dark:- hash: v1.k794b7964.f1c0834efdf1ebf264e46ba2ef25c79266051f51ee4ddc70c939b1bfbedab033.1D-CrzTr7y6mQww6EZRG8VmOtNYW7cMvJ2t3RFc2E10+ hash: v1.k794b7964.7c5a5bdb7736062bcb70e36f20fc683eb9c014a0409dddb546a345fba91894b5.lMpgtqpaZZZsixseHxd_CxR4u_ZR5SnnrrOixJUvesMscenes-app-settings-user--settings-user-navigation--light:- hash: v1.k794b7964.81ca37a8d9427140b54c07c9c68d8b77001e956e6cf6f4fa66a4420d2adc0d02.VOWpKzNBO_d-f7SkK0G7tFxwGKj4TaRH-9n3BztTszI+ hash: v1.k794b7964.3acb8296dccbd1585e16658aea21430558340a74ec07c6b0bfc27f5d6e424187.r_cJHvPzf4G4BmOgDkZwZJDuDTdBGFPlbdxO_xNYNHIscenes-app-settings-user--settings-user-notifications--dark:hash: v1.k794b7964.a09a57f1c0bbcebf82942edebeba7772b2f684ba235bcef3a816aec2beb4cbce.AtQZhdZeeMVvpcmyBhPvprSMZawliTZaIFE5G8M_MVgscenes-app-settings-user--settings-user-notifications--light:diff --git a/frontend/src/layout/panel-layout/ProjectTree/defaultTree.tsx b/frontend/src/layout/panel-layout/ProjectTree/defaultTree.tsxindex 3feec5934a57..7fb04d38bc69 100644--- a/frontend/src/layout/panel-layout/ProjectTree/defaultTree.tsx+++ b/frontend/src/layout/panel-layout/ProjectTree/defaultTree.tsx@@ -154,11 +154,11 @@ const iconTypes: Record<FileSystemIconType, { icon: JSX.Element; iconColor?: Fil},product_tour: {icon: <IconSpotlight />,- iconColor: ['var(--color-product-surveys-light)'],+ iconColor: ['var(--color-product-product-tours-light)', 'var(--color-product-product-tours-dark)'],},user_interview: {icon: <IconApp />,- iconColor: ['var(--color-product-user-interviews-light)'],+ iconColor: ['var(--color-product-user-interviews-light)', 'var(--color-product-user-interviews-dark)'],},home: {icon: <IconHome />,@@ -172,7 +172,7 @@ const iconTypes: Record<FileSystemIconType, { icon: JSX.Element; iconColor?: Fil},tracing: {icon: <IconListTree />,- iconColor: ['var(--color-product-tracing-light)'],+ iconColor: ['var(--color-product-tracing-light)', 'var(--color-product-tracing-dark)'],},metrics: {icon: <IconGraph />,@@ -199,7 +199,7 @@ const iconTypes: Record<FileSystemIconType, { icon: JSX.Element; iconColor?: Fil},data_pipeline: {icon: <IconPlug />,- iconColor: ['var(--color-product-data-pipeline-light)'],+ iconColor: ['var(--color-product-data-pipeline-light)', 'var(--color-product-data-pipeline-dark)'],},data_pipeline_metadata: {icon: <IconPlug />,@@ -214,7 +214,7 @@ const iconTypes: Record<FileSystemIconType, { icon: JSX.Element; iconColor?: Fil},workflows: {icon: <IconDecisionTree />,- iconColor: ['var(--color-product-workflows-light)', 'var(--color-product-workflows-dark)'],+ iconColor: ['var(--color-product-workflows-light)'],},notebook: {icon: <IconNotebook />,@@ -355,6 +355,7 @@ const iconTypes: Record<FileSystemIconType, { icon: JSX.Element; iconColor?: Fil},visual_review: {icon: <IconApp />,+ iconColor: ['var(--color-product-visual-review-light)', 'var(--color-product-visual-review-dark)'],},code_review: {icon: <IconPullRequest />,diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.tsindex c1fdfa57f262..e586b44ee3ba 100644--- a/frontend/src/lib/api.ts+++ b/frontend/src/lib/api.ts@@ -688,6 +688,10 @@ export class ApiRequest {return this.pluginConfigs(teamId).addPathComponent(id)}+ public pipelineFrontendAppsConfigs(teamId?: TeamType['id']): ApiRequest {+ return this.projectsDetail(teamId).addPathComponent('pipeline_frontend_apps_configs')+ }+public hog(teamId?: TeamType['id']): ApiRequest {return this.projectsDetail(teamId).addPathComponent('hog')}@@ -3894,6 +3898,15 @@ const api = {},},+ // Site apps still backed by a plugin rather than a hog function. The web scripts scene+ // lists these alongside hog functions, so anything deciding whether a project has web+ // scripts has to count them too.+ pipelineFrontendAppsConfigs: {+ async list(params: { limit?: number } = {}): Promise<CountedPaginatedResponse<PluginConfigTypeNew>> {+ return await new ApiRequest().pipelineFrontendAppsConfigs().withQueryString(params).get()+ },+ },+pluginConfigs: {async get(id: PluginConfigTypeNew['id']): Promise<PluginConfigWithPluginInfoNew> {return await new ApiRequest().pluginConfig(id).get()diff --git a/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.stories.tsx b/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.stories.tsxindex 73258b4c4af7..fe56b1da94b3 100644--- a/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.stories.tsx+++ b/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.stories.tsx@@ -3,7 +3,18 @@ import { Meta } from '@storybook/react'import type { Mocks } from '~/mocks/utils'import { aiObservabilityEmptyState } from 'products/ai_observability/frontend/emptyState/aiObservabilityEmptyState'+import { llmPromptsEmptyState } from 'products/ai_observability/frontend/emptyState/llmPromptsEmptyState'+import { webScriptsEmptyState } from 'products/cdp/frontend/emptyState/webScriptsEmptyState'+import { supportEmptyState } from 'products/conversations/frontend/emptyState/supportEmptyState'+import { earlyAccessFeaturesEmptyState } from 'products/early_access_features/frontend/emptyState/earlyAccessFeaturesEmptyState'+import { endpointsEmptyState } from 'products/endpoints/frontend/emptyState/endpointsEmptyState'+import { experimentsEmptyState } from 'products/experiments/frontend/emptyState/experimentsEmptyState'+import { featureFlagsEmptyState } from 'products/feature_flags/frontend/emptyState/featureFlagsEmptyState'+import { linksEmptyState } from 'products/links/frontend/emptyState/linksEmptyState'import { mcpAnalyticsEmptyState } from 'products/mcp_analytics/frontend/emptyState/mcpAnalyticsEmptyState'+import { productToursEmptyState } from 'products/product_tours/frontend/emptyState/productToursEmptyState'+import { llmSkillsEmptyState } from 'products/skills/frontend/emptyState/llmSkillsEmptyState'+import { userInterviewsEmptyState } from 'products/user_interviews/frontend/emptyState/userInterviewsEmptyState'import { ProductEmptyState } from './ProductEmptyState'import { ProductEmptyStateStory, productEmptyStateStory } from './storybookHelpers'@@ -54,6 +65,78 @@ export const MCPAnalyticsWithoutWizard: ProductEmptyStateStory = productEmptySta{ config: { wizard: undefined }, mocks: mcpSignalMocks(false) })+// The detection logics for flags and experiments count entities on mount - answer+// with an empty list so the story renders the shipped needs-setup surface.+const emptyEntityList = { count: 0, next: null, previous: null, results: [] }++export const FeatureFlagsNeedsSetup: ProductEmptyStateStory = productEmptyStateStory(+ featureFlagsEmptyState,+ 'needs-setup',+ { mocks: { get: { '/api/projects/:team_id/feature_flags/': [200, emptyEntityList] } } }+)++export const ExperimentsNeedsSetup: ProductEmptyStateStory = productEmptyStateStory(+ experimentsEmptyState,+ 'needs-setup',+ { mocks: { get: { '/api/projects/:team_id/experiments/': [200, emptyEntityList] } } }+)++export const EarlyAccessFeaturesNeedsSetup: ProductEmptyStateStory = productEmptyStateStory(+ earlyAccessFeaturesEmptyState,+ 'needs-setup',+ { mocks: { get: { '/api/projects/:team_id/early_access_feature/': [200, emptyEntityList] } } }+)++export const LLMPromptsNeedsSetup: ProductEmptyStateStory = productEmptyStateStory(+ llmPromptsEmptyState,+ 'needs-setup',+ {+ mocks: { get: { '/api/projects/:team_id/llm_prompts/': [200, emptyEntityList] } },+ }+)++export const SkillsNeedsSetup: ProductEmptyStateStory = productEmptyStateStory(llmSkillsEmptyState, 'needs-setup', {+ mocks: { get: { '/api/projects/:team_id/llm_skills/': [200, emptyEntityList] } },+})++export const EndpointsNeedsSetup: ProductEmptyStateStory = productEmptyStateStory(endpointsEmptyState, 'needs-setup', {+ mocks: { get: { '/api/projects/:team_id/endpoints/': [200, emptyEntityList] } },+})++export const UserInterviewsNeedsSetup: ProductEmptyStateStory = productEmptyStateStory(+ userInterviewsEmptyState,+ 'needs-setup',+ { mocks: { get: { '/api/projects/:team_id/user_interview_topics/': [200, emptyEntityList] } } }+)++export const LinksNeedsSetup: ProductEmptyStateStory = productEmptyStateStory(linksEmptyState, 'needs-setup', {+ mocks: { get: { '/api/projects/:team_id/links/': [200, emptyEntityList] } },+})++export const ProductToursNeedsSetup: ProductEmptyStateStory = productEmptyStateStory(+ productToursEmptyState,+ 'needs-setup',+ { mocks: { get: { '/api/projects/:team_id/product_tours/': [200, emptyEntityList] } } }+)++export const SupportNeedsSetup: ProductEmptyStateStory = productEmptyStateStory(supportEmptyState, 'needs-setup', {+ mocks: { get: { '/api/projects/:team_id/conversations/tickets/': [200, emptyEntityList] } },+})++export const SupportWaitingForData: ProductEmptyStateStory = productEmptyStateStory(+ supportEmptyState,+ 'waiting-for-data',+ { mocks: { get: { '/api/projects/:team_id/conversations/tickets/': [200, emptyEntityList] } } }+)++export const WebScriptsNeedsSetup: ProductEmptyStateStory = productEmptyStateStory(+ webScriptsEmptyState,+ 'needs-setup',+ {+ mocks: { get: { '/api/projects/:team_id/hog_functions/': [200, emptyEntityList] } },+ }+)+// AI observability detection is binary (no waiting-for-data middle state).export const AIObservabilityNeedsSetup: ProductEmptyStateStory = productEmptyStateStory(aiObservabilityEmptyState,diff --git a/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.test.tsx b/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.test.tsxnew file mode 100644index 000000000000..258c1844f8fe--- /dev/null+++ b/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.test.tsx@@ -0,0 +1,70 @@+import { cleanup, render, screen } from '@testing-library/react'++import { useMocks } from '~/mocks/jest'+import { ProductKey } from '~/queries/schema/schema-general'+import { initKeaTests } from '~/test/init'+import { AccessControlLevel, AccessControlResourceType, AppContext } from '~/types'++import { ProductEmptyState } from './ProductEmptyState'+import type { ProductEmptyStateConfig } from './types'++const config: ProductEmptyStateConfig = {+ productKey: ProductKey.EXPERIMENTS,+ productName: 'Experiments',+ icon: <span />,+ accentColor: 'red',+ text: { 'needs-setup': { headline: 'Headline', lead: 'Lead' } },+ primaryAction: {+ label: 'Create your first experiment',+ to: '/experiments/new',+ accessControl: {+ resourceType: AccessControlResourceType.Experiment,+ minAccessLevel: AccessControlLevel.Editor,+ },+ dataAttr: 'create-experiment',+ },+ previewLabel: 'Preview',+ Preview: () => <div />,+}++describe('ProductEmptyState', () => {+ let priorAppContext: AppContext | undefined++ beforeEach(() => {+ // preflightLogic and teamLogic mount with the component; leaving their requests+ // unanswered lets them settle after teardown and tear jsdom down mid-render.+ useMocks({+ get: {+ '/_preflight/': { cloud: false },+ '/api/environments/@current/': {},+ '/api/users/@me/': {},+ },+ })+ initKeaTests()+ priorAppContext = window.POSTHOG_APP_CONTEXT+ })++ afterEach(() => {+ cleanup()+ window.POSTHOG_APP_CONTEXT = priorAppContext+ })++ // The empty state replaces the scene's own gated create button, so a viewer who+ // reaches it must not get an enabled create action that only fails on save.+ it.each([+ [AccessControlLevel.Editor, 'false'],+ [AccessControlLevel.Viewer, 'true'],+ ])('renders the primary action for a %s as aria-disabled=%s', (userLevel, expected) => {+ window.POSTHOG_APP_CONTEXT = {+ ...window.POSTHOG_APP_CONTEXT,+ resource_access_control: {+ ...window.POSTHOG_APP_CONTEXT?.resource_access_control,+ [AccessControlResourceType.Experiment]: userLevel,+ },+ } as AppContext++ render(<ProductEmptyState config={config} mode="needs-setup" />)++ expect(screen.getByTestId('create-experiment').getAttribute('aria-disabled')).toBe(expected)+ })+})diff --git a/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.tsx b/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.tsxindex ae944394ee47..29ccf5fda38e 100644--- a/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.tsx+++ b/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.tsx@@ -3,6 +3,7 @@ import posthog from 'posthog-js'import { IconBook, IconGear } from '@posthog/icons'+import { AccessControlAction } from 'lib/components/AccessControlAction'import { TerminalCard } from 'lib/components/CommandBlock/TerminalCard'import { LemonButton } from 'lib/lemon-ui/LemonButton'import { useWizardCommand } from 'scenes/onboarding/shared/useWizardCommand'@@ -43,6 +44,33 @@ export function ProductEmptyState({ config, mode }: ProductEmptyStateProps): JSXconst Hedgehog = config.hedgehogconst Preview = config.Preview+ const { primaryAction } = config+ const primaryActionButton = primaryAction ? (+ <LemonButton+ type="primary"+ to={primaryAction.to}+ onClick={() => {+ captureClick('primary action clicked')+ primaryAction.onClick?.()+ }}+ className="self-start"+ data-attr={primaryAction.dataAttr ?? 'product-empty-state-primary-action'}+ >+ {primaryAction.label}+ </LemonButton>+ ) : null+ const guardedPrimaryAction =+ primaryActionButton && primaryAction?.accessControl ? (+ <AccessControlAction+ resourceType={primaryAction.accessControl.resourceType}+ minAccessLevel={primaryAction.accessControl.minAccessLevel}+ >+ {primaryActionButton}+ </AccessControlAction>+ ) : (+ primaryActionButton+ )+return (<div// Fill the scene: viewport minus the app chrome and the product header above us.@@ -75,19 +103,10 @@ export function ProductEmptyState({ config, mode }: ProductEmptyStateProps): JSXcopyLabel={`${config.productName} wizard command`}onCopy={() => captureClick('wizard command copied')}/>- ) : config.primaryAction ? (- <LemonButton- type="primary"- to={config.primaryAction.to}- onClick={() => {- captureClick('primary action clicked')- config.primaryAction?.onClick?.()- }}- className="self-start"- data-attr="product-empty-state-primary-action"- >- {config.primaryAction.label}- </LemonButton>+ ) : config.PrimaryAction ? (+ <config.PrimaryAction />+ ) : guardedPrimaryAction ? (+ guardedPrimaryAction) : manualUrl ? (<LemonButtontype="primary"@@ -129,19 +148,23 @@ export function ProductEmptyState({ config, mode }: ProductEmptyStateProps): JSXRead the docs</LemonButton>) : null}- <LemonButton- size="xsmall"- type="tertiary"- onClick={skipEmptyState}- data-attr="product-empty-state-skip"- >- Skip for now- </LemonButton>+ {config.skippable !== false ? (+ <LemonButton+ size="xsmall"+ type="tertiary"+ onClick={skipEmptyState}+ data-attr="product-empty-state-skip"+ >+ Skip for now+ </LemonButton>+ ) : null}</div></div><div- className="hidden min-w-0 flex-col justify-center gap-3 p-10 md:flex rounded-md border border-primary"+ // Previews read `--empty-state-accent` only, so in dark mode point that at the dark+ // token here rather than asking every preview to branch on the theme itself.+ className="hidden min-w-0 flex-col justify-center gap-3 p-10 md:flex rounded-md border border-primary dark:[--empty-state-accent:var(--empty-state-accent-dark)]"style={{backgroundImage:'linear-gradient(135deg, color-mix(in oklab, var(--empty-state-accent) 16%, transparent) 0%, color-mix(in oklab, var(--empty-state-accent) 5%, transparent) 45%, transparent 80%)',diff --git a/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.tsx b/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.tsxindex cbcb4c3b5ca1..e6ac716a9823 100644--- a/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.tsx+++ b/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.tsx@@ -45,11 +45,18 @@ function ProductEmptyStateGateInner({ emptyState, children }: ProductEmptyStateGconst { config, statusLogic } = emptyStateuseMountedLogic(statusLogic)const setupLogic = productSetupStatusLogic({ productKey: config.productKey })- const { status, skipped, showEmptyState, mode } = useValues(setupLogic)+ const { status, skipped, mode } = useValues(setupLogic)const { unskipEmptyState } = useActions(setupLogic)const { featureFlags } = useValues(featureFlagLogic)- if (skipped) {+ // A lingering local skip is ignored for non-skippable products (the button may have been+ // shown before the product opted out of skipping). Derived once, because the empty-state+ // branch below has to reach the same verdict: honoring the skip there but not here would+ // render the bare scene with neither the setup screen nor the reminder banner, and a+ // non-skippable product has no button left to clear the stored flag with.+ const skipHonored = skipped && config.skippable !== false++ if (skipHonored) {// Skip bypasses the screen, not detection: render the scene, plus a "Set up" reminder// until data lands, so there's always a way back to setup.const needsSetup = status === 'needs-setup' || status === 'waiting-for-data'@@ -79,16 +86,18 @@ function ProductEmptyStateGateInner({ emptyState, children }: ProductEmptyStateG)}if (status === 'loading') {- // One consistent loading treatment app-wide — the same scene-level spinner- // shown while scene chunks load. Statuses are preloaded at app boot (see- // productSetupPreloadLogic), so this rarely renders in practice.+ // One consistent loading treatment app-wide, the same scene-level spinner shown while+ // scene chunks load. `productSetupPreloadLogic` answers this ahead of time only for+ // products that declare a `setupProbe` in their manifest, which is an event-based+ // signal. Entity-count products have none, so for them the spinner is the normal path+ // on every entry, including every trip back from a detail page.return (<ProductSceneFrame config={config}><SpinnerOverlay sceneLevel /></ProductSceneFrame>)}- if (showEmptyState) {+ if (!skipHonored && (status === 'needs-setup' || status === 'waiting-for-data')) {return (<ProductSceneFrame config={config}><ProductEmptyState config={config} mode={mode} />diff --git a/frontend/src/lib/components/ProductEmptyState/README.md b/frontend/src/lib/components/ProductEmptyState/README.mdindex 21e1ab97c4d9..25e6505f6fad 100644--- a/frontend/src/lib/components/ProductEmptyState/README.md+++ b/frontend/src/lib/components/ProductEmptyState/README.md@@ -1,6 +1,6 @@# ProductEmptyState-The empty state a product scene shows until it has received real data: the product pitch and install command on the left, an animated preview of the product filled with example data on the right. Users can always skip it (stored locally in the browser), and it disappears on its own once data arrives — gating is driven by real data detection, never by dismissal flags.+The empty state a product scene shows until it has received real data: the product pitch and install command on the left, an animated preview of the product filled with example data on the right. Users can skip it (stored locally in the browser) unless the product sets `skippable: false` (creation-first products whose gated scene is just an empty list), and it disappears on its own once data arrives — gating is driven by real data detection, never by dismissal flags.Scenes opt in declaratively: set `emptyState` on the scene's `SceneExport` and the app shell handles loading, empty, and has-data states — no branching inside the scene component.diff --git a/frontend/src/lib/components/ProductEmptyState/_previewMixins.scss b/frontend/src/lib/components/ProductEmptyState/_previewMixins.scssnew file mode 100644index 000000000000..c124abf39bfd--- /dev/null+++ b/frontend/src/lib/components/ProductEmptyState/_previewMixins.scss@@ -0,0 +1,105 @@+// Shared building blocks for the product empty-state previews.++// Crossfading halves of a preview must leave the accessibility tree and the tab order while+// hidden, not merely fade out. Under `opacity: 0` alone a screen reader announces both halves+// of every swap at once ("0% 100%", ": false : true"), which contradicts the one thing the+// preview demonstrates, and any control in the hidden half stays focusable, so a keyboard user+// lands on an invisible button. `pointer-events` does not help, since it suppresses only mouse+// and touch.+//+// `visibility` is delayed by the fade duration when hiding so the transition still plays, and+// applied immediately when showing. A `visibility: hidden` grid item keeps its cell, so+// swapping the two states causes no layout shift.++// Product accents are sidebar icon tints, not text colors. On the light surface most of them+// land well under the 4.5:1 AA floor as text (endpoints 2.19:1, feature flags 2.70:1), so a+// preview painting a label, a code keyword, or a served-version marker in the raw accent is+// unreadable for a low-vision reader. Each preview therefore derives a text-safe variant with+// this mix and uses it for every `color:` declaration, keeping the raw accent for fills,+// borders, and strokes where the floor is 3:1 for graphics.+//+// Mixing toward `--color-text-primary` moves the accent toward whatever contrasts the current+// theme's background, so one formula covers light and dark. 60% keeps the hue recognizable+// while leaving the worst token at 5.6:1.+@mixin preview-accent-text($accent) {+ color: color-mix(in oklab, #{$accent} 60%, var(--color-text-primary));+}++$preview-swap-duration: 250ms;++@mixin preview-swap-hidden($duration: $preview-swap-duration) {+ visibility: hidden;+ opacity: 0;+ transition:+ opacity $duration ease,+ visibility 0s linear $duration;+}++@mixin preview-swap-visible($duration: $preview-swap-duration) {+ visibility: visible;+ opacity: 1;+ transition:+ opacity $duration ease,+ visibility 0s;+}++// Every preview guards its ambient motion twice: `prefers-reduced-motion` for the user's own+// setting, and a `--static` class the component adds under `inStorybook()` so visual-regression+// snapshots don't catch a frame mid-animation. Both are the same two rules in every preview.+@mixin preview-motion-guards($root) {+ .#{$root}--static *,+ .#{$root}--static *::after {+ animation: none !important;+ }++ @media (prefers-reduced-motion: reduce) {+ .#{$root} *,+ .#{$root} *::after {+ animation: none !important;+ }+ }+}++// The stat card that sits under most previews: a title and a value above a sparkline. Structure+// only, so the sparkline's own line and fill stay with the preview that draws them. Include+// inside the preview root, where `&` resolves to it.+@mixin preview-sparkline {+ &__spark-head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ }++ &__spark-title {+ font-size: 0.75rem;+ font-weight: 600;+ color: var(--color-text-secondary);+ }++ &__spark-value {+ display: flex;+ gap: 0.5rem;+ align-items: baseline;+ margin-top: 0.25rem;+ font-size: 1.5rem;+ font-weight: 700;+ line-height: 1.1;+ }++ &__spark-svg {+ display: block;+ width: 100%;+ height: 44px;+ overflow: visible;+ }+}++// One of the window dots in a preview's fake browser or app chrome.+@mixin preview-chrome-dot {+ &__chrome-dot {+ width: 7px;+ height: 7px;+ background: var(--color-fill-secondary);+ border-radius: 50%;+ }+}diff --git a/frontend/src/lib/components/ProductEmptyState/productSetupStatusLogic.test.ts b/frontend/src/lib/components/ProductEmptyState/productSetupStatusLogic.test.tsindex e93c18db32bb..7f03f2ad7174 100644--- a/frontend/src/lib/components/ProductEmptyState/productSetupStatusLogic.test.ts+++ b/frontend/src/lib/components/ProductEmptyState/productSetupStatusLogic.test.ts@@ -20,32 +20,49 @@ describe('productSetupStatusLogic', () => {}// Guards the skip path end to end: a broken skip either traps users on the- // empty state or (worse) permanently hides it for users who never skipped.- it('skip hides the empty state without touching detection, and unskip restores it', async () => {+ // empty state or (worse) permanently hides it for users who never skipped. The gate+ // decides from `skipped` and `status` together, so both have to move independently.+ it('skip flips only skipped, leaving detection alone, and unskip restores it', async () => {const logic = mountLogic()logic.actions.setDetectedStatus('needs-setup')- expect(logic.values.showEmptyState).toBe(true)+ expect(logic.values.skipped).toBe(false)await expectLogic(logic, () => logic.actions.skipEmptyState()).toFinishAllListeners()expect(logic.values.skipped).toBe(true)- expect(logic.values.showEmptyState).toBe(false)// Detection is untouched by skipping.expect(logic.values.status).toBe('needs-setup')await expectLogic(logic, () => logic.actions.unskipEmptyState()).toFinishAllListeners()- expect(logic.values.showEmptyState).toBe(true)+ expect(logic.values.skipped).toBe(false)+ expect(logic.values.status).toBe('needs-setup')})+ // `mode` picks which copy and preview state the empty state renders.it.each([- ['loading', false],- ['unknown', false],- ['needs-setup', true],- ['waiting-for-data', true],- ['has-data', false],- ] as const)('status %s → showEmptyState %s', (status, expected) => {+ ['loading', 'needs-setup'],+ ['unknown', 'needs-setup'],+ ['needs-setup', 'needs-setup'],+ ['waiting-for-data', 'waiting-for-data'],+ ['has-data', 'needs-setup'],+ ] as const)('status %s → mode %s', (status, expected) => {const logic = mountLogic()logic.actions.setDetectedStatus(status)- expect(logic.values.showEmptyState).toBe(expected)+ expect(logic.values.mode).toBe(expected)+ })++ // Guards the no-downgrade rule. Products that poll re-answer while the scene is mounted,+ // so without it a failed first check (which fails open to the live scene) followed by a+ // successful zero-count poll replaces that scene with the setup screen 20 seconds later.+ it.each([+ ['unknown', 'unknown'],+ ['has-data', 'has-data'],+ // A user-initiated transition, e.g. support switched off with no tickets, still lands.+ ['waiting-for-data', 'needs-setup'],+ ] as const)('a later needs-setup over %s settles on %s', (settled, expected) => {+ const logic = mountLogic()+ logic.actions.setDetectedStatus(settled)+ logic.actions.setDetectedStatus('needs-setup')+ expect(logic.values.status).toBe(expected)})// Guards the team stamp: without it, a project switch serves the previousdiff --git a/frontend/src/lib/components/ProductEmptyState/productSetupStatusLogic.ts b/frontend/src/lib/components/ProductEmptyState/productSetupStatusLogic.tsindex bb467f62aef1..d14212c4912c 100644--- a/frontend/src/lib/components/ProductEmptyState/productSetupStatusLogic.ts+++ b/frontend/src/lib/components/ProductEmptyState/productSetupStatusLogic.ts@@ -21,7 +21,6 @@ export interface productSetupStatusLogicValues {currentTeamId: number | null // teamLogicdetected: DetectedStatusmode: ProductEmptyStateMode- showEmptyState: booleanskipped: booleanskippedByTeam: Record<number, boolean>status: ProductSetupStatus@@ -60,7 +59,6 @@ export interface productSetupStatusLogicMeta {__keaTypeGenInternalSelectorTypes: {status: (detected: DetectedStatus, currentTeamId: number | null) => ProductSetupStatusskipped: (skippedByTeam: Record<number, boolean>, currentTeamId: number | null) => boolean- showEmptyState: (status: ProductSetupStatus, skipped: boolean) => booleanmode: (status: ProductSetupStatus) => ProductEmptyStateMode}}@@ -138,11 +136,6 @@ export const productSetupStatusLogic = kea<productSetupStatusLogicType>([(skippedByTeam: Record<number, boolean>, currentTeamId: number | null): boolean =>!!(currentTeamId && skippedByTeam[currentTeamId]),],- showEmptyState: [- (s) => [s.status, s.skipped],- (status: ProductSetupStatus, skipped: boolean): boolean =>- !skipped && (status === 'needs-setup' || status === 'waiting-for-data'),- ],mode: [(s) => [s.status],(status: ProductSetupStatus): ProductEmptyStateMode =>@@ -151,6 +144,17 @@ export const productSetupStatusLogic = kea<productSetupStatusLogicType>([}),listeners(({ actions, values, props }) => ({setDetectedStatus: ({ status }) => {+ // Detection answers more than once per session: several products poll while their+ // scene is mounted. Once a status has put the real scene on screen, a later+ // `needs-setup` must not replace it, because that swaps a mounted scene for the+ // setup screen under the user, losing whatever they had typed into it, and a+ // product with `skippable: false` leaves no way back. `unknown` means detection+ // failed and we deliberately failed open; `has-data` means real data was seen.+ // A project switch resets `status` to `loading`, so the new team can still land on+ // `needs-setup`, and `waiting-for-data` stays free to move either way.+ if (status === 'needs-setup' && (values.status === 'unknown' || values.status === 'has-data')) {+ return+ }actions.applyDetectedStatus(status, values.currentTeamId)},skipEmptyState: () => {diff --git a/frontend/src/lib/components/ProductEmptyState/types.ts b/frontend/src/lib/components/ProductEmptyState/types.tsindex abfeb5f70d43..6d600b0cfa0a 100644--- a/frontend/src/lib/components/ProductEmptyState/types.ts+++ b/frontend/src/lib/components/ProductEmptyState/types.ts@@ -4,6 +4,7 @@ import type { ComponentType, CSSProperties, ReactNode } from 'react'import type { FeatureFlagKey } from 'lib/constants'import type { ProductKey } from '~/queries/schema/schema-general'+import type { AccessControlLevel, AccessControlResourceType } from '~/types'/*** Normalized setup status for a product, pushed into `productSetupStatusLogic`@@ -44,10 +45,27 @@ export interface ProductEmptyStateWizard {pinProjectId?: boolean}+export interface ProductEmptyStateAccessControl {+ resourceType: AccessControlResourceType+ minAccessLevel: AccessControlLevel+}+export interface ProductEmptyStatePrimaryAction {label: stringto?: stringonClick?: () => void+ /**+ * Permission the action requires, mirroring the gated scene's own create button.+ * Without it a viewer gets an enabled button and only finds out they can't create+ * when the form fails to save.+ */+ accessControl?: ProductEmptyStateAccessControl+ /**+ * `data-attr` on the button, defaulting to `product-empty-state-primary-action`.+ * Set it to the attr the gated scene's create button carries, so end-to-end specs+ * keep one selector across both surfaces.+ */+ dataAttr?: string}export interface ProductEmptyStateConfig {@@ -67,6 +85,12 @@ export interface ProductEmptyStateConfig {wizard?: ProductEmptyStateWizard/** Primary CTA for products set up in the UI rather than via the wizard, e.g. "Create your first flag" */primaryAction?: ProductEmptyStatePrimaryAction+ /**+ * Rendered in the primary-action slot instead of the `primaryAction` button, for+ * actions that need hooks - e.g. a create flow that opens PostHog AI via `useMaxTool`.+ * Takes precedence over `primaryAction`.+ */+ PrimaryAction?: ComponentTypedocsUrl?: string/** Target of the small "Or configure manually" link; falls back to `docsUrl` */manualSetupUrl?: string@@ -76,6 +100,12 @@ export interface ProductEmptyStateConfig {Preview: ComponentType<{ mode: ProductEmptyStateMode }>/** Product-specific live status line (e.g. a "listening for events" indicator), rendered under the command block */statusIndicator?: ReactNode+ /**+ * Whether the "Skip for now" escape hatch shows. Defaults to true. Set false for+ * creation-first products where the gated scene is just an empty list, so skipping+ * has nothing to reveal and the primary action is the only next step.+ */+ skippable?: boolean}/**diff --git a/frontend/src/products.tsx b/frontend/src/products.tsxindex 05e0d85a8ec9..18784d51f8e1 100644--- a/frontend/src/products.tsx+++ b/frontend/src/products.tsx@@ -555,7 +555,14 @@ export const productConfiguration: Record<string, any> = {iconType: 'data_pipeline',},CohortsStaffTools: { instanceLevel: true, name: 'Cohorts staff tools' },- SupportTickets: { name: 'Ticket list', projectBased: true, layout: 'app-container' },+ SupportTickets: {+ name: 'Ticket list',+ description:+ 'Collect support tickets from an in-app widget, email, or Slack into one inbox, with the product context behind every ticket',+ iconType: 'conversations',+ projectBased: true,+ layout: 'app-container',+ },SupportTicketDetail: { name: 'Ticket detail', projectBased: true, layout: 'app-container' },SupportSettings: { name: 'Support settings', projectBased: true, layout: 'app-container' },MyTickets: { name: 'Your tickets', projectBased: true, layout: 'app-container' },@@ -1506,14 +1513,14 @@ export const fileSystemTypes = {href: (ref: string) => urls.action(ref),filterKey: 'action',iconType: 'action' as FileSystemIconType,- iconColor: ['var(--color-product-actions-light)'] as FileSystemIconColor,+ iconColor: ['var(--color-product-actions-light)', 'var(--color-product-actions-dark)'] as FileSystemIconColor,},cohort: {name: 'Cohort',iconType: 'cohort' as FileSystemIconType,+ iconColor: ['var(--color-product-cohorts-light)', 'var(--color-product-cohorts-dark)'] as FileSystemIconColor,href: (ref: string) => urls.cohort(ref),filterKey: 'cohort',- iconColor: ['var(--color-product-cohorts-light)'] as FileSystemIconColor,},dashboard: {name: 'Dashboard',@@ -1536,7 +1543,7 @@ export const fileSystemTypes = {name: 'Endpoints',iconType: 'endpoints',href: () => urls.endpoints(),- iconColor: ['var(--color-product-endpoints-light)'],+ iconColor: ['var(--color-product-endpoints-light)', 'var(--color-product-endpoints-dark)'],filterKey: 'endpoints',},experiment: {@@ -1564,7 +1571,7 @@ export const fileSystemTypes = {name: 'Link',iconType: 'link' as FileSystemIconType,href: (ref: string) => urls.link(ref),- iconColor: ['var(--color-product-links-light)'],+ iconColor: ['var(--color-product-links-light)', 'var(--color-product-links-dark)'],filterKey: 'link',flag: FEATURE_FLAGS.LINKS,},@@ -1586,7 +1593,7 @@ export const fileSystemTypes = {name: 'Product tour',iconType: 'product_tour',href: (ref: string) => urls.productTour(ref),- iconColor: ['var(--color-product-surveys-light)'],+ iconColor: ['var(--color-product-product-tours-light)', 'var(--color-product-product-tours-dark)'],filterKey: 'product_tour',},session_recording_playlist: {@@ -1615,7 +1622,7 @@ export const fileSystemTypes = {name: 'User research',iconType: 'user_interview',href: (ref: string) => urls.userInterview(ref),- iconColor: ['var(--color-product-user-interviews-light)'],+ iconColor: ['var(--color-product-user-interviews-light)', 'var(--color-product-user-interviews-dark)'],filterKey: 'user_interview',flag: FEATURE_FLAGS.USER_INTERVIEWS,},@@ -1645,14 +1652,14 @@ export const getTreeItemsNew = (): FileSystemImport[] => [path: 'Action',href: urls.createAction(),iconType: 'action' as FileSystemIconType,- iconColor: ['var(--color-product-actions-light)'] as FileSystemIconColor,+ iconColor: ['var(--color-product-actions-light)', 'var(--color-product-actions-dark)'] as FileSystemIconColor,},{path: `Cohort`,type: 'cohort',href: urls.cohort('new'),iconType: 'cohort' as FileSystemIconType,- iconColor: ['var(--color-product-cohorts-light)'] as FileSystemIconColor,+ iconColor: ['var(--color-product-cohorts-light)', 'var(--color-product-cohorts-dark)'] as FileSystemIconColor,sceneKeys: ['Cohorts', 'Cohort'],},{@@ -1668,28 +1675,28 @@ export const getTreeItemsNew = (): FileSystemImport[] => [path: `Data/Destination`,type: 'hog_function/destination',href: urls.dataPipelinesNew('destination'),- iconColor: ['var(--color-product-data-pipeline-light)'],+ iconColor: ['var(--color-product-data-pipeline-light)', 'var(--color-product-data-pipeline-dark)'],sceneKeys: ['HogFunction'],},{path: `Data/Source`,type: 'hog_function/source',href: urls.dataPipelinesNew('source'),- iconColor: ['var(--color-product-data-pipeline-light)'],+ iconColor: ['var(--color-product-data-pipeline-light)', 'var(--color-product-data-pipeline-dark)'],sceneKeys: ['HogFunction'],},{path: `Data/Transformation`,type: 'hog_function/transformation',href: urls.dataPipelinesNew('transformation'),- iconColor: ['var(--color-product-data-pipeline-light)'],+ iconColor: ['var(--color-product-data-pipeline-light)', 'var(--color-product-data-pipeline-dark)'],sceneKeys: ['HogFunction'],},{path: `Data/Web script`,type: 'hog_function/site_app',href: urls.webScriptsNew(),- iconColor: ['var(--color-product-data-pipeline-light)'],+ iconColor: ['var(--color-product-data-pipeline-light)', 'var(--color-product-data-pipeline-dark)'],sceneKeys: ['HogFunction'],},{@@ -1788,7 +1795,7 @@ export const getTreeItemsNew = (): FileSystemImport[] => [type: 'link',href: urls.link('new'),iconType: 'link' as FileSystemIconType,- iconColor: ['var(--color-product-links-light)'] as FileSystemIconColor,+ iconColor: ['var(--color-product-links-light)', 'var(--color-product-links-dark)'] as FileSystemIconColor,flag: FEATURE_FLAGS.LINKS,},{ path: `Notebook`, type: 'notebook', href: urls.notebook('new'), iconType: 'notebook' },@@ -1797,7 +1804,10 @@ export const getTreeItemsNew = (): FileSystemImport[] => [type: 'product_tour',href: urls.productTour('new'),iconType: 'product_tour',- iconColor: ['var(--color-product-surveys-light)'] as FileSystemIconColor,+ iconColor: [+ 'var(--color-product-product-tours-light)',+ 'var(--color-product-product-tours-dark)',+ ] as FileSystemIconColor,},{path: `Survey`,@@ -2047,7 +2057,10 @@ export const getTreeItemsProducts = (): FileSystemImport[] => [href: urls.endpoints(),type: 'endpoints',iconType: 'endpoints',- iconColor: ['var(--color-product-endpoints-light)'] as FileSystemIconColor,+ iconColor: [+ 'var(--color-product-endpoints-light)',+ 'var(--color-product-endpoints-dark)',+ ] as FileSystemIconColor,sceneKey: 'EndpointsScene',sceneKeys: ['EndpointsScene', 'EndpointScene'],},@@ -2355,7 +2368,10 @@ export const getTreeItemsProducts = (): FileSystemImport[] => [type: 'product_tour',href: urls.productTours(),iconType: 'product_tour',- iconColor: ['var(--color-product-surveys-light)'] as FileSystemIconColor,+ iconColor: [+ 'var(--color-product-product-tours-light)',+ 'var(--color-product-product-tours-dark)',+ ] as FileSystemIconColor,sceneKey: 'ProductTours',sceneKeys: ['ProductTour', 'ProductTours'],flag: FEATURE_FLAGS.PRODUCT_TOURS,@@ -2454,7 +2470,7 @@ export const getTreeItemsProducts = (): FileSystemImport[] => [href: urls.supportTickets(),type: 'conversations',iconType: 'conversations',- iconColor: ['var(--color-product-support-light)'] as FileSystemIconColor,+ iconColor: ['var(--color-product-support-light)', 'var(--color-product-support-dark)'] as FileSystemIconColor,sceneKey: 'SupportTickets',sceneKeys: ['SupportTickets', 'SupportTicketDetail', 'SupportSettings', 'MyTickets'],},@@ -2526,7 +2542,7 @@ export const getTreeItemsProducts = (): FileSystemImport[] => [intents: [ProductKey.TRACING],category: ProductItemCategory.APP_MONITORING,iconType: 'tracing',- iconColor: ['var(--color-product-tracing-light)'] as FileSystemIconColor,+ iconColor: ['var(--color-product-tracing-light)', 'var(--color-product-tracing-dark)'] as FileSystemIconColor,href: urls.tracing(),flag: FEATURE_FLAGS.TRACING,tags: ['beta'],@@ -2542,7 +2558,10 @@ export const getTreeItemsProducts = (): FileSystemImport[] => [flag: FEATURE_FLAGS.USER_INTERVIEWS,tags: ['alpha'],iconType: 'user_interview',- iconColor: ['var(--color-product-user-interviews-light)'] as FileSystemIconColor,+ iconColor: [+ 'var(--color-product-user-interviews-light)',+ 'var(--color-product-user-interviews-dark)',+ ] as FileSystemIconColor,sceneKey: 'UserInterviews',sceneKeys: ['UserInterviews', 'UserInterview', 'UserInterviewResponse'],},@@ -2552,6 +2571,10 @@ export const getTreeItemsProducts = (): FileSystemImport[] => [category: ProductItemCategory.UNRELEASED,href: urls.visualReviewRuns(),iconType: 'visual_review' as FileSystemIconType,+ iconColor: [+ 'var(--color-product-visual-review-light)',+ 'var(--color-product-visual-review-dark)',+ ] as FileSystemIconColor,flag: FEATURE_FLAGS.VISUAL_REVIEW,tags: ['alpha'],sceneKey: 'VisualReviewIndex',@@ -2580,7 +2603,7 @@ export const getTreeItemsProducts = (): FileSystemImport[] => [category: ProductItemCategory.TOOLS,type: 'hog_function',iconType: 'data_pipeline',- iconColor: ['var(--color-product-data-pipeline-light)'],+ iconColor: ['var(--color-product-data-pipeline-light)', 'var(--color-product-data-pipeline-dark)'],href: urls.webScripts(),sceneKey: 'WebScripts',sceneKeys: ['WebScripts'],@@ -2651,7 +2674,10 @@ export const getTreeItemsMetadata = (): FileSystemImport[] => [path: 'Endpoints',category: 'Tools',iconType: 'endpoints' as FileSystemIconType,- iconColor: ['var(--color-product-endpoints-light)'] as FileSystemIconColor,+ iconColor: [+ 'var(--color-product-endpoints-light)',+ 'var(--color-product-endpoints-dark)',+ ] as FileSystemIconColor,href: urls.endpoints(),sceneKey: 'EndpointsScene',sceneKeys: ['EndpointsScene', 'EndpointScene'],diff --git a/frontend/src/scenes/data-pipelines/DataPipelinesHogFunctions.tsx b/frontend/src/scenes/data-pipelines/DataPipelinesHogFunctions.tsxindex ce417064bd56..e91c3ddbaac1 100644--- a/frontend/src/scenes/data-pipelines/DataPipelinesHogFunctions.tsx+++ b/frontend/src/scenes/data-pipelines/DataPipelinesHogFunctions.tsx@@ -22,6 +22,8 @@ export type DataPipelinesHogFunctionsProps = {action?: JSX.Element}+// `site_app` is intentionally absent: web scripts renders the scene-level product+// empty state instead (products/cdp/frontend/emptyState).export const MAPPING: Partial<Record<HogFunctionTypeType, { key: ProductKey; description: string }>> = {destination: {key: ProductKey.PIPELINE_DESTINATIONS,@@ -32,10 +34,6 @@ export const MAPPING: Partial<Record<HogFunctionTypeType, { key: ProductKey; desdescription:'Transformations let you modify, filter, and enrich event data to improve data quality, privacy, and consistency.',},- site_app: {- key: ProductKey.SITE_APPS,- description: 'Web scripts allow you to add custom tags and functionality to your website using PostHog.',- },}export function DataPipelinesHogFunctions({diff --git a/frontend/src/scenes/data-pipelines/WebScriptsScene.tsx b/frontend/src/scenes/data-pipelines/WebScriptsScene.tsxindex 354513fe13b6..bbab8a5aba09 100644--- a/frontend/src/scenes/data-pipelines/WebScriptsScene.tsx+++ b/frontend/src/scenes/data-pipelines/WebScriptsScene.tsx@@ -15,6 +15,8 @@ import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'import { ProductKey } from '~/queries/schema/schema-general'import { ActivityScope } from '~/types'+import { webScriptsEmptyState } from 'products/cdp/frontend/emptyState/webScriptsEmptyState'+import { DataPipelinesHogFunctions } from './DataPipelinesHogFunctions'import { webScriptsSceneLogic } from './webScriptsSceneLogic'@@ -22,6 +24,7 @@ export const scene: SceneExport = {component: WebScriptsScene,logic: webScriptsSceneLogic,productKey: ProductKey.SITE_APPS,+ emptyState: webScriptsEmptyState,}export function WebScriptsScene(): JSX.Element {diff --git a/frontend/src/scenes/experiments/Experiments.tsx b/frontend/src/scenes/experiments/Experiments.tsxindex 6682155b050b..26204549f040 100644--- a/frontend/src/scenes/experiments/Experiments.tsx+++ b/frontend/src/scenes/experiments/Experiments.tsx@@ -3,14 +3,11 @@ import { useActions, useValues } from 'kea'import { router } from 'kea-router'import { useState } from 'react'-import * as experimentPng from '@posthog/brand/hoggies/png/experiment'import { LemonInput, LemonSelect, LemonTag, Tooltip, lemonToast } from '@posthog/lemon-ui'-import { pngHoggie } from 'lib/brand/hoggies'import { AccessControlAction } from 'lib/components/AccessControlAction'import { ActivityLog } from 'lib/components/ActivityLog/ActivityLog'import { MemberMultiSelect } from 'lib/components/MemberMultiSelect'-import { ProductIntroduction } from 'lib/components/ProductIntroduction/ProductIntroduction'import { Shortcut } from 'lib/components/Shortcuts/Shortcut'import { keyBinds } from 'lib/components/Shortcuts/shortcuts'import { FEATURE_FLAGS } from 'lib/constants'@@ -49,6 +46,8 @@ import {ExperimentsTabs,} from '~/types'+import { experimentsEmptyState } from 'products/experiments/frontend/emptyState/experimentsEmptyState'+import { CONCLUSION_DISPLAY_CONFIG } from './constants'import { CopyExperimentToProjectModal } from './CopyExperimentToProjectModal'import { DuplicateExperimentModal } from './DuplicateExperimentModal'@@ -67,17 +66,13 @@ import { StatusTag } from './ExperimentView/StatusTag'import { Holdouts } from './Holdouts'import { SharedMetrics } from './SharedMetrics/SharedMetrics'-const HedgehogExperiment = pngHoggie(experimentPng)-export const scene: SceneExport = {component: Experiments,logic: experimentsLogic,productKey: ProductKey.EXPERIMENTS,+ emptyState: experimentsEmptyState,}-export const EXPERIMENTS_PRODUCT_DESCRIPTION =- 'Experiments help you test changes to your product to see which changes will lead to optimal results. Automatic statistical calculations let you see if the results are valid or due to chance.'-// Component for the survey button using QuickSurveyModalconst ExperimentSurveyButton = ({experiment,@@ -206,7 +201,7 @@ const ExperimentsTable = ({openSurveyModal: (experiment: Experiment) => voidopenCopyToProjectModal: (experiment: Experiment) => void}): JSX.Element => {- const { currentProjectId, experiments, experimentsLoading, tab, shouldShowEmptyState, filters, count, pagination } =+ const { currentProjectId, experiments, experimentsLoading, filters, count, pagination } =useValues(experimentsLogic)const { loadExperiments, archiveExperiment, unarchiveExperiment, setExperimentsFilters } =useActions(experimentsLogic)@@ -501,25 +496,6 @@ const ExperimentsTable = ({return (<SceneContent>- {tab === ExperimentsTabs.All && (- <AccessControlAction- resourceType={AccessControlResourceType.Experiment}- minAccessLevel={AccessControlLevel.Editor}- >- <ProductIntroduction- productName="Experiments"- productKey={ProductKey.EXPERIMENTS}- thingName="experiment"- description={EXPERIMENTS_PRODUCT_DESCRIPTION}- docsURL="https://posthog.com/docs/experiments"- action={() => router.actions.push(urls.experiment('new'))}- isEmpty={shouldShowEmptyState}- customHog={HedgehogExperiment}- className="my-0"- mcpSurfaceKey="experiments.create"- />- </AccessControlAction>- )}<ExperimentsTableFilters filters={filters} onFiltersChange={setExperimentsFilters} /><LemonDivider className="my-0" />{count ? (diff --git a/frontend/src/scenes/experiments/experimentsLogic.test.ts b/frontend/src/scenes/experiments/experimentsLogic.test.tsindex 119291b7a397..31ee68296891 100644--- a/frontend/src/scenes/experiments/experimentsLogic.test.ts+++ b/frontend/src/scenes/experiments/experimentsLogic.test.ts@@ -490,25 +490,6 @@ describe('experimentsLogic', () => {})describe('selectors', () => {- it('calculates shouldShowEmptyState correctly', () => {- logic.actions.setExperimentsFilters({- search: undefined,- status: 'all',- page: 1,- created_by_id: undefined,- order: undefined,- })- logic.actions.loadExperimentsSuccess({ results: [], count: 0 })-- expect(logic.values.shouldShowEmptyState).toBe(true)-- logic.actions.loadExperimentsSuccess({ results: [mockExperiment], count: 1 })- expect(logic.values.shouldShowEmptyState).toBe(false)-- logic.actions.setExperimentsFilters({ search: 'test' })- expect(logic.values.shouldShowEmptyState).toBe(false)- })-it('calculates pagination correctly', () => {logic.actions.setExperimentsFilters({ page: 2 })logic.actions.loadExperimentsSuccess({ results: [], count: 150 })diff --git a/frontend/src/scenes/experiments/experimentsLogic.ts b/frontend/src/scenes/experiments/experimentsLogic.tsindex 6fb5a64d8679..8c204971da27 100644--- a/frontend/src/scenes/experiments/experimentsLogic.ts+++ b/frontend/src/scenes/experiments/experimentsLogic.ts@@ -6,7 +6,6 @@ import { LemonTagType, PaginationManual } from '@posthog/lemon-ui'import api, { CountedPaginatedResponse } from 'lib/api'import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'-import { objectsEqual } from 'lib/utils/objects'import { parseNumericArrayFilter, toParams } from 'lib/utils/url'import { FLAGS_PER_PAGE, type FeatureFlagsResult, featureFlagsLogic } from 'scenes/feature-flags/featureFlagsLogic'import { projectLogic } from 'scenes/projectLogic'@@ -191,7 +190,6 @@ export interface experimentsLogicValues {search?: string | undefinedstatus?: ExperimentStatus | 'all' | undefined}- shouldShowEmptyState: booleansidePanelContext: SidePanelSceneContexttab: ExperimentsTabsunavailableFeatureFlagKeys: Set<string>@@ -515,11 +513,6 @@ export interface experimentsLogicMeta {},featureFlagModalPageFromURL: number) => PaginationManual- shouldShowEmptyState: (- experimentsLoading: boolean,- experiments: ExperimentsResult,- filters: ExperimentsFilters- ) => booleanpagination: (filters: ExperimentsFilters, count: number) => PaginationManualunavailableFeatureFlagKeys: (featureFlags: FeatureFlagsResult, experiments: ExperimentsResult) => Set<string>}@@ -839,16 +832,6 @@ export const experimentsLogic = kea<experimentsLogicType>([}},],- shouldShowEmptyState: [- (s) => [s.experimentsLoading, s.experiments, s.filters],- (experimentsLoading: boolean, experiments: ExperimentsResult, filters: ExperimentsFilters): boolean => {- return (- !experimentsLoading &&- (experiments.results?.length ?? 0) === 0 &&- objectsEqual(filters, DEFAULT_FILTERS)- )- },- ],pagination: [(s) => [s.filters, s.count],(filters: ExperimentsFilters, count: number): PaginationManual => {diff --git a/frontend/src/scenes/feature-flags/FeatureFlags.tsx b/frontend/src/scenes/feature-flags/FeatureFlags.tsxindex ceb098b03b54..4cf2a6335a57 100644--- a/frontend/src/scenes/feature-flags/FeatureFlags.tsx+++ b/frontend/src/scenes/feature-flags/FeatureFlags.tsx@@ -1,5 +1,5 @@import { useActions, useValues } from 'kea'-import { combineUrl, router } from 'kea-router'+import { combineUrl } from 'kea-router'import { useEffect, useRef, useState } from 'react'import { IconArchive, IconLock, IconPlusSmall, IconTrash } from '@posthog/icons'@@ -9,9 +9,7 @@ import api from 'lib/api'import { AccessControlAction } from 'lib/components/AccessControlAction'import { ActivityLog } from 'lib/components/ActivityLog/ActivityLog'import { BulkUpdateTagsButton } from 'lib/components/BulkActions/BulkUpdateTagsButton'-import { FeatureFlagHog } from 'lib/components/hedgehogs'import { ObjectTags } from 'lib/components/ObjectTags/ObjectTags'-import { ProductIntroduction } from 'lib/components/ProductIntroduction/ProductIntroduction'import PropertyFiltersDisplay from 'lib/components/PropertyFilters/components/PropertyFiltersDisplay'import { Shortcut } from 'lib/components/Shortcuts/Shortcut'import { keyBinds } from 'lib/components/Shortcuts/shortcuts'@@ -40,7 +38,6 @@ import { Scene, SceneExport } from 'scenes/sceneTypes'import { QuickSurveyType } from 'scenes/surveys/quick-create/types'import { QuickSurveyModal } from 'scenes/surveys/QuickSurveyModal'import { urls } from 'scenes/urls'-import { userLogic } from 'scenes/userLogic'import { SceneContent } from '~/layout/scenes/components/SceneContent'import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'@@ -57,6 +54,8 @@ import {FeatureFlagType,} from '~/types'+import { featureFlagsEmptyState } from 'products/feature_flags/frontend/emptyState/featureFlagsEmptyState'+import { ApprovalsPromoBanner } from './ApprovalsPromoBanner'import { BulkCopyFlagsModal, BulkCopyToProjectsButton } from './BulkCopyFlagsModal'import { BulkDeleteResultsModal } from './BulkDeleteResultsModal'@@ -342,6 +341,7 @@ export const scene: SceneExport = {component: FeatureFlags,logic: featureFlagsLogic,productKey: ProductKey.FEATURE_FLAGS,+ emptyState: featureFlagsEmptyState,}const RUNTIME_LABELS: Record<FeatureFlagEvaluationRuntime, string> = {@@ -360,14 +360,11 @@ export function OverviewTab({nouns?: [string, string]}): JSX.Element {const { aggregationLabel } = useValues(groupsModel)- const { user } = useValues(userLogic)const flagLogic = featureFlagsLogic({ flagPrefix })const { featureFlagsLoading, displayedFlags, pagination, filters, shouldShowEmptyState, filtersChanged } =useValues(flagLogic)const { setFeatureFlagsFilters } = useActions(flagLogic)- const newFeatureFlagUrl = urls.featureFlagTemplates()- const isProductIntroVisible = shouldShowEmptyState || !user?.has_seen_product_intro_for?.[ProductKey.FEATURE_FLAGS]const { currentProjectId } = useValues(projectLogic)const { currentOrganization } = useValues(organizationLogic)@@ -558,19 +555,7 @@ export function OverviewTab({return (<SceneContent>- <ProductIntroduction- productName="Feature flags"- productKey={ProductKey.FEATURE_FLAGS}- thingName="feature flag"- description="Use feature flags to safely deploy and roll back new features in an easy-to-manage way. Roll variants out to certain groups, a percentage of users, or everyone all at once."- docsURL="https://posthog.com/docs/feature-flags/manual"- action={() => router.actions.push(newFeatureFlagUrl)}- isEmpty={shouldShowEmptyState}- customHog={FeatureFlagHog}- className={cn('my-0')}- mcpSurfaceKey="feature_flags.create"- />- {!isProductIntroVisible && <ApprovalsPromoBanner />}+ {!shouldShowEmptyState && <ApprovalsPromoBanner />}<PendingApprovalsBanner /><div>{filtersSection}</div><BulkDeleteResultsModal />diff --git a/frontend/src/scenes/product-tours/ProductTours.tsx b/frontend/src/scenes/product-tours/ProductTours.tsxindex de009a0cdc42..02bf10ee1f13 100644--- a/frontend/src/scenes/product-tours/ProductTours.tsx+++ b/frontend/src/scenes/product-tours/ProductTours.tsx@@ -14,6 +14,8 @@ import { SceneContent } from '~/layout/scenes/components/SceneContent'import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'import { ProductKey } from '~/queries/schema/schema-general'+import { productToursEmptyState } from 'products/product_tours/frontend/emptyState/productToursEmptyState'+import { NewProductTourModal } from './components/NewProductTourModal'import { ProductToursTable } from './components/ProductToursTable'import { ProductToursTabs, productToursLogic } from './productToursLogic'@@ -22,6 +24,7 @@ export const scene: SceneExport = {component: ProductTours,logic: productToursLogic,productKey: ProductKey.PRODUCT_TOURS,+ emptyState: productToursEmptyState,}function NewTourButton(): JSX.Element {diff --git a/frontend/src/scenes/product-tours/productToursLogic.ts b/frontend/src/scenes/product-tours/productToursLogic.tsindex 05d285eaa57e..bc9e08334392 100644--- a/frontend/src/scenes/product-tours/productToursLogic.ts+++ b/frontend/src/scenes/product-tours/productToursLogic.ts@@ -199,7 +199,7 @@ function createDefaultBannerContent(): ProductTourContent {}}-function createDefaultTourContent(): ProductTourContent {+export function createDefaultTourContent(): ProductTourContent {return {type: 'tour',steps: [@@ -249,6 +249,7 @@ export interface ProductToursFilters {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface productToursLogicValues {breadcrumbs: Breadcrumb[]+ creating: booleanduplicatedProductTour: ProductTour | nullduplicatedProductTourLoading: booleanfilteredProductTours: ProductTour[]@@ -325,6 +326,9 @@ export interface productToursLogicActions {productTours: ProductTour[]payload?: any}+ setCreating: (creating: boolean) => {+ creating: boolean+ }setFilters: (filters: Partial<ProductToursFilters>) => {filters: Partial<ProductToursFilters>}@@ -386,6 +390,7 @@ export const productToursLogic = kea<productToursLogicType>([createAnnouncement: (name: string) => ({ name }),createBanner: (name: string) => ({ name }),createTour: (name: string) => ({ name }),+ setCreating: (creating: boolean) => ({ creating }),}),loaders(({ values, actions }) => ({productTours: {@@ -466,8 +471,16 @@ export const productToursLogic = kea<productToursLogicType>([setFilters: (state, { filters }) => ({ ...state, ...filters }),},],+ // Every create route lands on the editor, so a second click before the first+ // response would leave a stray tour behind.+ creating: [+ false,+ {+ setCreating: (_, { creating }) => creating,+ },+ ],}),- listeners(({ actions }) => ({+ listeners(({ actions, values }) => ({setSearchTerm: async (_, breakpoint) => {await breakpoint(250)actions.loadProductTours()@@ -479,6 +492,10 @@ export const productToursLogic = kea<productToursLogicType>([router.actions.push(urls.productTours())},createAnnouncement: async ({ name }) => {+ if (values.creating) {+ return+ }+ actions.setCreating(true)try {const announcement = await api.productTours.create({name,@@ -493,9 +510,15 @@ export const productToursLogic = kea<productToursLogicType>([router.actions.push(urls.productTour(announcement.id, 'edit=true'))} catch {lemonToast.error('Failed to create announcement')+ } finally {+ actions.setCreating(false)}},createBanner: async ({ name }) => {+ if (values.creating) {+ return+ }+ actions.setCreating(true)try {const banner = await api.productTours.create({name,@@ -510,9 +533,15 @@ export const productToursLogic = kea<productToursLogicType>([router.actions.push(urls.productTour(banner.id, 'edit=true'))} catch {lemonToast.error('Failed to create banner')+ } finally {+ actions.setCreating(false)}},createTour: async ({ name }) => {+ if (values.creating) {+ return+ }+ actions.setCreating(true)try {const tour = await api.productTours.create({name,@@ -527,6 +556,8 @@ export const productToursLogic = kea<productToursLogicType>([router.actions.push(urls.productTour(tour.id, 'edit=true'))} catch {lemonToast.error('Failed to create tour')+ } finally {+ actions.setCreating(false)}},loadProductToursSuccess: () => {diff --git a/frontend/src/scenes/scenes.ts b/frontend/src/scenes/scenes.tsindex 4ac34a13b503..f1aa7ee07413 100644--- a/frontend/src/scenes/scenes.ts+++ b/frontend/src/scenes/scenes.ts@@ -516,6 +516,7 @@ export const sceneConfigurations: Record<Scene | string, SceneConfig> = {projectBased: true,name: 'Product tours',description: 'Guide users through your product with interactive tours',+ iconType: 'product_tour',},[Scene.ProductTour]: {projectBased: true,diff --git a/frontend/src/styles/base.scss b/frontend/src/styles/base.scssindex 0ef684d66980..baf3212ffb6d 100644--- a/frontend/src/styles/base.scss+++ b/frontend/src/styles/base.scss@@ -311,12 +311,13 @@// Product specific colors--color-product-data-pipeline-light: rgb(46 162 211);+ --color-product-data-pipeline-dark: rgb(84 189 235);--color-product-product-analytics-light: rgb(47 128 250);--color-product-workflows-light: rgb(47 128 250);--color-product-web-analytics-light: rgb(52 175 102);--color-product-web-analytics-dark: rgb(54 196 111); // original color- --color-product-embedded-analytics-light: rgb(243 153 109);- --color-product-embedded-analytics-dark: rgb(250 158 120);+ --color-product-endpoints-light: rgb(243 153 109);+ --color-product-endpoints-dark: rgb(250 158 120);--color-product-session-replay-light: rgb(235 162 18);--color-product-session-replay-dark: rgb(247 165 1);--color-product-heatmaps-light: rgb(220 152 16);@@ -329,6 +330,8 @@--color-product-error-tracking-light: rgb(211 148 24);--color-product-error-tracking-dark: rgb(247 165 1);--color-product-surveys-light: rgb(243 84 84);+ --color-product-product-tours-light: rgb(243 84 84);+ --color-product-product-tours-dark: rgb(248 121 121);--color-product-data-warehouse-light: rgb(133 103 255);--color-product-llm-analytics-light: rgb(182 42 217);--color-product-llm-analytics-dark: rgb(212 106 240);@@ -340,6 +343,7 @@--color-product-mcp-analytics-light: rgb(205 48 180);--color-product-mcp-analytics-dark: rgb(229 105 205);--color-product-links-light: rgb(143 7 255);+ --color-product-links-dark: rgb(178 92 255);--color-product-tracing-light: rgb(6 182 212);--color-product-tracing-dark: rgb(34 211 238);--color-product-metrics-light: rgb(234 88 12);@@ -347,11 +351,20 @@--color-product-revenue-analytics-light: rgb(52 175 102);--color-product-revenue-analytics-dark: rgb(54 196 111);--color-product-user-interviews-light: rgb(0 140 255);+ --color-product-user-interviews-dark: rgb(77 171 255);--color-product-dashboards-light: rgb(255 139 7);--color-product-early-access-features-light: rgb(39 171 151);--color-product-early-access-features-dark: rgb(53 213 189);--color-product-support-light: rgb(243 84 84);--color-product-support-dark: rgb(247 165 1);+ --color-product-visual-review-light: rgb(101 163 13);+ --color-product-visual-review-dark: rgb(163 230 53);+ --color-product-actions-light: rgb(47 128 250);+ --color-product-actions-dark: rgb(96 165 250);+ --color-product-cohorts-light: rgb(13 148 136);+ --color-product-cohorts-dark: rgb(45 212 191);+ --color-product-activity-light: rgb(225 29 72);+ --color-product-activity-dark: rgb(251 113 133);// Generic brand color assignments// Change these to change the brand colorsdiff --git a/playwright/e2e/early-access-management.spec.ts b/playwright/e2e/early-access-management.spec.tsindex ad6c234595aa..918dac0445e0 100644--- a/playwright/e2e/early-access-management.spec.ts+++ b/playwright/e2e/early-access-management.spec.ts@@ -20,8 +20,10 @@ test.describe('Early Access Management', () => {await expect(page.locator('h1')).toContainText('Early access features')await expect(page).toHaveTitle('Early access features • PostHog')- // go to create a new feature- await page.getByRole('link', { name: 'New feature' }).click()+ // go to create a new feature. This workspace has no features, so the scene renders its+ // setup empty state instead of the list; the create button on both carries this attr,+ // while their labels differ.+ await page.locator('[data-attr="create-feature"]').click()// cancel new featureawait page.locator('[data-attr="cancel-feature"]').click()@@ -30,7 +32,7 @@ test.describe('Early Access Management', () => {const name = randomString('test-feature')// set feature name & description- await page.getByRole('link', { name: 'New feature' }).click()+ await page.locator('[data-attr="create-feature"]').click()await page.click('[data-attr="scene-title-textarea"]')await page.locator('[data-attr="scene-title-textarea"]').pressSequentially(name)await delay(1000)diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 89f73ce8c12c..8d44925d0d17 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -668,6 +668,9 @@ importers:'@posthog/products-canvas':specifier: workspace:*version: link:../products/canvas+ '@posthog/products-cdp':+ specifier: workspace:*+ version: link:../products/cdp'@posthog/products-cohorts':specifier: workspace:*version: link:../products/cohorts@@ -767,6 +770,9 @@ importers:'@posthog/products-product-analytics':specifier: workspace:*version: link:../products/product_analytics+ '@posthog/products-product-tours':+ specifier: workspace:*+ version: link:../products/product_tours'@posthog/products-pulse':specifier: workspace:*version: link:../products/pulse@@ -2588,7 +2594,33 @@ importers:specifier: ^29.7.0version: 29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))- products/cdp: {}+ products/cdp:+ dependencies:+ '@posthog/brand':+ specifier: 'catalog:'+ version: 0.9.1([email protected])+ '@posthog/icons':+ specifier: 'catalog:'+ '@types/react':+ specifier: 18.3.27+ version: 18.3.27+ clsx:+ specifier: '*'+ version: 2.1.1+ kea:+ specifier: 'catalog:'+ version: 4.0.0-pre.6(patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected])+ kea-loaders:+ specifier: 'catalog:'+ version: 3.1.1([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))+ react:+ specifier: 18.3.1+ version: 18.3.1+ devDependencies:+ kea-test-utils:+ specifier: 'catalog:'+ version: 0.2.4([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))products/cohorts:dependencies:@@ -2626,6 +2658,9 @@ importers:products/conversations:dependencies:+ '@posthog/brand':+ specifier: 'catalog:'+ version: 0.9.1([email protected])'@posthog/icons':specifier: 'catalog:'@@ -2977,6 +3012,9 @@ importers:products/early_access_features:dependencies:+ '@posthog/brand':+ specifier: 'catalog:'+ version: 0.9.1([email protected])'@posthog/icons':specifier: 'catalog:'@@ -3014,6 +3052,9 @@ importers:products/endpoints:dependencies:+ '@posthog/brand':+ specifier: 'catalog:'+ version: 0.9.1([email protected])'@posthog/icons':specifier: 'catalog:'@@ -3051,6 +3092,9 @@ importers:'@storybook/react':specifier: 'catalog:'version: 10.4.6(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])([email protected](@testing-library/[email protected])(@types/[email protected])([email protected])([email protected]([email protected]))([email protected]))([email protected])+ kea-test-utils:+ specifier: 'catalog:'+ version: 0.2.4([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))products/engineering_analytics:dependencies:@@ -3181,6 +3225,9 @@ importers:products/experiments:dependencies:+ '@posthog/brand':+ specifier: 'catalog:'+ version: 0.9.1([email protected])'@posthog/icons':specifier: 'catalog:'@@ -3209,11 +3256,17 @@ importers:'@storybook/react':specifier: 'catalog:'version: 10.4.6(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])([email protected](@testing-library/[email protected])(@types/[email protected])([email protected])([email protected]([email protected]))([email protected]))([email protected])+ kea-test-utils:+ specifier: 'catalog:'+ version: 0.2.4([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))products/exports: {}products/feature_flags:dependencies:+ '@posthog/brand':+ specifier: 'catalog:'+ version: 0.9.1([email protected])'@posthog/icons':specifier: 'catalog:'@@ -3389,6 +3442,9 @@ importers:products/links:dependencies:+ '@posthog/brand':+ specifier: 'catalog:'+ version: 0.9.1([email protected])'@posthog/icons':specifier: 'catalog:'@@ -3419,6 +3475,10 @@ importers:react:specifier: 18.3.1version: 18.3.1+ devDependencies:+ kea-test-utils:+ specifier: 'catalog:'+ version: 0.2.4([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))products/live_debugger:dependencies:@@ -3902,7 +3962,36 @@ importers:specifier: 'catalog:'version: 0.2.4([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))- products/product_tours: {}+ products/product_tours:+ dependencies:+ '@posthog/brand':+ specifier: 'catalog:'+ version: 0.9.1([email protected])+ '@posthog/icons':+ specifier: 'catalog:'+ '@types/react':+ specifier: 18.3.27+ version: 18.3.27+ clsx:+ specifier: '*'+ version: 2.1.1+ kea:+ specifier: 'catalog:'+ version: 4.0.0-pre.6(patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected])+ kea-loaders:+ specifier: 'catalog:'+ version: 3.1.1([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))+ kea-router:+ specifier: 'catalog:'+ version: 3.4.1([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))+ react:+ specifier: 18.3.1+ version: 18.3.1+ devDependencies:+ kea-test-utils:+ specifier: 'catalog:'+ version: 0.2.4([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))products/pulse:dependencies:@@ -4155,6 +4244,9 @@ importers:products/skills:dependencies:+ '@posthog/brand':+ specifier: 'catalog:'+ version: 0.9.1([email protected])'@posthog/icons':specifier: 'catalog:'@@ -4465,6 +4557,10 @@ importers:typescript:specifier: 6.0.3version: 6.0.3+ devDependencies:+ kea-test-utils:+ specifier: 'catalog:'+ version: 0.2.4([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))products/visual_review:dependencies:@@ -22317,8 +22413,8 @@ packages:resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==}engines: {node: '>= 10.0.0'}- resolution: {integrity: sha512-WFC/WPjFGtL7VVMw4qLM3DS5vUxWfMkZShqxFFJhWbdwrdnNnmK9Qa/S40Xo5vD4XYI4TtRqPzzgAXUjHo+7jg==}+ resolution: {integrity: sha512-iU/pjRpXmUk220qcnG/j9OYbw7CuNViAR2NtO0ccatyuDzVkSx6SJMAb+UPO4uRzOxOTrmjVbmrs8ZRob+lBWQ==}resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==}@@ -23141,14 +23237,14 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7react: 18.3.1react-dom: 18.3.1([email protected])dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7'@emotion/hash': 0.8.0'@emotion/unitless': 0.7.5classnames: 2.5.1@@ -23160,7 +23256,7 @@ snapshots:'@ant-design/[email protected]':dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7'@ant-design/[email protected]': {}@@ -23168,7 +23264,7 @@ snapshots:dependencies:'@ant-design/colors': 7.2.1'@ant-design/icons-svg': 4.4.2- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1react: 18.3.1@@ -23176,7 +23272,7 @@ snapshots:'@ant-design/[email protected]([email protected])':dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1json2mq: 0.2.0react: 18.3.1@@ -30206,12 +30302,12 @@ snapshots:'@rc-component/[email protected]':dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7dependencies:'@ant-design/fast-color': 2.0.6- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1react: 18.3.1@@ -30219,18 +30315,18 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7react: 18.3.1react-dom: 18.3.1([email protected])'@rc-component/[email protected]':dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1react: 18.3.1@@ -30238,7 +30334,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1react: 18.3.1@@ -30246,14 +30342,14 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1react: 18.3.1react-dom: 18.3.1([email protected])dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -30263,7 +30359,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -33682,7 +33778,7 @@ snapshots:'@ant-design/fast-color': 2.0.6'@ant-design/react-slick': 1.1.2([email protected])- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7@@ -42424,7 +42520,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42434,7 +42530,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1react: 18.3.1@@ -42442,7 +42538,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42451,7 +42547,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42461,7 +42557,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42471,7 +42567,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42480,7 +42576,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7'@rc-component/async-validator': 5.1.0react: 18.3.1@@ -42488,7 +42584,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42499,7 +42595,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7'@rc-component/mini-decimal': 1.1.3classnames: 2.5.1@@ -42509,7 +42605,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1react: 18.3.1@@ -42517,7 +42613,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42529,7 +42625,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42540,7 +42636,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1react: 18.3.1@@ -42548,7 +42644,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42557,7 +42653,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42566,7 +42662,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1react: 18.3.1@@ -42574,7 +42670,7 @@ snapshots:[email protected]([email protected])([email protected](patch_hash=2e3e09d22bbc20d8961e0392c318f12ffada0babb6422f03b5538af8b2707852))([email protected])([email protected])([email protected]([email protected]))([email protected]):dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42590,7 +42686,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1react: 18.3.1@@ -42598,7 +42694,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1react: 18.3.1@@ -42606,7 +42702,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1react: 18.3.1@@ -42615,7 +42711,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42624,7 +42720,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42636,7 +42732,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1react: 18.3.1@@ -42644,7 +42740,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1react: 18.3.1@@ -42652,7 +42748,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1react: 18.3.1@@ -42660,7 +42756,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42671,7 +42767,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42683,7 +42779,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42693,7 +42789,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42702,7 +42798,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42712,7 +42808,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42722,7 +42818,7 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1react: 18.3.1@@ -42730,14 +42826,14 @@ snapshots:dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7react: 18.3.1react-dom: 18.3.1([email protected])react-is: 18.3.1dependencies:- '@babel/runtime': 7.29.2+ '@babel/runtime': 7.29.7classnames: 2.5.1@@ -42815,7 +42911,7 @@ snapshots:dependencies:react: 18.3.1- unlayer-types: 1.467.0+ unlayer-types: 1.468.0dependencies:@@ -45128,7 +45224,7 @@ snapshots:- [email protected]: {}+ [email protected]: {}diff --git a/products/actions/manifest.tsx b/products/actions/manifest.tsxindex a4eef62e4286..80ef0553d2d0 100644--- a/products/actions/manifest.tsx+++ b/products/actions/manifest.tsx@@ -52,7 +52,10 @@ export const manifest: ProductManifest = {href: (ref: string) => urls.action(ref),filterKey: 'action',iconType: 'action' as FileSystemIconType,- iconColor: ['var(--color-product-actions-light)'] as FileSystemIconColor,+ iconColor: [+ 'var(--color-product-actions-light)',+ 'var(--color-product-actions-dark)',+ ] as FileSystemIconColor,},},treeItemsNew: [@@ -61,7 +64,10 @@ export const manifest: ProductManifest = {path: 'Action',href: urls.createAction(),iconType: 'action' as FileSystemIconType,- iconColor: ['var(--color-product-actions-light)'] as FileSystemIconColor,+ iconColor: [+ 'var(--color-product-actions-light)',+ 'var(--color-product-actions-dark)',+ ] as FileSystemIconColor,},],treeItemsMetadata: [diff --git a/products/ai_observability/frontend/emptyState/LLMPromptPreview.scss b/products/ai_observability/frontend/emptyState/LLMPromptPreview.scssnew file mode 100644index 000000000000..a58195f00013--- /dev/null+++ b/products/ai_observability/frontend/emptyState/LLMPromptPreview.scss@@ -0,0 +1,348 @@+@import '../../../../frontend/src/lib/components/ProductEmptyState/previewMixins';++.PromptPreview {+ --prompt-preview-accent: var(--empty-state-accent, var(--color-primary-500));++ display: flex;+ flex-direction: column;+ gap: 0.75rem;++ // Hidden served-version state. Direct children of .PromptPreview so `:checked ~` reaches all cards.+ &__radio {+ position: absolute;+ width: 0;+ height: 0;+ pointer-events: none;+ opacity: 0;+ }++ &__panel,+ &__code,+ &__spark {+ overflow: hidden;+ background: var(--color-bg-surface-primary);+ border: 1px solid var(--color-border-primary);+ border-radius: var(--radius);+ }++ // Version pairs are stacked on one grid cell and crossfaded, so promoting never+ // changes any element's size (no layout shift).+ &__swap {+ display: grid;+ }++ &__swap > * {+ grid-area: 1 / 1;+ min-width: 0;+ }++ &__when-v4 {+ @include preview-swap-hidden;+ }++ &__when-v3 {+ @include preview-swap-visible;+ }++ &__head {+ display: flex;+ gap: 0.5rem;+ align-items: center;+ padding: 0.5rem 0.75rem;+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__name {+ font-family: var(--font-mono);+ font-size: 0.75rem;+ font-weight: 600;+ }++ &__versions {+ margin-right: auto;+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ }++ &__rows {+ display: flex;+ flex-direction: column;+ padding: 0.25rem 0.5rem;+ }++ &__row {+ display: flex;+ gap: 0.5rem;+ align-items: center;+ padding: 0.4375rem 0.5rem;+ border: 1px solid transparent;+ border-radius: var(--radius);+ transition:+ background-color 150ms ease,+ border-color 150ms ease;+ }++ &__row--v3,+ &__row--v4 {+ cursor: pointer;+ user-select: none;+ }++ &__row--v3:hover,+ &__row--v4:hover {+ background: var(--color-bg-fill-highlight-50);+ }++ &__row--past {+ opacity: 0.6;+ }++ // Radio dots make the version rows read as selectable.+ &__vradio {+ position: relative;+ flex-shrink: 0;+ width: 12px;+ height: 12px;+ border: 1.5px solid var(--prompt-preview-accent);+ border-radius: 50%;++ &::after {+ position: absolute;+ inset: 2px;+ content: '';+ background: var(--prompt-preview-accent);+ border-radius: 50%;+ transition: transform 150ms ease;+ transform: scale(0);+ }+ }++ &__vradio--past {+ border-color: var(--color-text-tertiary);+ }++ &__version {+ min-width: 1.375rem;+ font-family: var(--font-mono);+ font-size: 0.75rem;+ font-weight: 600;+ }++ &__message {+ overflow: hidden;+ font-size: 0.75rem;+ color: var(--color-text-secondary);+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ // Fixed-width label column, so the production chip moving rows never reflows the list.+ &__chip-slot {+ min-width: 4.75rem;+ margin-left: auto;+ }++ &__chip {+ justify-self: end;+ padding: 0 0.375rem;+ font-family: var(--font-mono);+ font-size: 0.625rem;+ font-weight: 700;+ background: color-mix(in oklab, var(--prompt-preview-accent) 12%, transparent);+ border-radius: 999px;++ @include preview-accent-text(var(--prompt-preview-accent));+ }++ &__hint {+ padding: 0 0.75rem 0.625rem;+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ }++ // Editor chrome for the runtime-fetch card.+ &__code-head {+ display: flex;+ gap: 0.3125rem;+ align-items: center;+ padding: 0.4375rem 0.75rem;+ background: var(--color-bg-surface-secondary);+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__code-dot {+ width: 7px;+ height: 7px;+ background: var(--color-fill-secondary);+ border-radius: 50%;+ }++ &__code-file {+ margin-left: 0.375rem;+ font-family: var(--font-mono);+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ }++ &__code-body {+ display: flex;+ flex-direction: column;+ gap: 0.625rem;+ padding: 0.75rem 0.875rem;+ }++ &__code-line {+ font-family: var(--font-mono);+ font-size: 0.6875rem;+ line-height: 1.5;+ color: var(--color-text-primary);+ }++ &__kw {+ @include preview-accent-text(var(--prompt-preview-accent));+ }++ &__fn {+ font-weight: 600;+ }++ &__str {+ color: var(--color-text-secondary);+ }++ // What the app fetched at runtime. Both bodies stay stacked, so the block never resizes.+ &__fetched {+ padding: 0.5rem 0.625rem;+ background: var(--color-bg-surface-secondary);+ border: 1px solid var(--color-border-primary);+ border-radius: var(--radius);+ }++ &__fetched-body {+ display: flex;+ gap: 0.5rem;+ align-items: baseline;+ }++ &__fetched-version {+ flex-shrink: 0;+ font-family: var(--font-mono);+ font-size: 0.625rem;+ font-weight: 700;+ color: var(--color-text-tertiary);+ }++ &__fetched-version--live {+ @include preview-accent-text(var(--prompt-preview-accent));+ }++ &__fetched-text {+ font-size: 0.6875rem;+ font-style: italic;+ color: var(--color-text-secondary);+ }++ // Fetch stat card, showing which version production traffic gets.+ &__spark {+ padding: 0.75rem 0.875rem 0.875rem;+ }++ &__spark-label {+ font-family: var(--font-mono);+ font-size: 0.6875rem;+ font-weight: 600;+ color: var(--color-text-tertiary);+ }++ &__spark-label--live {+ @include preview-accent-text(var(--prompt-preview-accent));+ }++ &__spark-chart {+ margin-top: 0.5rem;+ }++ &__spark-area {+ fill: color-mix(in oklab, var(--prompt-preview-accent) 13%, transparent);+ stroke: none;+ }++ &__spark-line {+ fill: none;+ stroke: color-mix(in oklab, var(--prompt-preview-accent) 32%, transparent);+ stroke-width: 2;+ }++ // The moving bit: a short bright segment cycling along the line.+ &__spark-trace {+ fill: none;+ stroke: var(--prompt-preview-accent);+ stroke-dasharray: 16 84;+ stroke-linecap: round;+ stroke-width: 2;+ animation: PromptPreview__trace 3.2s linear infinite;+ }++ @include preview-sparkline;+}++// Served-version state, driven purely by the hidden radios. v4 checked shows the+// `when-v4` layer everywhere; v3 (the default) shows `when-v3`.++#prompt-preview-v4:checked ~ * .PromptPreview__when-v4 {+ @include preview-swap-visible;+}++#prompt-preview-v4:checked ~ * .PromptPreview__when-v3 {+ @include preview-swap-hidden;+}++// Selected version row, mirroring the radio dot.+#prompt-preview-v3:checked ~ .PromptPreview__panel .PromptPreview__row--v3,+#prompt-preview-v4:checked ~ .PromptPreview__panel .PromptPreview__row--v4 {+ background: color-mix(in oklab, var(--prompt-preview-accent) 8%, transparent);+ border-color: color-mix(in oklab, var(--prompt-preview-accent) 40%, transparent);+}++#prompt-preview-v3:checked ~ .PromptPreview__panel .PromptPreview__vradio--v3::after,+#prompt-preview-v4:checked ~ .PromptPreview__panel .PromptPreview__vradio--v4::after {+ transform: scale(1);+}++// The radios stay keyboard-focusable while visually hidden, so the version row they+// label needs a visible focus indicator (WCAG 2.4.7).+#prompt-preview-v3:focus-visible ~ .PromptPreview__panel .PromptPreview__row--v3,+#prompt-preview-v4:focus-visible ~ .PromptPreview__panel .PromptPreview__row--v4 {+ outline: 2px solid var(--prompt-preview-accent);+ outline-offset: 1px;+}++// Nudge attention at the newest version's radio until it's been promoted.+.PromptPreview:not(.PromptPreview--static)+ #prompt-preview-v4:not(:checked)+ ~ .PromptPreview__panel+ .PromptPreview__vradio--v4 {+ animation: PromptPreview__nudge 2.4s ease-in-out infinite;+}++@keyframes PromptPreview__nudge {+ 0%,+ 100% {+ box-shadow: 0 0 0 0 color-mix(in oklab, var(--prompt-preview-accent) 45%, transparent);+ }++ 50% {+ box-shadow: 0 0 0 4px color-mix(in oklab, var(--prompt-preview-accent) 20%, transparent);+ }+}++// pathLength is normalized to 100, so the dash offset loops cleanly regardless of length.+@keyframes PromptPreview__trace {+ to {+ stroke-dashoffset: -100;+ }+}++// Storybook snapshots and reduced motion drop all ambient motion; promoting a+// version still works (transitions only).+@include preview-motion-guards('PromptPreview');diff --git a/products/ai_observability/frontend/emptyState/LLMPromptPreview.tsx b/products/ai_observability/frontend/emptyState/LLMPromptPreview.tsxnew file mode 100644index 000000000000..9cee571b1aa5--- /dev/null+++ b/products/ai_observability/frontend/emptyState/LLMPromptPreview.tsx@@ -0,0 +1,141 @@+import './LLMPromptPreview.scss'++import { LemonTag } from 'lib/lemon-ui/LemonTag'+import { cn } from 'lib/utils/css-classes'+import { inStorybook, inStorybookTestRunner } from 'lib/utils/dom'++// Hand-authored rising prompt-fetches series for the stat card sparkline.+const SPARK_LINE = 'M 0 31 L 10 29.5 L 20 30.2 L 30 27 L 40 27.8 L 50 24.5 L 60 25.4 L 70 21 L 80 19.5 L 90 16 L 100 14'+const SPARK_AREA = `${SPARK_LINE} L 100 40 L 0 40 Z`++/**+ * Example-data preview for the prompts empty state: one prompt's version history+ * wired to a mini runtime-fetch card, so promoting the newest version - by picking+ * its row - moves the production label and crossfades the text the app fetches,+ * with no deploy in sight. The whole interaction is two hidden radios driving+ * `:checked ~` styles - no timers or state, per the preview rules in the+ * `building-product-empty-states` skill. Version pairs are stacked in `__swap`+ * grids and crossfaded, so promoting never changes the layout's size.+ */+export function LLMPromptPreview(): JSX.Element {+ const isStatic = inStorybook() || inStorybookTestRunner()++ return (+ <div className={cn('PromptPreview', isStatic && 'PromptPreview--static')}>+ {/* Served-version state, before all three cards so `:checked ~` can style them. */}+ <input+ type="radio"+ name="prompt-preview-version"+ id="prompt-preview-v3"+ defaultChecked+ className="PromptPreview__radio"+ />+ <input type="radio" name="prompt-preview-version" id="prompt-preview-v4" className="PromptPreview__radio" />++ <div className="PromptPreview__panel">+ <div className="PromptPreview__head">+ <span className="PromptPreview__name">support-triage</span>+ <span className="PromptPreview__versions">3 versions</span>+ <LemonTag size="small">example data</LemonTag>+ </div>++ <div className="PromptPreview__rows">+ <label htmlFor="prompt-preview-v4" className="PromptPreview__row PromptPreview__row--v4">+ <span className="PromptPreview__vradio PromptPreview__vradio--v4" aria-hidden="true" />+ <span className="PromptPreview__version">v4</span>+ <span className="PromptPreview__message">Add refund policy context</span>+ <span className="PromptPreview__chip-slot PromptPreview__swap">+ <span className="PromptPreview__chip PromptPreview__when-v4">production</span>+ </span>+ </label>+ <label htmlFor="prompt-preview-v3" className="PromptPreview__row PromptPreview__row--v3">+ <span className="PromptPreview__vradio PromptPreview__vradio--v3" aria-hidden="true" />+ <span className="PromptPreview__version">v3</span>+ <span className="PromptPreview__message">Tighten tone guidelines</span>+ <span className="PromptPreview__chip-slot PromptPreview__swap">+ <span className="PromptPreview__chip PromptPreview__when-v3">production</span>+ </span>+ </label>+ <div className="PromptPreview__row PromptPreview__row--past">+ <span className="PromptPreview__vradio PromptPreview__vradio--past" aria-hidden="true" />+ <span className="PromptPreview__version">v2</span>+ <span className="PromptPreview__message">Initial prompt</span>+ <span className="PromptPreview__chip-slot" />+ </div>+ </div>++ <div className="PromptPreview__hint PromptPreview__swap">+ <span className="PromptPreview__when-v3">Pick v4 to move the production label to it.</span>+ <span className="PromptPreview__when-v4">v4 is live everywhere. No redeploy.</span>+ </div>+ </div>++ <div className="PromptPreview__code">+ <div className="PromptPreview__code-head">+ <span className="PromptPreview__code-dot" />+ <span className="PromptPreview__code-dot" />+ <span className="PromptPreview__code-dot" />+ <span className="PromptPreview__code-file">app/support.ts</span>+ </div>+ <div className="PromptPreview__code-body">+ <div className="PromptPreview__code-line">+ <span className="PromptPreview__kw">const</span> prompt ={' '}+ <span className="PromptPreview__kw">await</span> posthog.+ <span className="PromptPreview__fn">getPrompt</span>(+ <span className="PromptPreview__str">'support-triage'</span>, {'{'} label:{' '}+ <span className="PromptPreview__str">'production'</span> {'}'})+ </div>+ <div className="PromptPreview__fetched PromptPreview__swap">+ <span className="PromptPreview__fetched-body PromptPreview__when-v3">+ <span className="PromptPreview__fetched-version">v3</span>+ <span className="PromptPreview__fetched-text">+ You are a support agent for Hedgebox. Keep replies short and friendly.+ </span>+ </span>+ <span className="PromptPreview__fetched-body PromptPreview__when-v4">+ <span className="PromptPreview__fetched-version PromptPreview__fetched-version--live">+ v4+ </span>+ <span className="PromptPreview__fetched-text">+ You are a support agent for Hedgebox. Include the refund policy when relevant.+ </span>+ </span>+ </div>+ </div>+ </div>++ <div className="PromptPreview__spark">+ <div className="PromptPreview__spark-head">+ <span className="PromptPreview__spark-title">Prompt fetches · 7 days</span>+ <LemonTag size="small">example data</LemonTag>+ </div>++ <div className="PromptPreview__spark-value">+ 8,412+ <span className="PromptPreview__spark-label PromptPreview__swap">+ <span className="PromptPreview__when-v3">serving v3</span>+ <span className="PromptPreview__spark-label--live PromptPreview__when-v4">serving v4</span>+ </span>+ </div>++ <div className="PromptPreview__spark-chart">+ <svg+ className="PromptPreview__spark-svg"+ viewBox="0 0 100 40"+ preserveAspectRatio="none"+ aria-hidden="true"+ >+ <path className="PromptPreview__spark-area" d={SPARK_AREA} />+ <path className="PromptPreview__spark-line" d={SPARK_LINE} vectorEffect="non-scaling-stroke" />+ <path+ className="PromptPreview__spark-trace"+ d={SPARK_LINE}+ pathLength={100}+ vectorEffect="non-scaling-stroke"+ />+ </svg>+ </div>+ </div>+ </div>+ )+}diff --git a/products/ai_observability/frontend/emptyState/llmPromptsEmptyState.tsx b/products/ai_observability/frontend/emptyState/llmPromptsEmptyState.tsxnew file mode 100644index 000000000000..74501c60acdd--- /dev/null+++ b/products/ai_observability/frontend/emptyState/llmPromptsEmptyState.tsx@@ -0,0 +1,45 @@+import * as deskWizardPng from '@posthog/brand/hoggies/png/desk-wizard'+import { IconLlmPromptManagement } from '@posthog/icons'++import { pngHoggie } from 'lib/brand/hoggies'+import type { SceneProductEmptyState } from 'lib/components/ProductEmptyState/types'+import { urls } from 'scenes/urls'++import { ProductKey } from '~/queries/schema/schema-general'+import { AccessControlLevel, AccessControlResourceType } from '~/types'++import { LLMPromptPreview } from './LLMPromptPreview'+import { llmPromptsSetupLogic } from './llmPromptsSetupLogic'++const HedgehogDeskWizard = pngHoggie(deskWizardPng)++export const llmPromptsEmptyState: SceneProductEmptyState = {+ statusLogic: llmPromptsSetupLogic,+ config: {+ productKey: ProductKey.LLM_PROMPTS,+ productName: 'Prompt management',+ icon: <IconLlmPromptManagement />,+ accentColor: 'var(--color-product-llm-analytics-light)',+ accentColorDark: 'var(--color-product-llm-analytics-dark)',+ hedgehog: HedgehogDeskWizard,+ text: {+ 'needs-setup': {+ headline: 'Update prompts without redeploying',+ lead: 'Create and version LLM prompts in PostHog, then fetch them from your code at runtime. Every change becomes an immutable version you can compare, restore, and A/B test. Point a label like production at any version to control what your app serves, and move it whenever you want.',+ },+ },+ primaryAction: {+ label: 'Create your first prompt',+ to: urls.aiObservabilityPrompt('new'),+ accessControl: {+ resourceType: AccessControlResourceType.LlmAnalytics,+ minAccessLevel: AccessControlLevel.Editor,+ },+ dataAttr: 'new-prompt-button',+ },+ skippable: false,+ docsUrl: 'https://posthog.com/docs/prompt-management',+ previewLabel: 'Your prompts, once created',+ Preview: LLMPromptPreview,+ },+}diff --git a/products/ai_observability/frontend/emptyState/llmPromptsSetupLogic.test.ts b/products/ai_observability/frontend/emptyState/llmPromptsSetupLogic.test.tsnew file mode 100644index 000000000000..cb22c5bffcf1--- /dev/null+++ b/products/ai_observability/frontend/emptyState/llmPromptsSetupLogic.test.ts@@ -0,0 +1,45 @@+import { expectLogic } from 'kea-test-utils'++import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'++import { ProductKey } from '~/queries/schema/schema-general'+import { initKeaTests } from '~/test/init'++import { llmPromptsList } from 'products/ai_observability/frontend/generated/api'++import { llmPromptsSetupLogic } from './llmPromptsSetupLogic'++jest.mock('products/ai_observability/frontend/generated/api', () => ({+ llmPromptsList: jest.fn(),+}))++const mockLlmPromptsList = llmPromptsList as jest.MockedFunction<typeof llmPromptsList>++// Guards the connect + mapping into the app-wide setup-status layer: if either+// breaks, the scene empty-state gate strands on its spinner or shows the wrong surface.+describe('llmPromptsSetupLogic', () => {+ beforeEach(() => {+ jest.clearAllMocks()+ initKeaTests()+ })++ it.each([+ [0, 'needs-setup'],+ [1, 'has-data'],+ [42, 'has-data'],+ ])('pushes a prompt count of %i as status %s', async (count, expected) => {+ mockLlmPromptsList.mockResolvedValue({ count, next: null, previous: null, results: [] })+ const logic = llmPromptsSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.LLM_PROMPTS }).values.status).toBe(expected)+ })++ it('fails open to unknown when the count query fails before any answer', async () => {+ mockLlmPromptsList.mockRejectedValue(new Error('network down'))+ const logic = llmPromptsSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.LLM_PROMPTS }).values.status).toBe('unknown')+ })+})diff --git a/products/ai_observability/frontend/emptyState/llmPromptsSetupLogic.ts b/products/ai_observability/frontend/emptyState/llmPromptsSetupLogic.tsnew file mode 100644index 000000000000..a37c0145de86--- /dev/null+++ b/products/ai_observability/frontend/emptyState/llmPromptsSetupLogic.ts@@ -0,0 +1,93 @@+import { MakeLogicType, afterMount, connect, kea, listeners, path } from 'kea'+import { loaders } from 'kea-loaders'++import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'+import type { ProductSetupStatus } from 'lib/components/ProductEmptyState/types'+import { teamLogic } from 'scenes/teamLogic'++import { ProductKey } from '~/queries/schema/schema-general'++import { llmPromptsList } from 'products/ai_observability/frontend/generated/api'++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface llmPromptsSetupLogicValues {+ setupStatus: ProductSetupStatus // productSetupStatusLogic+ currentProjectId: number | string // teamLogic+ promptCount: number | null+ promptCountLoading: boolean+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface llmPromptsSetupLogicActions {+ setDetectedStatus: (status: ProductSetupStatus) => {+ status: ProductSetupStatus+ } // productSetupStatusLogic+ loadPromptCount: (_: void) => void+ loadPromptCountFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadPromptCountSuccess: (+ promptCount: number,+ payload?: void+ ) => {+ promptCount: number+ payload?: void+ }+}++export type llmPromptsSetupLogicType = MakeLogicType<llmPromptsSetupLogicValues, llmPromptsSetupLogicActions>++/**+ * Setup detection for the prompts empty state. Prompts are a creation-first+ * product, so "set up" simply means the project has at least one prompt - no+ * event or traffic signal involved. Re-checks on every mount (the scene gate+ * mounts it), which covers returning from the prompt creation page.+ */+export const llmPromptsSetupLogic = kea<llmPromptsSetupLogicType>([+ path(['products', 'ai_observability', 'frontend', 'emptyState', 'llmPromptsSetupLogic']),+ connect(() => ({+ actions: [productSetupStatusLogic({ productKey: ProductKey.LLM_PROMPTS }), ['setDetectedStatus']],+ values: [+ productSetupStatusLogic({ productKey: ProductKey.LLM_PROMPTS }),+ ['status as setupStatus'],+ teamLogic,+ ['currentProjectId'],+ ],+ })),+ loaders(({ values }) => ({+ promptCount: [+ null as number | null,+ {+ loadPromptCount: async (_: void, breakpoint): Promise<number> => {+ // content: 'none' skips prompt bodies, so the count probe stays cheap.+ const response = await llmPromptsList(String(values.currentProjectId), {+ limit: 1,+ offset: 0,+ content: 'none',+ })+ breakpoint()+ return response.count+ },+ },+ ],+ })),+ listeners(({ actions, values }) => ({+ loadPromptCountSuccess: ({ promptCount }) => {+ actions.setDetectedStatus(promptCount !== null && promptCount > 0 ? 'has-data' : 'needs-setup')+ },+ loadPromptCountFailure: () => {+ // Never strand the gate on its spinner: if nothing has answered yet, fail+ // open to the real scene. Don't downgrade an existing answer on a blip.+ if (values.setupStatus === 'loading') {+ actions.setDetectedStatus('unknown')+ }+ },+ })),+ afterMount(({ actions }) => {+ actions.loadPromptCount()+ }),+])diff --git a/products/ai_observability/frontend/prompts/LLMPromptsScene.tsx b/products/ai_observability/frontend/prompts/LLMPromptsScene.tsxindex 7a0d27e82ad5..ea06b04165b9 100644--- a/products/ai_observability/frontend/prompts/LLMPromptsScene.tsx+++ b/products/ai_observability/frontend/prompts/LLMPromptsScene.tsx@@ -6,7 +6,6 @@ import { Link } from '@posthog/lemon-ui'import { AccessControlAction } from 'lib/components/AccessControlAction'import { MemberSelect } from 'lib/components/MemberSelect'-import { ProductIntroduction } from 'lib/components/ProductIntroduction/ProductIntroduction'import { LemonButton } from 'lib/lemon-ui/LemonButton'import { More } from 'lib/lemon-ui/LemonButton/More'import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture'@@ -21,6 +20,7 @@ import { atColumn } from '~/lib/lemon-ui/LemonTable/columnUtils'import { ProductKey } from '~/queries/schema/schema-general'import { AccessControlLevel, AccessControlResourceType } from '~/types'+import { llmPromptsEmptyState } from '../emptyState/llmPromptsEmptyState'import { PROMPTS_PER_PAGE, llmPromptsLogic } from './llmPromptsLogic'import { PromptLabelChip } from './PromptLabelChip'import { LLMPrompt } from './types'@@ -30,13 +30,13 @@ export const scene: SceneExport = {component: LLMPromptsScene,logic: llmPromptsLogic,productKey: ProductKey.AI_OBSERVABILITY,+ emptyState: llmPromptsEmptyState,}export function LLMPromptsScene(): JSX.Element {const { setFilters, deletePrompt } = useActions(llmPromptsLogic)const { duplicatePrompt } = useAsyncActions(llmPromptsLogic)- const { prompts, promptsLoading, sorting, pagination, filters, promptCountLabel, shouldShowEmptyState } =- useValues(llmPromptsLogic)+ const { prompts, promptsLoading, sorting, pagination, filters, promptCountLabel } = useValues(llmPromptsLogic)const { searchParams } = useValues(router)const promptUrl = (name: string): string =>combineUrl(urls.aiObservabilityPrompt(name), stripPromptSceneSearchParams(searchParams)).url@@ -182,74 +182,48 @@ export function LLMPromptsScene(): JSX.Element {}/>- {shouldShowEmptyState ? (- <ProductIntroduction- productName="Prompt management"- productKey={ProductKey.LLM_PROMPTS}- thingName="prompt"- description="Create and version LLM prompts in PostHog, then fetch them from your code at runtime — update prompts without deploying. Every change is an immutable version you can compare, restore, and A/B test."- docsURL="https://posthog.com/docs/prompt-management"- isEmpty- actionElementOverride={- <AccessControlAction- resourceType={AccessControlResourceType.LlmAnalytics}- minAccessLevel={AccessControlLevel.Editor}- >- <LemonButton- type="primary"- to={promptUrl('new')}- icon={<IconPlusSmall />}- data-attr="llma-prompts-empty-state-new-prompt"- >- New prompt- </LemonButton>- </AccessControlAction>- }- />- ) : (- <div className="space-y-4">- <div className="flex gap-x-4 gap-y-2 items-center flex-wrap">- <LemonInput- type="search"- placeholder="Search prompts..."- value={filters.search}- data-attr="prompts-search-input"- onChange={(value) => setFilters({ search: value })}- className="max-w-md"- />- <div className="text-muted-alt">{promptCountLabel}</div>- <div className="flex-1" />- <span>- <b>Created by</b>- </span>- <MemberSelect- defaultLabel="Any user"- value={filters.created_by_id ?? null}- size="xsmall"- onChange={(user) => setFilters({ created_by_id: user?.id, page: 1 })}- />- </div>-- <LemonTable- loading={promptsLoading}- columns={columns}- dataSource={prompts.results}- pagination={pagination}- noSortingCancellation- sorting={sorting}- onSort={(newSorting) =>- setFilters({- order_by: newSorting- ? `${newSorting.order === -1 ? '-' : ''}${newSorting.columnKey}`- : undefined,- })- }- rowKey="id"- loadingSkeletonRows={PROMPTS_PER_PAGE}- nouns={['prompt', 'prompts']}+ <div className="space-y-4">+ <div className="flex gap-x-4 gap-y-2 items-center flex-wrap">+ <LemonInput+ type="search"+ placeholder="Search prompts..."+ value={filters.search}+ data-attr="prompts-search-input"+ onChange={(value) => setFilters({ search: value })}+ className="max-w-md"+ />+ <div className="text-muted-alt">{promptCountLabel}</div>+ <div className="flex-1" />+ <span>+ <b>Created by</b>+ </span>+ <MemberSelect+ defaultLabel="Any user"+ value={filters.created_by_id ?? null}+ size="xsmall"+ onChange={(user) => setFilters({ created_by_id: user?.id, page: 1 })}/></div>- )}++ <LemonTable+ loading={promptsLoading}+ columns={columns}+ dataSource={prompts.results}+ pagination={pagination}+ noSortingCancellation+ sorting={sorting}+ onSort={(newSorting) =>+ setFilters({+ order_by: newSorting+ ? `${newSorting.order === -1 ? '-' : ''}${newSorting.columnKey}`+ : undefined,+ })+ }+ rowKey="id"+ loadingSkeletonRows={PROMPTS_PER_PAGE}+ nouns={['prompt', 'prompts']}+ />+ </div></SceneContent>)}diff --git a/products/ai_observability/frontend/prompts/llmPromptsLogic.ts b/products/ai_observability/frontend/prompts/llmPromptsLogic.tsindex 7dff323fc6e7..8186aa34c7b1 100644--- a/products/ai_observability/frontend/prompts/llmPromptsLogic.ts+++ b/products/ai_observability/frontend/prompts/llmPromptsLogic.ts@@ -45,10 +45,8 @@ export interface llmPromptsLogicValues {pagination: PaginationManualpromptCountLabel: stringprompts: CountedPaginatedResponse<LLMPrompt>- promptsLoaded: booleanpromptsLoading: booleanrawFilters: Partial<PromptFilters> | null- shouldShowEmptyState: booleansorting: Sorting | null}@@ -104,12 +102,6 @@ export interface llmPromptsLogicMeta {sorting: (filters: PromptFilters) => Sorting | nullpagination: (filters: PromptFilters, count: number) => PaginationManualpromptCountLabel: (filters: PromptFilters, count: number) => string- shouldShowEmptyState: (- count: number,- promptsLoaded: boolean,- promptsLoading: boolean,- filters: PromptFilters- ) => boolean}}@@ -147,12 +139,6 @@ export const llmPromptsLogic = kea<llmPromptsLogicType>([}),},],- promptsLoaded: [- false as boolean,- {- loadPromptsSuccess: () => true,- },- ],}),loaders(({ values }) => ({@@ -230,12 +216,6 @@ export const llmPromptsLogic = kea<llmPromptsLogicType>([return count === 0 ? '0 prompts' : `${start}-${end} of ${count} prompt${count === 1 ? '' : 's'}`},],-- shouldShowEmptyState: [- (s) => [s.count, s.promptsLoaded, s.promptsLoading, s.filters],- (count: number, promptsLoaded: boolean, promptsLoading: boolean, filters: PromptFilters): boolean =>- promptsLoaded && !promptsLoading && count === 0 && !filters.search && !filters.created_by_id,- ],}),listeners(({ asyncActions, values, selectors }) => ({diff --git a/products/cdp/frontend/emptyState/WebScriptPreview.scss b/products/cdp/frontend/emptyState/WebScriptPreview.scssnew file mode 100644index 000000000000..6de73414ca35--- /dev/null+++ b/products/cdp/frontend/emptyState/WebScriptPreview.scss@@ -0,0 +1,315 @@+@import '../../../../frontend/src/lib/components/ProductEmptyState/previewMixins';++.WebScriptPreview {+ --web-script-preview-accent: var(--empty-state-accent, var(--color-primary-500));++ display: flex;+ flex-direction: column;+ gap: 0.75rem;++ // Hidden enabled state. A direct child of .WebScriptPreview so `:checked ~` reaches both cards.+ &__checkbox {+ position: absolute;+ width: 0;+ height: 0;+ pointer-events: none;+ opacity: 0;+ }++ &__panel,+ &__site {+ overflow: hidden;+ background: var(--color-bg-surface-primary);+ border: 1px solid var(--color-border-primary);+ border-radius: var(--radius);+ }++ // On/off pairs are stacked on one grid cell and crossfaded, so enabling the+ // script never changes any element's size (no layout shift).+ &__swap {+ display: grid;+ }++ &__swap > * {+ grid-area: 1 / 1;+ min-width: 0;+ }++ &__when-on {+ @include preview-swap-hidden;+ }++ &__when-off {+ @include preview-swap-visible;+ }++ &__head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 0.5rem 0.75rem;+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__title {+ font-size: 0.75rem;+ font-weight: 600;+ }++ &__rows {+ display: flex;+ flex-direction: column;+ padding: 0.25rem 0.5rem;+ }++ &__row {+ display: grid;+ grid-template-columns: 9.5rem 1fr auto auto;+ gap: 0.625rem;+ align-items: center;+ padding: 0.4375rem 0.5rem;+ border-radius: var(--radius);+ }++ &__row--hero {+ cursor: pointer;+ user-select: none;+ transition: background-color 150ms ease;+ }++ &__row--hero:hover {+ background: var(--color-bg-fill-highlight-50);+ }++ &__name {+ overflow: hidden;+ font-size: 0.75rem;+ font-weight: 600;+ color: var(--color-text-primary);+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ // Per-script 7-day invocations sparkline.+ &__row-spark {+ display: block;+ width: 100%;+ height: 16px;+ overflow: visible;+ }++ &__row-line {+ fill: none;+ stroke: color-mix(in oklab, var(--web-script-preview-accent) 45%, transparent);+ stroke-width: 1.5;+ }++ &__row-line--flat {+ stroke: var(--color-fill-secondary);+ }++ // The hero's series reads as "no data yet" until its script is enabled.+ &__row-line--hero {+ stroke: var(--color-fill-secondary);+ transition: stroke 400ms ease;+ }++ // Ambient motion: a short bright segment cycling along the enabled script's line.+ &__row-trace {+ fill: none;+ stroke: var(--web-script-preview-accent);+ stroke-dasharray: 14 86;+ stroke-linecap: round;+ stroke-width: 1.5;+ animation: WebScriptPreview__trace 3.2s linear infinite;+ }++ &__invocations {+ min-width: 2.25rem;+ font-family: var(--font-mono);+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ text-align: right;+ }++ &__invocations--live {+ font-weight: 600;++ @include preview-accent-text(var(--web-script-preview-accent));+ }++ // Mini toggle, mimicking the list's enabled switch. The off track gets a darker+ // fill plus an inset ring so it stays legible on the card surface.+ &__switch {+ position: relative;+ flex-shrink: 0;+ width: 26px;+ height: 15px;+ background: color-mix(in oklab, var(--color-text-secondary) 25%, var(--color-fill-secondary));+ border-radius: 999px;+ box-shadow: inset 0 0 0 1px var(--color-border-primary);+ transition: background-color 200ms ease;++ &::after {+ position: absolute;+ top: 2px;+ left: 2px;+ width: 11px;+ height: 11px;+ content: '';+ background: var(--color-bg-surface-primary);+ border-radius: 50%;+ box-shadow: 0 1px 2px rgb(0 0 0 / 25%);+ transition: transform 200ms ease;+ }+ }++ &__switch--on {+ background: var(--web-script-preview-accent);++ &::after {+ transform: translateX(11px);+ }+ }++ &__hint {+ padding: 0 0.75rem 0.625rem;+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ }++ // Browser chrome for the mini website.+ &__chrome {+ display: flex;+ gap: 0.3125rem;+ align-items: center;+ padding: 0.4375rem 0.75rem;+ background: var(--color-bg-surface-secondary);+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__url {+ margin-left: 0.375rem;+ font-family: var(--font-mono);+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ }++ &__screen {+ display: flex;+ flex-direction: column;+ gap: 0.625rem;+ padding: 0.875rem;+ }++ // The banner the script injects. Always occupies its space (no layout shift);+ // only its opacity follows the switch.+ &__banner {+ padding: 0.375rem 0.625rem;+ font-size: 0.6875rem;+ font-weight: 600;+ text-align: center;+ background: color-mix(in oklab, var(--web-script-preview-accent) 10%, transparent);+ border: 1px solid color-mix(in oklab, var(--web-script-preview-accent) 35%, transparent);+ border-radius: var(--radius);++ @include preview-accent-text(var(--web-script-preview-accent));+ }++ &__skel {+ display: block;+ width: var(--w, 100%);+ height: 8px;+ background: var(--color-fill-secondary);+ border-radius: 999px;+ }++ // What the snippet reports about the script.+ &__console {+ display: flex;+ gap: 0.375rem;+ padding: 0.375rem 0.625rem;+ font-family: var(--font-mono);+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ background: var(--color-bg-surface-secondary);+ border-radius: var(--radius);+ }++ &__console-key {+ color: var(--color-text-secondary);+ }++ &__console-val--on {+ font-weight: 600;++ @include preview-accent-text(var(--web-script-preview-accent));+ }++ @include preview-chrome-dot;+}++// Enabled state (user flipped the banner script's switch)++.WebScriptPreview__checkbox:checked ~ * .WebScriptPreview__when-on {+ @include preview-swap-visible;+}++.WebScriptPreview__checkbox:checked ~ * .WebScriptPreview__when-off {+ @include preview-swap-hidden;+}++.WebScriptPreview__checkbox:checked ~ .WebScriptPreview__panel .WebScriptPreview__row--hero .WebScriptPreview__switch {+ background: var(--web-script-preview-accent);++ &::after {+ transform: translateX(11px);+ }+}++// The hero sparkline lights up once its script runs.+.WebScriptPreview__checkbox:checked ~ .WebScriptPreview__panel .WebScriptPreview__row-line--hero {+ stroke: color-mix(in oklab, var(--web-script-preview-accent) 45%, transparent);+}++// The checkbox stays keyboard-focusable while visually hidden, so the row it labels+// needs a visible focus indicator (WCAG 2.4.7).+.WebScriptPreview__checkbox:focus-visible ~ .WebScriptPreview__panel .WebScriptPreview__row--hero {+ outline: 2px solid var(--web-script-preview-accent);+ outline-offset: 1px;+}++// Nudge attention at the hero switch until it's flipped.+.WebScriptPreview:not(.WebScriptPreview--static)+ .WebScriptPreview__checkbox:not(:checked)+ ~ .WebScriptPreview__panel+ .WebScriptPreview__row--hero+ .WebScriptPreview__switch {+ animation: WebScriptPreview__nudge 2.4s ease-in-out infinite;+}++@keyframes WebScriptPreview__nudge {+ 0%,+ 100% {+ box-shadow:+ inset 0 0 0 1px var(--color-border-primary),+ 0 0 0 0 color-mix(in oklab, var(--web-script-preview-accent) 45%, transparent);+ }++ 50% {+ box-shadow:+ inset 0 0 0 1px var(--color-border-primary),+ 0 0 0 4px color-mix(in oklab, var(--web-script-preview-accent) 20%, transparent);+ }+}++// pathLength is normalized to 100, so the dash offset loops cleanly regardless of length.+@keyframes WebScriptPreview__trace {+ to {+ stroke-dashoffset: -100;+ }+}++// Storybook snapshots and reduced motion drop all ambient motion; flipping the+// switch still works (transitions only).+@include preview-motion-guards('WebScriptPreview');diff --git a/products/cdp/frontend/emptyState/WebScriptPreview.tsx b/products/cdp/frontend/emptyState/WebScriptPreview.tsxnew file mode 100644index 000000000000..9cba3efc1b4f--- /dev/null+++ b/products/cdp/frontend/emptyState/WebScriptPreview.tsx@@ -0,0 +1,139 @@+import './WebScriptPreview.scss'++import { LemonTag } from 'lib/lemon-ui/LemonTag'+import { cn } from 'lib/utils/css-classes'+import { inStorybook, inStorybookTestRunner } from 'lib/utils/dom'++// Hand-authored 7-day invocation sparklines for the script rows. The hero's series+// only shows once its script is enabled.+const SPARK_CONSENT = 'M 0 13 L 16 11 L 32 12.5 L 48 9.5 L 64 10.5 L 80 8 L 100 7'+const SPARK_BANNER = 'M 0 15.5 L 16 15.5 L 32 15.2 L 48 10 L 64 7.5 L 80 5.5 L 100 4'++/**+ * Example-data preview for the web scripts empty state: the scripts list wired to a+ * mini website, so enabling the announcement banner script makes the banner appear+ * on the site and lights up the script's invocation sparkline. The whole interaction+ * is one hidden checkbox driving `:checked ~` styles - no timers or state, per the+ * preview rules in the `building-product-empty-states` skill. On/off pairs are+ * stacked in `__swap` grids and crossfaded, so enabling never changes the layout's size.+ */+export function WebScriptPreview(): JSX.Element {+ const isStatic = inStorybook() || inStorybookTestRunner()++ return (+ <div className={cn('WebScriptPreview', isStatic && 'WebScriptPreview--static')}>+ {/* Enabled state, before both cards so `:checked ~` can style them. */}+ <input type="checkbox" id="web-script-preview-toggle" className="WebScriptPreview__checkbox" />++ <div className="WebScriptPreview__panel">+ <div className="WebScriptPreview__head">+ <span className="WebScriptPreview__title">Web scripts</span>+ <LemonTag size="small">example data</LemonTag>+ </div>++ <div className="WebScriptPreview__rows">+ <div className="WebScriptPreview__row">+ <span className="WebScriptPreview__name">Cookie consent</span>+ <svg+ className="WebScriptPreview__row-spark"+ viewBox="0 0 100 20"+ preserveAspectRatio="none"+ aria-hidden="true"+ >+ <path+ className="WebScriptPreview__row-line"+ d={SPARK_CONSENT}+ vectorEffect="non-scaling-stroke"+ />+ <path+ className="WebScriptPreview__row-trace"+ d={SPARK_CONSENT}+ pathLength={100}+ vectorEffect="non-scaling-stroke"+ />+ </svg>+ <span className="WebScriptPreview__invocations">8.2k</span>+ <span className="WebScriptPreview__switch WebScriptPreview__switch--on" aria-hidden="true" />+ </div>+ <label+ htmlFor="web-script-preview-toggle"+ className="WebScriptPreview__row WebScriptPreview__row--hero"+ >+ <span className="WebScriptPreview__name">Announcement banner</span>+ <svg+ className="WebScriptPreview__row-spark"+ viewBox="0 0 100 20"+ preserveAspectRatio="none"+ aria-hidden="true"+ >+ <path+ className="WebScriptPreview__row-line WebScriptPreview__row-line--hero"+ d={SPARK_BANNER}+ vectorEffect="non-scaling-stroke"+ />+ </svg>+ <span className="WebScriptPreview__swap">+ <span className="WebScriptPreview__invocations WebScriptPreview__when-off">–</span>+ <span className="WebScriptPreview__invocations WebScriptPreview__invocations--live WebScriptPreview__when-on">+ 1.4k+ </span>+ </span>+ <span className="WebScriptPreview__switch" aria-hidden="true" />+ </label>+ <div className="WebScriptPreview__row">+ <span className="WebScriptPreview__name">Feedback widget</span>+ <svg+ className="WebScriptPreview__row-spark"+ viewBox="0 0 100 20"+ preserveAspectRatio="none"+ aria-hidden="true"+ >+ <path+ className="WebScriptPreview__row-line WebScriptPreview__row-line--flat"+ d="M 0 16 L 100 16"+ vectorEffect="non-scaling-stroke"+ />+ </svg>+ <span className="WebScriptPreview__invocations">–</span>+ <span className="WebScriptPreview__switch" aria-hidden="true" />+ </div>+ </div>++ <div className="WebScriptPreview__hint WebScriptPreview__swap">+ <span className="WebScriptPreview__when-off">+ Enable the banner script to run it on the site below.+ </span>+ <span className="WebScriptPreview__when-on">Live on every page. Flip it off to remove it.</span>+ </div>+ </div>++ <div className="WebScriptPreview__site">+ <div className="WebScriptPreview__chrome">+ <span className="WebScriptPreview__chrome-dot" />+ <span className="WebScriptPreview__chrome-dot" />+ <span className="WebScriptPreview__chrome-dot" />+ <span className="WebScriptPreview__url">yourapp.com</span>+ </div>+ <div className="WebScriptPreview__screen">+ {/* The banner the script injects. Always occupies its slot (no layout+ shift); only its opacity follows the switch. */}+ <div className="WebScriptPreview__banner WebScriptPreview__when-on">+ Spring sale: 20% off annual plans this week+ </div>+ <span className="WebScriptPreview__skel" style={{ '--w': '70%' } as React.CSSProperties} />+ <span className="WebScriptPreview__skel" style={{ '--w': '90%' } as React.CSSProperties} />+ <span className="WebScriptPreview__skel" style={{ '--w': '45%' } as React.CSSProperties} />+ <div className="WebScriptPreview__console">+ <span className="WebScriptPreview__console-key">site_app:announcement-banner</span>+ <span className="WebScriptPreview__swap">+ <span className="WebScriptPreview__console-val WebScriptPreview__when-off">disabled</span>+ <span className="WebScriptPreview__console-val WebScriptPreview__console-val--on WebScriptPreview__when-on">+ loaded+ </span>+ </span>+ </div>+ </div>+ </div>+ </div>+ )+}diff --git a/products/cdp/frontend/emptyState/webScriptsEmptyState.tsx b/products/cdp/frontend/emptyState/webScriptsEmptyState.tsxnew file mode 100644index 000000000000..b579e7fbba9d--- /dev/null+++ b/products/cdp/frontend/emptyState/webScriptsEmptyState.tsx@@ -0,0 +1,40 @@+import * as codeBubblePng from '@posthog/brand/hoggies/png/code-bubble'+import { IconPlug } from '@posthog/icons'++import { pngHoggie } from 'lib/brand/hoggies'+import type { SceneProductEmptyState } from 'lib/components/ProductEmptyState/types'+import { urls } from 'scenes/urls'++import { ProductKey } from '~/queries/schema/schema-general'++import { WebScriptPreview } from './WebScriptPreview'+import { webScriptsSetupLogic } from './webScriptsSetupLogic'++const HedgehogCodeBubble = pngHoggie(codeBubblePng)++export const webScriptsEmptyState: SceneProductEmptyState = {+ statusLogic: webScriptsSetupLogic,+ config: {+ productKey: ProductKey.SITE_APPS,+ productName: 'Web scripts',+ icon: <IconPlug />,+ accentColor: 'var(--color-product-data-pipeline-light)',+ accentColorDark: 'var(--color-product-data-pipeline-dark)',+ hedgehog: HedgehogCodeBubble,+ text: {+ 'needs-setup': {+ headline: 'Add scripts to your site without redeploying',+ lead: 'Web scripts run custom JavaScript on your site through the PostHog snippet you already have. Start from templates for banners, notifications, and chat-style widgets, or write your own. Enable, update, or disable each script from PostHog, with no code changes.',+ },+ },+ primaryAction: {+ label: 'Create your first web script',+ to: urls.webScriptsNew(),+ dataAttr: 'new-web-script',+ },+ skippable: false,+ docsUrl: 'https://posthog.com/docs/cdp',+ previewLabel: 'Your scripts, once created',+ Preview: WebScriptPreview,+ },+}diff --git a/products/cdp/frontend/emptyState/webScriptsSetupLogic.test.ts b/products/cdp/frontend/emptyState/webScriptsSetupLogic.test.tsnew file mode 100644index 000000000000..ab54b529b037--- /dev/null+++ b/products/cdp/frontend/emptyState/webScriptsSetupLogic.test.ts@@ -0,0 +1,52 @@+import { expectLogic } from 'kea-test-utils'++import api from 'lib/api'+import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'++import { ProductKey } from '~/queries/schema/schema-general'+import { initKeaTests } from '~/test/init'++import { hogFunctionsList } from 'products/cdp/frontend/generated/api'++import { webScriptsSetupLogic } from './webScriptsSetupLogic'++jest.mock('products/cdp/frontend/generated/api', () => ({+ hogFunctionsList: jest.fn(),+}))++const mockHogFunctionsList = hogFunctionsList as jest.MockedFunction<typeof hogFunctionsList>+const mockLegacySiteAppsList = jest.spyOn(api.pipelineFrontendAppsConfigs, 'list')++// Guards the connect + mapping into the app-wide setup-status layer: if either+// breaks, the scene empty-state gate strands on its spinner or shows the wrong surface.+describe('webScriptsSetupLogic', () => {+ beforeEach(() => {+ jest.clearAllMocks()+ initKeaTests()+ })++ // The scene lists hog functions and legacy plugin site apps together, so the count is+ // the sum of both sources.+ it.each([+ [0, 0, 'needs-setup'],+ [1, 0, 'has-data'],+ [42, 0, 'has-data'],+ [0, 2, 'has-data'],+ ])('pushes %i hog functions and %i legacy site apps as status %s', async (hogFunctions, legacy, expected) => {+ mockHogFunctionsList.mockResolvedValue({ count: hogFunctions, next: null, previous: null, results: [] })+ mockLegacySiteAppsList.mockResolvedValue({ count: legacy, results: [] })+ const logic = webScriptsSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.SITE_APPS }).values.status).toBe(expected)+ })++ it('fails open to unknown when the count query fails before any answer', async () => {+ mockHogFunctionsList.mockRejectedValue(new Error('network down'))+ mockLegacySiteAppsList.mockResolvedValue({ count: 0, results: [] })+ const logic = webScriptsSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.SITE_APPS }).values.status).toBe('unknown')+ })+})diff --git a/products/cdp/frontend/emptyState/webScriptsSetupLogic.ts b/products/cdp/frontend/emptyState/webScriptsSetupLogic.tsnew file mode 100644index 000000000000..eda2124111e5--- /dev/null+++ b/products/cdp/frontend/emptyState/webScriptsSetupLogic.ts@@ -0,0 +1,95 @@+import { MakeLogicType, afterMount, connect, kea, listeners, path } from 'kea'+import { loaders } from 'kea-loaders'++import api from 'lib/api'+import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'+import type { ProductSetupStatus } from 'lib/components/ProductEmptyState/types'+import { teamLogic } from 'scenes/teamLogic'++import { ProductKey } from '~/queries/schema/schema-general'++import { hogFunctionsList } from 'products/cdp/frontend/generated/api'++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface webScriptsSetupLogicValues {+ setupStatus: ProductSetupStatus // productSetupStatusLogic+ currentProjectId: number | string // teamLogic+ scriptCount: number | null+ scriptCountLoading: boolean+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface webScriptsSetupLogicActions {+ setDetectedStatus: (status: ProductSetupStatus) => {+ status: ProductSetupStatus+ } // productSetupStatusLogic+ loadScriptCount: (_: void) => void+ loadScriptCountFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadScriptCountSuccess: (+ scriptCount: number,+ payload?: void+ ) => {+ scriptCount: number+ payload?: void+ }+}++export type webScriptsSetupLogicType = MakeLogicType<webScriptsSetupLogicValues, webScriptsSetupLogicActions>++/**+ * Setup detection for the web scripts empty state. Web scripts are creation-first,+ * so "set up" simply means the project has at least one script the scene would list:+ * a `site_app` hog function, or a legacy plugin site app. Re-checks on every mount+ * (the scene gate mounts it), which covers returning from the creation page.+ */+export const webScriptsSetupLogic = kea<webScriptsSetupLogicType>([+ path(['products', 'cdp', 'frontend', 'emptyState', 'webScriptsSetupLogic']),+ connect(() => ({+ actions: [productSetupStatusLogic({ productKey: ProductKey.SITE_APPS }), ['setDetectedStatus']],+ values: [+ productSetupStatusLogic({ productKey: ProductKey.SITE_APPS }),+ ['status as setupStatus'],+ teamLogic,+ ['currentProjectId'],+ ],+ })),+ loaders(({ values }) => ({+ scriptCount: [+ null as number | null,+ {+ loadScriptCount: async (_: void, breakpoint): Promise<number> => {+ // The scene lists plugin-backed site apps alongside hog functions, so counting+ // only hog functions would tell a project still running legacy site apps to+ // create its first one and hide the ones serving its site today.+ const [hogFunctions, legacySiteApps] = await Promise.all([+ hogFunctionsList(String(values.currentProjectId), { type: ['site_app'], limit: 1 }),+ api.pipelineFrontendAppsConfigs.list({ limit: 1 }),+ ])+ breakpoint()+ return hogFunctions.count + legacySiteApps.count+ },+ },+ ],+ })),+ listeners(({ actions, values }) => ({+ loadScriptCountSuccess: ({ scriptCount }) => {+ actions.setDetectedStatus(scriptCount !== null && scriptCount > 0 ? 'has-data' : 'needs-setup')+ },+ loadScriptCountFailure: () => {+ // Never strand the gate on its spinner: if nothing has answered yet, fail+ // open to the real scene. Don't downgrade an existing answer on a blip.+ if (values.setupStatus === 'loading') {+ actions.setDetectedStatus('unknown')+ }+ },+ })),+ afterMount(({ actions }) => {+ actions.loadScriptCount()+ }),+])diff --git a/products/cdp/manifest.tsx b/products/cdp/manifest.tsxindex e6100b4626fe..30b84915e2d8 100644--- a/products/cdp/manifest.tsx+++ b/products/cdp/manifest.tsx@@ -36,28 +36,28 @@ export const manifest: ProductManifest = {path: `Data/Source`,type: 'hog_function/source',href: urls.dataPipelinesNew('source'),- iconColor: ['var(--color-product-data-pipeline-light)'],+ iconColor: ['var(--color-product-data-pipeline-light)', 'var(--color-product-data-pipeline-dark)'],sceneKeys: ['HogFunction'],},{path: `Data/Destination`,type: 'hog_function/destination',href: urls.dataPipelinesNew('destination'),- iconColor: ['var(--color-product-data-pipeline-light)'],+ iconColor: ['var(--color-product-data-pipeline-light)', 'var(--color-product-data-pipeline-dark)'],sceneKeys: ['HogFunction'],},{path: `Data/Transformation`,type: 'hog_function/transformation',href: urls.dataPipelinesNew('transformation'),- iconColor: ['var(--color-product-data-pipeline-light)'],+ iconColor: ['var(--color-product-data-pipeline-light)', 'var(--color-product-data-pipeline-dark)'],sceneKeys: ['HogFunction'],},{path: `Data/Web script`,type: 'hog_function/site_app',href: urls.webScriptsNew(),- iconColor: ['var(--color-product-data-pipeline-light)'],+ iconColor: ['var(--color-product-data-pipeline-light)', 'var(--color-product-data-pipeline-dark)'],sceneKeys: ['HogFunction'],},],@@ -68,7 +68,7 @@ export const manifest: ProductManifest = {category: ProductItemCategory.TOOLS,type: 'hog_function',iconType: 'data_pipeline',- iconColor: ['var(--color-product-data-pipeline-light)'],+ iconColor: ['var(--color-product-data-pipeline-light)', 'var(--color-product-data-pipeline-dark)'],href: urls.webScripts(),sceneKey: 'WebScripts',sceneKeys: ['WebScripts'],diff --git a/products/cdp/package.json b/products/cdp/package.jsonindex a7dba5ab9a61..0bb38269fb21 100644--- a/products/cdp/package.json+++ b/products/cdp/package.json@@ -2,5 +2,19 @@"name": "@posthog/products-cdp","scripts": {"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -v --tb=short"+ },+ "dependencies": {+ "kea": "catalog:",+ "kea-loaders": "catalog:"+ },+ "devDependencies": {+ "kea-test-utils": "catalog:"+ },+ "peerDependencies": {+ "@posthog/brand": "catalog:",+ "@posthog/icons": "catalog:",+ "@types/react": "*",+ "clsx": "*",+ "react": "*"}}diff --git a/products/cohorts/manifest.tsx b/products/cohorts/manifest.tsxindex 9eb020249d9d..8c19aeacf230 100644--- a/products/cohorts/manifest.tsx+++ b/products/cohorts/manifest.tsx@@ -27,9 +27,12 @@ export const manifest: ProductManifest = {cohort: {name: 'Cohort',iconType: 'cohort' as FileSystemIconType,+ iconColor: [+ 'var(--color-product-cohorts-light)',+ 'var(--color-product-cohorts-dark)',+ ] as FileSystemIconColor,href: (ref: string) => urls.cohort(ref),filterKey: 'cohort',- iconColor: ['var(--color-product-cohorts-light)'] as FileSystemIconColor,},},treeItemsNew: [@@ -38,7 +41,10 @@ export const manifest: ProductManifest = {type: 'cohort',href: urls.cohort('new'),iconType: 'cohort' as FileSystemIconType,- iconColor: ['var(--color-product-cohorts-light)'] as FileSystemIconColor,+ iconColor: [+ 'var(--color-product-cohorts-light)',+ 'var(--color-product-cohorts-dark)',+ ] as FileSystemIconColor,sceneKeys: ['Cohorts', 'Cohort'],},],diff --git a/products/conversations/frontend/emptyState/SupportPreview.scss b/products/conversations/frontend/emptyState/SupportPreview.scssnew file mode 100644index 000000000000..739f058e21ee--- /dev/null+++ b/products/conversations/frontend/emptyState/SupportPreview.scss@@ -0,0 +1,400 @@+@import '../../../../frontend/src/lib/components/ProductEmptyState/previewMixins';++.SupportPreview {+ --support-preview-accent: var(--empty-state-accent, var(--color-primary-500));++ display: flex;+ flex-direction: column;+ gap: 0.75rem;++ // Hidden sent state. A direct child of .SupportPreview so `:checked ~` reaches all cards.+ &__checkbox {+ position: absolute;+ width: 0;+ height: 0;+ pointer-events: none;+ opacity: 0;+ }++ &__inbox,+ &__site,+ &__spark {+ overflow: hidden;+ background: var(--color-bg-surface-primary);+ border: 1px solid var(--color-border-primary);+ border-radius: var(--radius);+ }++ // Off/on pairs are stacked on one grid cell and crossfaded, so sending the+ // message never changes any element's size (no layout shift).+ &__swap {+ display: grid;+ }++ &__swap > * {+ grid-area: 1 / 1;+ min-width: 0;+ }++ &__when-on {+ @include preview-swap-hidden;+ }++ &__when-off {+ @include preview-swap-visible;+ }++ &__head {+ display: flex;+ gap: 0.5rem;+ align-items: center;+ padding: 0.5rem 0.75rem;+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__title {+ font-size: 0.75rem;+ font-weight: 600;+ }++ &__count {+ margin-right: auto;+ font-family: var(--font-mono);+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ }++ &__count--live {+ font-weight: 600;++ @include preview-accent-text(var(--support-preview-accent));+ }++ &__listening {+ display: flex;+ gap: 0.5rem;+ align-items: center;+ padding: 0.5rem 0.75rem 0;+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ }++ &__rows {+ display: flex;+ flex-direction: column;+ padding: 0.25rem 0.5rem 0.5rem;+ }++ &__row {+ display: grid;+ grid-template-columns: 2.5rem 1fr auto auto;+ gap: 0.625rem;+ align-items: center;+ padding: 0.375rem 0.5rem;+ border-radius: var(--radius);+ }++ // The incoming ticket: invisible until the widget message is sent, but always+ // occupying its slot so the list never jumps.+ &__row--new {+ background: color-mix(in oklab, var(--support-preview-accent) 8%, transparent);+ opacity: 0;+ transition: opacity 300ms ease;+ }++ &__num {+ position: relative;+ font-family: var(--font-mono);+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ }++ &__unread {+ position: absolute;+ top: 50%;+ left: -0.5rem;+ width: 6px;+ height: 6px;+ background: var(--support-preview-accent);+ border-radius: 50%;+ transform: translateY(-50%);+ animation: SupportPreview__pulse 2s ease-in-out infinite;+ }++ &__who {+ display: flex;+ flex-direction: column;+ min-width: 0;+ }++ &__person {+ font-size: 0.75rem;+ font-weight: 600;+ }++ &__subject {+ overflow: hidden;+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ // Mini status tag, mimicking the ticket list's status column.+ &__status {+ padding: 0 0.375rem;+ font-size: 0.625rem;+ font-weight: 700;+ color: var(--color-text-secondary);+ text-transform: uppercase;+ background: var(--color-fill-secondary);+ border-radius: 999px;+ }++ &__status--new,+ &__status--open {+ background: color-mix(in oklab, var(--support-preview-accent) 12%, transparent);++ @include preview-accent-text(var(--support-preview-accent));+ }++ &__status--solved {+ color: var(--color-green-500);+ background: color-mix(in oklab, var(--color-green-500) 12%, transparent);+ }++ &__sla {+ min-width: 3.25rem;+ font-family: var(--font-mono);+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ text-align: right;+ }++ &__sla--due {+ font-weight: 600;++ @include preview-accent-text(var(--support-preview-accent));+ }++ // Browser chrome for the fake site hosting the widget.+ &__chrome {+ display: flex;+ gap: 0.3125rem;+ align-items: center;+ padding: 0.4375rem 0.75rem;+ background: var(--color-bg-surface-secondary);+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__url {+ margin-left: 0.375rem;+ font-family: var(--font-mono);+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ }++ &__widget {+ display: flex;+ flex-direction: column;+ gap: 0.5rem;+ max-width: 15rem;+ padding: 0.625rem 0.75rem 0.75rem;+ margin: 0.875rem 0.875rem 0.875rem auto;+ border: 1px solid var(--color-border-primary);+ border-radius: var(--radius);+ box-shadow: 0 2px 8px rgb(0 0 0 / 8%);+ }++ &__widget-head {+ font-size: 0.6875rem;+ font-weight: 600;++ @include preview-accent-text(var(--support-preview-accent));+ }++ &__bubble {+ justify-self: start;+ max-width: 85%;+ padding: 0.3125rem 0.5rem;+ font-size: 0.6875rem;+ background: var(--color-fill-secondary);+ border-radius: 0.625rem;+ }++ &__bubble--agent {+ align-self: flex-start;+ }++ &__bubble--user {+ justify-self: end;+ color: var(--color-bg-surface-primary);+ background: var(--support-preview-accent);+ }++ // The customer's typed-but-unsent message, styled as the widget's input.+ &__draft {+ display: flex;+ gap: 0.375rem;+ align-items: center;+ padding: 0.3125rem 0.5rem;+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ border: 1px solid var(--color-border-primary);+ border-radius: 0.625rem;+ }++ &__typing {+ display: inline-flex;+ gap: 2px;+ align-items: center;+ }++ &__typing span {+ width: 4px;+ height: 4px;+ background: var(--color-text-tertiary);+ border-radius: 50%;+ animation: SupportPreview__typing 1.2s ease-in-out infinite;+ }++ &__typing span:nth-child(2) {+ animation-delay: 0.2s;+ }++ &__typing span:nth-child(3) {+ animation-delay: 0.4s;+ }++ &__widget-foot {+ display: flex;+ gap: 0.5rem;+ align-items: center;+ justify-content: space-between;+ }++ &__sent-note {+ font-size: 0.5625rem;+ color: var(--color-text-tertiary);+ }++ &__send {+ padding: 0.1875rem 0.625rem;+ font-size: 0.6875rem;+ font-weight: 600;+ color: var(--color-bg-surface-primary);+ cursor: pointer;+ user-select: none;+ background: var(--support-preview-accent);+ border-radius: var(--radius);+ }++ // First-response stat card.+ &__spark {+ padding: 0.75rem 0.875rem 0.875rem;+ }++ // Response time falling is the good direction.+ &__spark-delta {+ font-size: 0.6875rem;+ font-weight: 600;+ color: var(--color-green-500);+ }++ &__spark-chart {+ margin-top: 0.5rem;+ }++ &__spark-area {+ fill: color-mix(in oklab, var(--support-preview-accent) 13%, transparent);+ stroke: none;+ }++ &__spark-line {+ fill: none;+ stroke: color-mix(in oklab, var(--support-preview-accent) 32%, transparent);+ stroke-width: 2;+ }++ // The moving bit: a short bright segment cycling along the line.+ &__spark-trace {+ fill: none;+ stroke: var(--support-preview-accent);+ stroke-dasharray: 16 84;+ stroke-linecap: round;+ stroke-width: 2;+ animation: SupportPreview__trace 3.2s linear infinite;+ }++ @include preview-chrome-dot;+ @include preview-sparkline;+}++// Sent state (user clicked Send in the widget)++.SupportPreview__checkbox:checked ~ * .SupportPreview__when-on {+ @include preview-swap-visible;+}++.SupportPreview__checkbox:checked ~ * .SupportPreview__when-off {+ @include preview-swap-hidden;+}++.SupportPreview__checkbox:checked ~ .SupportPreview__inbox .SupportPreview__row--new {+ opacity: 1;+}++.SupportPreview__checkbox:checked ~ .SupportPreview__site .SupportPreview__typing span {+ animation: none;+}++// The checkbox stays keyboard-focusable while visually hidden, so the send button+// it labels needs a visible focus indicator (WCAG 2.4.7).+.SupportPreview__checkbox:focus-visible ~ .SupportPreview__site .SupportPreview__send {+ outline: 2px solid var(--support-preview-accent);+ outline-offset: 1px;+}++// Nudge attention at the send button until the message is sent.+.SupportPreview:not(.SupportPreview--static)+ .SupportPreview__checkbox:not(:checked)+ ~ .SupportPreview__site+ .SupportPreview__send {+ animation: SupportPreview__pulse 2.4s ease-in-out infinite;+}++@keyframes SupportPreview__pulse {+ 0%,+ 100% {+ box-shadow: 0 0 0 0 color-mix(in oklab, var(--support-preview-accent) 45%, transparent);+ }++ 50% {+ box-shadow: 0 0 0 4px color-mix(in oklab, var(--support-preview-accent) 18%, transparent);+ }+}++@keyframes SupportPreview__typing {+ 0%,+ 60%,+ 100% {+ opacity: 0.35;+ transform: translateY(0);+ }++ 30% {+ opacity: 1;+ transform: translateY(-2px);+ }+}++// pathLength is normalized to 100, so the dash offset loops cleanly regardless of length.+@keyframes SupportPreview__trace {+ to {+ stroke-dashoffset: -100;+ }+}++// Storybook snapshots and reduced motion drop all ambient motion; sending the+// message still works (transitions only).+@include preview-motion-guards('SupportPreview');diff --git a/products/conversations/frontend/emptyState/SupportPreview.tsx b/products/conversations/frontend/emptyState/SupportPreview.tsxnew file mode 100644index 000000000000..3ad03af7f602--- /dev/null+++ b/products/conversations/frontend/emptyState/SupportPreview.tsx@@ -0,0 +1,159 @@+import './SupportPreview.scss'++import type { ProductEmptyStateMode } from 'lib/components/ProductEmptyState/types'+import { LemonTag } from 'lib/lemon-ui/LemonTag'+import { Spinner } from 'lib/lemon-ui/Spinner'+import { cn } from 'lib/utils/css-classes'+import { inStorybook, inStorybookTestRunner } from 'lib/utils/dom'++// Hand-authored falling first-response-time series for the stat card sparkline.+const SPARK_LINE = 'M 0 12 L 10 14 L 20 13 L 30 17 L 40 16 L 50 20.5 L 60 19.5 L 70 24 L 80 25.5 L 90 28 L 100 29.5'+const SPARK_AREA = `${SPARK_LINE} L 100 40 L 0 40 Z`++/**+ * Example-data preview for the Support empty state: the ticket inbox wired to a mini+ * chat widget on a fake site, so sending the customer's typed message makes a new+ * ticket crossfade in at the top of the inbox and ticks the count up. The whole+ * interaction is one hidden checkbox driving `:checked ~` styles - no timers or+ * state, per the preview rules in the `building-product-empty-states` skill. The new+ * row and the count swap in fixed slots, so sending never changes the layout's size.+ * In `waiting-for-data` mode the inbox pins a listening row.+ */+export function SupportPreview({ mode }: { mode: ProductEmptyStateMode }): JSX.Element {+ const isStatic = inStorybook() || inStorybookTestRunner()++ return (+ <div className={cn('SupportPreview', isStatic && 'SupportPreview--static')}>+ {/* Sent state, before all cards so `:checked ~` can style them. */}+ <input type="checkbox" id="support-preview-send" className="SupportPreview__checkbox" />++ <div className="SupportPreview__inbox">+ <div className="SupportPreview__head">+ <span className="SupportPreview__title">Inbox</span>+ <span className="SupportPreview__count SupportPreview__swap">+ <span className="SupportPreview__when-off">3 tickets</span>+ <span className="SupportPreview__count--live SupportPreview__when-on">4 tickets</span>+ </span>+ <LemonTag size="small">example data</LemonTag>+ </div>++ {mode === 'waiting-for-data' ? (+ <div className="SupportPreview__listening">+ <Spinner className="text-sm" />+ Listening for your first ticket…+ </div>+ ) : null}++ <div className="SupportPreview__rows">+ {/* The row the widget's message becomes. Always occupies its slot+ (no layout shift); only its opacity follows the checkbox. */}+ <div className="SupportPreview__row SupportPreview__row--new">+ <span className="SupportPreview__num">#482</span>+ <span className="SupportPreview__who">+ <span className="SupportPreview__person">Mia Chen</span>+ <span className="SupportPreview__subject">The export button isn't working</span>+ </span>+ <span className="SupportPreview__status SupportPreview__status--new">New</span>+ <span className="SupportPreview__sla">SLA 4h</span>+ </div>+ <div className="SupportPreview__row">+ <span className="SupportPreview__num">+ #481+ <span className="SupportPreview__unread" aria-hidden="true" />+ </span>+ <span className="SupportPreview__who">+ <span className="SupportPreview__person">Albert Einstein</span>+ <span className="SupportPreview__subject">Can't invite teammates</span>+ </span>+ <span className="SupportPreview__status SupportPreview__status--open">Open</span>+ <span className="SupportPreview__sla SupportPreview__sla--due">1h left</span>+ </div>+ <div className="SupportPreview__row">+ <span className="SupportPreview__num">#479</span>+ <span className="SupportPreview__who">+ <span className="SupportPreview__person">Nikola Tesla</span>+ <span className="SupportPreview__subject">Question about billing seats</span>+ </span>+ <span className="SupportPreview__status">Pending</span>+ <span className="SupportPreview__sla">SLA met</span>+ </div>+ <div className="SupportPreview__row">+ <span className="SupportPreview__num">#476</span>+ <span className="SupportPreview__who">+ <span className="SupportPreview__person">Niels Bohr</span>+ <span className="SupportPreview__subject">Feature request: dark mode</span>+ </span>+ <span className="SupportPreview__status SupportPreview__status--solved">Solved</span>+ <span className="SupportPreview__sla">SLA met</span>+ </div>+ </div>+ </div>++ <div className="SupportPreview__site">+ <div className="SupportPreview__chrome">+ <span className="SupportPreview__chrome-dot" />+ <span className="SupportPreview__chrome-dot" />+ <span className="SupportPreview__chrome-dot" />+ <span className="SupportPreview__url">yourapp.com</span>+ </div>+ <div className="SupportPreview__widget">+ <div className="SupportPreview__widget-head">Chat with us</div>+ <div className="SupportPreview__bubble SupportPreview__bubble--agent">Hi! How can we help?</div>+ {/* Draft and sent variants stacked in one slot and crossfaded. */}+ <div className="SupportPreview__swap">+ <span className="SupportPreview__draft SupportPreview__when-off">+ The export button isn't working+ <span className="SupportPreview__typing" aria-hidden="true">+ <span />+ <span />+ <span />+ </span>+ </span>+ <span className="SupportPreview__bubble SupportPreview__bubble--user SupportPreview__when-on">+ The export button isn't working+ </span>+ </div>+ <div className="SupportPreview__widget-foot">+ <span className="SupportPreview__sent-note SupportPreview__swap">+ <span className="SupportPreview__when-off">Also reaches you by email and Slack</span>+ <span className="SupportPreview__when-on">Delivered · ticket #482 opened</span>+ </span>+ <label htmlFor="support-preview-send" className="SupportPreview__send">+ Send+ </label>+ </div>+ </div>+ </div>++ <div className="SupportPreview__spark">+ <div className="SupportPreview__spark-head">+ <span className="SupportPreview__spark-title">Median first response · 7 days</span>+ <LemonTag size="small">example data</LemonTag>+ </div>++ <div className="SupportPreview__spark-value">+ 42m+ <span className="SupportPreview__spark-delta">▼ 18%</span>+ </div>++ <div className="SupportPreview__spark-chart">+ <svg+ className="SupportPreview__spark-svg"+ viewBox="0 0 100 40"+ preserveAspectRatio="none"+ aria-hidden="true"+ >+ <path className="SupportPreview__spark-area" d={SPARK_AREA} />+ <path className="SupportPreview__spark-line" d={SPARK_LINE} vectorEffect="non-scaling-stroke" />+ <path+ className="SupportPreview__spark-trace"+ d={SPARK_LINE}+ pathLength={100}+ vectorEffect="non-scaling-stroke"+ />+ </svg>+ </div>+ </div>+ </div>+ )+}diff --git a/products/conversations/frontend/emptyState/supportEmptyState.tsx b/products/conversations/frontend/emptyState/supportEmptyState.tsxnew file mode 100644index 000000000000..148c84da0e4a--- /dev/null+++ b/products/conversations/frontend/emptyState/supportEmptyState.tsx@@ -0,0 +1,42 @@+import * as phoneCallPng from '@posthog/brand/hoggies/png/phone-call'+import { IconSupport } from '@posthog/icons'++import { pngHoggie } from 'lib/brand/hoggies'+import type { SceneProductEmptyState } from 'lib/components/ProductEmptyState/types'+import { urls } from 'scenes/urls'++import { ProductKey } from '~/queries/schema/schema-general'++import { SupportPreview } from './SupportPreview'+import { supportSetupLogic } from './supportSetupLogic'++const HedgehogPhoneCall = pngHoggie(phoneCallPng)++export const supportEmptyState: SceneProductEmptyState = {+ statusLogic: supportSetupLogic,+ config: {+ productKey: ProductKey.CONVERSATIONS,+ productName: 'Support',+ icon: <IconSupport />,+ accentColor: 'var(--color-product-support-light)',+ accentColorDark: 'var(--color-product-support-dark)',+ hedgehog: HedgehogPhoneCall,+ text: {+ 'needs-setup': {+ headline: 'Answer support tickets with full product context',+ lead: 'Collect tickets from an in-app chat widget, email, or Slack into one inbox. Every ticket shows the person behind it, with their events, session replays, and past tickets alongside the conversation. Set SLAs, assign owners, and trigger workflows on ticket events.',+ },+ 'waiting-for-data': {+ headline: 'Support is on. Waiting for your first ticket',+ lead: 'Tickets from your chat widget, email, and any other connected channels will show up here as they arrive. Send a test message through the widget to see one land, or finish connecting a channel in settings.',+ },+ },+ // `primaryAction` isn't keyed by mode the way `text` is, and support is the only+ // adopter with a middle state, so this copy has to read correctly both before+ // support is switched on and while it waits for a first ticket.+ primaryAction: { label: 'Open support settings', to: urls.supportSettings() },+ docsUrl: 'https://posthog.com/docs/support',+ previewLabel: 'Your inbox, once tickets arrive',+ Preview: SupportPreview,+ },+}diff --git a/products/conversations/frontend/emptyState/supportSetupLogic.test.ts b/products/conversations/frontend/emptyState/supportSetupLogic.test.tsnew file mode 100644index 000000000000..daf1e5635968--- /dev/null+++ b/products/conversations/frontend/emptyState/supportSetupLogic.test.ts@@ -0,0 +1,57 @@+import { MOCK_DEFAULT_TEAM } from 'lib/api.mock'++import { expectLogic } from 'kea-test-utils'++import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'++import { ProductKey } from '~/queries/schema/schema-general'+import { initKeaTests } from '~/test/init'+import type { TeamType } from '~/types'++import { conversationsTicketsList } from 'products/conversations/frontend/generated/api'++import { supportSetupLogic } from './supportSetupLogic'++jest.mock('products/conversations/frontend/generated/api', () => ({+ conversationsTicketsList: jest.fn(),+}))++const mockTicketsList = conversationsTicketsList as jest.MockedFunction<typeof conversationsTicketsList>++function mountWithTeam(conversationsEnabled: boolean): ReturnType<typeof supportSetupLogic.build> {+ initKeaTests(true, { ...MOCK_DEFAULT_TEAM, conversations_enabled: conversationsEnabled } as TeamType)+ const logic = supportSetupLogic()+ logic.mount()+ return logic+}++// Guards the three-way ladder into the app-wide setup-status layer: no tickets and support+// off → needs-setup, on without tickets → waiting-for-data, any tickets → has-data whatever+// the toggle says. If the connect or mapping breaks, the gate shows the wrong surface.+describe('supportSetupLogic', () => {+ beforeEach(() => {+ jest.clearAllMocks()+ })++ it.each([+ [0, false, 'needs-setup'],+ [0, true, 'waiting-for-data'],+ [1, true, 'has-data'],+ [42, true, 'has-data'],+ // A team that switched support off keeps its tickets, and this list is the only+ // place to read them, so the history has to outrank the toggle.+ [42, false, 'has-data'],+ ])('pushes %i tickets with support enabled=%s as status %s', async (count, enabled, expected) => {+ mockTicketsList.mockResolvedValue({ count, next: null, previous: null, results: [] })+ const logic = mountWithTeam(enabled)+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.CONVERSATIONS }).values.status).toBe(expected)+ })++ it('fails open to unknown when the count query fails before any answer', async () => {+ mockTicketsList.mockRejectedValue(new Error('network down'))+ const logic = mountWithTeam(true)+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.CONVERSATIONS }).values.status).toBe('unknown')+ })+})diff --git a/products/conversations/frontend/emptyState/supportSetupLogic.ts b/products/conversations/frontend/emptyState/supportSetupLogic.tsnew file mode 100644index 000000000000..b81ae940475a--- /dev/null+++ b/products/conversations/frontend/emptyState/supportSetupLogic.ts@@ -0,0 +1,139 @@+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path } from 'kea'+import { loaders } from 'kea-loaders'+import { subscriptions } from 'kea-subscriptions'++import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'+import type { ProductSetupStatus } from 'lib/components/ProductEmptyState/types'+import { teamLogic } from 'scenes/teamLogic'++import { ProductKey } from '~/queries/schema/schema-general'+import type { TeamPublicType, TeamType } from '~/types'++import { conversationsTicketsList } from 'products/conversations/frontend/generated/api'++// While waiting for the first ticket we re-check on a timer so the page advances on+// its own as tickets land. The disposables plugin pauses this on hidden tabs.+const POLL_INTERVAL_MS = 20000++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface supportSetupLogicValues {+ setupStatus: ProductSetupStatus // productSetupStatusLogic+ currentProjectId: number | string // teamLogic+ currentTeam: TeamPublicType | TeamType | null // teamLogic+ ticketCount: number | null+ ticketCountLoading: boolean+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface supportSetupLogicActions {+ setDetectedStatus: (status: ProductSetupStatus) => {+ status: ProductSetupStatus+ } // productSetupStatusLogic+ checkSetup: () => {+ value: true+ }+ loadTicketCount: (_: void) => void+ loadTicketCountFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadTicketCountSuccess: (+ ticketCount: number,+ payload?: void+ ) => {+ ticketCount: number+ payload?: void+ }+}++export type supportSetupLogicType = MakeLogicType<supportSetupLogicValues, supportSetupLogicActions>++/**+ * Setup detection for the Support empty state, with the full three-state ladder:+ * the team hasn't enabled conversations → `needs-setup` (no query needed); enabled+ * but no tickets yet → `waiting-for-data` (kept fresh by a poll until the first+ * ticket lands); at least one ticket → `has-data`. The `currentTeam` subscription+ * covers the user flipping the enable switch in settings and coming back.+ */+export const supportSetupLogic = kea<supportSetupLogicType>([+ path(['products', 'conversations', 'frontend', 'emptyState', 'supportSetupLogic']),+ connect(() => ({+ actions: [productSetupStatusLogic({ productKey: ProductKey.CONVERSATIONS }), ['setDetectedStatus']],+ values: [+ productSetupStatusLogic({ productKey: ProductKey.CONVERSATIONS }),+ ['status as setupStatus'],+ teamLogic,+ ['currentTeam', 'currentProjectId'],+ ],+ })),+ actions({+ checkSetup: true,+ }),+ loaders(({ values }) => ({+ ticketCount: [+ null as number | null,+ {+ loadTicketCount: async (_: void, breakpoint): Promise<number> => {+ const response = await conversationsTicketsList(String(values.currentProjectId), { limit: 1 })+ breakpoint()+ return response.count+ },+ },+ ],+ })),+ listeners(({ actions, values, cache }) => ({+ checkSetup: () => {+ // No team loaded yet: leave the status at `loading` and let the+ // `currentTeam` subscription re-run this once it arrives.+ if (!values.currentTeam) {+ return+ }+ actions.loadTicketCount()+ },+ loadTicketCountSuccess: () => {+ // Tickets outrank the toggle. Turning support off keeps the tickets, and the+ // settings copy says so, but this list is the only place to read them.+ if (values.ticketCount && values.ticketCount > 0) {+ actions.setDetectedStatus('has-data')+ cache.disposables.dispose('poll')+ } else if (!values.currentTeam?.conversations_enabled) {+ // Nothing to wait for while support is off. Enabling it updates the team,+ // and the `currentTeam` subscription re-runs the check.+ actions.setDetectedStatus('needs-setup')+ cache.disposables.dispose('poll')+ } else {+ actions.setDetectedStatus('waiting-for-data')+ }+ },+ loadTicketCountFailure: () => {+ // Never strand the gate on its spinner: if nothing has answered yet, fail+ // open to the real scene. Don't downgrade an existing answer on a poll blip.+ if (values.setupStatus === 'loading') {+ actions.setDetectedStatus('unknown')+ }+ },+ })),+ subscriptions(({ actions }) => ({+ // kea-subscriptions fires once at mount for any value that isn't `undefined`, and+ // `currentTeam` defaults to `null`, so without this guard every mount checked twice:+ // once here and once from `afterMount`. Still fires on the null-to-team transition,+ // which is the case this subscription exists for.+ currentTeam: (_, previousTeam) => {+ if (previousTeam !== undefined) {+ actions.checkSetup()+ }+ },+ })),+ afterMount(({ actions, cache }) => {+ actions.checkSetup()+ // The poll stops for good once the first ticket arrives, or once a project with no+ // tickets is found to have support switched off.+ cache.disposables.add(() => {+ const id = window.setInterval(() => actions.checkSetup(), POLL_INTERVAL_MS)+ return () => clearInterval(id)+ }, 'poll')+ }),+])diff --git a/products/conversations/frontend/scenes/tickets/SupportTicketsScene.tsx b/products/conversations/frontend/scenes/tickets/SupportTicketsScene.tsxindex 42a6b179e4ca..2488dd63678a 100644--- a/products/conversations/frontend/scenes/tickets/SupportTicketsScene.tsx+++ b/products/conversations/frontend/scenes/tickets/SupportTicketsScene.tsx@@ -33,9 +33,9 @@ import { ProductKey } from '~/queries/schema/schema-general'import { AssigneeMultiSelect } from '../../components/Assignee'import { clearFilterButtonProps } from '../../components/clearFilterButtonProps'import { ComposeTicketButton } from '../../components/ComposeTicket'-import { ConversationsDisabledBanner } from '../../components/ConversationsDisabledBanner'import { SavedViewsButton } from '../../components/SavedViews/SavedViewsButton'import { ScenesTabs } from '../../components/ScenesTabs'+import { supportEmptyState } from '../../emptyState/supportEmptyState'import {type AITriageFilterValue,type Ticket,@@ -58,6 +58,7 @@ export const scene: SceneExport = {component: SupportTicketsScene,logic: supportTicketsSceneLogic,productKey: ProductKey.CONVERSATIONS,+ emptyState: supportEmptyState,}interface SupportTicketsTableProps {@@ -622,9 +623,6 @@ export function SupportTicketsTableFilters({ embedded = false }: SupportTicketsT}export function SupportTicketsScene(): JSX.Element {- const { currentTeam } = useValues(teamLogic)- const conversationsDisabled = !!currentTeam && !currentTeam.conversations_enabled-return (<SceneContent className="pb-4"><SceneTitleSection@@ -636,7 +634,6 @@ export function SupportTicketsScene(): JSX.Element {actions={<ComposeTicketButton />}/><ScenesTabs />- {conversationsDisabled ? <ConversationsDisabledBanner /> : null}<SupportTicketsTableFilters /><SupportTicketsTable /></SceneContent>diff --git a/products/conversations/manifest.tsx b/products/conversations/manifest.tsxindex 5d77672104b2..f55ca1826ad4 100644--- a/products/conversations/manifest.tsx+++ b/products/conversations/manifest.tsx@@ -9,6 +9,9 @@ export const manifest: ProductManifest = {scenes: {SupportTickets: {name: 'Ticket list',+ description:+ 'Collect support tickets from an in-app widget, email, or Slack into one inbox, with the product context behind every ticket',+ iconType: 'conversations',import: () => import('./frontend/scenes/tickets/SupportTicketsScene'),projectBased: true,layout: 'app-container',@@ -61,7 +64,10 @@ export const manifest: ProductManifest = {href: urls.supportTickets(),type: 'conversations',iconType: 'conversations',- iconColor: ['var(--color-product-support-light)'] as FileSystemIconColor,+ iconColor: [+ 'var(--color-product-support-light)',+ 'var(--color-product-support-dark)',+ ] as FileSystemIconColor,sceneKey: 'SupportTickets',},],diff --git a/products/conversations/package.json b/products/conversations/package.jsonindex 67a8bf7b666c..7c8721384ca2 100644--- a/products/conversations/package.json+++ b/products/conversations/package.json@@ -19,6 +19,7 @@"kea-test-utils": "catalog:"},"peerDependencies": {+ "@posthog/brand": "catalog:","@posthog/icons": "catalog:","@posthog/lemon-ui": "*","@storybook/react": "catalog:",diff --git a/products/early_access_features/frontend/EarlyAccessFeatures.tsx b/products/early_access_features/frontend/EarlyAccessFeatures.tsxindex 1789f13ea70b..597ca51821d5 100644--- a/products/early_access_features/frontend/EarlyAccessFeatures.tsx+++ b/products/early_access_features/frontend/EarlyAccessFeatures.tsx@@ -1,9 +1,7 @@import { useActions, useValues } from 'kea'-import { router } from 'kea-router'import { LemonButton, LemonInput, LemonTable, LemonTag, Link, Spinner, Tooltip } from '@posthog/lemon-ui'-import { ProductIntroduction } from 'lib/components/ProductIntroduction/ProductIntroduction'import { Shortcut } from 'lib/components/Shortcuts/Shortcut'import { keyBinds } from 'lib/components/Shortcuts/shortcuts'import { createdAtColumn } from 'lib/lemon-ui/LemonTable/columnUtils'@@ -27,6 +25,7 @@ import {import { AssigneeSelect } from 'products/error_tracking/frontend/components/Assignee/AssigneeSelect'import { earlyAccessFeaturesLogic, waitlistSurveyId } from './earlyAccessFeaturesLogic'+import { earlyAccessFeaturesEmptyState } from './emptyState/earlyAccessFeaturesEmptyState'// Features with no waitlist survey sort below a real count of 0.const NO_WAITLIST_SORT_VALUE = -1@@ -35,6 +34,7 @@ export const scene: SceneExport = {component: EarlyAccessFeatures,logic: earlyAccessFeaturesLogic,productKey: ProductKey.EARLY_ACCESS_FEATURES,+ emptyState: earlyAccessFeaturesEmptyState,}const STAGES_IN_ORDER: Record<EarlyAccessFeatureType['stage'], number> = {@@ -56,7 +56,6 @@ export function EarlyAccessFeatures(): JSX.Element {waitlistResponsesCountFailed,} = useValues(earlyAccessFeaturesLogic)const { setSearchTerm, updateFeatureAssignee } = useActions(earlyAccessFeaturesLogic)- const shouldShowEmptyState = filteredEarlyAccessFeatures.length == 0 && !earlyAccessFeaturesLoading && !searchTerm// Creating an early access feature requires editor access to the resource.const accessControlDisabledReason = getAccessControlDisabledReason(@@ -94,170 +93,149 @@ export function EarlyAccessFeatures(): JSX.Element {}/>- <ProductIntroduction- productName="Early access features"- productKey={ProductKey.EARLY_ACCESS_FEATURES}- thingName="feature"- description="Allow your users to individually enable or disable features that are in public beta."- isEmpty={shouldShowEmptyState}- docsURL="https://posthog.com/docs/feature-flags/early-access-feature-management"- action={() => router.actions.push(urls.earlyAccessFeature('new'))}- className="my-0"- mcpSurfaceKey="early_access_features.create"- />- {!shouldShowEmptyState && (- <>- <div className="mb-4">- <LemonInput- type="search"- placeholder="Search early access features..."- value={searchTerm}- onChange={setSearchTerm}- allowClear- />- </div>- <LemonTable- loading={earlyAccessFeaturesLoading}- columns={[- {- title: 'Name',- key: 'name',- render(_, feature) {- return (- <LemonTableLink- title={feature.name}- description={feature.description}- to={urls.earlyAccessFeature(feature.id)}- />- )- },- sorter: (a, b) => a.name.localeCompare(b.name),- },- {- title: 'Stage',- dataIndex: 'stage',- render(_, { stage }) {- return (- <LemonTag- type={- stage === 'beta'- ? 'warning'- : stage === 'general-availability'- ? 'success'- : 'default'- }- className="uppercase cursor-default"- data-attr="feature-stage"- >- {stage}- </LemonTag>- )- },- sorter: (a, b) => STAGES_IN_ORDER[a.stage] - STAGES_IN_ORDER[b.stage],- },- {- title: 'Waitlist',- key: 'waitlist',- tooltip: 'People who signed up to the waitlist survey for this feature',- render(_, feature) {- const surveyId = waitlistSurveyId(feature)- if (surveyId === null) {- return <span className="text-secondary">–</span>- }- if (waitlistResponsesCountLoading) {- return <Spinner />+ <div className="mb-4">+ <LemonInput+ type="search"+ placeholder="Search early access features..."+ value={searchTerm}+ onChange={setSearchTerm}+ allowClear+ />+ </div>+ <LemonTable+ loading={earlyAccessFeaturesLoading}+ columns={[+ {+ title: 'Name',+ key: 'name',+ render(_, feature) {+ return (+ <LemonTableLink+ title={feature.name}+ description={feature.description}+ to={urls.earlyAccessFeature(feature.id)}+ />+ )+ },+ sorter: (a, b) => a.name.localeCompare(b.name),+ },+ {+ title: 'Stage',+ dataIndex: 'stage',+ render(_, { stage }) {+ return (+ <LemonTag+ type={+ stage === 'beta'+ ? 'warning'+ : stage === 'general-availability'+ ? 'success'+ : 'default'}- if (waitlistResponsesCountFailed) {- return (- <Tooltip title="Couldn't load waitlist signups">- <span className="text-secondary">–</span>+ className="uppercase cursor-default"+ data-attr="feature-stage"+ >+ {stage}+ </LemonTag>+ )+ },+ sorter: (a, b) => STAGES_IN_ORDER[a.stage] - STAGES_IN_ORDER[b.stage],+ },+ {+ title: 'Waitlist',+ key: 'waitlist',+ tooltip: 'People who signed up to the waitlist survey for this feature',+ render(_, feature) {+ const surveyId = waitlistSurveyId(feature)+ if (surveyId === null) {+ return <span className="text-secondary">–</span>+ }+ if (waitlistResponsesCountLoading) {+ return <Spinner />+ }+ if (waitlistResponsesCountFailed) {+ return (+ <Tooltip title="Couldn't load waitlist signups">+ <span className="text-secondary">–</span>+ </Tooltip>+ )+ }+ const count = waitlistResponsesCount[surveyId] ?? 0+ return (+ <Link+ to={urls.survey(surveyId)}+ aria-label={`${count} waitlist signups for ${feature.name}`}+ >+ {count}+ </Link>+ )+ },+ sorter: (a, b) => {+ const getCount = (feature: EarlyAccessFeatureType): number => {+ const surveyId = waitlistSurveyId(feature)+ return surveyId !== null+ ? (waitlistResponsesCount[surveyId] ?? 0)+ : NO_WAITLIST_SORT_VALUE+ }+ return getCount(a) - getCount(b)+ },+ },+ {+ title: 'Assignee',+ key: 'assignee',+ render(_, feature) {+ const assigneeEditDisabledReason = getAccessControlDisabledReason(+ AccessControlResourceType.EarlyAccessFeature,+ AccessControlLevel.Editor,+ feature.user_access_level+ )+ // AssigneeSelect opens its dropdown from a wrapper the disabled button+ // can't gate, so viewers get a read-only display instead of a live trigger.+ if (assigneeEditDisabledReason) {+ return (+ <AssigneeResolver assignee={feature.assignee ?? null}>+ {({ assignee: resolvedAssignee }) => (+ <Tooltip title={assigneeEditDisabledReason}>+ <span className="flex items-center gap-1">+ <AssigneeIconDisplay assignee={resolvedAssignee} size="small" />+ <AssigneeLabelDisplay assignee={resolvedAssignee} size="small" />+ </span></Tooltip>- )- }- const count = waitlistResponsesCount[surveyId] ?? 0- return (- <Link- to={urls.survey(surveyId)}- aria-label={`${count} waitlist signups for ${feature.name}`}+ )}+ </AssigneeResolver>+ )+ }+ return (+ <AssigneeSelect+ assignee={feature.assignee ?? null}+ onChange={(assignee) => updateFeatureAssignee(feature.id, assignee)}+ >+ {(displayAssignee) => (+ <LemonButton+ type="tertiary"+ size="small"+ data-attr="early-access-feature-list-assignee">- {count}- </Link>- )- },- sorter: (a, b) => {- const getCount = (feature: EarlyAccessFeatureType): number => {- const surveyId = waitlistSurveyId(feature)- return surveyId !== null- ? (waitlistResponsesCount[surveyId] ?? 0)- : NO_WAITLIST_SORT_VALUE- }- return getCount(a) - getCount(b)- },- },- {- title: 'Assignee',- key: 'assignee',- render(_, feature) {- const assigneeEditDisabledReason = getAccessControlDisabledReason(- AccessControlResourceType.EarlyAccessFeature,- AccessControlLevel.Editor,- feature.user_access_level- )- // AssigneeSelect opens its dropdown from a wrapper the disabled button- // can't gate, so viewers get a read-only display instead of a live trigger.- if (assigneeEditDisabledReason) {- return (- <AssigneeResolver assignee={feature.assignee ?? null}>- {({ assignee: resolvedAssignee }) => (- <Tooltip title={assigneeEditDisabledReason}>- <span className="flex items-center gap-1">- <AssigneeIconDisplay- assignee={resolvedAssignee}- size="small"- />- <AssigneeLabelDisplay- assignee={resolvedAssignee}- size="small"- />- </span>- </Tooltip>- )}- </AssigneeResolver>- )- }- return (- <AssigneeSelect- assignee={feature.assignee ?? null}- onChange={(assignee) => updateFeatureAssignee(feature.id, assignee)}- >- {(displayAssignee) => (- <LemonButton- type="tertiary"- size="small"- data-attr="early-access-feature-list-assignee"- >- <AssigneeIconDisplay assignee={displayAssignee} size="small" />- <AssigneeLabelDisplay assignee={displayAssignee} size="small" />- </LemonButton>- )}- </AssigneeSelect>- )- },- },- createdAtColumn<EarlyAccessFeatureType>() as LemonTableColumn<- EarlyAccessFeatureType,- keyof EarlyAccessFeatureType | undefined- >,- ]}- dataSource={filteredEarlyAccessFeatures}- emptyState={- searchTerm ? (- <div className="text-center py-8">No early access features match your search</div>- ) : undefined- }- />- </>- )}+ <AssigneeIconDisplay assignee={displayAssignee} size="small" />+ <AssigneeLabelDisplay assignee={displayAssignee} size="small" />+ </LemonButton>+ )}+ </AssigneeSelect>+ )+ },+ },+ createdAtColumn<EarlyAccessFeatureType>() as LemonTableColumn<+ EarlyAccessFeatureType,+ keyof EarlyAccessFeatureType | undefined+ >,+ ]}+ dataSource={filteredEarlyAccessFeatures}+ emptyState={+ searchTerm ? (+ <div className="text-center py-8">No early access features match your search</div>+ ) : undefined+ }+ /></SceneContent>)}diff --git a/products/early_access_features/frontend/emptyState/EarlyAccessFeaturePreview.scss b/products/early_access_features/frontend/emptyState/EarlyAccessFeaturePreview.scssnew file mode 100644index 000000000000..b4ceb72658d3--- /dev/null+++ b/products/early_access_features/frontend/emptyState/EarlyAccessFeaturePreview.scss@@ -0,0 +1,346 @@+@import '../../../../frontend/src/lib/components/ProductEmptyState/previewMixins';++.EafPreview {+ --eaf-preview-accent: var(--empty-state-accent, var(--color-primary-500));++ display: flex;+ flex-direction: column;+ gap: 0.75rem;++ // Hidden opt-in state. A direct child of .EafPreview so `:checked ~` reaches all cards.+ &__checkbox {+ position: absolute;+ width: 0;+ height: 0;+ pointer-events: none;+ opacity: 0;+ }++ &__panel,+ &__app,+ &__spark {+ overflow: hidden;+ background: var(--color-bg-surface-primary);+ border: 1px solid var(--color-border-primary);+ border-radius: var(--radius);+ }++ // On/off pairs are stacked on one grid cell and crossfaded, so opting in never+ // changes any element's size (no layout shift).+ &__swap {+ display: grid;+ }++ &__swap > * {+ grid-area: 1 / 1;+ min-width: 0;+ }++ &__when-on {+ @include preview-swap-hidden;+ }++ &__when-off {+ @include preview-swap-visible;+ }++ &__head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 0.5rem 0.75rem;+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__title {+ font-size: 0.75rem;+ font-weight: 600;+ }++ &__rows {+ display: flex;+ flex-direction: column;+ padding: 0.25rem 0.5rem 0.5rem;+ }++ &__row {+ display: grid;+ grid-template-columns: 1fr auto auto;+ gap: 0.625rem;+ align-items: center;+ padding: 0.4375rem 0.5rem;+ border-radius: var(--radius);+ }++ &__name {+ overflow: hidden;+ font-size: 0.75rem;+ font-weight: 600;+ color: var(--color-text-primary);+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ // Mini stage tag, mimicking the roster's stage column.+ &__stage {+ padding: 0 0.375rem;+ font-size: 0.625rem;+ font-weight: 700;+ color: var(--color-text-secondary);+ text-transform: uppercase;+ background: var(--color-fill-secondary);+ border-radius: 999px;+ }++ &__stage--beta {+ background: color-mix(in oklab, var(--eaf-preview-accent) 12%, transparent);++ @include preview-accent-text(var(--eaf-preview-accent));+ }++ &__optins {+ min-width: 6.5rem;+ font-family: var(--font-mono);+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ text-align: right;+ }++ &__optins--live {+ @include preview-accent-text(var(--eaf-preview-accent));+ }++ // Browser chrome for the mini app.+ &__chrome {+ display: flex;+ gap: 0.3125rem;+ align-items: center;+ padding: 0.4375rem 0.75rem;+ background: var(--color-bg-surface-secondary);+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__url {+ margin-left: 0.375rem;+ font-family: var(--font-mono);+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ }++ &__screen {+ display: flex;+ flex-direction: column;+ gap: 0.5rem;+ padding: 0.875rem;+ }++ // A feature-preview row in the user's labs settings.+ &__lab {+ display: flex;+ gap: 0.625rem;+ align-items: center;+ justify-content: space-between;+ padding: 0.25rem 0.375rem;+ border-radius: var(--radius);+ }++ &__lab--hero {+ cursor: pointer;+ user-select: none;+ transition: background-color 150ms ease;+ }++ &__lab--hero:hover {+ background: var(--color-bg-fill-highlight-50);+ }++ &__lab-copy {+ display: flex;+ flex-direction: column;+ min-width: 0;+ }++ &__lab-name {+ font-size: 0.75rem;+ font-weight: 600;+ }++ &__lab-desc {+ overflow: hidden;+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ // Mini toggle, mimicking an opt-in switch. The off track gets a darker fill plus+ // an inset ring so it stays legible on the card surface.+ &__switch {+ position: relative;+ flex-shrink: 0;+ width: 26px;+ height: 15px;+ background: color-mix(in oklab, var(--color-text-secondary) 25%, var(--color-fill-secondary));+ border-radius: 999px;+ box-shadow: inset 0 0 0 1px var(--color-border-primary);+ transition: background-color 200ms ease;++ &::after {+ position: absolute;+ top: 2px;+ left: 2px;+ width: 11px;+ height: 11px;+ content: '';+ background: var(--color-bg-surface-primary);+ border-radius: 50%;+ box-shadow: 0 1px 2px rgb(0 0 0 / 25%);+ transition: transform 200ms ease;+ }+ }++ &__switch--on {+ background: var(--eaf-preview-accent);++ &::after {+ transform: translateX(11px);+ }+ }++ // The report the beta changes. Both bodies stay stacked, so the block never resizes.+ &__report {+ padding: 0.5rem 0.625rem;+ background: var(--color-bg-surface-secondary);+ border: 1px solid var(--color-border-primary);+ border-radius: var(--radius);+ }++ &__report-body {+ display: flex;+ flex-direction: column;+ gap: 0.375rem;+ }++ &__skel {+ display: block;+ width: var(--w, 100%);+ height: 8px;+ background: var(--color-fill-secondary);+ border-radius: 999px;+ }++ &__summary {+ overflow: hidden;+ font-size: 0.6875rem;+ font-weight: 600;+ text-overflow: ellipsis;+ white-space: nowrap;++ @include preview-accent-text(var(--eaf-preview-accent));+ }++ &__hint {+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ }++ // Opt-in stat card, ticking up when this user joins the beta.+ &__spark {+ padding: 0.75rem 0.875rem 0.875rem;+ }++ &__spark-delta {+ font-size: 0.6875rem;+ font-weight: 600;++ @include preview-accent-text(var(--eaf-preview-accent));+ }++ &__spark-chart {+ margin-top: 0.5rem;+ }++ &__spark-area {+ fill: color-mix(in oklab, var(--eaf-preview-accent) 13%, transparent);+ stroke: none;+ }++ &__spark-line {+ fill: none;+ stroke: color-mix(in oklab, var(--eaf-preview-accent) 32%, transparent);+ stroke-width: 2;+ }++ // The moving bit: a short bright segment cycling along the line.+ &__spark-trace {+ fill: none;+ stroke: var(--eaf-preview-accent);+ stroke-dasharray: 16 84;+ stroke-linecap: round;+ stroke-width: 2;+ animation: EafPreview__trace 3.2s linear infinite;+ }++ @include preview-chrome-dot;+ @include preview-sparkline;+}++// Opted-in state (user flipped the hero switch)++.EafPreview__checkbox:checked ~ * .EafPreview__when-on {+ @include preview-swap-visible;+}++.EafPreview__checkbox:checked ~ * .EafPreview__when-off {+ @include preview-swap-hidden;+}++.EafPreview__checkbox:checked ~ .EafPreview__app .EafPreview__lab--hero .EafPreview__switch {+ background: var(--eaf-preview-accent);++ &::after {+ transform: translateX(11px);+ }+}++// The checkbox stays keyboard-focusable while visually hidden, so the row it labels+// needs a visible focus indicator (WCAG 2.4.7).+.EafPreview__checkbox:focus-visible ~ .EafPreview__app .EafPreview__lab--hero {+ outline: 2px solid var(--eaf-preview-accent);+ outline-offset: 1px;+}++// Nudge attention at the hero switch until it's flipped.+.EafPreview:not(.EafPreview--static)+ .EafPreview__checkbox:not(:checked)+ ~ .EafPreview__app+ .EafPreview__lab--hero+ .EafPreview__switch {+ animation: EafPreview__nudge 2.4s ease-in-out infinite;+}++@keyframes EafPreview__nudge {+ 0%,+ 100% {+ box-shadow:+ inset 0 0 0 1px var(--color-border-primary),+ 0 0 0 0 color-mix(in oklab, var(--eaf-preview-accent) 45%, transparent);+ }++ 50% {+ box-shadow:+ inset 0 0 0 1px var(--color-border-primary),+ 0 0 0 4px color-mix(in oklab, var(--eaf-preview-accent) 20%, transparent);+ }+}++// pathLength is normalized to 100, so the dash offset loops cleanly regardless of length.+@keyframes EafPreview__trace {+ to {+ stroke-dashoffset: -100;+ }+}++// Storybook snapshots and reduced motion drop all ambient motion; flipping the+// switch still works (transitions only).+@include preview-motion-guards('EafPreview');diff --git a/products/early_access_features/frontend/emptyState/EarlyAccessFeaturePreview.tsx b/products/early_access_features/frontend/emptyState/EarlyAccessFeaturePreview.tsxnew file mode 100644index 000000000000..310e71aa9018--- /dev/null+++ b/products/early_access_features/frontend/emptyState/EarlyAccessFeaturePreview.tsx@@ -0,0 +1,138 @@+import './EarlyAccessFeaturePreview.scss'++import { LemonTag } from 'lib/lemon-ui/LemonTag'+import { cn } from 'lib/utils/css-classes'+import { inStorybook, inStorybookTestRunner } from 'lib/utils/dom'++// Hand-authored rising opt-ins series for the stat card sparkline.+const SPARK_LINE = 'M 0 32 L 10 30.5 L 20 31 L 30 28 L 40 28.8 L 50 25.5 L 60 26.2 L 70 22 L 80 20.5 L 90 17 L 100 15'+const SPARK_AREA = `${SPARK_LINE} L 100 40 L 0 40 Z`++/**+ * Example-data preview for the early access features empty state: the feature roster+ * wired to a mini "labs" settings dashboard, so opting into the hero beta - like an+ * end user would - reveals the feature in the app and ticks the opt-in counter. The+ * whole interaction is one hidden checkbox driving `:checked ~` styles - no timers or+ * state, per the preview rules in the `building-product-empty-states` skill. On/off+ * pairs are stacked in `__swap` grids and crossfaded, so opting in never changes the+ * layout's size.+ */+export function EarlyAccessFeaturePreview(): JSX.Element {+ const isStatic = inStorybook() || inStorybookTestRunner()++ return (+ <div className={cn('EafPreview', isStatic && 'EafPreview--static')}>+ {/* Opt-in state, before all three cards so `:checked ~` can style them. */}+ <input type="checkbox" id="eaf-preview-toggle" className="EafPreview__checkbox" />++ <div className="EafPreview__panel">+ <div className="EafPreview__head">+ <span className="EafPreview__title">Early access features</span>+ <LemonTag size="small">example data</LemonTag>+ </div>++ <div className="EafPreview__rows">+ <div className="EafPreview__row">+ <span className="EafPreview__name">AI summaries</span>+ <span className="EafPreview__stage EafPreview__stage--beta">Beta</span>+ <span className="EafPreview__swap EafPreview__optins">+ <span className="EafPreview__when-off">1,204 opted in</span>+ <span className="EafPreview__optins--live EafPreview__when-on">1,205 opted in</span>+ </span>+ </div>+ <div className="EafPreview__row">+ <span className="EafPreview__name">New editor</span>+ <span className="EafPreview__stage">Alpha</span>+ <span className="EafPreview__optins">87 opted in</span>+ </div>+ <div className="EafPreview__row">+ <span className="EafPreview__name">Dark charts</span>+ <span className="EafPreview__stage EafPreview__stage--beta">Beta</span>+ <span className="EafPreview__optins">412 opted in</span>+ </div>+ </div>+ </div>++ <div className="EafPreview__app">+ <div className="EafPreview__chrome">+ <span className="EafPreview__chrome-dot" />+ <span className="EafPreview__chrome-dot" />+ <span className="EafPreview__chrome-dot" />+ <span className="EafPreview__url">yourapp.com/settings/labs</span>+ </div>+ <div className="EafPreview__screen">+ <label htmlFor="eaf-preview-toggle" className="EafPreview__lab EafPreview__lab--hero">+ <span className="EafPreview__lab-copy">+ <span className="EafPreview__lab-name">AI summaries</span>+ <span className="EafPreview__lab-desc">Get a summary on every report</span>+ </span>+ <span className="EafPreview__switch" aria-hidden="true" />+ </label>+ <div className="EafPreview__lab">+ <span className="EafPreview__lab-copy">+ <span className="EafPreview__lab-name">New editor</span>+ <span className="EafPreview__lab-desc">Rebuilt from the ground up</span>+ </span>+ <span className="EafPreview__switch" aria-hidden="true" />+ </div>+ <div className="EafPreview__lab">+ <span className="EafPreview__lab-copy">+ <span className="EafPreview__lab-name">Dark charts</span>+ <span className="EafPreview__lab-desc">High-contrast chart theme</span>+ </span>+ <span className="EafPreview__switch EafPreview__switch--on" aria-hidden="true" />+ </div>++ <div className="EafPreview__report EafPreview__swap">+ <span className="EafPreview__report-body EafPreview__when-off">+ <span className="EafPreview__skel" style={{ '--w': '100%' } as React.CSSProperties} />+ <span className="EafPreview__skel" style={{ '--w': '65%' } as React.CSSProperties} />+ </span>+ <span className="EafPreview__report-body EafPreview__when-on">+ <span className="EafPreview__summary">AI summary: signups up 12% this week</span>+ <span className="EafPreview__skel" style={{ '--w': '65%' } as React.CSSProperties} />+ </span>+ </div>++ <div className="EafPreview__hint EafPreview__swap">+ <span className="EafPreview__when-off">Flip a feature on to opt this user in.</span>+ <span className="EafPreview__when-on">Opted in. Flip it off any time.</span>+ </div>+ </div>+ </div>++ <div className="EafPreview__spark">+ <div className="EafPreview__spark-head">+ <span className="EafPreview__spark-title">Opt-ins · AI summaries · 7 days</span>+ <LemonTag size="small">example data</LemonTag>+ </div>++ <div className="EafPreview__spark-value">+ <span className="EafPreview__swap">+ <span className="EafPreview__when-off">1,204</span>+ <span className="EafPreview__when-on">1,205</span>+ </span>+ <span className="EafPreview__spark-delta EafPreview__when-on">+1 just now</span>+ </div>++ <div className="EafPreview__spark-chart">+ <svg+ className="EafPreview__spark-svg"+ viewBox="0 0 100 40"+ preserveAspectRatio="none"+ aria-hidden="true"+ >+ <path className="EafPreview__spark-area" d={SPARK_AREA} />+ <path className="EafPreview__spark-line" d={SPARK_LINE} vectorEffect="non-scaling-stroke" />+ <path+ className="EafPreview__spark-trace"+ d={SPARK_LINE}+ pathLength={100}+ vectorEffect="non-scaling-stroke"+ />+ </svg>+ </div>+ </div>+ </div>+ )+}diff --git a/products/early_access_features/frontend/emptyState/earlyAccessFeaturesEmptyState.tsx b/products/early_access_features/frontend/emptyState/earlyAccessFeaturesEmptyState.tsxnew file mode 100644index 000000000000..2549f849231d--- /dev/null+++ b/products/early_access_features/frontend/emptyState/earlyAccessFeaturesEmptyState.tsx@@ -0,0 +1,45 @@+import * as rocketPng from '@posthog/brand/hoggies/png/rocket'+import { IconRocket } from '@posthog/icons'++import { pngHoggie } from 'lib/brand/hoggies'+import type { SceneProductEmptyState } from 'lib/components/ProductEmptyState/types'+import { urls } from 'scenes/urls'++import { ProductKey } from '~/queries/schema/schema-general'+import { AccessControlLevel, AccessControlResourceType } from '~/types'++import { EarlyAccessFeaturePreview } from './EarlyAccessFeaturePreview'+import { earlyAccessFeaturesSetupLogic } from './earlyAccessFeaturesSetupLogic'++const HedgehogRocket = pngHoggie(rocketPng)++export const earlyAccessFeaturesEmptyState: SceneProductEmptyState = {+ statusLogic: earlyAccessFeaturesSetupLogic,+ config: {+ productKey: ProductKey.EARLY_ACCESS_FEATURES,+ productName: 'Early access features',+ icon: <IconRocket />,+ accentColor: 'var(--color-product-early-access-features-light)',+ accentColorDark: 'var(--color-product-early-access-features-dark)',+ hedgehog: HedgehogRocket,+ text: {+ 'needs-setup': {+ headline: 'Run beta programs without building your own',+ lead: 'Let users opt in and out of features at any stage, from early concepts to general availability. Run beta programs, collect waitlists for upcoming features, and give users control of their product experience, all without custom infrastructure. Each feature links to a flag, and a user opting in overrides its release conditions.',+ },+ },+ primaryAction: {+ label: 'Create your first early access feature',+ to: urls.earlyAccessFeature('new'),+ accessControl: {+ resourceType: AccessControlResourceType.EarlyAccessFeature,+ minAccessLevel: AccessControlLevel.Editor,+ },+ dataAttr: 'create-feature',+ },+ skippable: false,+ docsUrl: 'https://posthog.com/docs/feature-flags/early-access-feature-management',+ previewLabel: 'Your betas, once published',+ Preview: EarlyAccessFeaturePreview,+ },+}diff --git a/products/early_access_features/frontend/emptyState/earlyAccessFeaturesSetupLogic.test.ts b/products/early_access_features/frontend/emptyState/earlyAccessFeaturesSetupLogic.test.tsnew file mode 100644index 000000000000..d114b8b7f18d--- /dev/null+++ b/products/early_access_features/frontend/emptyState/earlyAccessFeaturesSetupLogic.test.ts@@ -0,0 +1,45 @@+import { expectLogic } from 'kea-test-utils'++import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'++import { ProductKey } from '~/queries/schema/schema-general'+import { initKeaTests } from '~/test/init'++import { earlyAccessFeatureList } from 'products/early_access_features/frontend/generated/api'++import { earlyAccessFeaturesSetupLogic } from './earlyAccessFeaturesSetupLogic'++jest.mock('products/early_access_features/frontend/generated/api', () => ({+ earlyAccessFeatureList: jest.fn(),+}))++const mockEarlyAccessFeatureList = earlyAccessFeatureList as jest.MockedFunction<typeof earlyAccessFeatureList>++// Guards the connect + mapping into the app-wide setup-status layer: if either+// breaks, the scene empty-state gate strands on its spinner or shows the wrong surface.+describe('earlyAccessFeaturesSetupLogic', () => {+ beforeEach(() => {+ jest.clearAllMocks()+ initKeaTests()+ })++ it.each([+ [0, 'needs-setup'],+ [1, 'has-data'],+ [42, 'has-data'],+ ])('pushes a feature count of %i as status %s', async (count, expected) => {+ mockEarlyAccessFeatureList.mockResolvedValue({ count, next: null, previous: null, results: [] })+ const logic = earlyAccessFeaturesSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.EARLY_ACCESS_FEATURES }).values.status).toBe(expected)+ })++ it('fails open to unknown when the count query fails before any answer', async () => {+ mockEarlyAccessFeatureList.mockRejectedValue(new Error('network down'))+ const logic = earlyAccessFeaturesSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.EARLY_ACCESS_FEATURES }).values.status).toBe('unknown')+ })+})diff --git a/products/early_access_features/frontend/emptyState/earlyAccessFeaturesSetupLogic.ts b/products/early_access_features/frontend/emptyState/earlyAccessFeaturesSetupLogic.tsnew file mode 100644index 000000000000..0db1bef6c3ab--- /dev/null+++ b/products/early_access_features/frontend/emptyState/earlyAccessFeaturesSetupLogic.ts@@ -0,0 +1,91 @@+import { MakeLogicType, afterMount, connect, kea, listeners, path } from 'kea'+import { loaders } from 'kea-loaders'++import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'+import type { ProductSetupStatus } from 'lib/components/ProductEmptyState/types'+import { teamLogic } from 'scenes/teamLogic'++import { ProductKey } from '~/queries/schema/schema-general'++import { earlyAccessFeatureList } from 'products/early_access_features/frontend/generated/api'++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface earlyAccessFeaturesSetupLogicValues {+ setupStatus: ProductSetupStatus // productSetupStatusLogic+ currentProjectId: number | string // teamLogic+ featureCount: number | null+ featureCountLoading: boolean+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface earlyAccessFeaturesSetupLogicActions {+ setDetectedStatus: (status: ProductSetupStatus) => {+ status: ProductSetupStatus+ } // productSetupStatusLogic+ loadFeatureCount: (_: void) => void+ loadFeatureCountFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadFeatureCountSuccess: (+ featureCount: number,+ payload?: void+ ) => {+ featureCount: number+ payload?: void+ }+}++export type earlyAccessFeaturesSetupLogicType = MakeLogicType<+ earlyAccessFeaturesSetupLogicValues,+ earlyAccessFeaturesSetupLogicActions+>++/**+ * Setup detection for the early access features empty state. Early access is a+ * creation-first product, so "set up" simply means the project has at least one+ * feature - no event or traffic signal involved. Re-checks on every mount (the+ * scene gate mounts it), which covers returning from the feature creation page.+ */+export const earlyAccessFeaturesSetupLogic = kea<earlyAccessFeaturesSetupLogicType>([+ path(['products', 'early_access_features', 'frontend', 'emptyState', 'earlyAccessFeaturesSetupLogic']),+ connect(() => ({+ actions: [productSetupStatusLogic({ productKey: ProductKey.EARLY_ACCESS_FEATURES }), ['setDetectedStatus']],+ values: [+ productSetupStatusLogic({ productKey: ProductKey.EARLY_ACCESS_FEATURES }),+ ['status as setupStatus'],+ teamLogic,+ ['currentProjectId'],+ ],+ })),+ loaders(({ values }) => ({+ featureCount: [+ null as number | null,+ {+ loadFeatureCount: async (_: void, breakpoint): Promise<number> => {+ const response = await earlyAccessFeatureList(String(values.currentProjectId), { limit: 1 })+ breakpoint()+ return response.count+ },+ },+ ],+ })),+ listeners(({ actions, values }) => ({+ loadFeatureCountSuccess: ({ featureCount }) => {+ actions.setDetectedStatus(featureCount !== null && featureCount > 0 ? 'has-data' : 'needs-setup')+ },+ loadFeatureCountFailure: () => {+ // Never strand the gate on its spinner: if nothing has answered yet, fail+ // open to the real scene. Don't downgrade an existing answer on a blip.+ if (values.setupStatus === 'loading') {+ actions.setDetectedStatus('unknown')+ }+ },+ })),+ afterMount(({ actions }) => {+ actions.loadFeatureCount()+ }),+])diff --git a/products/early_access_features/package.json b/products/early_access_features/package.jsonindex ee8af1c0bd5e..48380b2ef060 100644--- a/products/early_access_features/package.json+++ b/products/early_access_features/package.json@@ -14,6 +14,7 @@"kea-test-utils": "catalog:"},"peerDependencies": {+ "@posthog/brand": "catalog:","@posthog/icons": "catalog:","@storybook/react": "catalog:","@types/react": "*",diff --git a/products/endpoints/frontend/EndpointsScene.tsx b/products/endpoints/frontend/EndpointsScene.tsxindex ef632bd0728b..7e1894d63885 100644--- a/products/endpoints/frontend/EndpointsScene.tsx+++ b/products/endpoints/frontend/EndpointsScene.tsx@@ -1,12 +1,9 @@import { BindLogic, useValues } from 'kea'-import { router } from 'kea-router'import { IconPlusSmall } from '@posthog/icons'import { LemonButton } from '@posthog/lemon-ui'import { AccessControlAction } from 'lib/components/AccessControlAction'-import { BigLeaguesHog } from 'lib/components/hedgehogs'-import { ProductIntroduction } from 'lib/components/ProductIntroduction/ProductIntroduction'import { Shortcut } from 'lib/components/Shortcuts/Shortcut'import { keyBinds } from 'lib/components/Shortcuts/shortcuts'import { LemonTab, LemonTabs } from 'lib/lemon-ui/LemonTabs'@@ -19,6 +16,7 @@ import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'import { ProductKey } from '~/queries/schema/schema-general'import { AccessControlLevel, AccessControlResourceType } from '~/types'+import { endpointsEmptyState } from './emptyState/endpointsEmptyState'import { Endpoints } from './Endpoints'import { endpointsLogic } from './endpointsLogic'import { EndpointsUsage } from './EndpointsUsage'@@ -26,15 +24,11 @@ import { endpointsUsageLogic } from './endpointsUsageLogic'import { InsightPickerEndpointModal } from './InsightPickerEndpointModal'import { OverlayForNewEndpointMenu } from './newEndpointMenu'-const ENDPOINTS_PRODUCT_DESCRIPTION =- 'Create reusable SQL queries and expose them as API endpoints. Query your data programmatically from any application.'-const ENDPOINTS_USAGE_PRODUCT_DESCRIPTION =- 'Monitor endpoint execution metrics including bytes read, CPU usage, and query duration. Compare materialized vs inline executions.'-export const scene: SceneExport = {component: EndpointsScene,logic: endpointsLogic,productKey: ProductKey.ENDPOINTS,+ emptyState: endpointsEmptyState,}export function EndpointsScene(): JSX.Element {@@ -98,18 +92,6 @@ export function EndpointsScene(): JSX.Element {</Shortcut>}/>- <ProductIntroduction- productName="endpoints"- productKey={ProductKey.ENDPOINTS}- thingName="endpoint"- description={- activeTab === 'usage' ? ENDPOINTS_USAGE_PRODUCT_DESCRIPTION : ENDPOINTS_PRODUCT_DESCRIPTION- }- docsURL="https://posthog.com/docs/endpoints"- customHog={BigLeaguesHog}- isEmpty={false}- action={() => router.actions.push(urls.sqlEditor({ source: 'endpoint' }))}- /><LemonTabs activeKey={activeTab} data-attr="endpoints-tabs" tabs={tabs} sceneInset /><InsightPickerEndpointModal /></SceneContent>diff --git a/products/endpoints/frontend/emptyState/CreateFirstEndpointButton.tsx b/products/endpoints/frontend/emptyState/CreateFirstEndpointButton.tsxnew file mode 100644index 000000000000..52d3492e0461--- /dev/null+++ b/products/endpoints/frontend/emptyState/CreateFirstEndpointButton.tsx@@ -0,0 +1,49 @@+import { IconPlusSmall } from '@posthog/icons'+import { LemonButton } from '@posthog/lemon-ui'++import { AccessControlAction } from 'lib/components/AccessControlAction'+import { urls } from 'scenes/urls'++import { AccessControlLevel, AccessControlResourceType } from '~/types'++import { InsightPickerEndpointModal } from '../InsightPickerEndpointModal'+import { OverlayForNewEndpointMenu } from '../newEndpointMenu'++/**+ * The endpoints scene's own "New" button, reproduced for the setup empty state.+ * Both routes into endpoint creation live on that button, and the insight-based one+ * has no URL of its own, so a first-run screen offering only the SQL editor would+ * make the insight route unreachable for the projects most likely to want it.+ */+export function CreateFirstEndpointButton(): JSX.Element {+ return (+ <>+ <AccessControlAction+ resourceType={AccessControlResourceType.Endpoint}+ minAccessLevel={AccessControlLevel.Editor}+ >+ <LemonButton+ type="primary"+ to={urls.sqlEditor({ source: 'endpoint' })}+ sideAction={{+ dropdown: {+ placement: 'bottom-end',+ className: 'new-endpoint-overlay',+ actionable: true,+ overlay: <OverlayForNewEndpointMenu />,+ },+ 'data-attr': 'new-endpoint-dropdown',+ }}+ data-attr="new-endpoint-button"+ icon={<IconPlusSmall />}+ className="self-start"+ >+ Create your first endpoint+ </LemonButton>+ </AccessControlAction>+ {/* The scene mounts this modal, and the gate renders in place of the scene, so without+ it here the dropdown's insight option would open nothing. */}+ <InsightPickerEndpointModal />+ </>+ )+}diff --git a/products/endpoints/frontend/emptyState/EndpointPreview.scss b/products/endpoints/frontend/emptyState/EndpointPreview.scssnew file mode 100644index 000000000000..da3eb4b44f2c--- /dev/null+++ b/products/endpoints/frontend/emptyState/EndpointPreview.scss@@ -0,0 +1,343 @@+@import '../../../../frontend/src/lib/components/ProductEmptyState/previewMixins';++.EndpointPreview {+ --endpoint-preview-accent: var(--empty-state-accent, var(--color-primary-500));++ display: flex;+ flex-direction: column;+ gap: 0.75rem;++ // Hidden materialization state. A direct child of .EndpointPreview so `:checked ~` reaches all cards.+ &__checkbox {+ position: absolute;+ width: 0;+ height: 0;+ pointer-events: none;+ opacity: 0;+ }++ &__panel,+ &__terminal,+ &__spark {+ overflow: hidden;+ background: var(--color-bg-surface-primary);+ border: 1px solid var(--color-border-primary);+ border-radius: var(--radius);+ }++ // Inline/materialized pairs are stacked on one grid cell and crossfaded, so+ // toggling never changes any element's size (no layout shift).+ &__swap {+ display: grid;+ }++ &__swap > * {+ grid-area: 1 / 1;+ min-width: 0;+ }++ &__when-on {+ @include preview-swap-hidden;+ }++ &__when-off {+ @include preview-swap-visible;+ }++ &__head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 0.5rem 0.75rem;+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__title {+ font-size: 0.75rem;+ font-weight: 600;+ }++ &__rows {+ display: flex;+ flex-direction: column;+ padding: 0.25rem 0.5rem;+ }++ &__row {+ display: flex;+ gap: 0.625rem;+ align-items: center;+ padding: 0.4375rem 0.5rem;+ border-radius: var(--radius);+ }++ &__row--hero {+ cursor: pointer;+ user-select: none;+ transition: background-color 150ms ease;+ }++ &__row--hero:hover {+ background: var(--color-bg-fill-highlight-50);+ }++ &__copy {+ display: flex;+ flex-direction: column;+ min-width: 0;+ }++ &__name {+ overflow: hidden;+ font-family: var(--font-mono);+ font-size: 0.75rem;+ font-weight: 600;+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ &__path {+ overflow: hidden;+ font-family: var(--font-mono);+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ // Execution-mode column. Fixed width, so the label swap never reflows the row.+ &__mat {+ flex-shrink: 0;+ min-width: 5.25rem;+ margin-left: auto;+ font-size: 0.625rem;+ font-weight: 700;+ color: var(--color-text-secondary);+ text-align: right;+ text-transform: uppercase;+ }++ &__mat--live {+ @include preview-accent-text(var(--endpoint-preview-accent));+ }++ // Mini toggle, mimicking the materialize switch. The off track gets a darker fill+ // plus an inset ring so it stays legible on the card surface.+ &__switch {+ position: relative;+ flex-shrink: 0;+ width: 26px;+ height: 15px;+ background: color-mix(in oklab, var(--color-text-secondary) 25%, var(--color-fill-secondary));+ border-radius: 999px;+ box-shadow: inset 0 0 0 1px var(--color-border-primary);+ transition: background-color 200ms ease;++ &::after {+ position: absolute;+ top: 2px;+ left: 2px;+ width: 11px;+ height: 11px;+ content: '';+ background: var(--color-bg-surface-primary);+ border-radius: 50%;+ box-shadow: 0 1px 2px rgb(0 0 0 / 25%);+ transition: transform 200ms ease;+ }+ }++ &__switch--on {+ background: var(--endpoint-preview-accent);++ &::after {+ transform: translateX(11px);+ }+ }++ &__hint {+ padding: 0 0.75rem 0.625rem;+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ }++ // Terminal chrome for the calling application.+ &__chrome {+ display: flex;+ gap: 0.3125rem;+ align-items: center;+ padding: 0.4375rem 0.75rem;+ background: var(--color-bg-surface-secondary);+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__chrome-title {+ margin-left: 0.375rem;+ font-family: var(--font-mono);+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ }++ &__screen {+ display: flex;+ flex-direction: column;+ gap: 0.5rem;+ padding: 0.875rem;+ }++ &__line {+ overflow: hidden;+ font-family: var(--font-mono);+ font-size: 0.6875rem;+ line-height: 1.4;+ color: var(--color-text-primary);+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ &__prompt-char {+ color: var(--color-text-tertiary);+ }++ &__response {+ color: var(--color-text-secondary);+ }++ &__ok {+ font-weight: 700;+ color: var(--color-green-500);+ }++ &__timing {+ margin-left: 0.25rem;+ color: var(--color-text-secondary);+ }++ &__timing--fast {+ font-weight: 700;++ @include preview-accent-text(var(--endpoint-preview-accent));+ }++ // Latency stat card, dropping when the endpoint is materialized.+ &__spark {+ padding: 0.75rem 0.875rem 0.875rem;+ }++ &__spark-delta {+ font-size: 0.6875rem;+ font-weight: 600;++ @include preview-accent-text(var(--endpoint-preview-accent));+ }++ &__spark-chart {+ position: relative;+ margin-top: 0.5rem;+ }++ &__marker-label {+ position: absolute;+ top: -0.25rem;+ left: 56%;+ font-size: 0.5625rem;+ font-weight: 700;+ text-transform: uppercase;++ @include preview-accent-text(var(--endpoint-preview-accent));+ }++ &__spark-g {+ transition: opacity 250ms ease;+ }++ &__spark-marker {+ stroke: color-mix(in oklab, var(--endpoint-preview-accent) 55%, transparent);+ stroke-dasharray: 3 3;+ stroke-width: 1;+ }++ &__spark-area {+ fill: color-mix(in oklab, var(--endpoint-preview-accent) 13%, transparent);+ stroke: none;+ }++ &__spark-line {+ fill: none;+ stroke: color-mix(in oklab, var(--endpoint-preview-accent) 32%, transparent);+ stroke-width: 2;+ }++ // The moving bit: a short bright segment cycling along the line.+ &__spark-trace {+ fill: none;+ stroke: var(--endpoint-preview-accent);+ stroke-dasharray: 16 84;+ stroke-linecap: round;+ stroke-width: 2;+ animation: EndpointPreview__trace 3.2s linear infinite;+ }++ @include preview-chrome-dot;+ @include preview-sparkline;+}++// Materialized state (user flipped the hero switch)++.EndpointPreview__checkbox:checked ~ * .EndpointPreview__when-on {+ @include preview-swap-visible;+}++.EndpointPreview__checkbox:checked ~ * .EndpointPreview__when-off {+ @include preview-swap-hidden;+}++.EndpointPreview__checkbox:checked ~ .EndpointPreview__panel .EndpointPreview__row--hero .EndpointPreview__switch {+ background: var(--endpoint-preview-accent);++ &::after {+ transform: translateX(11px);+ }+}++// The checkbox stays keyboard-focusable while visually hidden, so the row it labels+// needs a visible focus indicator (WCAG 2.4.7).+.EndpointPreview__checkbox:focus-visible ~ .EndpointPreview__panel .EndpointPreview__row--hero {+ outline: 2px solid var(--endpoint-preview-accent);+ outline-offset: 1px;+}++// Nudge attention at the hero switch until it's flipped.+.EndpointPreview:not(.EndpointPreview--static)+ .EndpointPreview__checkbox:not(:checked)+ ~ .EndpointPreview__panel+ .EndpointPreview__row--hero+ .EndpointPreview__switch {+ animation: EndpointPreview__nudge 2.4s ease-in-out infinite;+}++@keyframes EndpointPreview__nudge {+ 0%,+ 100% {+ box-shadow:+ inset 0 0 0 1px var(--color-border-primary),+ 0 0 0 0 color-mix(in oklab, var(--endpoint-preview-accent) 45%, transparent);+ }++ 50% {+ box-shadow:+ inset 0 0 0 1px var(--color-border-primary),+ 0 0 0 4px color-mix(in oklab, var(--endpoint-preview-accent) 20%, transparent);+ }+}++// pathLength is normalized to 100, so the dash offset loops cleanly regardless of length.+@keyframes EndpointPreview__trace {+ to {+ stroke-dashoffset: -100;+ }+}++// Storybook snapshots and reduced motion drop all ambient motion; flipping the+// switch still works (transitions only).+@include preview-motion-guards('EndpointPreview');diff --git a/products/endpoints/frontend/emptyState/EndpointPreview.tsx b/products/endpoints/frontend/emptyState/EndpointPreview.tsxnew file mode 100644index 000000000000..b79975bec382--- /dev/null+++ b/products/endpoints/frontend/emptyState/EndpointPreview.tsx@@ -0,0 +1,168 @@+import './EndpointPreview.scss'++import { LemonTag } from 'lib/lemon-ui/LemonTag'+import { cn } from 'lib/utils/css-classes'+import { inStorybook, inStorybookTestRunner } from 'lib/utils/dom'++// Hand-authored latency sparkline geometry. Both series share the same start; the+// "materialized" series drops at the materialization point (x=55), where the marker sits.+const BASELINE = 'M 0 13 L 10 14.5 L 20 12.5 L 30 15 L 40 13.2 L 50 14.6'+const LINE_INLINE = `${BASELINE} L 60 12.8 L 70 14.9 L 80 13 L 90 15 L 100 13.4`+const LINE_MATERIALIZED = `${BASELINE} L 55 14.2 L 62 30 L 70 31.5 L 78 31 L 86 31.8 L 100 31.2`++function areaPath(line: string): string {+ return `${line} L 100 40 L 0 40 Z`+}++/**+ * Example-data preview for the endpoints empty state: a mini endpoint list wired to a+ * terminal calling one over the API and a latency sparkline, so materializing the hero+ * endpoint flips the response time from seconds to milliseconds and drops the latency+ * chart at the marker. The whole interaction is one hidden checkbox driving+ * `:checked ~` styles - no timers or state, per the preview rules in the+ * `building-product-empty-states` skill. Inline/materialized pairs are stacked in+ * `__swap` grids and crossfaded, so toggling never changes the layout's size.+ */+export function EndpointPreview(): JSX.Element {+ const isStatic = inStorybook() || inStorybookTestRunner()++ return (+ <div className={cn('EndpointPreview', isStatic && 'EndpointPreview--static')}>+ {/* Materialization state, before all three cards so `:checked ~` can style them. */}+ <input type="checkbox" id="endpoint-preview-toggle" className="EndpointPreview__checkbox" />++ <div className="EndpointPreview__panel">+ <div className="EndpointPreview__head">+ <span className="EndpointPreview__title">Endpoints</span>+ <LemonTag size="small">example data</LemonTag>+ </div>++ <div className="EndpointPreview__rows">+ <label+ htmlFor="endpoint-preview-toggle"+ className="EndpointPreview__row EndpointPreview__row--hero"+ >+ <span className="EndpointPreview__copy">+ <span className="EndpointPreview__name">active-users-daily</span>+ <span className="EndpointPreview__path">+ /api/projects/2/endpoints/active-users-daily/run+ </span>+ </span>+ <span className="EndpointPreview__swap EndpointPreview__mat">+ <span className="EndpointPreview__when-off">Inline</span>+ <span className="EndpointPreview__mat--live EndpointPreview__when-on">Materialized</span>+ </span>+ <span className="EndpointPreview__switch" aria-hidden="true" />+ </label>+ <div className="EndpointPreview__row">+ <span className="EndpointPreview__copy">+ <span className="EndpointPreview__name">revenue-by-plan</span>+ <span className="EndpointPreview__path">/api/projects/2/endpoints/revenue-by-plan/run</span>+ </span>+ <span className="EndpointPreview__mat EndpointPreview__mat--live">Materialized</span>+ <span className="EndpointPreview__switch EndpointPreview__switch--on" aria-hidden="true" />+ </div>+ </div>++ <div className="EndpointPreview__hint EndpointPreview__swap">+ <span className="EndpointPreview__when-off">+ Materialize the endpoint to precompute its results.+ </span>+ <span className="EndpointPreview__when-on">+ Serving precomputed results. Same API, no code changes.+ </span>+ </div>+ </div>++ <div className="EndpointPreview__terminal">+ <div className="EndpointPreview__chrome">+ <span className="EndpointPreview__chrome-dot" />+ <span className="EndpointPreview__chrome-dot" />+ <span className="EndpointPreview__chrome-dot" />+ <span className="EndpointPreview__chrome-title">your app</span>+ </div>+ <div className="EndpointPreview__screen">+ <div className="EndpointPreview__line">+ <span className="EndpointPreview__prompt-char">$</span> curl+ us.posthog.com/api/projects/2/endpoints/active-users-daily/run+ </div>+ <div className="EndpointPreview__line EndpointPreview__response">+ {'{ "results": [["2026-07-28", 4102], ["2026-07-27", 3987], …] }'}+ </div>+ <div className="EndpointPreview__line EndpointPreview__swap">+ <span className="EndpointPreview__when-off">+ <span className="EndpointPreview__ok">200 OK</span>+ <span className="EndpointPreview__timing">· 4.2s</span>+ </span>+ <span className="EndpointPreview__when-on">+ <span className="EndpointPreview__ok">200 OK</span>+ <span className="EndpointPreview__timing EndpointPreview__timing--fast">· 180ms</span>+ </span>+ </div>+ </div>+ </div>++ <div className="EndpointPreview__spark">+ <div className="EndpointPreview__spark-head">+ <span className="EndpointPreview__spark-title">p95 latency · active-users-daily · 7 days</span>+ <LemonTag size="small">example data</LemonTag>+ </div>++ <div className="EndpointPreview__spark-value">+ <span className="EndpointPreview__swap">+ <span className="EndpointPreview__when-off">4.2s</span>+ <span className="EndpointPreview__when-on">180ms</span>+ </span>+ <span className="EndpointPreview__spark-delta EndpointPreview__when-on">▼ 96%</span>+ </div>++ <div className="EndpointPreview__spark-chart">+ <span className="EndpointPreview__marker-label EndpointPreview__when-on">Materialized</span>+ <svg+ className="EndpointPreview__spark-svg"+ viewBox="0 0 100 40"+ preserveAspectRatio="none"+ aria-hidden="true"+ >+ <g className="EndpointPreview__spark-g EndpointPreview__when-off">+ <path className="EndpointPreview__spark-area" d={areaPath(LINE_INLINE)} />+ <path+ className="EndpointPreview__spark-line"+ d={LINE_INLINE}+ vectorEffect="non-scaling-stroke"+ />+ <path+ className="EndpointPreview__spark-trace"+ d={LINE_INLINE}+ pathLength={100}+ vectorEffect="non-scaling-stroke"+ />+ </g>+ <g className="EndpointPreview__spark-g EndpointPreview__when-on">+ <line+ className="EndpointPreview__spark-marker"+ x1="55"+ y1="4"+ x2="55"+ y2="40"+ vectorEffect="non-scaling-stroke"+ />+ <path className="EndpointPreview__spark-area" d={areaPath(LINE_MATERIALIZED)} />+ <path+ className="EndpointPreview__spark-line"+ d={LINE_MATERIALIZED}+ vectorEffect="non-scaling-stroke"+ />+ <path+ className="EndpointPreview__spark-trace"+ d={LINE_MATERIALIZED}+ pathLength={100}+ vectorEffect="non-scaling-stroke"+ />+ </g>+ </svg>+ </div>+ </div>+ </div>+ )+}diff --git a/products/endpoints/frontend/emptyState/endpointsEmptyState.tsx b/products/endpoints/frontend/emptyState/endpointsEmptyState.tsxnew file mode 100644index 000000000000..56560b93416e--- /dev/null+++ b/products/endpoints/frontend/emptyState/endpointsEmptyState.tsx@@ -0,0 +1,36 @@+import * as codeBubblePng from '@posthog/brand/hoggies/png/code-bubble'+import { IconEndpoints } from '@posthog/icons'++import { pngHoggie } from 'lib/brand/hoggies'+import type { SceneProductEmptyState } from 'lib/components/ProductEmptyState/types'++import { ProductKey } from '~/queries/schema/schema-general'++import { CreateFirstEndpointButton } from './CreateFirstEndpointButton'+import { EndpointPreview } from './EndpointPreview'+import { endpointsSetupLogic } from './endpointsSetupLogic'++const HedgehogCodeBubble = pngHoggie(codeBubblePng)++export const endpointsEmptyState: SceneProductEmptyState = {+ statusLogic: endpointsSetupLogic,+ config: {+ productKey: ProductKey.ENDPOINTS,+ productName: 'Endpoints',+ icon: <IconEndpoints />,+ accentColor: 'var(--color-product-endpoints-light)',+ accentColorDark: 'var(--color-product-endpoints-dark)',+ hedgehog: HedgehogCodeBubble,+ text: {+ 'needs-setup': {+ headline: 'Turn a SQL query into an API endpoint',+ lead: 'Save a query as a named endpoint and call it from any application over the API. Update the query without changing your integration, and monitor every execution: bytes read, CPU usage, and duration. Materialize an endpoint to precompute its results and serve them fast.',+ },+ },+ PrimaryAction: CreateFirstEndpointButton,+ skippable: false,+ docsUrl: 'https://posthog.com/docs/endpoints',+ previewLabel: 'Your endpoints, once created',+ Preview: EndpointPreview,+ },+}diff --git a/products/endpoints/frontend/emptyState/endpointsSetupLogic.test.ts b/products/endpoints/frontend/emptyState/endpointsSetupLogic.test.tsnew file mode 100644index 000000000000..4a45a14a31db--- /dev/null+++ b/products/endpoints/frontend/emptyState/endpointsSetupLogic.test.ts@@ -0,0 +1,45 @@+import { expectLogic } from 'kea-test-utils'++import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'++import { ProductKey } from '~/queries/schema/schema-general'+import { initKeaTests } from '~/test/init'++import { endpointsList } from 'products/endpoints/frontend/generated/api'++import { endpointsSetupLogic } from './endpointsSetupLogic'++jest.mock('products/endpoints/frontend/generated/api', () => ({+ endpointsList: jest.fn(),+}))++const mockEndpointsList = endpointsList as jest.MockedFunction<typeof endpointsList>++// Guards the connect + mapping into the app-wide setup-status layer: if either+// breaks, the scene empty-state gate strands on its spinner or shows the wrong surface.+describe('endpointsSetupLogic', () => {+ beforeEach(() => {+ jest.clearAllMocks()+ initKeaTests()+ })++ it.each([+ [0, 'needs-setup'],+ [1, 'has-data'],+ [42, 'has-data'],+ ])('pushes an endpoint count of %i as status %s', async (count, expected) => {+ mockEndpointsList.mockResolvedValue({ count, next: null, previous: null, results: [] })+ const logic = endpointsSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.ENDPOINTS }).values.status).toBe(expected)+ })++ it('fails open to unknown when the count query fails before any answer', async () => {+ mockEndpointsList.mockRejectedValue(new Error('network down'))+ const logic = endpointsSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.ENDPOINTS }).values.status).toBe('unknown')+ })+})diff --git a/products/endpoints/frontend/emptyState/endpointsSetupLogic.ts b/products/endpoints/frontend/emptyState/endpointsSetupLogic.tsnew file mode 100644index 000000000000..dd15f7410109--- /dev/null+++ b/products/endpoints/frontend/emptyState/endpointsSetupLogic.ts@@ -0,0 +1,88 @@+import { MakeLogicType, afterMount, connect, kea, listeners, path } from 'kea'+import { loaders } from 'kea-loaders'++import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'+import type { ProductSetupStatus } from 'lib/components/ProductEmptyState/types'+import { teamLogic } from 'scenes/teamLogic'++import { ProductKey } from '~/queries/schema/schema-general'++import { endpointsList } from 'products/endpoints/frontend/generated/api'++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface endpointsSetupLogicValues {+ setupStatus: ProductSetupStatus // productSetupStatusLogic+ currentProjectId: number | string // teamLogic+ endpointCount: number | null+ endpointCountLoading: boolean+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface endpointsSetupLogicActions {+ setDetectedStatus: (status: ProductSetupStatus) => {+ status: ProductSetupStatus+ } // productSetupStatusLogic+ loadEndpointCount: (_: void) => void+ loadEndpointCountFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadEndpointCountSuccess: (+ endpointCount: number,+ payload?: void+ ) => {+ endpointCount: number+ payload?: void+ }+}++export type endpointsSetupLogicType = MakeLogicType<endpointsSetupLogicValues, endpointsSetupLogicActions>++/**+ * Setup detection for the endpoints empty state. Endpoints are a creation-first+ * product, so "set up" simply means the project has at least one endpoint - no+ * event or traffic signal involved. Re-checks on every mount (the scene gate+ * mounts it), which covers returning from the SQL editor after saving one.+ */+export const endpointsSetupLogic = kea<endpointsSetupLogicType>([+ path(['products', 'endpoints', 'frontend', 'emptyState', 'endpointsSetupLogic']),+ connect(() => ({+ actions: [productSetupStatusLogic({ productKey: ProductKey.ENDPOINTS }), ['setDetectedStatus']],+ values: [+ productSetupStatusLogic({ productKey: ProductKey.ENDPOINTS }),+ ['status as setupStatus'],+ teamLogic,+ ['currentProjectId'],+ ],+ })),+ loaders(({ values }) => ({+ endpointCount: [+ null as number | null,+ {+ loadEndpointCount: async (_: void, breakpoint): Promise<number> => {+ const response = await endpointsList(String(values.currentProjectId), { limit: 1, offset: 0 })+ breakpoint()+ return response.count+ },+ },+ ],+ })),+ listeners(({ actions, values }) => ({+ loadEndpointCountSuccess: ({ endpointCount }) => {+ actions.setDetectedStatus(endpointCount !== null && endpointCount > 0 ? 'has-data' : 'needs-setup')+ },+ loadEndpointCountFailure: () => {+ // Never strand the gate on its spinner: if nothing has answered yet, fail+ // open to the real scene. Don't downgrade an existing answer on a blip.+ if (values.setupStatus === 'loading') {+ actions.setDetectedStatus('unknown')+ }+ },+ })),+ afterMount(({ actions }) => {+ actions.loadEndpointCount()+ }),+])diff --git a/products/endpoints/manifest.tsx b/products/endpoints/manifest.tsxindex e95af3f6a4f3..a3c76202dca5 100644--- a/products/endpoints/manifest.tsx+++ b/products/endpoints/manifest.tsx@@ -76,7 +76,7 @@ export const manifest: ProductManifest = {name: 'Endpoints',iconType: 'endpoints',href: () => urls.endpoints(),- iconColor: ['var(--color-product-endpoints-light)'],+ iconColor: ['var(--color-product-endpoints-light)', 'var(--color-product-endpoints-dark)'],filterKey: 'endpoints',},},@@ -88,7 +88,10 @@ export const manifest: ProductManifest = {href: urls.endpoints(),type: 'endpoints',iconType: 'endpoints',- iconColor: ['var(--color-product-endpoints-light)'] as FileSystemIconColor,+ iconColor: [+ 'var(--color-product-endpoints-light)',+ 'var(--color-product-endpoints-dark)',+ ] as FileSystemIconColor,sceneKey: 'EndpointsScene',},],@@ -97,7 +100,10 @@ export const manifest: ProductManifest = {path: 'Endpoints',category: 'Tools',iconType: 'endpoints' as FileSystemIconType,- iconColor: ['var(--color-product-endpoints-light)'] as FileSystemIconColor,+ iconColor: [+ 'var(--color-product-endpoints-light)',+ 'var(--color-product-endpoints-dark)',+ ] as FileSystemIconColor,href: urls.endpoints(),sceneKey: 'EndpointsScene',sceneKeys: ['EndpointsScene', 'EndpointScene'],diff --git a/products/endpoints/package.json b/products/endpoints/package.jsonindex 4da2c0b2a4ed..c7a1e39c8ca2 100644--- a/products/endpoints/package.json+++ b/products/endpoints/package.json@@ -12,9 +12,11 @@"kea-router": "catalog:"},"devDependencies": {- "@storybook/react": "catalog:"+ "@storybook/react": "catalog:",+ "kea-test-utils": "catalog:"},"peerDependencies": {+ "@posthog/brand": "catalog:","@posthog/icons": "catalog:","@types/react": "*","clsx": "*",diff --git a/products/experiments/frontend/emptyState/ExperimentPreview.scss b/products/experiments/frontend/emptyState/ExperimentPreview.scssnew file mode 100644index 000000000000..d7a6685708ca--- /dev/null+++ b/products/experiments/frontend/emptyState/ExperimentPreview.scss@@ -0,0 +1,419 @@+@import '../../../../frontend/src/lib/components/ProductEmptyState/previewMixins';++.ExpPreview {+ --exp-preview-accent: var(--empty-state-accent, var(--color-primary-500));+ --exp-preview-control: var(--color-text-tertiary);++ display: flex;+ flex-direction: column;+ gap: 0.75rem;++ // Hidden variant state. Direct children of .ExpPreview so `:checked ~` reaches both cards.+ &__radio {+ position: absolute;+ width: 0;+ height: 0;+ pointer-events: none;+ opacity: 0;+ }++ &__card,+ &__app {+ overflow: hidden;+ background: var(--color-bg-surface-primary);+ border: 1px solid var(--color-border-primary);+ border-radius: var(--radius);+ }++ &__head {+ display: flex;+ gap: 0.5rem;+ align-items: center;+ padding: 0.5rem 0.75rem;+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__title {+ font-family: var(--font-mono);+ font-size: 0.75rem;+ font-weight: 600;+ }++ &__running {+ display: inline-flex;+ gap: 0.25rem;+ align-items: center;+ margin-right: auto;+ font-size: 0.6875rem;+ font-weight: 600;+ color: var(--color-green-500);+ }++ &__running-dot {+ width: 6px;+ height: 6px;+ background: var(--color-green-500);+ border-radius: 50%;+ animation: ExpPreview__pulse 1.8s ease-in-out infinite;+ }++ &__variants {+ display: flex;+ flex-direction: column;+ padding: 0.25rem 0.5rem;+ }++ &__variant {+ display: flex;+ gap: 0.5rem;+ align-items: center;+ padding: 0.4375rem 0.5rem;+ cursor: pointer;+ user-select: none;+ border: 1px solid transparent;+ border-radius: var(--radius);+ transition:+ background-color 150ms ease,+ border-color 150ms ease;+ }++ &__variant:hover {+ background: var(--color-bg-fill-highlight-50);+ }++ // Radio dots make the rows read as selectable, and their colors tie each variant+ // to its interval in the chart below.+ &__vradio {+ position: relative;+ flex-shrink: 0;+ width: 12px;+ height: 12px;+ border: 1.5px solid;+ border-radius: 50%;++ &::after {+ position: absolute;+ inset: 2px;+ content: '';+ border-radius: 50%;+ transition: transform 150ms ease;+ transform: scale(0);+ }+ }++ &__vradio--control {+ border-color: var(--exp-preview-control);++ &::after {+ background: var(--exp-preview-control);+ }+ }++ &__vradio--test {+ border-color: var(--exp-preview-accent);++ &::after {+ background: var(--exp-preview-accent);+ }+ }++ &__variant-name {+ font-family: var(--font-mono);+ font-size: 0.75rem;+ color: var(--color-text-primary);+ }++ &__variant-users {+ margin-left: auto;+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ }++ &__variant-metric {+ min-width: 2.25rem;+ font-family: var(--font-mono);+ font-size: 0.75rem;+ font-weight: 600;+ text-align: right;+ }++ &__badge {+ padding: 0 0.375rem;+ font-size: 0.625rem;+ font-weight: 700;+ color: var(--color-green-600);+ text-transform: uppercase;+ background: color-mix(in oklab, var(--color-green-500) 14%, transparent);+ border-radius: 999px;+ }++ &__chart {+ padding: 0.25rem 0.75rem 0;+ }++ &__chart-svg {+ display: block;+ width: 100%;+ height: auto;+ }++ &__chart-caption {+ padding: 0.125rem 0 0.5rem;+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ }++ &__axis {+ stroke: color-mix(in oklab, var(--color-text-secondary) 50%, transparent);+ stroke-dasharray: 3 3;+ stroke-width: 1;+ }++ &__int {+ transition: opacity 200ms ease;+ }++ &__int-bar {+ transform-box: fill-box;+ transform-origin: center;+ animation: ExpPreview__grow 700ms ease-out both;+ }++ &__int-dot {+ animation: ExpPreview__fade 300ms ease 450ms both;+ }++ &__int--control &__int-bar {+ fill: color-mix(in oklab, var(--exp-preview-control) 30%, transparent);+ animation-delay: 100ms;+ }++ &__int--control &__int-dot {+ fill: var(--exp-preview-control);+ }++ &__int--test &__int-bar {+ fill: color-mix(in oklab, var(--exp-preview-accent) 35%, transparent);+ animation-delay: 250ms;+ }++ &__int--test &__int-dot {+ fill: var(--exp-preview-accent);+ transform-box: fill-box;+ transform-origin: center;+ animation:+ ExpPreview__fade 300ms ease 450ms both,+ ExpPreview__dot-pulse 2.4s ease-in-out 1s infinite;+ }++ &__prob {+ display: grid;+ grid-template-columns: 1fr auto;+ gap: 0.25rem 0.625rem;+ align-items: center;+ padding: 0.5rem 0.75rem 0.625rem;+ border-top: 1px solid var(--color-border-primary);+ }++ &__prob-label {+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ }++ &__prob-value {+ font-family: var(--font-mono);+ font-size: 0.75rem;+ font-weight: 600;+ }++ &__track {+ grid-column: 1 / -1;+ height: 6px;+ overflow: hidden;+ background: var(--color-fill-secondary);+ border-radius: 999px;+ }++ &__fill {+ display: block;+ width: var(--w);+ height: 100%;+ background: color-mix(in oklab, var(--exp-preview-accent) 45%, transparent);+ border-radius: 999px;+ transform-origin: left;+ animation: ExpPreview__grow 900ms ease-out;+ }++ &__fill--winner {+ background: var(--exp-preview-accent);+ }++ // Browser chrome for the mini app.+ &__chrome {+ display: flex;+ gap: 0.3125rem;+ align-items: center;+ padding: 0.4375rem 0.75rem;+ background: var(--color-bg-surface-secondary);+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__url {+ margin-right: auto;+ margin-left: 0.375rem;+ font-family: var(--font-mono);+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ }++ // Which variant this user landed in, mirrored in the mini app's chrome.+ &__pill {+ display: none;+ padding: 0 0.375rem;+ font-family: var(--font-mono);+ font-size: 0.625rem;+ background: color-mix(in oklab, var(--exp-preview-accent) 12%, transparent);+ border-radius: 999px;++ @include preview-accent-text(var(--exp-preview-accent));+ }++ &__screen {+ display: flex;+ flex-direction: column;+ gap: 0.625rem;+ padding: 0.875rem;+ }++ &__cta {+ display: none;+ padding: 0.5rem 0.75rem;+ font-size: 0.75rem;+ font-weight: 600;+ text-align: center;+ border-radius: var(--radius);+ }++ &__cta--control {+ background: var(--color-fill-secondary);+ }++ &__cta--test {+ color: var(--color-bg-surface-primary);+ background: var(--exp-preview-accent);+ }++ &__conv {+ display: none;+ margin-top: -0.25rem;+ font-size: 0.625rem;+ color: var(--color-text-secondary);+ text-align: center;+ }++ &__hint {+ font-size: 0.6875rem;+ color: var(--color-text-tertiary);+ text-align: center;+ }++ @include preview-chrome-dot;+}++// Selected variant, driven purely by the hidden radios.+#exp-preview-control:checked ~ .ExpPreview__card .ExpPreview__variant--control,+#exp-preview-test:checked ~ .ExpPreview__card .ExpPreview__variant--test {+ background: color-mix(in oklab, var(--exp-preview-accent) 8%, transparent);+ border-color: color-mix(in oklab, var(--exp-preview-accent) 40%, transparent);+}++#exp-preview-control:checked ~ .ExpPreview__card .ExpPreview__vradio--control::after,+#exp-preview-test:checked ~ .ExpPreview__card .ExpPreview__vradio--test::after {+ transform: scale(1);+}++// Nudge attention at the leading variant's radio until it's been picked.+.ExpPreview:not(.ExpPreview--static) #exp-preview-test:not(:checked) ~ .ExpPreview__card .ExpPreview__vradio--test {+ animation: ExpPreview__nudge 2.4s ease-in-out infinite;+}++// The chart spotlights the selected variant's interval.+#exp-preview-control:checked ~ .ExpPreview__card .ExpPreview__int--test,+#exp-preview-test:checked ~ .ExpPreview__card .ExpPreview__int--control {+ opacity: 0.35;+}++// The mini app renders the selected variant's experience.+#exp-preview-control:checked ~ .ExpPreview__app .ExpPreview__cta--control,+#exp-preview-test:checked ~ .ExpPreview__app .ExpPreview__cta--test,+#exp-preview-control:checked ~ .ExpPreview__app .ExpPreview__conv--control,+#exp-preview-test:checked ~ .ExpPreview__app .ExpPreview__conv--test,+#exp-preview-control:checked ~ .ExpPreview__app .ExpPreview__pill--control,+#exp-preview-test:checked ~ .ExpPreview__app .ExpPreview__pill--test {+ display: block;+}++// The radios stay keyboard-focusable while visually hidden, so the variant row they+// label needs a visible focus indicator (WCAG 2.4.7).+#exp-preview-control:focus-visible ~ .ExpPreview__card .ExpPreview__variant--control,+#exp-preview-test:focus-visible ~ .ExpPreview__card .ExpPreview__variant--test {+ outline: 2px solid var(--exp-preview-accent);+ outline-offset: 1px;+}++@keyframes ExpPreview__grow {+ from {+ transform: scaleX(0);+ }++ to {+ transform: scaleX(1);+ }+}++@keyframes ExpPreview__fade {+ from {+ opacity: 0;+ }++ to {+ opacity: 1;+ }+}++@keyframes ExpPreview__dot-pulse {+ 0%,+ 100% {+ transform: scale(1);+ }++ 50% {+ transform: scale(1.5);+ }+}++@keyframes ExpPreview__pulse {+ 0%,+ 100% {+ opacity: 1;+ }++ 50% {+ opacity: 0.35;+ }+}++@keyframes ExpPreview__nudge {+ 0%,+ 100% {+ box-shadow: 0 0 0 0 color-mix(in oklab, var(--exp-preview-accent) 45%, transparent);+ }++ 50% {+ box-shadow: 0 0 0 4px color-mix(in oklab, var(--exp-preview-accent) 20%, transparent);+ }+}++// Storybook snapshots and reduced motion drop all ambient motion; selecting a+// variant still works (transitions only).+@include preview-motion-guards('ExpPreview');diff --git a/products/experiments/frontend/emptyState/ExperimentPreview.tsx b/products/experiments/frontend/emptyState/ExperimentPreview.tsxnew file mode 100644index 000000000000..40c76e7e73ed--- /dev/null+++ b/products/experiments/frontend/emptyState/ExperimentPreview.tsx@@ -0,0 +1,104 @@+import './ExperimentPreview.scss'++import { LemonTag } from 'lib/lemon-ui/LemonTag'+import { cn } from 'lib/utils/css-classes'+import { inStorybook, inStorybookTestRunner } from 'lib/utils/dom'++/**+ * Example-data preview for the experiments empty state: a running experiment's results+ * card (variant rows, credible-interval chart, win probability) wired to a mini app,+ * so picking a variant highlights its interval and shows what its users see. The whole+ * interaction is two hidden radios driving `:checked ~` styles - no timers or state,+ * per the preview rules in the `building-product-empty-states` skill.+ */+export function ExperimentPreview(): JSX.Element {+ const isStatic = inStorybook() || inStorybookTestRunner()++ return (+ <div className={cn('ExpPreview', isStatic && 'ExpPreview--static')}>+ {/* Variant selection, before both cards so `:checked ~` can style them. */}+ <input+ type="radio"+ name="exp-preview-variant"+ id="exp-preview-control"+ defaultChecked+ className="ExpPreview__radio"+ />+ <input type="radio" name="exp-preview-variant" id="exp-preview-test" className="ExpPreview__radio" />++ <div className="ExpPreview__card">+ <div className="ExpPreview__head">+ <span className="ExpPreview__title">checkout-cta</span>+ <span className="ExpPreview__running">+ <span className="ExpPreview__running-dot" aria-hidden="true" />+ Running+ </span>+ <LemonTag size="small">example data</LemonTag>+ </div>++ <div className="ExpPreview__variants">+ <label htmlFor="exp-preview-control" className="ExpPreview__variant ExpPreview__variant--control">+ <span className="ExpPreview__vradio ExpPreview__vradio--control" aria-hidden="true" />+ <span className="ExpPreview__variant-name">control</span>+ <span className="ExpPreview__variant-users">6,204 users</span>+ <span className="ExpPreview__variant-metric">3.1%</span>+ </label>+ <label htmlFor="exp-preview-test" className="ExpPreview__variant ExpPreview__variant--test">+ <span className="ExpPreview__vradio ExpPreview__vradio--test" aria-hidden="true" />+ <span className="ExpPreview__variant-name">one-click</span>+ <span className="ExpPreview__badge">Leading</span>+ <span className="ExpPreview__variant-users">6,277 users</span>+ <span className="ExpPreview__variant-metric">4.6%</span>+ </label>+ </div>++ {/* Credible-interval chart: control straddles the zero line, the test+ variant sits clear of it. Fixed aspect (no preserveAspectRatio="none")+ so the dots stay round. */}+ <div className="ExpPreview__chart" aria-hidden="true">+ <svg className="ExpPreview__chart-svg" viewBox="0 0 300 60">+ <line className="ExpPreview__axis" x1="105" y1="4" x2="105" y2="56" />+ <g className="ExpPreview__int ExpPreview__int--control">+ <rect className="ExpPreview__int-bar" x="66" y="14" width="78" height="8" rx="4" />+ <circle className="ExpPreview__int-dot" cx="105" cy="18" r="3" />+ </g>+ <g className="ExpPreview__int ExpPreview__int--test">+ <rect className="ExpPreview__int-bar" x="120" y="38" width="114" height="8" rx="4" />+ <circle className="ExpPreview__int-dot" cx="177" cy="42" r="3" />+ </g>+ </svg>+ <div className="ExpPreview__chart-caption">Change in conversion vs control</div>+ </div>++ <div className="ExpPreview__prob">+ <span className="ExpPreview__prob-label">Chance one-click wins</span>+ <span className="ExpPreview__prob-value">96%</span>+ <span className="ExpPreview__track">+ <span+ className="ExpPreview__fill ExpPreview__fill--winner"+ style={{ '--w': '96%' } as React.CSSProperties}+ />+ </span>+ </div>+ </div>++ <div className="ExpPreview__app">+ <div className="ExpPreview__chrome">+ <span className="ExpPreview__chrome-dot" />+ <span className="ExpPreview__chrome-dot" />+ <span className="ExpPreview__chrome-dot" />+ <span className="ExpPreview__url">yourapp.com/checkout</span>+ <span className="ExpPreview__pill ExpPreview__pill--control">control</span>+ <span className="ExpPreview__pill ExpPreview__pill--test">one-click</span>+ </div>+ <div className="ExpPreview__screen">+ <div className="ExpPreview__cta ExpPreview__cta--control">Proceed to checkout</div>+ <div className="ExpPreview__cta ExpPreview__cta--test">Buy now with 1 click</div>+ <div className="ExpPreview__conv ExpPreview__conv--control">3.1% of visitors convert</div>+ <div className="ExpPreview__conv ExpPreview__conv--test">4.6% of visitors convert</div>+ <div className="ExpPreview__hint">Select a variant above to preview what its users see.</div>+ </div>+ </div>+ </div>+ )+}diff --git a/products/experiments/frontend/emptyState/experimentsEmptyState.tsx b/products/experiments/frontend/emptyState/experimentsEmptyState.tsxnew file mode 100644index 000000000000..7daeb0476a6e--- /dev/null+++ b/products/experiments/frontend/emptyState/experimentsEmptyState.tsx@@ -0,0 +1,44 @@+import * as experimentPng from '@posthog/brand/hoggies/png/experiment'+import { IconFlask } from '@posthog/icons'++import { pngHoggie } from 'lib/brand/hoggies'+import type { SceneProductEmptyState } from 'lib/components/ProductEmptyState/types'+import { urls } from 'scenes/urls'++import { ProductKey } from '~/queries/schema/schema-general'+import { AccessControlLevel, AccessControlResourceType } from '~/types'++import { ExperimentPreview } from './ExperimentPreview'+import { experimentsSetupLogic } from './experimentsSetupLogic'++const HedgehogExperiment = pngHoggie(experimentPng)++export const experimentsEmptyState: SceneProductEmptyState = {+ statusLogic: experimentsSetupLogic,+ config: {+ productKey: ProductKey.EXPERIMENTS,+ productName: 'Experiments',+ icon: <IconFlask />,+ accentColor: 'var(--color-product-experiments-light)',+ hedgehog: HedgehogExperiment,+ text: {+ 'needs-setup': {+ headline: 'Test changes on real users before you commit',+ lead: 'Split traffic between variants and measure the impact on the metrics you care about. Choose Bayesian or frequentist statistics, keep a holdout to track long-term impact, and reuse shared metrics across experiments. Run no-code experiments on your site, or test anything a flag can gate, LLM prompts included.',+ },+ },+ primaryAction: {+ label: 'Create your first experiment',+ to: urls.experiment('new'),+ accessControl: {+ resourceType: AccessControlResourceType.Experiment,+ minAccessLevel: AccessControlLevel.Editor,+ },+ dataAttr: 'create-experiment',+ },+ skippable: false,+ docsUrl: 'https://posthog.com/docs/experiments',+ previewLabel: 'Your results, once running',+ Preview: ExperimentPreview,+ },+}diff --git a/products/experiments/frontend/emptyState/experimentsSetupLogic.test.ts b/products/experiments/frontend/emptyState/experimentsSetupLogic.test.tsnew file mode 100644index 000000000000..158cdfd7d0ba--- /dev/null+++ b/products/experiments/frontend/emptyState/experimentsSetupLogic.test.ts@@ -0,0 +1,49 @@+import { expectLogic } from 'kea-test-utils'++import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'++import { ProductKey } from '~/queries/schema/schema-general'+import { initKeaTests } from '~/test/init'++import { experimentsList } from 'products/experiments/frontend/generated/api'++import { experimentsSetupLogic } from './experimentsSetupLogic'++jest.mock('products/experiments/frontend/generated/api', () => ({+ experimentsList: jest.fn(),+}))++const mockExperimentsList = experimentsList as jest.MockedFunction<typeof experimentsList>++// Guards the connect + mapping into the app-wide setup-status layer: if either+// breaks, the scene empty-state gate strands on its spinner or shows the wrong surface.+describe('experimentsSetupLogic', () => {+ beforeEach(() => {+ jest.clearAllMocks()+ initKeaTests()+ })++ // The list answers archived and non-archived separately, so the count is the sum of both.+ it.each([+ [0, 0, 'needs-setup'],+ [1, 0, 'has-data'],+ [42, 0, 'has-data'],+ [0, 3, 'has-data'],+ ])('pushes %i live and %i archived experiments as status %s', async (live, archived, expected) => {+ mockExperimentsList.mockImplementation((_projectId, params) =>+ Promise.resolve({ count: params?.archived ? archived : live, next: null, previous: null, results: [] })+ )+ const logic = experimentsSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.EXPERIMENTS }).values.status).toBe(expected)+ })++ it('fails open to unknown when the count query fails before any answer', async () => {+ mockExperimentsList.mockRejectedValue(new Error('network down'))+ const logic = experimentsSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.EXPERIMENTS }).values.status).toBe('unknown')+ })+})diff --git a/products/experiments/frontend/emptyState/experimentsSetupLogic.ts b/products/experiments/frontend/emptyState/experimentsSetupLogic.tsnew file mode 100644index 000000000000..fcbedd8d9672--- /dev/null+++ b/products/experiments/frontend/emptyState/experimentsSetupLogic.ts@@ -0,0 +1,94 @@+import { MakeLogicType, afterMount, connect, kea, listeners, path } from 'kea'+import { loaders } from 'kea-loaders'++import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'+import type { ProductSetupStatus } from 'lib/components/ProductEmptyState/types'+import { teamLogic } from 'scenes/teamLogic'++import { ProductKey } from '~/queries/schema/schema-general'++import { experimentsList } from 'products/experiments/frontend/generated/api'++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface experimentsSetupLogicValues {+ setupStatus: ProductSetupStatus // productSetupStatusLogic+ currentProjectId: number | string // teamLogic+ experimentCount: number | null+ experimentCountLoading: boolean+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface experimentsSetupLogicActions {+ setDetectedStatus: (status: ProductSetupStatus) => {+ status: ProductSetupStatus+ } // productSetupStatusLogic+ loadExperimentCount: (_: void) => void+ loadExperimentCountFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadExperimentCountSuccess: (+ experimentCount: number,+ payload?: void+ ) => {+ experimentCount: number+ payload?: void+ }+}++export type experimentsSetupLogicType = MakeLogicType<experimentsSetupLogicValues, experimentsSetupLogicActions>++/**+ * Setup detection for the experiments empty state. Experiments are a creation-first+ * product, so "set up" simply means the project has at least one experiment - no+ * event or traffic signal involved. Re-checks on every mount (the scene gate mounts+ * it), which covers returning from the experiment creation page.+ */+export const experimentsSetupLogic = kea<experimentsSetupLogicType>([+ path(['products', 'experiments', 'frontend', 'emptyState', 'experimentsSetupLogic']),+ connect(() => ({+ actions: [productSetupStatusLogic({ productKey: ProductKey.EXPERIMENTS }), ['setDetectedStatus']],+ values: [+ productSetupStatusLogic({ productKey: ProductKey.EXPERIMENTS }),+ ['status as setupStatus'],+ teamLogic,+ ['currentProjectId'],+ ],+ })),+ loaders(({ values }) => ({+ experimentCount: [+ null as number | null,+ {+ loadExperimentCount: async (_: void, breakpoint): Promise<number> => {+ // The list excludes archived experiments unless asked for them, and no value of+ // `archived` returns both, so a project that archived all of its experiments+ // would count zero and lose the scene it unarchives them from.+ const [live, archived] = await Promise.all([+ experimentsList(String(values.currentProjectId), { limit: 1 }),+ experimentsList(String(values.currentProjectId), { limit: 1, archived: true }),+ ])+ breakpoint()+ return live.count + archived.count+ },+ },+ ],+ })),+ listeners(({ actions, values }) => ({+ loadExperimentCountSuccess: ({ experimentCount }) => {+ actions.setDetectedStatus(experimentCount !== null && experimentCount > 0 ? 'has-data' : 'needs-setup')+ },+ loadExperimentCountFailure: () => {+ // Never strand the gate on its spinner: if nothing has answered yet, fail+ // open to the real scene. Don't downgrade an existing answer on a blip.+ if (values.setupStatus === 'loading') {+ actions.setDetectedStatus('unknown')+ }+ },+ })),+ afterMount(({ actions }) => {+ actions.loadExperimentCount()+ }),+])diff --git a/products/experiments/package.json b/products/experiments/package.jsonindex 093d20806d11..87506288393e 100644--- a/products/experiments/package.json+++ b/products/experiments/package.json@@ -9,9 +9,11 @@"kea-router": "catalog:"},"devDependencies": {- "@storybook/react": "catalog:"+ "@storybook/react": "catalog:",+ "kea-test-utils": "catalog:"},"peerDependencies": {+ "@posthog/brand": "catalog:","@posthog/icons": "catalog:","@types/react": "*","clsx": "*",diff --git a/products/feature_flags/frontend/emptyState/FeatureFlagPreview.scss b/products/feature_flags/frontend/emptyState/FeatureFlagPreview.scssnew file mode 100644index 000000000000..b30d8e094c1d--- /dev/null+++ b/products/feature_flags/frontend/emptyState/FeatureFlagPreview.scss@@ -0,0 +1,420 @@+@import '../../../../frontend/src/lib/components/ProductEmptyState/previewMixins';++.FlagPreview {+ --flag-preview-accent: var(--empty-state-accent, var(--color-primary-500));++ display: flex;+ flex-direction: column;+ gap: 0.75rem;++ // Hidden flag state. A direct child of .FlagPreview so `:checked ~` reaches all cards.+ &__checkbox {+ position: absolute;+ width: 0;+ height: 0;+ pointer-events: none;+ opacity: 0;+ }++ &__panel,+ &__app,+ &__spark {+ overflow: hidden;+ background: var(--color-bg-surface-primary);+ border: 1px solid var(--color-border-primary);+ border-radius: var(--radius);+ }++ // On/off pairs are stacked on one grid cell and crossfaded, so flipping the flag+ // never changes any element's size (no layout shift).+ &__swap {+ display: grid;+ }++ &__swap > * {+ grid-area: 1 / 1;+ min-width: 0;+ }++ &__when-on {+ @include preview-swap-hidden;+ }++ &__when-off {+ @include preview-swap-visible;+ }++ &__head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 0.5rem 0.75rem;+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__title {+ font-size: 0.75rem;+ font-weight: 600;+ }++ &__rows {+ display: flex;+ flex-direction: column;+ padding: 0.25rem 0.5rem;+ }++ &__row {+ display: grid;+ grid-template-columns: 9.5rem 1fr auto auto;+ gap: 0.625rem;+ align-items: center;+ padding: 0.4375rem 0.5rem;+ border-radius: var(--radius);+ }++ &__row--hero {+ cursor: pointer;+ user-select: none;+ transition: background-color 150ms ease;+ }++ &__row--hero:hover {+ background: var(--color-bg-fill-highlight-50);+ }++ &__key {+ overflow: hidden;+ font-family: var(--font-mono);+ font-size: 0.75rem;+ color: var(--color-text-primary);+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ // Per-flag rollout bar, mimicking the release conditions summary.+ &__bar {+ height: 4px;+ overflow: hidden;+ background: var(--color-fill-secondary);+ border-radius: 999px;+ }++ &__bar-fill {+ display: block;+ width: var(--w, 0%);+ height: 100%;+ background: color-mix(in oklab, var(--flag-preview-accent) 55%, transparent);+ border-radius: 999px;+ transition: width 400ms ease;+ }++ &__bar-fill--hero {+ width: 0;+ background: var(--flag-preview-accent);+ }++ &__rollout {+ min-width: 2.25rem;+ font-family: var(--font-mono);+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ text-align: right;+ }++ &__rollout--live {+ @include preview-accent-text(var(--flag-preview-accent));+ }++ // Mini toggle, mimicking the flag list's enabled switch. The off track gets a+ // darker fill plus an inset ring so it stays legible on the card surface.+ &__switch {+ position: relative;+ flex-shrink: 0;+ width: 26px;+ height: 15px;+ background: color-mix(in oklab, var(--color-text-secondary) 25%, var(--color-fill-secondary));+ border-radius: 999px;+ box-shadow: inset 0 0 0 1px var(--color-border-primary);+ transition: background-color 200ms ease;++ &::after {+ position: absolute;+ top: 2px;+ left: 2px;+ width: 11px;+ height: 11px;+ content: '';+ background: var(--color-bg-surface-primary);+ border-radius: 50%;+ box-shadow: 0 1px 2px rgb(0 0 0 / 25%);+ transition: transform 200ms ease;+ }+ }++ &__switch--on {+ background: var(--flag-preview-accent);++ &::after {+ transform: translateX(11px);+ }+ }++ &__hint {+ padding: 0 0.75rem 0.625rem;+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ }++ // Browser chrome for the mini app.+ &__chrome {+ display: flex;+ gap: 0.3125rem;+ align-items: center;+ padding: 0.4375rem 0.75rem;+ background: var(--color-bg-surface-secondary);+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__url {+ margin-left: 0.375rem;+ font-family: var(--font-mono);+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ }++ &__screen {+ display: flex;+ flex-direction: column;+ gap: 0.625rem;+ padding: 0.875rem;+ }++ &__item {+ display: flex;+ gap: 0.625rem;+ align-items: center;+ }++ &__item-blob {+ flex-shrink: 0;+ width: 52px;+ height: 52px;+ overflow: hidden;+ background: color-mix(in oklab, var(--flag-preview-accent) 18%, transparent);+ border-radius: var(--radius);+ }++ // Zoom in on the hog's head: cover the box, then scale toward a point on the face.+ &__item-blob img {+ width: 100%;+ height: 100%;+ object-fit: cover;+ transform: scale(1.9);+ }++ &__hog--noir {+ transform-origin: 44% 38%;+ }++ &__hog--party {+ transform-origin: 44% 36%;+ }++ &__item-copy {+ display: flex;+ flex-direction: column;+ }++ &__item-name {+ font-size: 0.75rem;+ font-weight: 600;+ }++ &__item-price {+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ }++ // The new-experience row the flag releases. Always occupies its space (no layout+ // shift); only its opacity follows the flag.+ &__express {+ padding: 0.375rem 0.625rem;+ font-size: 0.6875rem;+ font-weight: 600;+ background: color-mix(in oklab, var(--flag-preview-accent) 10%, transparent);+ border: 1px solid color-mix(in oklab, var(--flag-preview-accent) 35%, transparent);+ border-radius: var(--radius);++ @include preview-accent-text(var(--flag-preview-accent));+ }++ &__cta {+ display: grid;+ padding: 0.5rem 0.75rem;+ font-size: 0.75rem;+ font-weight: 600;+ text-align: center;+ background: var(--color-fill-secondary);+ border-radius: var(--radius);+ transition:+ background-color 250ms ease,+ color 250ms ease;+ }++ &__cta > * {+ grid-area: 1 / 1;+ }++ // What the app's code sees when it evaluates the flag.+ &__console {+ display: flex;+ padding: 0.375rem 0.625rem;+ font-family: var(--font-mono);+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ background: var(--color-bg-surface-secondary);+ border-radius: var(--radius);+ }++ &__console-key {+ color: var(--color-text-secondary);+ }++ &__console-val--on {+ font-weight: 600;++ @include preview-accent-text(var(--flag-preview-accent));+ }++ // Conversion stat card. The chart crossfades between the flat series and the+ // stepped-up post-release series when the flag flips.+ &__spark {+ padding: 0.75rem 0.875rem 0.875rem;+ }++ &__spark-delta {+ font-size: 0.6875rem;+ font-weight: 600;+ color: var(--color-green-500);+ }++ &__spark-chart {+ position: relative;+ margin-top: 0.5rem;+ }++ &__spark-area {+ fill: color-mix(in oklab, var(--flag-preview-accent) 13%, transparent);+ stroke: none;+ }++ &__spark-line {+ fill: none;+ stroke: color-mix(in oklab, var(--flag-preview-accent) 32%, transparent);+ stroke-width: 2;+ }++ // The moving bit: a short bright segment cycling along the line.+ &__spark-trace {+ fill: none;+ stroke: var(--flag-preview-accent);+ stroke-dasharray: 16 84;+ stroke-linecap: round;+ stroke-width: 2;+ animation: FlagPreview__trace 3.2s linear infinite;+ }++ &__spark-marker {+ stroke: color-mix(in oklab, var(--flag-preview-accent) 55%, transparent);+ stroke-dasharray: 3 3;+ stroke-width: 1;+ }++ // "Released" annotation chip, sitting just left of the marker where the series is flat.+ &__release {+ position: absolute;+ top: 0.125rem;+ left: 55%;+ z-index: 1;+ padding: 0 0.25rem;+ font-size: 0.5625rem;+ font-weight: 600;+ background: color-mix(in oklab, var(--flag-preview-accent) 12%, var(--color-bg-surface-primary));+ border-radius: 999px;+ transform: translateX(-104%);++ @include preview-accent-text(var(--flag-preview-accent));+ }++ @include preview-chrome-dot;+ @include preview-sparkline;+}++// Pinned-on state (user clicked the flag row)++.FlagPreview__checkbox:checked ~ * .FlagPreview__when-on {+ @include preview-swap-visible;+}++.FlagPreview__checkbox:checked ~ * .FlagPreview__when-off {+ @include preview-swap-hidden;+}++.FlagPreview__checkbox:checked ~ .FlagPreview__panel .FlagPreview__row--hero .FlagPreview__switch {+ background: var(--flag-preview-accent);++ &::after {+ transform: translateX(11px);+ }+}++.FlagPreview__checkbox:checked ~ .FlagPreview__panel .FlagPreview__bar-fill--hero {+ width: 100%;+}++.FlagPreview__checkbox:checked ~ .FlagPreview__app .FlagPreview__cta {+ color: var(--color-bg-surface-primary);+ background: var(--flag-preview-accent);+}++// The checkbox stays keyboard-focusable while visually hidden, so the row it labels+// needs a visible focus indicator (WCAG 2.4.7).+.FlagPreview__checkbox:focus-visible ~ .FlagPreview__panel .FlagPreview__row--hero {+ outline: 2px solid var(--flag-preview-accent);+ outline-offset: 1px;+}++// Nudge attention at the hero switch until it's flipped.+.FlagPreview:not(.FlagPreview--static)+ .FlagPreview__checkbox:not(:checked)+ ~ .FlagPreview__panel+ .FlagPreview__row--hero+ .FlagPreview__switch {+ animation: FlagPreview__nudge 2.4s ease-in-out infinite;+}++@keyframes FlagPreview__nudge {+ 0%,+ 100% {+ box-shadow:+ inset 0 0 0 1px var(--color-border-primary),+ 0 0 0 0 color-mix(in oklab, var(--flag-preview-accent) 45%, transparent);+ }++ 50% {+ box-shadow:+ inset 0 0 0 1px var(--color-border-primary),+ 0 0 0 4px color-mix(in oklab, var(--flag-preview-accent) 20%, transparent);+ }+}++// pathLength is normalized to 100, so the dash offset loops cleanly regardless of length.+@keyframes FlagPreview__trace {+ to {+ stroke-dashoffset: -100;+ }+}++// Storybook snapshots and reduced motion drop all ambient motion; clicking the+// flag row still flips the state (transitions only).+@include preview-motion-guards('FlagPreview');diff --git a/products/feature_flags/frontend/emptyState/FeatureFlagPreview.tsx b/products/feature_flags/frontend/emptyState/FeatureFlagPreview.tsxnew file mode 100644index 000000000000..833d38217989--- /dev/null+++ b/products/feature_flags/frontend/emptyState/FeatureFlagPreview.tsx@@ -0,0 +1,172 @@+import './FeatureFlagPreview.scss'++import * as noir1Png from '@posthog/brand/hoggies/png/noir-1'+import * as partyPng from '@posthog/brand/hoggies/png/party'++import { LemonTag } from 'lib/lemon-ui/LemonTag'+import { cn } from 'lib/utils/css-classes'+import { inStorybook, inStorybookTestRunner } from 'lib/utils/dom'++// Hand-authored sparkline geometry for the conversion card. Both series share the same+// baseline; the "on" series steps up at the release point (x=55), where the marker sits.+const BASELINE = 'M 0 30.5 L 10 29 L 20 31 L 30 28.5 L 40 30.8 L 50 29.2'+const LINE_OFF = `${BASELINE} L 60 31 L 70 28.8 L 80 30.9 L 90 29 L 100 30.6`+const LINE_ON = `${BASELINE} L 55 29.8 L 62 16 L 70 15 L 78 13.5 L 86 14.5 L 100 12.5`++function areaPath(line: string): string {+ return `${line} L 100 40 L 0 40 Z`+}++/**+ * Example-data preview for the feature flags empty state: a mini flag list wired to a+ * mini app and a conversion sparkline, so flipping the hero flag re-skins the app's+ * checkout UI and steps the conversion chart up at the release marker. The whole+ * interaction is one hidden checkbox driving `:checked ~` styles - no timers or state,+ * per the preview rules in the `building-product-empty-states` skill. On/off pairs are+ * stacked in `__swap` grids and crossfaded, so flipping never changes the layout's size.+ */+export function FeatureFlagPreview(): JSX.Element {+ const isStatic = inStorybook() || inStorybookTestRunner()++ return (+ <div className={cn('FlagPreview', isStatic && 'FlagPreview--static')}>+ {/* Flag state, before all three cards so `:checked ~` can style them. */}+ <input type="checkbox" id="flag-preview-toggle" className="FlagPreview__checkbox" />++ <div className="FlagPreview__panel">+ <div className="FlagPreview__head">+ <span className="FlagPreview__title">Feature flags</span>+ <LemonTag size="small">example data</LemonTag>+ </div>++ <div className="FlagPreview__rows">+ <div className="FlagPreview__row">+ <span className="FlagPreview__key">dark-mode</span>+ <span className="FlagPreview__bar">+ <span className="FlagPreview__bar-fill" style={{ '--w': '100%' } as React.CSSProperties} />+ </span>+ <span className="FlagPreview__rollout">100%</span>+ <span className="FlagPreview__switch FlagPreview__switch--on" aria-hidden="true" />+ </div>+ <label htmlFor="flag-preview-toggle" className="FlagPreview__row FlagPreview__row--hero">+ <span className="FlagPreview__key">one-click-checkout</span>+ <span className="FlagPreview__bar">+ <span className="FlagPreview__bar-fill FlagPreview__bar-fill--hero" />+ </span>+ <span className="FlagPreview__swap">+ <span className="FlagPreview__rollout FlagPreview__when-off">0%</span>+ <span className="FlagPreview__rollout FlagPreview__rollout--live FlagPreview__when-on">+ 100%+ </span>+ </span>+ <span className="FlagPreview__switch" aria-hidden="true" />+ </label>+ <div className="FlagPreview__row">+ <span className="FlagPreview__key">beta-invites</span>+ <span className="FlagPreview__bar">+ <span className="FlagPreview__bar-fill" style={{ '--w': '25%' } as React.CSSProperties} />+ </span>+ <span className="FlagPreview__rollout">25%</span>+ <span className="FlagPreview__switch FlagPreview__switch--on" aria-hidden="true" />+ </div>+ </div>++ <div className="FlagPreview__hint FlagPreview__swap">+ <span className="FlagPreview__when-off">Flip the flag to release it in the app below.</span>+ <span className="FlagPreview__when-on">Live for everyone. Flip it off to roll back.</span>+ </div>+ </div>++ <div className="FlagPreview__app">+ <div className="FlagPreview__chrome">+ <span className="FlagPreview__chrome-dot" />+ <span className="FlagPreview__chrome-dot" />+ <span className="FlagPreview__chrome-dot" />+ <span className="FlagPreview__url">yourapp.com/checkout</span>+ </div>+ <div className="FlagPreview__screen">+ <div className="FlagPreview__item">+ <span className="FlagPreview__item-blob FlagPreview__swap" aria-hidden="true">+ <img src={noir1Png.src} alt="" className="FlagPreview__hog--noir FlagPreview__when-off" />+ <img src={partyPng.src} alt="" className="FlagPreview__hog--party FlagPreview__when-on" />+ </span>+ <div className="FlagPreview__item-copy">+ <span className="FlagPreview__item-name">Hedgehog plushie</span>+ <span className="FlagPreview__item-price">$28.00</span>+ </div>+ </div>+ <div className="FlagPreview__express FlagPreview__when-on">+ Express checkout enabled for this order+ </div>+ <div className="FlagPreview__cta">+ <span className="FlagPreview__when-off">Proceed to checkout</span>+ <span className="FlagPreview__when-on">Buy now with 1 click</span>+ </div>+ <div className="FlagPreview__console">+ <span className="FlagPreview__console-key">one-click-checkout</span>+ <span className="FlagPreview__swap">+ <span className="FlagPreview__console-val FlagPreview__when-off">: false</span>+ <span className="FlagPreview__console-val FlagPreview__console-val--on FlagPreview__when-on">+ : true+ </span>+ </span>+ </div>+ </div>+ </div>++ <div className="FlagPreview__spark">+ <div className="FlagPreview__spark-head">+ <span className="FlagPreview__spark-title">Checkout conversion · 7 days</span>+ <LemonTag size="small">example data</LemonTag>+ </div>++ <div className="FlagPreview__spark-value">+ <span className="FlagPreview__swap">+ <span className="FlagPreview__when-off">3.1%</span>+ <span className="FlagPreview__when-on">4.6%</span>+ </span>+ <span className="FlagPreview__spark-delta FlagPreview__when-on">▲ 48%</span>+ </div>++ <div className="FlagPreview__spark-chart">+ <span className="FlagPreview__release FlagPreview__when-on">Released</span>+ <svg+ className="FlagPreview__spark-svg"+ viewBox="0 0 100 40"+ preserveAspectRatio="none"+ aria-hidden="true"+ >+ <g className="FlagPreview__spark-g FlagPreview__when-off">+ <path className="FlagPreview__spark-area" d={areaPath(LINE_OFF)} />+ <path className="FlagPreview__spark-line" d={LINE_OFF} vectorEffect="non-scaling-stroke" />+ <path+ className="FlagPreview__spark-trace"+ d={LINE_OFF}+ pathLength={100}+ vectorEffect="non-scaling-stroke"+ />+ </g>+ <g className="FlagPreview__spark-g FlagPreview__when-on">+ <line+ className="FlagPreview__spark-marker"+ x1="55"+ y1="4"+ x2="55"+ y2="40"+ vectorEffect="non-scaling-stroke"+ />+ <path className="FlagPreview__spark-area" d={areaPath(LINE_ON)} />+ <path className="FlagPreview__spark-line" d={LINE_ON} vectorEffect="non-scaling-stroke" />+ <path+ className="FlagPreview__spark-trace"+ d={LINE_ON}+ pathLength={100}+ vectorEffect="non-scaling-stroke"+ />+ </g>+ </svg>+ </div>+ </div>+ </div>+ )+}diff --git a/products/feature_flags/frontend/emptyState/featureFlagsEmptyState.tsx b/products/feature_flags/frontend/emptyState/featureFlagsEmptyState.tsxnew file mode 100644index 000000000000..8c0c1abebe78--- /dev/null+++ b/products/feature_flags/frontend/emptyState/featureFlagsEmptyState.tsx@@ -0,0 +1,44 @@+import * as trafficControllerPng from '@posthog/brand/hoggies/png/traffic-controller'+import { IconToggle } from '@posthog/icons'++import { pngHoggie } from 'lib/brand/hoggies'+import type { SceneProductEmptyState } from 'lib/components/ProductEmptyState/types'+import { urls } from 'scenes/urls'++import { ProductKey } from '~/queries/schema/schema-general'+import { AccessControlLevel, AccessControlResourceType } from '~/types'++import { FeatureFlagPreview } from './FeatureFlagPreview'+import { featureFlagsSetupLogic } from './featureFlagsSetupLogic'++const HedgehogTrafficController = pngHoggie(trafficControllerPng)++export const featureFlagsEmptyState: SceneProductEmptyState = {+ statusLogic: featureFlagsSetupLogic,+ config: {+ productKey: ProductKey.FEATURE_FLAGS,+ productName: 'Feature flags',+ icon: <IconToggle />,+ accentColor: 'var(--color-product-feature-flags-light)',+ hedgehog: HedgehogTrafficController,+ text: {+ 'needs-setup': {+ headline: 'Ship code without shipping the feature',+ lead: 'Wrap a change in a feature flag, roll it out to 1% of users, and watch what happens: the session replays, events, and exceptions from the people who got it. Turn it off the moment something looks wrong, no redeploy needed. Flags also power experiments, early access programs, kill switches, and remote config.',+ },+ },+ primaryAction: {+ label: 'Create your first feature flag',+ to: urls.featureFlagTemplates(),+ accessControl: {+ resourceType: AccessControlResourceType.FeatureFlag,+ minAccessLevel: AccessControlLevel.Editor,+ },+ dataAttr: 'new-feature-flag',+ },+ skippable: false,+ docsUrl: 'https://posthog.com/docs/feature-flags',+ previewLabel: 'Your flags, once created',+ Preview: FeatureFlagPreview,+ },+}diff --git a/products/feature_flags/frontend/emptyState/featureFlagsSetupLogic.test.ts b/products/feature_flags/frontend/emptyState/featureFlagsSetupLogic.test.tsnew file mode 100644index 000000000000..6d2d7d8112d0--- /dev/null+++ b/products/feature_flags/frontend/emptyState/featureFlagsSetupLogic.test.ts@@ -0,0 +1,49 @@+import { expectLogic } from 'kea-test-utils'++import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'++import { ProductKey } from '~/queries/schema/schema-general'+import { initKeaTests } from '~/test/init'++import { featureFlagsList } from 'products/feature_flags/frontend/generated/api'++import { featureFlagsSetupLogic } from './featureFlagsSetupLogic'++jest.mock('products/feature_flags/frontend/generated/api', () => ({+ featureFlagsList: jest.fn(),+}))++const mockFeatureFlagsList = featureFlagsList as jest.MockedFunction<typeof featureFlagsList>++// Guards the connect + mapping into the app-wide setup-status layer: if either+// breaks, the scene empty-state gate strands on its spinner or shows the wrong surface.+describe('featureFlagsSetupLogic', () => {+ beforeEach(() => {+ jest.clearAllMocks()+ initKeaTests()+ })++ // The list answers archived and non-archived separately, so the count is the sum of both.+ it.each([+ [0, 0, 'needs-setup'],+ [1, 0, 'has-data'],+ [42, 0, 'has-data'],+ [0, 3, 'has-data'],+ ])('pushes %i live and %i archived flags as status %s', async (live, archived, expected) => {+ mockFeatureFlagsList.mockImplementation((_projectId, params) =>+ Promise.resolve({ count: params?.archived ? archived : live, next: null, previous: null, results: [] })+ )+ const logic = featureFlagsSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.FEATURE_FLAGS }).values.status).toBe(expected)+ })++ it('fails open to unknown when the count query fails before any answer', async () => {+ mockFeatureFlagsList.mockRejectedValue(new Error('network down'))+ const logic = featureFlagsSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.FEATURE_FLAGS }).values.status).toBe('unknown')+ })+})diff --git a/products/feature_flags/frontend/emptyState/featureFlagsSetupLogic.ts b/products/feature_flags/frontend/emptyState/featureFlagsSetupLogic.tsnew file mode 100644index 000000000000..3ba6c140551b--- /dev/null+++ b/products/feature_flags/frontend/emptyState/featureFlagsSetupLogic.ts@@ -0,0 +1,98 @@+import { MakeLogicType, afterMount, connect, kea, listeners, path } from 'kea'+import { loaders } from 'kea-loaders'++import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'+import type { ProductSetupStatus } from 'lib/components/ProductEmptyState/types'+import { teamLogic } from 'scenes/teamLogic'++import { ProductKey } from '~/queries/schema/schema-general'++import { featureFlagsList } from 'products/feature_flags/frontend/generated/api'+import { FeatureFlagsListArchived } from 'products/feature_flags/frontend/generated/api.schemas'++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface featureFlagsSetupLogicValues {+ setupStatus: ProductSetupStatus // productSetupStatusLogic+ currentProjectId: number | string // teamLogic+ flagCount: number | null+ flagCountLoading: boolean+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface featureFlagsSetupLogicActions {+ setDetectedStatus: (status: ProductSetupStatus) => {+ status: ProductSetupStatus+ } // productSetupStatusLogic+ loadFlagCount: (_: void) => void+ loadFlagCountFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadFlagCountSuccess: (+ flagCount: number,+ payload?: void+ ) => {+ flagCount: number+ payload?: void+ }+}++export type featureFlagsSetupLogicType = MakeLogicType<featureFlagsSetupLogicValues, featureFlagsSetupLogicActions>++/**+ * Setup detection for the feature flags empty state. Flags are a creation-first+ * product, so "set up" simply means the project has at least one flag - no event+ * or traffic signal involved. Re-checks on every mount (the scene gate mounts it),+ * which covers returning from the flag creation page.+ */+export const featureFlagsSetupLogic = kea<featureFlagsSetupLogicType>([+ path(['products', 'feature_flags', 'frontend', 'emptyState', 'featureFlagsSetupLogic']),+ connect(() => ({+ actions: [productSetupStatusLogic({ productKey: ProductKey.FEATURE_FLAGS }), ['setDetectedStatus']],+ values: [+ productSetupStatusLogic({ productKey: ProductKey.FEATURE_FLAGS }),+ ['status as setupStatus'],+ teamLogic,+ ['currentProjectId'],+ ],+ })),+ loaders(({ values }) => ({+ flagCount: [+ null as number | null,+ {+ loadFlagCount: async (_: void, breakpoint): Promise<number> => {+ // The list excludes archived flags unless asked for them, and no value of+ // `archived` returns both, so a project that archived all of its flags would+ // count zero and lose the scene it unarchives them from.+ const [live, archived] = await Promise.all([+ featureFlagsList(String(values.currentProjectId), { limit: 1 }),+ featureFlagsList(String(values.currentProjectId), {+ limit: 1,+ archived: FeatureFlagsListArchived.True,+ }),+ ])+ breakpoint()+ return live.count + archived.count+ },+ },+ ],+ })),+ listeners(({ actions, values }) => ({+ loadFlagCountSuccess: ({ flagCount }) => {+ actions.setDetectedStatus(flagCount !== null && flagCount > 0 ? 'has-data' : 'needs-setup')+ },+ loadFlagCountFailure: () => {+ // Never strand the gate on its spinner: if nothing has answered yet, fail+ // open to the real scene. Don't downgrade an existing answer on a blip.+ if (values.setupStatus === 'loading') {+ actions.setDetectedStatus('unknown')+ }+ },+ })),+ afterMount(({ actions }) => {+ actions.loadFlagCount()+ }),+])diff --git a/products/feature_flags/package.json b/products/feature_flags/package.jsonindex e932a6b367cc..91fc501c84f5 100644--- a/products/feature_flags/package.json+++ b/products/feature_flags/package.json@@ -14,6 +14,7 @@"kea-test-utils": "catalog:"},"peerDependencies": {+ "@posthog/brand": "catalog:","@posthog/icons": "catalog:","@types/react": "*","clsx": "*",diff --git a/products/links/frontend/LinksScene.tsx b/products/links/frontend/LinksScene.tsxindex 074a758a6607..9fbefaacba4c 100644--- a/products/links/frontend/LinksScene.tsx+++ b/products/links/frontend/LinksScene.tsx@@ -4,7 +4,6 @@ import { router } from 'kea-router'import { IconPlus } from '@posthog/icons'import { LemonBanner, LemonButton, LemonTable, LemonTableColumn, Link } from '@posthog/lemon-ui'-import { ProductIntroduction } from 'lib/components/ProductIntroduction/ProductIntroduction'import { Shortcut } from 'lib/components/Shortcuts/Shortcut'import { keyBinds } from 'lib/components/Shortcuts/shortcuts'import { More } from 'lib/lemon-ui/LemonButton/More'@@ -21,6 +20,7 @@ import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'import { ProductKey } from '~/queries/schema/schema-general'import { LinkType } from '~/types'+import { linksEmptyState } from './emptyState/linksEmptyState'import { LinkMetricSparkline } from './LinkMetricSparkline'import { linksLogic } from './linksLogic'@@ -28,11 +28,11 @@ export const scene: SceneExport = {component: LinksScene,logic: linksLogic,productKey: ProductKey.LINKS,+ emptyState: linksEmptyState,}export function LinksScene(): JSX.Element {const { links, linksLoading } = useValues(linksLogic)- const shouldShowEmptyState = links.length == 0 && !linksLoadingconst columns = [{@@ -153,18 +153,7 @@ export function LinksScene(): JSX.Element {</p></LemonBanner>- <ProductIntroduction- isEmpty={shouldShowEmptyState}- productName="Links"- productKey={ProductKey.LINKS}- thingName="link"- description="Start creating links for your marketing campaigns, referral programs, and more."- action={() => router.actions.push(urls.link('new'))}- docsURL="https://posthog.com/docs/links"- className="my-0"- />-- {!shouldShowEmptyState && <LemonTable loading={linksLoading} columns={columns} dataSource={links} />}+ <LemonTable loading={linksLoading} columns={columns} dataSource={links} /></SceneContent>)}diff --git a/products/links/frontend/emptyState/LinkPreview.scss b/products/links/frontend/emptyState/LinkPreview.scssnew file mode 100644index 000000000000..e083d2f35539--- /dev/null+++ b/products/links/frontend/emptyState/LinkPreview.scss@@ -0,0 +1,335 @@+@import '../../../../frontend/src/lib/components/ProductEmptyState/previewMixins';++.LinkPreview {+ --link-preview-accent: var(--empty-state-accent, var(--color-primary-500));++ display: flex;+ flex-direction: column;+ gap: 0.75rem;++ // Hidden link state. Direct children of .LinkPreview so `:checked ~` reaches all cards.+ &__radio {+ position: absolute;+ width: 0;+ height: 0;+ pointer-events: none;+ opacity: 0;+ }++ &__panel,+ &__app,+ &__spark {+ overflow: hidden;+ background: var(--color-bg-surface-primary);+ border: 1px solid var(--color-border-primary);+ border-radius: var(--radius);+ }++ // Link variants are stacked on one grid cell and crossfaded, so switching links+ // never changes any element's size (no layout shift).+ &__swap {+ display: grid;+ }++ &__swap > * {+ grid-area: 1 / 1;+ min-width: 0;+ }++ &__on-a,+ &__on-b {+ @include preview-swap-hidden;+ }++ &__head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 0.5rem 0.75rem;+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__title {+ font-size: 0.75rem;+ font-weight: 600;+ }++ &__rows {+ display: flex;+ flex-direction: column;+ padding: 0.25rem 0.5rem;+ }++ &__row {+ display: grid;+ grid-template-columns: auto 1fr auto auto;+ gap: 0.5rem;+ align-items: center;+ padding: 0.375rem 0.5rem;+ border: 1px solid transparent;+ border-radius: var(--radius);+ transition:+ background-color 150ms ease,+ border-color 150ms ease;+ }++ &__row--a,+ &__row--b {+ cursor: pointer;+ user-select: none;+ }++ &__row--a:hover,+ &__row--b:hover {+ background: var(--color-bg-fill-highlight-50);+ }++ // Radio dots make the selectable rows read as selectable; the static row keeps an+ // empty spacer so all rows align.+ &__vradio {+ position: relative;+ flex-shrink: 0;+ width: 12px;+ height: 12px;+ border: 1.5px solid var(--link-preview-accent);+ border-radius: 50%;++ &::after {+ position: absolute;+ inset: 2px;+ content: '';+ background: var(--link-preview-accent);+ border-radius: 50%;+ transition: transform 150ms ease;+ transform: scale(0);+ }+ }++ &__vradio--blank {+ visibility: hidden;+ }++ &__link {+ display: flex;+ flex-direction: column;+ min-width: 0;+ }++ &__key {+ overflow: hidden;+ font-family: var(--font-mono);+ font-size: 0.6875rem;+ font-weight: 600;+ color: var(--color-text-primary);+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ &__dest {+ overflow: hidden;+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ &__row-spark {+ width: 40px;+ height: 12px;++ path {+ fill: none;+ stroke: color-mix(in oklab, var(--link-preview-accent) 55%, transparent);+ stroke-linecap: round;+ stroke-width: 1.5;+ }+ }++ &__clicks {+ min-width: 3rem;+ font-family: var(--font-mono);+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ text-align: right;+ }++ &__hint {+ padding: 0 0.75rem 0.5rem;+ font-size: 0.6875rem;+ color: var(--color-text-tertiary);+ }++ // Browser chrome for the landing-page card.+ &__chrome {+ display: flex;+ gap: 0.3125rem;+ align-items: center;+ padding: 0.4375rem 0.75rem;+ background: var(--color-bg-surface-secondary);+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__url {+ margin-left: 0.375rem;+ font-family: var(--font-mono);+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ }++ &__redirect {+ display: flex;+ gap: 0.375rem;+ align-items: center;+ padding: 0.3125rem 0.75rem;+ font-size: 0.625rem;+ color: var(--color-text-secondary);+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__redirect-arrow {+ font-weight: 700;++ @include preview-accent-text(var(--link-preview-accent));+ }++ &__screen {+ display: flex;+ flex-direction: column;+ gap: 0.4375rem;+ align-items: flex-start;+ padding: 0.875rem;+ }++ &__page-title {+ font-size: 0.9375rem;+ font-weight: 700;+ }++ &__page-sub {+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ }++ &__page-cta {+ margin-top: 0.125rem;+ font-size: 0.6875rem;+ font-weight: 600;++ > * {+ padding: 0.3125rem 0.625rem;+ color: var(--color-bg-surface-primary);+ text-align: center;+ background: var(--link-preview-accent);+ border-radius: var(--radius);+ }+ }++ // The podcast page's play button meeps (the inbox onboarding easter egg). The swap+ // mixins keep it out of reach, and out of the tab order, while its half is hidden.+ &__play {+ font: inherit;+ cursor: pointer;+ border: none;++ &:focus-visible {+ outline: 2px solid var(--link-preview-accent);+ outline-offset: 1px;+ }+ }++ // Clicks stat card for the selected link.+ &__spark {+ padding: 0.75rem 0.875rem 0.875rem;+ }++ &__spark-note {+ font-size: 0.6875rem;+ font-weight: 400;+ color: var(--color-text-tertiary);+ }++ &__spark-chart {+ margin-top: 0.5rem;+ }++ &__spark-g {+ transition: opacity 250ms ease;+ }++ &__spark-area {+ fill: color-mix(in oklab, var(--link-preview-accent) 13%, transparent);+ stroke: none;+ }++ &__spark-line {+ fill: none;+ stroke: color-mix(in oklab, var(--link-preview-accent) 32%, transparent);+ stroke-width: 2;+ }++ // The moving bit: a short bright segment cycling along the line.+ &__spark-trace {+ fill: none;+ stroke: var(--link-preview-accent);+ stroke-dasharray: 16 84;+ stroke-linecap: round;+ stroke-width: 2;+ animation: LinkPreview__trace 3.2s linear infinite;+ }++ @include preview-chrome-dot;+ @include preview-sparkline;+}++// Selected link, driven purely by the hidden radios.++#link-preview-a:checked ~ * .LinkPreview__on-a,+#link-preview-b:checked ~ * .LinkPreview__on-b {+ @include preview-swap-visible;+}++#link-preview-a:checked ~ .LinkPreview__panel .LinkPreview__row--a,+#link-preview-b:checked ~ .LinkPreview__panel .LinkPreview__row--b {+ background: color-mix(in oklab, var(--link-preview-accent) 8%, transparent);+ border-color: color-mix(in oklab, var(--link-preview-accent) 40%, transparent);+}++#link-preview-a:checked ~ .LinkPreview__panel .LinkPreview__vradio--a::after,+#link-preview-b:checked ~ .LinkPreview__panel .LinkPreview__vradio--b::after {+ transform: scale(1);+}++// The radios stay keyboard-focusable while visually hidden, so the link row they+// label needs a visible focus indicator (WCAG 2.4.7).+#link-preview-a:focus-visible ~ .LinkPreview__panel .LinkPreview__row--a,+#link-preview-b:focus-visible ~ .LinkPreview__panel .LinkPreview__row--b {+ outline: 2px solid var(--link-preview-accent);+ outline-offset: 1px;+}++// Nudge attention at the unselected link's radio until it's been picked.+.LinkPreview:not(.LinkPreview--static) #link-preview-b:not(:checked) ~ .LinkPreview__panel .LinkPreview__vradio--b {+ animation: LinkPreview__nudge 2.4s ease-in-out infinite;+}++@keyframes LinkPreview__nudge {+ 0%,+ 100% {+ box-shadow: 0 0 0 0 color-mix(in oklab, var(--link-preview-accent) 45%, transparent);+ }++ 50% {+ box-shadow: 0 0 0 4px color-mix(in oklab, var(--link-preview-accent) 20%, transparent);+ }+}++// pathLength is normalized to 100, so the dash offset loops cleanly regardless of length.+@keyframes LinkPreview__trace {+ to {+ stroke-dashoffset: -100;+ }+}++// Storybook snapshots and reduced motion drop all ambient motion; picking a link+// still works (transitions only).+@include preview-motion-guards('LinkPreview');diff --git a/products/links/frontend/emptyState/LinkPreview.tsx b/products/links/frontend/emptyState/LinkPreview.tsxnew file mode 100644index 000000000000..3526e350590d--- /dev/null+++ b/products/links/frontend/emptyState/LinkPreview.tsx@@ -0,0 +1,177 @@+import './LinkPreview.scss'++import { LemonTag } from 'lib/lemon-ui/LemonTag'+import { cn } from 'lib/utils/css-classes'+import { inStorybook, inStorybookTestRunner } from 'lib/utils/dom'++import { playMeep } from 'products/signals/frontend/inbox/components/onboarding/meep'++// Hand-authored 7-day click series: one tiny sparkline per link row, plus a pair of+// larger series for the stat card (one per selectable link).+const ROW_SPARKS = [+ 'M 0 10 L 6.6 8.5 L 13.3 9 L 20 7 L 26.6 7.6 L 33.3 5 L 40 3',+ 'M 0 9 L 6.6 9.5 L 13.3 7.5 L 20 8 L 26.6 6 L 33.3 6.6 L 40 4.5',+ 'M 0 8 L 6.6 8.6 L 13.3 7.8 L 20 8.4 L 26.6 7.4 L 33.3 8 L 40 7',+]+const LINE_A = 'M 0 32 L 10 30 L 20 30.8 L 30 27 L 40 27.8 L 50 24 L 60 25 L 70 20.5 L 80 19 L 90 15.5 L 100 13'+const LINE_B = 'M 0 33 L 10 32 L 20 32.4 L 30 30 L 40 30.8 L 50 28 L 60 28.8 L 70 26 L 80 25 L 90 22.5 L 100 21'++function areaPath(line: string): string {+ return `${line} L 100 40 L 0 40 Z`+}++/**+ * Example-data preview for the links empty state: the link list wired to a mini+ * browser and a clicks stat card, so picking a link shows the page its visitors land+ * on. The whole interaction is two hidden radios driving `:checked ~` styles - no+ * timers or state, per the preview rules in the `building-product-empty-states`+ * skill. Link variants are stacked in `__swap` grids and crossfaded, so switching+ * never changes the layout's size.+ */+export function LinkPreview(): JSX.Element {+ const isStatic = inStorybook() || inStorybookTestRunner()++ return (+ <div className={cn('LinkPreview', isStatic && 'LinkPreview--static')}>+ {/* Link selection, before all three cards so `:checked ~` can style them. */}+ <input+ type="radio"+ name="link-preview-link"+ id="link-preview-a"+ defaultChecked+ className="LinkPreview__radio"+ />+ <input type="radio" name="link-preview-link" id="link-preview-b" className="LinkPreview__radio" />++ <div className="LinkPreview__panel">+ <div className="LinkPreview__head">+ <span className="LinkPreview__title">Links</span>+ <LemonTag size="small">example data</LemonTag>+ </div>++ <div className="LinkPreview__rows">+ <label htmlFor="link-preview-a" className="LinkPreview__row LinkPreview__row--a">+ <span className="LinkPreview__vradio LinkPreview__vradio--a" aria-hidden="true" />+ <span className="LinkPreview__link">+ <span className="LinkPreview__key">phog.gg/spring-sale</span>+ <span className="LinkPreview__dest">yourstore.com/spring-sale</span>+ </span>+ <svg className="LinkPreview__row-spark" viewBox="0 0 40 12" aria-hidden="true">+ <path d={ROW_SPARKS[0]} vectorEffect="non-scaling-stroke" />+ </svg>+ <span className="LinkPreview__clicks">1,284</span>+ </label>+ <label htmlFor="link-preview-b" className="LinkPreview__row LinkPreview__row--b">+ <span className="LinkPreview__vradio LinkPreview__vradio--b" aria-hidden="true" />+ <span className="LinkPreview__link">+ <span className="LinkPreview__key">phog.gg/podcast</span>+ <span className="LinkPreview__dest">yourshow.fm/episode-42</span>+ </span>+ <svg className="LinkPreview__row-spark" viewBox="0 0 40 12" aria-hidden="true">+ <path d={ROW_SPARKS[1]} vectorEffect="non-scaling-stroke" />+ </svg>+ <span className="LinkPreview__clicks">967</span>+ </label>+ <div className="LinkPreview__row LinkPreview__row--static">+ <span className="LinkPreview__vradio LinkPreview__vradio--blank" aria-hidden="true" />+ <span className="LinkPreview__link">+ <span className="LinkPreview__key">phog.gg/qr-menu</span>+ <span className="LinkPreview__dest">yourcafe.com/menu</span>+ </span>+ <svg className="LinkPreview__row-spark" viewBox="0 0 40 12" aria-hidden="true">+ <path d={ROW_SPARKS[2]} vectorEffect="non-scaling-stroke" />+ </svg>+ <span className="LinkPreview__clicks">412</span>+ </div>+ </div>++ <div className="LinkPreview__hint">Pick a link to preview where it takes people.</div>+ </div>++ <div className="LinkPreview__app">+ <div className="LinkPreview__chrome">+ <span className="LinkPreview__chrome-dot" />+ <span className="LinkPreview__chrome-dot" />+ <span className="LinkPreview__chrome-dot" />+ <span className="LinkPreview__swap LinkPreview__url">+ <span className="LinkPreview__on-a">phog.gg/spring-sale</span>+ <span className="LinkPreview__on-b">phog.gg/podcast</span>+ </span>+ </div>+ <div className="LinkPreview__redirect">+ <span className="LinkPreview__redirect-arrow" aria-hidden="true">+ →+ </span>+ <span className="LinkPreview__swap">+ <span className="LinkPreview__on-a">Redirects to yourstore.com/spring-sale</span>+ <span className="LinkPreview__on-b">Redirects to yourshow.fm/episode-42</span>+ </span>+ </div>+ <div className="LinkPreview__screen">+ <span className="LinkPreview__swap LinkPreview__page-title">+ <span className="LinkPreview__on-a">Spring sale</span>+ <span className="LinkPreview__on-b">Episode 42</span>+ </span>+ <span className="LinkPreview__swap LinkPreview__page-sub">+ <span className="LinkPreview__on-a">20% off sitewide, this week only</span>+ <span className="LinkPreview__on-b">How small teams ship faster</span>+ </span>+ <span className="LinkPreview__swap LinkPreview__page-cta">+ <span className="LinkPreview__on-a">Shop the sale</span>+ <button type="button" className="LinkPreview__on-b LinkPreview__play" onClick={playMeep}>+ Play episode+ </button>+ </span>+ </div>+ </div>++ <div className="LinkPreview__spark">+ <div className="LinkPreview__spark-head">+ <span className="LinkPreview__swap LinkPreview__spark-title">+ <span className="LinkPreview__on-a">Clicks · phog.gg/spring-sale · 7 days</span>+ <span className="LinkPreview__on-b">Clicks · phog.gg/podcast · 7 days</span>+ </span>+ <LemonTag size="small">example data</LemonTag>+ </div>++ <div className="LinkPreview__spark-value">+ <span className="LinkPreview__swap">+ <span className="LinkPreview__on-a">1,284</span>+ <span className="LinkPreview__on-b">967</span>+ </span>+ <span className="LinkPreview__spark-note">total clicks</span>+ </div>++ <div className="LinkPreview__spark-chart">+ <svg+ className="LinkPreview__spark-svg"+ viewBox="0 0 100 40"+ preserveAspectRatio="none"+ aria-hidden="true"+ >+ <g className="LinkPreview__spark-g LinkPreview__on-a">+ <path className="LinkPreview__spark-area" d={areaPath(LINE_A)} />+ <path className="LinkPreview__spark-line" d={LINE_A} vectorEffect="non-scaling-stroke" />+ <path+ className="LinkPreview__spark-trace"+ d={LINE_A}+ pathLength={100}+ vectorEffect="non-scaling-stroke"+ />+ </g>+ <g className="LinkPreview__spark-g LinkPreview__on-b">+ <path className="LinkPreview__spark-area" d={areaPath(LINE_B)} />+ <path className="LinkPreview__spark-line" d={LINE_B} vectorEffect="non-scaling-stroke" />+ <path+ className="LinkPreview__spark-trace"+ d={LINE_B}+ pathLength={100}+ vectorEffect="non-scaling-stroke"+ />+ </g>+ </svg>+ </div>+ </div>+ </div>+ )+}diff --git a/products/links/frontend/emptyState/linksEmptyState.tsx b/products/links/frontend/emptyState/linksEmptyState.tsxnew file mode 100644index 000000000000..51993b3fd1cd--- /dev/null+++ b/products/links/frontend/emptyState/linksEmptyState.tsx@@ -0,0 +1,38 @@+import * as megaphonePng from '@posthog/brand/hoggies/png/megaphone'+import { IconExternal } from '@posthog/icons'++import { pngHoggie } from 'lib/brand/hoggies'+import type { SceneProductEmptyState } from 'lib/components/ProductEmptyState/types'+import { FEATURE_FLAGS } from 'lib/constants'+import { urls } from 'scenes/urls'++import { ProductKey } from '~/queries/schema/schema-general'++import { LinkPreview } from './LinkPreview'+import { linksSetupLogic } from './linksSetupLogic'++const HedgehogMegaphone = pngHoggie(megaphonePng)++export const linksEmptyState: SceneProductEmptyState = {+ statusLogic: linksSetupLogic,+ // The whole product is behind this flag (nav-gated); flag-off users never reach the scene.+ featureFlag: FEATURE_FLAGS.LINKS,+ config: {+ productKey: ProductKey.LINKS,+ productName: 'Links',+ icon: <IconExternal />,+ accentColor: 'var(--color-product-links-light)',+ accentColorDark: 'var(--color-product-links-dark)',+ hedgehog: HedgehogMegaphone,+ text: {+ 'needs-setup': {+ headline: 'Short links you control after sharing them',+ lead: 'Turn long URLs into short links for emails, social posts, referral programs, and QR codes. Each link redirects to whatever destination you choose, and you can change that destination at any time without re-sharing the link.',+ },+ },+ primaryAction: { label: 'Create your first link', to: urls.link('new') },+ skippable: false,+ previewLabel: 'Your links, once created',+ Preview: LinkPreview,+ },+}diff --git a/products/links/frontend/emptyState/linksSetupLogic.test.ts b/products/links/frontend/emptyState/linksSetupLogic.test.tsnew file mode 100644index 000000000000..afab02f22406--- /dev/null+++ b/products/links/frontend/emptyState/linksSetupLogic.test.ts@@ -0,0 +1,44 @@+import { expectLogic } from 'kea-test-utils'++import api from 'lib/api'+import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'++import { ProductKey } from '~/queries/schema/schema-general'+import { initKeaTests } from '~/test/init'++import { linksSetupLogic } from './linksSetupLogic'++// Guards the connect + mapping into the app-wide setup-status layer: if either+// breaks, the scene empty-state gate strands on its spinner or shows the wrong surface.+describe('linksSetupLogic', () => {+ let listSpy: jest.SpyInstance++ beforeEach(() => {+ listSpy = jest.spyOn(api.links, 'list')+ initKeaTests()+ })++ afterEach(() => {+ listSpy.mockRestore()+ })++ it.each([+ [0, 'needs-setup'],+ [1, 'has-data'],+ [23, 'has-data'],+ ])('pushes a link count of %i as status %s', async (count, expected) => {+ listSpy.mockResolvedValue({ count, results: [] })+ const logic = linksSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.LINKS }).values.status).toBe(expected)+ })++ it('fails open to unknown when the count query fails before any answer', async () => {+ listSpy.mockRejectedValue(new Error('network down'))+ const logic = linksSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.LINKS }).values.status).toBe('unknown')+ })+})diff --git a/products/links/frontend/emptyState/linksSetupLogic.ts b/products/links/frontend/emptyState/linksSetupLogic.tsnew file mode 100644index 000000000000..0c32a48461c4--- /dev/null+++ b/products/links/frontend/emptyState/linksSetupLogic.ts@@ -0,0 +1,80 @@+import { MakeLogicType, afterMount, connect, kea, listeners, path } from 'kea'+import { loaders } from 'kea-loaders'++import api from 'lib/api'+import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'+import type { ProductSetupStatus } from 'lib/components/ProductEmptyState/types'++import { ProductKey } from '~/queries/schema/schema-general'++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface linksSetupLogicValues {+ setupStatus: ProductSetupStatus // productSetupStatusLogic+ linkCount: number | null+ linkCountLoading: boolean+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface linksSetupLogicActions {+ setDetectedStatus: (status: ProductSetupStatus) => {+ status: ProductSetupStatus+ } // productSetupStatusLogic+ loadLinkCount: (_: void) => void+ loadLinkCountFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadLinkCountSuccess: (+ linkCount: number,+ payload?: void+ ) => {+ linkCount: number+ payload?: void+ }+}++export type linksSetupLogicType = MakeLogicType<linksSetupLogicValues, linksSetupLogicActions>++/**+ * Setup detection for the links empty state. Links are a creation-first product,+ * so "set up" simply means the project has at least one link - no event or traffic+ * signal involved. Re-checks on every mount (the scene gate mounts it), which+ * covers returning from the link creation page.+ */+export const linksSetupLogic = kea<linksSetupLogicType>([+ path(['products', 'links', 'frontend', 'emptyState', 'linksSetupLogic']),+ connect(() => ({+ actions: [productSetupStatusLogic({ productKey: ProductKey.LINKS }), ['setDetectedStatus']],+ values: [productSetupStatusLogic({ productKey: ProductKey.LINKS }), ['status as setupStatus']],+ })),+ loaders({+ linkCount: [+ null as number | null,+ {+ loadLinkCount: async (_: void, breakpoint): Promise<number> => {+ const response = await api.links.list({ limit: 1 })+ breakpoint()+ return response.count+ },+ },+ ],+ }),+ listeners(({ actions, values }) => ({+ loadLinkCountSuccess: ({ linkCount }) => {+ actions.setDetectedStatus(linkCount !== null && linkCount > 0 ? 'has-data' : 'needs-setup')+ },+ loadLinkCountFailure: () => {+ // Never strand the gate on its spinner: if nothing has answered yet, fail+ // open to the real scene. Don't downgrade an existing answer on a blip.+ if (values.setupStatus === 'loading') {+ actions.setDetectedStatus('unknown')+ }+ },+ })),+ afterMount(({ actions }) => {+ actions.loadLinkCount()+ }),+])diff --git a/products/links/manifest.tsx b/products/links/manifest.tsxindex 8ae5122e3c3f..9976bb07d567 100644--- a/products/links/manifest.tsx+++ b/products/links/manifest.tsx@@ -37,7 +37,7 @@ export const manifest: ProductManifest = {name: 'Link',iconType: 'link' as FileSystemIconType,href: (ref: string) => urls.link(ref),- iconColor: ['var(--color-product-links-light)'],+ iconColor: ['var(--color-product-links-light)', 'var(--color-product-links-dark)'],filterKey: 'link',flag: FEATURE_FLAGS.LINKS,},@@ -48,7 +48,7 @@ export const manifest: ProductManifest = {type: 'link',href: urls.link('new'),iconType: 'link' as FileSystemIconType,- iconColor: ['var(--color-product-links-light)'] as FileSystemIconColor,+ iconColor: ['var(--color-product-links-light)', 'var(--color-product-links-dark)'] as FileSystemIconColor,flag: FEATURE_FLAGS.LINKS,},],diff --git a/products/links/package.json b/products/links/package.jsonindex cb9b427f7f2c..bdd2601c19c6 100644--- a/products/links/package.json+++ b/products/links/package.json@@ -10,7 +10,11 @@"kea-router": "catalog:","qrcode.react": "^4.2.0"},+ "devDependencies": {+ "kea-test-utils": "catalog:"+ },"peerDependencies": {+ "@posthog/brand": "catalog:","@posthog/icons": "catalog:","@storybook/react": "catalog:","@types/react": "*",diff --git a/products/mcp_analytics/frontend/emptyState/MCPToolCallPreview.scss b/products/mcp_analytics/frontend/emptyState/MCPToolCallPreview.scssindex 99b8dc952a8b..aa57dcd0c3a5 100644--- a/products/mcp_analytics/frontend/emptyState/MCPToolCallPreview.scss+++ b/products/mcp_analytics/frontend/emptyState/MCPToolCallPreview.scss@@ -1,3 +1,5 @@+@import '../../../../frontend/src/lib/components/ProductEmptyState/previewMixins';+.MCPPreview {--mcp-preview-accent: var(--empty-state-accent, var(--color-primary-500));@@ -153,9 +155,10 @@#mcp-preview-claude:checked ~ .MCPPreview__chips .MCPPreview__chip--claude,#mcp-preview-cursor:checked ~ .MCPPreview__chips .MCPPreview__chip--cursor,#mcp-preview-openai:checked ~ .MCPPreview__chips .MCPPreview__chip--openai {- color: var(--mcp-preview-accent);background: color-mix(in oklab, var(--mcp-preview-accent) 12%, transparent);border-color: color-mix(in oklab, var(--mcp-preview-accent) 45%, transparent);++ @include preview-accent-text(var(--mcp-preview-accent));}// Picking a client dims the rows that don't belong to it.diff --git a/products/product_tours/frontend/emptyState/ProductTourPreview.scss b/products/product_tours/frontend/emptyState/ProductTourPreview.scssnew file mode 100644index 000000000000..03c384980f60--- /dev/null+++ b/products/product_tours/frontend/emptyState/ProductTourPreview.scss@@ -0,0 +1,355 @@+@import '../../../../frontend/src/lib/components/ProductEmptyState/previewMixins';++.TourPreview {+ --tour-preview-accent: var(--empty-state-accent, var(--color-primary-500));++ display: flex;+ flex-direction: column;+ gap: 0.75rem;++ // Hidden step state. Direct children of .TourPreview so `:checked ~` reaches all cards.+ &__radio {+ position: absolute;+ width: 0;+ height: 0;+ pointer-events: none;+ opacity: 0;+ }++ &__panel,+ &__app,+ &__spark {+ overflow: hidden;+ background: var(--color-bg-surface-primary);+ border: 1px solid var(--color-border-primary);+ border-radius: var(--radius);+ }++ &__head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 0.5rem 0.75rem;+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__title {+ font-size: 0.75rem;+ font-weight: 600;+ }++ &__rows {+ display: flex;+ flex-direction: column;+ padding: 0.25rem 0.5rem 0.5rem;+ }++ &__row {+ display: grid;+ grid-template-columns: 1fr auto auto auto;+ gap: 0.625rem;+ align-items: center;+ padding: 0.4375rem 0.5rem;+ border-radius: var(--radius);+ }++ &__row--hero {+ background: color-mix(in oklab, var(--tour-preview-accent) 7%, transparent);+ }++ &__name {+ overflow: hidden;+ font-size: 0.75rem;+ font-weight: 600;+ color: var(--color-text-primary);+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ // Mini kind tag, mimicking the list's type column.+ &__kind {+ padding: 0 0.375rem;+ font-size: 0.625rem;+ font-weight: 700;+ color: var(--color-text-secondary);+ text-transform: uppercase;+ background: var(--color-fill-secondary);+ border-radius: 999px;+ }++ &__kind--tour {+ background: color-mix(in oklab, var(--tour-preview-accent) 12%, transparent);++ @include preview-accent-text(var(--tour-preview-accent));+ }++ &__steps {+ min-width: 3.25rem;+ font-family: var(--font-mono);+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ text-align: right;+ }++ &__status {+ display: inline-flex;+ gap: 0.25rem;+ align-items: center;+ min-width: 4.25rem;+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ }++ &__status--running {+ font-weight: 600;++ @include preview-accent-text(var(--tour-preview-accent));+ }++ &__status-dot {+ width: 6px;+ height: 6px;+ background: var(--tour-preview-accent);+ border-radius: 50%;+ animation: TourPreview__pulse 2s ease-in-out infinite;+ }++ // Browser chrome for the mini app.+ &__chrome {+ display: flex;+ gap: 0.3125rem;+ align-items: center;+ padding: 0.4375rem 0.75rem;+ background: var(--color-bg-surface-secondary);+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__url {+ margin-left: 0.375rem;+ font-family: var(--font-mono);+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ }++ // The tooltips are positioned against this box, so it anchors the whole scene.+ &__screen {+ position: relative;+ display: grid;+ grid-template-columns: 6.5rem 1fr;+ gap: 0.75rem;+ min-height: 9rem;+ padding: 0.875rem;+ }++ &__sidebar {+ display: flex;+ flex-direction: column;+ gap: 0.25rem;+ padding-right: 0.625rem;+ border-right: 1px solid var(--color-border-primary);+ }++ &__nav {+ position: relative;+ padding: 0.25rem 0.375rem;+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ border-radius: var(--radius);+ }++ &__main {+ display: flex;+ flex-direction: column;+ gap: 0.5rem;+ align-items: flex-start;+ }++ &__skel {+ display: block;+ width: var(--w, 100%);+ height: 8px;+ background: var(--color-fill-secondary);+ border-radius: 999px;+ }++ &__button {+ position: relative;+ padding: 0.25rem 0.625rem;+ margin-top: 0.25rem;+ font-size: 0.6875rem;+ font-weight: 600;+ background: var(--color-fill-secondary);+ border-radius: var(--radius);+ }++ // The tour's highlight ring and beacon, moving with the active step.+ &__nav--target1,+ &__button--target2 {+ transition: box-shadow 250ms ease;+ }++ &__beacon {+ position: absolute;+ top: -3px;+ right: -3px;+ width: 8px;+ height: 8px;+ background: var(--tour-preview-accent);+ border-radius: 50%;+ opacity: 0;+ transition: opacity 250ms ease;+ }++ // Tour tooltip, one per step, crossfaded in place (no layout shift).+ &__tip {+ position: absolute;+ z-index: 1;+ display: flex;+ flex-direction: column;+ gap: 0.375rem;+ width: 11rem;+ padding: 0.5rem 0.625rem;+ pointer-events: none;+ background: var(--color-bg-surface-primary);+ border: 1px solid color-mix(in oklab, var(--tour-preview-accent) 45%, var(--color-border-primary));+ border-radius: var(--radius);+ box-shadow: 0 2px 8px rgb(0 0 0 / 12%);++ @include preview-swap-hidden;+ }++ &__tip--1 {+ top: 1.375rem;+ left: 7.5rem;+ }++ &__tip--2 {+ right: 0.875rem;+ bottom: 0.75rem;+ }++ &__tip-text {+ font-size: 0.6875rem;+ color: var(--color-text-primary);+ }++ &__tip-foot {+ display: flex;+ align-items: center;+ justify-content: space-between;+ }++ &__tip-count {+ font-family: var(--font-mono);+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ }++ &__tip-btn {+ padding: 0.125rem 0.5rem;+ font-size: 0.6875rem;+ font-weight: 600;+ color: var(--color-bg-surface-primary);+ cursor: pointer;+ user-select: none;+ background: var(--tour-preview-accent);+ border-radius: var(--radius);+ }++ &__tip-btn--back {+ color: var(--color-text-secondary);+ background: var(--color-fill-secondary);+ }++ // Completion stat card.+ &__spark {+ padding: 0.75rem 0.875rem 0.875rem;+ }++ &__spark-delta {+ font-size: 0.6875rem;+ font-weight: 600;+ color: var(--color-green-500);+ }++ &__spark-chart {+ margin-top: 0.5rem;+ }++ &__spark-area {+ fill: color-mix(in oklab, var(--tour-preview-accent) 13%, transparent);+ stroke: none;+ }++ &__spark-line {+ fill: none;+ stroke: color-mix(in oklab, var(--tour-preview-accent) 32%, transparent);+ stroke-width: 2;+ }++ // The moving bit: a short bright segment cycling along the line.+ &__spark-trace {+ fill: none;+ stroke: var(--tour-preview-accent);+ stroke-dasharray: 16 84;+ stroke-linecap: round;+ stroke-width: 2;+ animation: TourPreview__trace 3.2s linear infinite;+ }++ @include preview-chrome-dot;+ @include preview-sparkline;+}++// Per-step state: each radio lights up its own tooltip, beacon, and highlight ring.++.TourPreview__radio--1:checked ~ .TourPreview__app .TourPreview__tip--1,+.TourPreview__radio--2:checked ~ .TourPreview__app .TourPreview__tip--2 {+ pointer-events: auto;++ @include preview-swap-visible;+}++.TourPreview__radio--1:checked ~ .TourPreview__app .TourPreview__beacon--1,+.TourPreview__radio--2:checked ~ .TourPreview__app .TourPreview__beacon--2 {+ opacity: 1;+ animation: TourPreview__pulse 2s ease-in-out infinite;+}++.TourPreview__radio--1:checked ~ .TourPreview__app .TourPreview__nav--target1,+.TourPreview__radio--2:checked ~ .TourPreview__app .TourPreview__button--target2 {+ box-shadow:+ 0 0 0 2px var(--tour-preview-accent),+ 0 0 0 5px color-mix(in oklab, var(--tour-preview-accent) 22%, transparent);+}++// The radios stay keyboard-focusable while visually hidden. Focus follows the+// checked radio, whose tooltip is the visible one, so its button gets the+// visible focus indicator (WCAG 2.4.7).+.TourPreview__radio--1:focus-visible ~ .TourPreview__app .TourPreview__tip--1 .TourPreview__tip-btn,+.TourPreview__radio--2:focus-visible ~ .TourPreview__app .TourPreview__tip--2 .TourPreview__tip-btn--back {+ outline: 2px solid var(--tour-preview-accent);+ outline-offset: 1px;+}++@keyframes TourPreview__pulse {+ 0%,+ 100% {+ box-shadow: 0 0 0 0 color-mix(in oklab, var(--tour-preview-accent) 45%, transparent);+ }++ 50% {+ box-shadow: 0 0 0 4px color-mix(in oklab, var(--tour-preview-accent) 15%, transparent);+ }+}++// pathLength is normalized to 100, so the dash offset loops cleanly regardless of length.+@keyframes TourPreview__trace {+ to {+ stroke-dashoffset: -100;+ }+}++// Storybook snapshots and reduced motion drop all ambient motion; clicking Next+// still steps the tour (transitions only).+@include preview-motion-guards('TourPreview');diff --git a/products/product_tours/frontend/emptyState/ProductTourPreview.tsx b/products/product_tours/frontend/emptyState/ProductTourPreview.tsxnew file mode 100644index 000000000000..104058afc24a--- /dev/null+++ b/products/product_tours/frontend/emptyState/ProductTourPreview.tsx@@ -0,0 +1,152 @@+import './ProductTourPreview.scss'++import { LemonTag } from 'lib/lemon-ui/LemonTag'+import { cn } from 'lib/utils/css-classes'+import { inStorybook, inStorybookTestRunner } from 'lib/utils/dom'++// Hand-authored rising completion series for the stat card sparkline.+const SPARK_LINE = 'M 0 31 L 10 30 L 20 30.8 L 30 27.5 L 40 28.2 L 50 24.5 L 60 25 L 70 21.5 L 80 20 L 90 16.5 L 100 15'+const SPARK_AREA = `${SPARK_LINE} L 100 40 L 0 40 Z`++/**+ * Example-data preview for the product tours empty state: the tours list wired to a+ * mini app where the hero tour is actually playing, so clicking "Next" in the tour+ * tooltip moves the spotlight (and step counter) from one UI element to another. The+ * whole interaction is two hidden radios driving `:checked ~` styles - no timers or+ * state, per the preview rules in the `building-product-empty-states` skill. Both+ * tooltips are absolutely positioned and crossfaded, so stepping never shifts layout.+ */+export function ProductTourPreview(): JSX.Element {+ const isStatic = inStorybook() || inStorybookTestRunner()++ return (+ <div className={cn('TourPreview', isStatic && 'TourPreview--static')}>+ {/* Step state, before all cards so `:checked ~` can style them. */}+ <input+ type="radio"+ name="tour-preview-step"+ id="tour-preview-step-1"+ defaultChecked+ className="TourPreview__radio TourPreview__radio--1"+ />+ <input+ type="radio"+ name="tour-preview-step"+ id="tour-preview-step-2"+ className="TourPreview__radio TourPreview__radio--2"+ />++ <div className="TourPreview__panel">+ <div className="TourPreview__head">+ <span className="TourPreview__title">Product tours</span>+ <LemonTag size="small">example data</LemonTag>+ </div>++ <div className="TourPreview__rows">+ <div className="TourPreview__row TourPreview__row--hero">+ <span className="TourPreview__name">Welcome tour</span>+ <span className="TourPreview__kind TourPreview__kind--tour">Tour</span>+ <span className="TourPreview__steps">3 steps</span>+ <span className="TourPreview__status TourPreview__status--running">+ <span className="TourPreview__status-dot" aria-hidden="true" />+ Running+ </span>+ </div>+ <div className="TourPreview__row">+ <span className="TourPreview__name">New: usage reports</span>+ <span className="TourPreview__kind">Announcement</span>+ <span className="TourPreview__steps">1 step</span>+ <span className="TourPreview__status">Draft</span>+ </div>+ <div className="TourPreview__row">+ <span className="TourPreview__name">Maintenance notice</span>+ <span className="TourPreview__kind">Banner</span>+ <span className="TourPreview__steps">1 step</span>+ <span className="TourPreview__status">Scheduled</span>+ </div>+ </div>+ </div>++ <div className="TourPreview__app">+ <div className="TourPreview__chrome">+ <span className="TourPreview__chrome-dot" />+ <span className="TourPreview__chrome-dot" />+ <span className="TourPreview__chrome-dot" />+ <span className="TourPreview__url">yourapp.com/reports</span>+ </div>+ <div className="TourPreview__screen">+ <div className="TourPreview__sidebar">+ <span className="TourPreview__nav TourPreview__nav--target1">+ Reports+ <span className="TourPreview__beacon TourPreview__beacon--1" aria-hidden="true" />+ </span>+ <span className="TourPreview__nav">Dashboards</span>+ <span className="TourPreview__nav">Settings</span>+ </div>+ <div className="TourPreview__main">+ <span className="TourPreview__skel" style={{ '--w': '80%' } as React.CSSProperties} />+ <span className="TourPreview__skel" style={{ '--w': '55%' } as React.CSSProperties} />+ <span className="TourPreview__button TourPreview__button--target2">+ Share report+ <span className="TourPreview__beacon TourPreview__beacon--2" aria-hidden="true" />+ </span>+ </div>++ {/* Both tour tooltips stay in the DOM, absolutely positioned next to+ their targets, and crossfade - stepping never resizes the screen. */}+ <div className="TourPreview__tip TourPreview__tip--1">+ <span className="TourPreview__tip-text">Your usage reports live here.</span>+ <span className="TourPreview__tip-foot">+ <span className="TourPreview__tip-count">1 of 3</span>+ <label htmlFor="tour-preview-step-2" className="TourPreview__tip-btn">+ Next+ </label>+ </span>+ </div>+ <div className="TourPreview__tip TourPreview__tip--2">+ <span className="TourPreview__tip-text">Share a report with your team.</span>+ <span className="TourPreview__tip-foot">+ <span className="TourPreview__tip-count">2 of 3</span>+ <label+ htmlFor="tour-preview-step-1"+ className="TourPreview__tip-btn TourPreview__tip-btn--back"+ >+ Back+ </label>+ </span>+ </div>+ </div>+ </div>++ <div className="TourPreview__spark">+ <div className="TourPreview__spark-head">+ <span className="TourPreview__spark-title">Tour completion · Welcome tour · 7 days</span>+ <LemonTag size="small">example data</LemonTag>+ </div>++ <div className="TourPreview__spark-value">+ 68%+ <span className="TourPreview__spark-delta">▲ 12%</span>+ </div>++ <div className="TourPreview__spark-chart">+ <svg+ className="TourPreview__spark-svg"+ viewBox="0 0 100 40"+ preserveAspectRatio="none"+ aria-hidden="true"+ >+ <path className="TourPreview__spark-area" d={SPARK_AREA} />+ <path className="TourPreview__spark-line" d={SPARK_LINE} vectorEffect="non-scaling-stroke" />+ <path+ className="TourPreview__spark-trace"+ d={SPARK_LINE}+ pathLength={100}+ vectorEffect="non-scaling-stroke"+ />+ </svg>+ </div>+ </div>+ </div>+ )+}diff --git a/products/product_tours/frontend/emptyState/productToursEmptyState.tsx b/products/product_tours/frontend/emptyState/productToursEmptyState.tsxnew file mode 100644index 000000000000..f1e0f3301367--- /dev/null+++ b/products/product_tours/frontend/emptyState/productToursEmptyState.tsx@@ -0,0 +1,42 @@+import * as directorPng from '@posthog/brand/hoggies/png/director'+import { IconSpotlight } from '@posthog/icons'++import { pngHoggie } from 'lib/brand/hoggies'+import type { SceneProductEmptyState } from 'lib/components/ProductEmptyState/types'+import { FEATURE_FLAGS } from 'lib/constants'++import { ProductKey } from '~/queries/schema/schema-general'++import { ProductTourPreview } from './ProductTourPreview'+import { productToursSetupLogic } from './productToursSetupLogic'++const HedgehogDirector = pngHoggie(directorPng)++export const productToursEmptyState: SceneProductEmptyState = {+ statusLogic: productToursSetupLogic,+ // The whole product is behind this flag; the scene's own 404 gate handles the flag-off case.+ featureFlag: FEATURE_FLAGS.PRODUCT_TOURS,+ config: {+ productKey: ProductKey.PRODUCT_TOURS,+ productName: 'Product tours',+ icon: <IconSpotlight />,+ accentColor: 'var(--color-product-product-tours-light)',+ accentColorDark: 'var(--color-product-product-tours-dark)',+ hedgehog: HedgehogDirector,+ text: {+ 'needs-setup': {+ headline: 'Show users what to do next, right in your app',+ lead: 'Build multi-step tours that point at real elements in your product, plus announcements and banners for one-off messages. Steps can highlight an element, open a modal, or pin a banner, and feature flags control exactly who sees each tour. No redeploy needed to launch, change, or stop one.',+ },+ },+ primaryAction: {+ label: 'Create your first tour',+ onClick: () => productToursSetupLogic.findMounted()?.actions.createTour('My first tour'),+ dataAttr: 'new-product-tour',+ },+ skippable: false,+ docsUrl: 'https://posthog.com/docs/product-tours',+ previewLabel: 'Your tours, once live',+ Preview: ProductTourPreview,+ },+}diff --git a/products/product_tours/frontend/emptyState/productToursSetupLogic.test.ts b/products/product_tours/frontend/emptyState/productToursSetupLogic.test.tsnew file mode 100644index 000000000000..b38a090671b7--- /dev/null+++ b/products/product_tours/frontend/emptyState/productToursSetupLogic.test.ts@@ -0,0 +1,46 @@+import { expectLogic } from 'kea-test-utils'++import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'++import { ProductKey } from '~/queries/schema/schema-general'+import { initKeaTests } from '~/test/init'++import { productToursList } from 'products/product_tours/frontend/generated/api'++import { productToursSetupLogic } from './productToursSetupLogic'++jest.mock('products/product_tours/frontend/generated/api', () => ({+ productToursList: jest.fn(),+ productToursCreate: jest.fn(),+}))++const mockProductToursList = productToursList as jest.MockedFunction<typeof productToursList>++// Guards the connect + mapping into the app-wide setup-status layer: if either+// breaks, the scene empty-state gate strands on its spinner or shows the wrong surface.+describe('productToursSetupLogic', () => {+ beforeEach(() => {+ jest.clearAllMocks()+ initKeaTests()+ })++ it.each([+ [0, 'needs-setup'],+ [1, 'has-data'],+ [42, 'has-data'],+ ])('pushes a tour count of %i as status %s', async (count, expected) => {+ mockProductToursList.mockResolvedValue({ count, next: null, previous: null, results: [] })+ const logic = productToursSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.PRODUCT_TOURS }).values.status).toBe(expected)+ })++ it('fails open to unknown when the count query fails before any answer', async () => {+ mockProductToursList.mockRejectedValue(new Error('network down'))+ const logic = productToursSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.PRODUCT_TOURS }).values.status).toBe('unknown')+ })+})diff --git a/products/product_tours/frontend/emptyState/productToursSetupLogic.ts b/products/product_tours/frontend/emptyState/productToursSetupLogic.tsnew file mode 100644index 000000000000..dacb2c538398--- /dev/null+++ b/products/product_tours/frontend/emptyState/productToursSetupLogic.ts@@ -0,0 +1,102 @@+import { MakeLogicType, afterMount, connect, kea, listeners, path } from 'kea'+import { loaders } from 'kea-loaders'++import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'+import type { ProductSetupStatus } from 'lib/components/ProductEmptyState/types'+import { productToursLogic } from 'scenes/product-tours/productToursLogic'+import { teamLogic } from 'scenes/teamLogic'++import { ProductKey } from '~/queries/schema/schema-general'++import { productToursList } from 'products/product_tours/frontend/generated/api'++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface productToursSetupLogicValues {+ setupStatus: ProductSetupStatus // productSetupStatusLogic+ currentProjectId: number | string // teamLogic+ tourCount: number | null+ tourCountLoading: boolean+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface productToursSetupLogicActions {+ setDetectedStatus: (status: ProductSetupStatus) => {+ status: ProductSetupStatus+ } // productSetupStatusLogic+ createTour: (name: string) => {+ name: string+ } // productToursLogic+ loadTourCount: (_: void) => void+ loadTourCountFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadTourCountSuccess: (+ tourCount: number,+ payload?: void+ ) => {+ tourCount: number+ payload?: void+ }+}++export type productToursSetupLogicType = MakeLogicType<productToursSetupLogicValues, productToursSetupLogicActions>++/**+ * Setup detection for the product tours empty state. Tours are a creation-first+ * product, so "set up" simply means the project has at least one tour - no event+ * or traffic signal involved. Re-checks on every mount (the scene gate mounts it),+ * which covers returning from the tour editor.+ *+ * The empty state's primary action dispatches `productToursLogic.createTour`, the same+ * action the list scene's modal submits. `/product_tours/new` has no working save path,+ * so a tour has to be created before the editor opens, and going through the shared+ * action keeps first-tour creations in the `product tour created` event stream.+ */+export const productToursSetupLogic = kea<productToursSetupLogicType>([+ path(['products', 'product_tours', 'frontend', 'emptyState', 'productToursSetupLogic']),+ connect(() => ({+ actions: [+ productSetupStatusLogic({ productKey: ProductKey.PRODUCT_TOURS }),+ ['setDetectedStatus'],+ productToursLogic,+ ['createTour'],+ ],+ values: [+ productSetupStatusLogic({ productKey: ProductKey.PRODUCT_TOURS }),+ ['status as setupStatus'],+ teamLogic,+ ['currentProjectId'],+ ],+ })),+ loaders(({ values }) => ({+ tourCount: [+ null as number | null,+ {+ loadTourCount: async (_: void, breakpoint): Promise<number> => {+ const response = await productToursList(String(values.currentProjectId), { limit: 1 })+ breakpoint()+ return response.count+ },+ },+ ],+ })),+ listeners(({ actions, values }) => ({+ loadTourCountSuccess: ({ tourCount }) => {+ actions.setDetectedStatus(tourCount !== null && tourCount > 0 ? 'has-data' : 'needs-setup')+ },+ loadTourCountFailure: () => {+ // Never strand the gate on its spinner: if nothing has answered yet, fail+ // open to the real scene. Don't downgrade an existing answer on a blip.+ if (values.setupStatus === 'loading') {+ actions.setDetectedStatus('unknown')+ }+ },+ })),+ afterMount(({ actions }) => {+ actions.loadTourCount()+ }),+])diff --git a/products/product_tours/manifest.tsx b/products/product_tours/manifest.tsxindex 54197c1030f0..585218a0ab4a 100644--- a/products/product_tours/manifest.tsx+++ b/products/product_tours/manifest.tsx@@ -15,7 +15,7 @@ export const manifest: ProductManifest = {name: 'Product tour',iconType: 'product_tour',href: (ref: string) => urls.productTour(ref),- iconColor: ['var(--color-product-surveys-light)'],+ iconColor: ['var(--color-product-product-tours-light)', 'var(--color-product-product-tours-dark)'],filterKey: 'product_tour',},},@@ -25,7 +25,10 @@ export const manifest: ProductManifest = {type: 'product_tour',href: urls.productTour('new'),iconType: 'product_tour',- iconColor: ['var(--color-product-surveys-light)'] as FileSystemIconColor,+ iconColor: [+ 'var(--color-product-product-tours-light)',+ 'var(--color-product-product-tours-dark)',+ ] as FileSystemIconColor,},],treeItemsProducts: [@@ -36,7 +39,10 @@ export const manifest: ProductManifest = {type: 'product_tour',href: urls.productTours(),iconType: 'product_tour',- iconColor: ['var(--color-product-surveys-light)'] as FileSystemIconColor,+ iconColor: [+ 'var(--color-product-product-tours-light)',+ 'var(--color-product-product-tours-dark)',+ ] as FileSystemIconColor,sceneKey: 'ProductTours',sceneKeys: ['ProductTour', 'ProductTours'],flag: FEATURE_FLAGS.PRODUCT_TOURS,diff --git a/products/product_tours/package.json b/products/product_tours/package.jsonindex 5684c3ca5c3e..1e3bbd2e6c7d 100644--- a/products/product_tours/package.json+++ b/products/product_tours/package.json@@ -2,5 +2,20 @@"name": "@posthog/products-product-tours","scripts": {"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -v --tb=short"+ },+ "dependencies": {+ "kea": "catalog:",+ "kea-loaders": "catalog:",+ "kea-router": "catalog:"+ },+ "devDependencies": {+ "kea-test-utils": "catalog:"+ },+ "peerDependencies": {+ "@posthog/brand": "catalog:",+ "@posthog/icons": "catalog:",+ "@types/react": "*",+ "clsx": "*",+ "react": "*"}}diff --git a/products/skills/frontend/LLMSkillsScene.tsx b/products/skills/frontend/LLMSkillsScene.tsxindex d5c4bc3681e6..72157520e36a 100644--- a/products/skills/frontend/LLMSkillsScene.tsx+++ b/products/skills/frontend/LLMSkillsScene.tsx@@ -30,6 +30,7 @@ import { AccessControlLevel, AccessControlResourceType } from '~/types'import type { LLMSkillListApi } from 'products/skills/frontend/generated/api.schemas'+import { llmSkillsEmptyState } from './emptyState/llmSkillsEmptyState'import { SKILLS_GROUP_LIMIT, SKILLS_PER_PAGE, SkillGroupNode, SkillGroupTree, llmSkillsLogic } from './llmSkillsLogic'import { SKILL_NAME_MAX_LENGTH, validateSkillName } from './skillConstants'import { openArchiveSkillDialog } from './skillSceneComponents'@@ -39,6 +40,7 @@ export const scene: SceneExport = {component: LLMSkillsScene,logic: llmSkillsLogic,productKey: ProductKey.AI_OBSERVABILITY,+ emptyState: llmSkillsEmptyState,}// Mirrors `metadata.seeded_by` stamped by the Signals scout harness (kept local so the skillsdiff --git a/products/skills/frontend/emptyState/LLMSkillPreview.scss b/products/skills/frontend/emptyState/LLMSkillPreview.scssnew file mode 100644index 000000000000..0b4ee61d3526--- /dev/null+++ b/products/skills/frontend/emptyState/LLMSkillPreview.scss@@ -0,0 +1,262 @@+@import '../../../../frontend/src/lib/components/ProductEmptyState/previewMixins';++.SkillPreview {+ --skill-preview-accent: var(--empty-state-accent, var(--color-primary-500));++ display: flex;+ flex-direction: column;+ gap: 0.75rem;++ // Hidden selected-skill state. Direct children of .SkillPreview so `:checked ~` reaches both cards.+ &__radio {+ position: absolute;+ width: 0;+ height: 0;+ pointer-events: none;+ opacity: 0;+ }++ &__list,+ &__terminal {+ overflow: hidden;+ background: var(--color-bg-surface-primary);+ border: 1px solid var(--color-border-primary);+ border-radius: var(--radius);+ }++ // Per-skill terminal lines are stacked on one grid cell and crossfaded, so+ // switching skills never changes any element's size (no layout shift).+ &__swap {+ display: grid;+ }++ &__swap > * {+ grid-area: 1 / 1;+ min-width: 0;+ }++ &__when-deploy,+ &__when-migrate,+ &__when-review {+ @include preview-swap-hidden;+ }++ &__head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 0.5rem 0.75rem;+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__title {+ font-size: 0.75rem;+ font-weight: 600;+ }++ &__rows {+ display: flex;+ flex-direction: column;+ padding: 0.25rem 0.5rem;+ }++ &__row {+ display: flex;+ gap: 0.5rem;+ align-items: center;+ padding: 0.4375rem 0.5rem;+ cursor: pointer;+ user-select: none;+ border: 1px solid transparent;+ border-radius: var(--radius);+ transition:+ background-color 150ms ease,+ border-color 150ms ease;+ }++ &__row:hover {+ background: var(--color-bg-fill-highlight-50);+ }++ // Radio dots make the skill rows read as selectable.+ &__vradio {+ position: relative;+ flex-shrink: 0;+ width: 12px;+ height: 12px;+ border: 1.5px solid var(--skill-preview-accent);+ border-radius: 50%;++ &::after {+ position: absolute;+ inset: 2px;+ content: '';+ background: var(--skill-preview-accent);+ border-radius: 50%;+ transition: transform 150ms ease;+ transform: scale(0);+ }+ }++ &__copy {+ display: flex;+ flex-direction: column;+ min-width: 0;+ }++ &__name {+ overflow: hidden;+ font-family: var(--font-mono);+ font-size: 0.75rem;+ font-weight: 600;+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ &__desc {+ overflow: hidden;+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ &__version {+ margin-left: auto;+ font-family: var(--font-mono);+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ }++ &__hint {+ padding: 0 0.75rem 0.625rem;+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ }++ // Terminal chrome for the mini coding agent.+ &__chrome {+ display: flex;+ gap: 0.3125rem;+ align-items: center;+ padding: 0.4375rem 0.75rem;+ background: var(--color-bg-surface-secondary);+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__chrome-title {+ margin-left: 0.375rem;+ font-family: var(--font-mono);+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ }++ &__screen {+ display: flex;+ flex-direction: column;+ gap: 0.5rem;+ padding: 0.875rem;+ }++ &__line {+ font-family: var(--font-mono);+ font-size: 0.6875rem;+ line-height: 1.4;+ color: var(--color-text-primary);+ }++ &__prompt-char {+ color: var(--color-text-tertiary);+ }++ &__cmd {+ font-weight: 600;++ @include preview-accent-text(var(--skill-preview-accent));+ }++ &__ok {+ font-weight: 700;+ color: var(--color-green-500);+ }++ &__muted {+ color: var(--color-text-tertiary);+ }++ // The ambient bit: a terminal caret blinking while the agent "works".+ &__cursor {+ display: inline-block;+ width: 7px;+ height: 13px;+ vertical-align: text-bottom;+ background: var(--skill-preview-accent);+ animation: SkillPreview__blink 1.1s step-end infinite;+ }++ @include preview-chrome-dot;+}++// Selected skill, driven purely by the hidden radios.++#skill-preview-deploy:checked ~ * .SkillPreview__when-deploy,+#skill-preview-migrate:checked ~ * .SkillPreview__when-migrate,+#skill-preview-review:checked ~ * .SkillPreview__when-review {+ @include preview-swap-visible;+}++#skill-preview-deploy:checked ~ .SkillPreview__list .SkillPreview__row--deploy,+#skill-preview-migrate:checked ~ .SkillPreview__list .SkillPreview__row--migrate,+#skill-preview-review:checked ~ .SkillPreview__list .SkillPreview__row--review {+ background: color-mix(in oklab, var(--skill-preview-accent) 8%, transparent);+ border-color: color-mix(in oklab, var(--skill-preview-accent) 40%, transparent);+}++#skill-preview-deploy:checked ~ .SkillPreview__list .SkillPreview__vradio--deploy::after,+#skill-preview-migrate:checked ~ .SkillPreview__list .SkillPreview__vradio--migrate::after,+#skill-preview-review:checked ~ .SkillPreview__list .SkillPreview__vradio--review::after {+ transform: scale(1);+}++// The radios stay keyboard-focusable while visually hidden, so the skill row they+// label needs a visible focus indicator (WCAG 2.4.7).+#skill-preview-deploy:focus-visible ~ .SkillPreview__list .SkillPreview__row--deploy,+#skill-preview-migrate:focus-visible ~ .SkillPreview__list .SkillPreview__row--migrate,+#skill-preview-review:focus-visible ~ .SkillPreview__list .SkillPreview__row--review {+ outline: 2px solid var(--skill-preview-accent);+ outline-offset: 1px;+}++// Nudge attention at the next skill's radio until the default selection changes.+.SkillPreview:not(.SkillPreview--static)+ #skill-preview-deploy:checked+ ~ .SkillPreview__list+ .SkillPreview__vradio--migrate {+ animation: SkillPreview__nudge 2.4s ease-in-out infinite;+}++@keyframes SkillPreview__nudge {+ 0%,+ 100% {+ box-shadow: 0 0 0 0 color-mix(in oklab, var(--skill-preview-accent) 45%, transparent);+ }++ 50% {+ box-shadow: 0 0 0 4px color-mix(in oklab, var(--skill-preview-accent) 20%, transparent);+ }+}++@keyframes SkillPreview__blink {+ 0%,+ 100% {+ opacity: 1;+ }++ 50% {+ opacity: 0;+ }+}++// Storybook snapshots and reduced motion drop all ambient motion; selecting a+// skill still works (transitions only).+@include preview-motion-guards('SkillPreview');diff --git a/products/skills/frontend/emptyState/LLMSkillPreview.tsx b/products/skills/frontend/emptyState/LLMSkillPreview.tsxnew file mode 100644index 000000000000..6399290d66f0--- /dev/null+++ b/products/skills/frontend/emptyState/LLMSkillPreview.tsx@@ -0,0 +1,134 @@+import './LLMSkillPreview.scss'++import { LemonTag } from 'lib/lemon-ui/LemonTag'+import { cn } from 'lib/utils/css-classes'+import { inStorybook, inStorybookTestRunner } from 'lib/utils/dom'++interface PreviewSkill {+ id: string+ name: string+ description: string+ version: string+ instructions: string+}++// Example skills - hand-authored, not real data. `id` keys the radio that drives+// the `:checked ~` selection styles.+const SKILLS: PreviewSkill[] = [+ {+ id: 'deploy',+ name: 'deploying-frontend',+ description: 'Deploy checklist for the web app',+ version: 'v4',+ instructions: '12 instructions applied',+ },+ {+ id: 'migrate',+ name: 'writing-migrations',+ description: 'Zero-downtime schema changes',+ version: 'v2',+ instructions: '8 instructions applied',+ },+ {+ id: 'review',+ name: 'reviewing-prs',+ description: 'House style for code review',+ version: 'v7',+ instructions: '15 instructions applied',+ },+]++/**+ * Example-data preview for the skills empty state: the published skill library+ * wired to a mini coding-agent terminal, so picking a skill shows the agent loading+ * it with `/posthog-skill-store:<name>` and applying its instructions. The whole+ * interaction is three hidden radios driving `:checked ~` styles - no timers or+ * state, per the preview rules in the `building-product-empty-states` skill.+ * Per-skill terminal lines are stacked in `__swap` grids and crossfaded, so+ * switching skills never changes the layout's size.+ */+export function LLMSkillPreview(): JSX.Element {+ const isStatic = inStorybook() || inStorybookTestRunner()++ return (+ <div className={cn('SkillPreview', isStatic && 'SkillPreview--static')}>+ {/* Selected-skill state, before both cards so `:checked ~` can style them. */}+ {SKILLS.map((skill, i) => (+ <input+ key={skill.id}+ type="radio"+ name="skill-preview-skill"+ id={`skill-preview-${skill.id}`}+ defaultChecked={i === 0}+ className="SkillPreview__radio"+ />+ ))}++ <div className="SkillPreview__list">+ <div className="SkillPreview__head">+ <span className="SkillPreview__title">Skills</span>+ <LemonTag size="small">example data</LemonTag>+ </div>++ <div className="SkillPreview__rows">+ {SKILLS.map((skill) => (+ <label+ key={skill.id}+ htmlFor={`skill-preview-${skill.id}`}+ className={`SkillPreview__row SkillPreview__row--${skill.id}`}+ >+ <span+ className={`SkillPreview__vradio SkillPreview__vradio--${skill.id}`}+ aria-hidden="true"+ />+ <span className="SkillPreview__copy">+ <span className="SkillPreview__name">{skill.name}</span>+ <span className="SkillPreview__desc">{skill.description}</span>+ </span>+ <span className="SkillPreview__version">{skill.version}</span>+ </label>+ ))}+ </div>++ <div className="SkillPreview__hint">Select a skill to load it in the agent below.</div>+ </div>++ <div className="SkillPreview__terminal">+ <div className="SkillPreview__chrome">+ <span className="SkillPreview__chrome-dot" />+ <span className="SkillPreview__chrome-dot" />+ <span className="SkillPreview__chrome-dot" />+ <span className="SkillPreview__chrome-title">Claude Code</span>+ </div>+ <div className="SkillPreview__screen">+ <div className="SkillPreview__line SkillPreview__swap">+ {SKILLS.map((skill) => (+ <span key={skill.id} className={`SkillPreview__when-${skill.id}`}>+ <span className="SkillPreview__prompt-char">></span>{' '}+ <span className="SkillPreview__cmd">/posthog-skill-store:{skill.name}</span>+ </span>+ ))}+ </div>+ <div className="SkillPreview__line SkillPreview__swap">+ {SKILLS.map((skill) => (+ <span key={skill.id} className={`SkillPreview__when-${skill.id}`}>+ <span className="SkillPreview__ok">✓</span> Loaded {skill.version} ·{' '}+ {skill.instructions}+ </span>+ ))}+ </div>+ <div className="SkillPreview__line SkillPreview__swap">+ {SKILLS.map((skill) => (+ <span key={skill.id} className={`SkillPreview__muted SkillPreview__when-${skill.id}`}>+ Following {skill.name} for this task…+ </span>+ ))}+ </div>+ <div className="SkillPreview__line">+ <span className="SkillPreview__cursor" aria-hidden="true" />+ </div>+ </div>+ </div>+ </div>+ )+}diff --git a/products/skills/frontend/emptyState/llmSkillsEmptyState.tsx b/products/skills/frontend/emptyState/llmSkillsEmptyState.tsxnew file mode 100644index 000000000000..c123fd346c17--- /dev/null+++ b/products/skills/frontend/emptyState/llmSkillsEmptyState.tsx@@ -0,0 +1,44 @@+import * as puzzlePng from '@posthog/brand/hoggies/png/puzzle'+import { IconLlmPromptManagement } from '@posthog/icons'++import { pngHoggie } from 'lib/brand/hoggies'+import type { SceneProductEmptyState } from 'lib/components/ProductEmptyState/types'+import { urls } from 'scenes/urls'++import { ProductKey } from '~/queries/schema/schema-general'+import { AccessControlLevel, AccessControlResourceType } from '~/types'++import { LLMSkillPreview } from './LLMSkillPreview'+import { llmSkillsSetupLogic } from './llmSkillsSetupLogic'++const HedgehogPuzzle = pngHoggie(puzzlePng)++export const llmSkillsEmptyState: SceneProductEmptyState = {+ statusLogic: llmSkillsSetupLogic,+ config: {+ productKey: ProductKey.SKILLS,+ productName: 'Skills',+ icon: <IconLlmPromptManagement />,+ accentColor: 'var(--color-product-llm-analytics-light)',+ accentColorDark: 'var(--color-product-llm-analytics-dark)',+ hedgehog: HedgehogPuzzle,+ text: {+ 'needs-setup': {+ headline: 'Write a skill once, load it in any agent',+ lead: 'Skills are versioned instructions your coding agents can discover and use. Publish them here and any MCP-connected agent can load them directly, or install them into Claude Code and Codex with automatic updates. Import and export skills as .zip files to share them across teams.',+ },+ },+ primaryAction: {+ label: 'Create your first skill',+ to: urls.skill('new'),+ accessControl: {+ resourceType: AccessControlResourceType.LlmSkill,+ minAccessLevel: AccessControlLevel.Editor,+ },+ dataAttr: 'new-skill-button',+ },+ skippable: false,+ previewLabel: 'Your skills, once published',+ Preview: LLMSkillPreview,+ },+}diff --git a/products/skills/frontend/emptyState/llmSkillsSetupLogic.test.ts b/products/skills/frontend/emptyState/llmSkillsSetupLogic.test.tsnew file mode 100644index 000000000000..28f849d15c93--- /dev/null+++ b/products/skills/frontend/emptyState/llmSkillsSetupLogic.test.ts@@ -0,0 +1,45 @@+import { expectLogic } from 'kea-test-utils'++import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'++import { ProductKey } from '~/queries/schema/schema-general'+import { initKeaTests } from '~/test/init'++import { llmSkillsList } from 'products/skills/frontend/generated/api'++import { llmSkillsSetupLogic } from './llmSkillsSetupLogic'++jest.mock('products/skills/frontend/generated/api', () => ({+ llmSkillsList: jest.fn(),+}))++const mockLlmSkillsList = llmSkillsList as jest.MockedFunction<typeof llmSkillsList>++// Guards the connect + mapping into the app-wide setup-status layer: if either+// breaks, the scene empty-state gate strands on its spinner or shows the wrong surface.+describe('llmSkillsSetupLogic', () => {+ beforeEach(() => {+ jest.clearAllMocks()+ initKeaTests()+ })++ it.each([+ [0, 'needs-setup'],+ [1, 'has-data'],+ [42, 'has-data'],+ ])('pushes a skill count of %i as status %s', async (count, expected) => {+ mockLlmSkillsList.mockResolvedValue({ count, next: null, previous: null, results: [] })+ const logic = llmSkillsSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.SKILLS }).values.status).toBe(expected)+ })++ it('fails open to unknown when the count query fails before any answer', async () => {+ mockLlmSkillsList.mockRejectedValue(new Error('network down'))+ const logic = llmSkillsSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.SKILLS }).values.status).toBe('unknown')+ })+})diff --git a/products/skills/frontend/emptyState/llmSkillsSetupLogic.ts b/products/skills/frontend/emptyState/llmSkillsSetupLogic.tsnew file mode 100644index 000000000000..5bfd0225153c--- /dev/null+++ b/products/skills/frontend/emptyState/llmSkillsSetupLogic.ts@@ -0,0 +1,89 @@+import { MakeLogicType, afterMount, connect, kea, listeners, path } from 'kea'+import { loaders } from 'kea-loaders'++import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'+import type { ProductSetupStatus } from 'lib/components/ProductEmptyState/types'+import { teamLogic } from 'scenes/teamLogic'++import { ProductKey } from '~/queries/schema/schema-general'++import { llmSkillsList } from 'products/skills/frontend/generated/api'++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface llmSkillsSetupLogicValues {+ setupStatus: ProductSetupStatus // productSetupStatusLogic+ currentProjectId: number | string // teamLogic+ skillCount: number | null+ skillCountLoading: boolean+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface llmSkillsSetupLogicActions {+ setDetectedStatus: (status: ProductSetupStatus) => {+ status: ProductSetupStatus+ } // productSetupStatusLogic+ loadSkillCount: (_: void) => void+ loadSkillCountFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadSkillCountSuccess: (+ skillCount: number,+ payload?: void+ ) => {+ skillCount: number+ payload?: void+ }+}++export type llmSkillsSetupLogicType = MakeLogicType<llmSkillsSetupLogicValues, llmSkillsSetupLogicActions>++/**+ * Setup detection for the skills empty state. Skills are a creation-first+ * product, so "set up" simply means the project has at least one skill in any+ * category - no event or traffic signal involved. Re-checks on every mount (the+ * scene gate mounts it), which covers returning from the skill creation page.+ */+export const llmSkillsSetupLogic = kea<llmSkillsSetupLogicType>([+ path(['products', 'skills', 'frontend', 'emptyState', 'llmSkillsSetupLogic']),+ connect(() => ({+ actions: [productSetupStatusLogic({ productKey: ProductKey.SKILLS }), ['setDetectedStatus']],+ values: [+ productSetupStatusLogic({ productKey: ProductKey.SKILLS }),+ ['status as setupStatus'],+ teamLogic,+ ['currentProjectId'],+ ],+ })),+ loaders(({ values }) => ({+ skillCount: [+ null as number | null,+ {+ loadSkillCount: async (_: void, breakpoint): Promise<number> => {+ // No category filter, so skills of every category count as data.+ const response = await llmSkillsList(String(values.currentProjectId), { limit: 1, offset: 0 })+ breakpoint()+ return response.count+ },+ },+ ],+ })),+ listeners(({ actions, values }) => ({+ loadSkillCountSuccess: ({ skillCount }) => {+ actions.setDetectedStatus(skillCount !== null && skillCount > 0 ? 'has-data' : 'needs-setup')+ },+ loadSkillCountFailure: () => {+ // Never strand the gate on its spinner: if nothing has answered yet, fail+ // open to the real scene. Don't downgrade an existing answer on a blip.+ if (values.setupStatus === 'loading') {+ actions.setDetectedStatus('unknown')+ }+ },+ })),+ afterMount(({ actions }) => {+ actions.loadSkillCount()+ }),+])diff --git a/products/skills/package.json b/products/skills/package.jsonindex 288c6aa0c17f..77b7b0239fce 100644--- a/products/skills/package.json+++ b/products/skills/package.json@@ -14,6 +14,7 @@"kea-test-utils": "catalog:"},"peerDependencies": {+ "@posthog/brand": "catalog:","@posthog/icons": "catalog:","@types/react": "*","clsx": "*",diff --git a/products/tracing/manifest.tsx b/products/tracing/manifest.tsxindex fbf6c9a44a3f..23f3cf5a4be6 100644--- a/products/tracing/manifest.tsx+++ b/products/tracing/manifest.tsx@@ -56,7 +56,10 @@ export const manifest: ProductManifest = {intents: [ProductKey.TRACING],category: ProductItemCategory.APP_MONITORING,iconType: 'tracing',- iconColor: ['var(--color-product-tracing-light)'] as FileSystemIconColor,+ iconColor: [+ 'var(--color-product-tracing-light)',+ 'var(--color-product-tracing-dark)',+ ] as FileSystemIconColor,href: urls.tracing(),flag: FEATURE_FLAGS.TRACING,tags: ['beta'],diff --git a/products/user_interviews/frontend/UserInterviews.tsx b/products/user_interviews/frontend/UserInterviews.tsxindex 46802a95173d..0e4f17e80d67 100644--- a/products/user_interviews/frontend/UserInterviews.tsx+++ b/products/user_interviews/frontend/UserInterviews.tsx@@ -5,6 +5,7 @@ import { LemonButton, LemonInput, LemonTable, LemonTag, Link } from '@posthog/leimport { LemonTableLink } from 'lib/lemon-ui/LemonTable/LemonTableLink'import { cn } from 'lib/utils/css-classes'+import { maxGlobalLogic } from 'scenes/max/maxGlobalLogic'import { useMaxTool } from 'scenes/max/useMaxTool'import { sceneConfigurations } from 'scenes/scenes'import { Scene, SceneExport } from 'scenes/sceneTypes'@@ -12,13 +13,18 @@ import { urls } from 'scenes/urls'import { SceneContent } from '~/layout/scenes/components/SceneContent'import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'+import { ProductKey } from '~/queries/schema/schema-general'+import { userInterviewsEmptyState } from './emptyState/userInterviewsEmptyState'import type { UserInterviewSearchResultApi, UserInterviewTopicApi } from './generated/api.schemas'+import { NEW_TOPIC_PROMPT, NEW_TOPIC_SUGGESTIONS } from './newTopicMaxTool'import { userInterviewsLogic } from './userInterviewsLogic'export const scene: SceneExport = {component: UserInterviews,logic: userInterviewsLogic,+ productKey: ProductKey.USER_INTERVIEWS,+ emptyState: userInterviewsEmptyState,}function targetingLabel(topic: UserInterviewTopicApi): string {@@ -34,19 +40,6 @@ function targetingLabel(topic: UserInterviewTopicApi): string {return parts.length > 0 ? parts.join(' + ') : 'Not set'}-const NEW_TOPIC_PROMPT = `!I want to set up a new user research topic. Help me work through:-1. What I want to learn — the feature, behavior, or question to research.-2. Who to interview — let me give you emails or distinct IDs, or help me pick from a cohort.-3. The interview questions — 3-6 open-ended, conversational prompts in a sensible order.-Then create the topic using the create_user_interview_topic tool. Don't try to send emails or generate links yourself — once the topic exists I'll do that from the topic page.`--const NEW_TOPIC_SUGGESTIONS = [- 'Interview recent signups about their onboarding experience',- 'Talk to power users about what they wish the product did better',- 'Interview customers who churned in the last 30 days',- 'Research how teams are using dashboards day-to-day',-]-function SearchResultCard({ result }: { result: UserInterviewSearchResultApi }): JSX.Element {const target = result.topic_id? urls.userInterviewResponse(result.topic_id, encodeURIComponent(result.interviewee_identifier))@@ -92,6 +85,7 @@ function SearchResults({export function UserInterviews(): JSX.Element {const { topics, topicsLoading, searchQuery, searchResults, searchResultsLoading } = useValues(userInterviewsLogic)+ const { isMaxAvailable } = useValues(maxGlobalLogic)const { setSearchQuery } = useActions(userInterviewsLogic)const hasSearch = searchQuery.trim().length > 0@@ -100,6 +94,9 @@ export function UserInterviews(): JSX.Element {context: {},initialMaxPrompt: NEW_TOPIC_PROMPT,suggestions: NEW_TOPIC_SUGGESTIONS,+ // `openMax` is null only when the tool is inactive, so the button's disabledReason+ // needs this to fire on an instance without PostHog AI.+ active: isMaxAvailable,})return (diff --git a/products/user_interviews/frontend/emptyState/NewTopicButton.tsx b/products/user_interviews/frontend/emptyState/NewTopicButton.tsxnew file mode 100644index 000000000000..2de048904457--- /dev/null+++ b/products/user_interviews/frontend/emptyState/NewTopicButton.tsx@@ -0,0 +1,36 @@+import { useValues } from 'kea'++import { IconSparkles } from '@posthog/icons'+import { LemonButton } from '@posthog/lemon-ui'++import { maxGlobalLogic } from 'scenes/max/maxGlobalLogic'+import { useMaxTool } from 'scenes/max/useMaxTool'++import { NEW_TOPIC_PROMPT, NEW_TOPIC_SUGGESTIONS } from '../newTopicMaxTool'++/** The empty state's primary action: the same Max-driven topic creation as the scene's "New topic" button. */+export function NewTopicButton(): JSX.Element {+ const { isMaxAvailable } = useValues(maxGlobalLogic)+ const { openMax } = useMaxTool({+ identifier: 'create_user_interview_topic',+ context: {},+ initialMaxPrompt: NEW_TOPIC_PROMPT,+ suggestions: NEW_TOPIC_SUGGESTIONS,+ // `openMax` is null only when the tool is inactive, so without this the button stays+ // enabled on an instance without PostHog AI and opens a panel saying it isn't set up.+ active: isMaxAvailable,+ })++ return (+ <LemonButton+ type="primary"+ icon={<IconSparkles />}+ className="self-start"+ data-attr="user-research-empty-state-new-topic"+ onClick={() => openMax?.()}+ disabledReason={openMax ? undefined : 'PostHog AI is unavailable here'}+ >+ Create your first topic+ </LemonButton>+ )+}diff --git a/products/user_interviews/frontend/emptyState/UserInterviewPreview.scss b/products/user_interviews/frontend/emptyState/UserInterviewPreview.scssnew file mode 100644index 000000000000..6de318a9bbf4--- /dev/null+++ b/products/user_interviews/frontend/emptyState/UserInterviewPreview.scss@@ -0,0 +1,318 @@+@import '../../../../frontend/src/lib/components/ProductEmptyState/previewMixins';++.ResearchPreview {+ --research-preview-accent: var(--empty-state-accent, var(--color-primary-500));+ --research-preview-alt: var(--color-text-tertiary);++ display: flex;+ flex-direction: column;+ gap: 0.75rem;++ // Hidden topic state. Direct children of .ResearchPreview so `:checked ~` reaches all cards.+ &__radio {+ position: absolute;+ width: 0;+ height: 0;+ pointer-events: none;+ opacity: 0;+ }++ &__panel,+ &__interview,+ &__spark {+ overflow: hidden;+ background: var(--color-bg-surface-primary);+ border: 1px solid var(--color-border-primary);+ border-radius: var(--radius);+ }++ // Topic variants are stacked on one grid cell and crossfaded, so switching topics+ // never changes any element's size (no layout shift).+ &__swap {+ display: grid;+ }++ &__swap > * {+ grid-area: 1 / 1;+ min-width: 0;+ }++ &__on-a,+ &__on-b {+ @include preview-swap-hidden;+ }++ &__head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 0.5rem 0.75rem;+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__title {+ font-size: 0.75rem;+ font-weight: 600;+ }++ &__rows {+ display: flex;+ flex-direction: column;+ padding: 0.25rem 0.5rem;+ }++ &__row {+ display: grid;+ grid-template-columns: auto 1fr auto auto;+ gap: 0.5rem;+ align-items: center;+ padding: 0.4375rem 0.5rem;+ cursor: pointer;+ user-select: none;+ border: 1px solid transparent;+ border-radius: var(--radius);+ transition:+ background-color 150ms ease,+ border-color 150ms ease;+ }++ &__row:hover {+ background: var(--color-bg-fill-highlight-50);+ }++ // Radio dots make the rows read as selectable.+ &__vradio {+ position: relative;+ flex-shrink: 0;+ width: 12px;+ height: 12px;+ border: 1.5px solid var(--research-preview-accent);+ border-radius: 50%;++ &::after {+ position: absolute;+ inset: 2px;+ content: '';+ background: var(--research-preview-accent);+ border-radius: 50%;+ transition: transform 150ms ease;+ transform: scale(0);+ }+ }++ &__topic {+ overflow: hidden;+ font-size: 0.75rem;+ font-weight: 600;+ color: var(--color-text-primary);+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ &__targeting {+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ }++ &__questions {+ min-width: 4.5rem;+ font-size: 0.625rem;+ color: var(--color-text-secondary);+ text-align: right;+ }++ &__hint {+ padding: 0 0.75rem 0.5rem;+ font-size: 0.6875rem;+ color: var(--color-text-tertiary);+ }++ // The live interview card the selected topic drives.+ &__interview-head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 0.5rem 0.75rem;+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__live {+ display: inline-flex;+ gap: 0.25rem;+ align-items: center;+ font-size: 0.6875rem;+ font-weight: 600;+ color: var(--color-green-500);+ }++ &__live-dot {+ width: 6px;+ height: 6px;+ background: var(--color-green-500);+ border-radius: 50%;+ animation: ResearchPreview__pulse 1.8s ease-in-out infinite;+ }++ &__who {+ font-family: var(--font-mono);+ font-size: 0.625rem;+ color: var(--color-text-tertiary);+ text-align: right;+ }++ &__transcript {+ display: flex;+ flex-direction: column;+ gap: 0.5rem;+ padding: 0.75rem 0.875rem;+ }++ &__msg {+ display: flex;+ flex-direction: column;+ gap: 0.1875rem;+ max-width: 88%;+ }++ &__msg--user {+ align-self: flex-end;+ text-align: right;+ }++ &__speaker {+ font-size: 0.5625rem;+ font-weight: 700;+ color: var(--color-text-tertiary);+ text-transform: uppercase;+ letter-spacing: 0.03em;+ }++ &__bubble {+ padding: 0.375rem 0.5625rem;+ font-size: 0.6875rem;+ line-height: 1.35;+ text-align: left;+ border-radius: var(--radius);+ }++ &__bubble--ai {+ color: var(--color-text-primary);+ background: var(--color-bg-surface-secondary);+ border: 1px solid var(--color-border-primary);+ }++ &__bubble--user {+ color: var(--color-text-primary);+ background: color-mix(in oklab, var(--research-preview-accent) 10%, transparent);+ border: 1px solid color-mix(in oklab, var(--research-preview-accent) 30%, transparent);+ }++ // Responses stat card for the selected topic.+ &__spark {+ padding: 0.75rem 0.875rem 0.875rem;+ }++ &__spark-note {+ font-size: 0.6875rem;+ font-weight: 400;+ color: var(--color-text-tertiary);+ }++ &__spark-chart {+ margin-top: 0.5rem;+ }++ &__spark-g {+ transition: opacity 250ms ease;+ }++ &__spark-area {+ fill: color-mix(in oklab, var(--research-preview-accent) 13%, transparent);+ stroke: none;+ }++ &__spark-line {+ fill: none;+ stroke: color-mix(in oklab, var(--research-preview-accent) 32%, transparent);+ stroke-width: 2;+ }++ // The moving bit: a short bright segment cycling along the line.+ &__spark-trace {+ fill: none;+ stroke: var(--research-preview-accent);+ stroke-dasharray: 16 84;+ stroke-linecap: round;+ stroke-width: 2;+ animation: ResearchPreview__trace 3.2s linear infinite;+ }++ @include preview-sparkline;+}++// Selected topic, driven purely by the hidden radios.++#research-preview-a:checked ~ * .ResearchPreview__on-a,+#research-preview-b:checked ~ * .ResearchPreview__on-b {+ @include preview-swap-visible;+}++#research-preview-a:checked ~ .ResearchPreview__panel .ResearchPreview__row--a,+#research-preview-b:checked ~ .ResearchPreview__panel .ResearchPreview__row--b {+ background: color-mix(in oklab, var(--research-preview-accent) 8%, transparent);+ border-color: color-mix(in oklab, var(--research-preview-accent) 40%, transparent);+}++#research-preview-a:checked ~ .ResearchPreview__panel .ResearchPreview__vradio--a::after,+#research-preview-b:checked ~ .ResearchPreview__panel .ResearchPreview__vradio--b::after {+ transform: scale(1);+}++// The radios stay keyboard-focusable while visually hidden, so the topic row they+// label needs a visible focus indicator (WCAG 2.4.7).+#research-preview-a:focus-visible ~ .ResearchPreview__panel .ResearchPreview__row--a,+#research-preview-b:focus-visible ~ .ResearchPreview__panel .ResearchPreview__row--b {+ outline: 2px solid var(--research-preview-accent);+ outline-offset: 1px;+}++// Nudge attention at the unselected topic's radio until it's been picked.+.ResearchPreview:not(.ResearchPreview--static)+ #research-preview-b:not(:checked)+ ~ .ResearchPreview__panel+ .ResearchPreview__vradio--b {+ animation: ResearchPreview__nudge 2.4s ease-in-out infinite;+}++@keyframes ResearchPreview__nudge {+ 0%,+ 100% {+ box-shadow: 0 0 0 0 color-mix(in oklab, var(--research-preview-accent) 45%, transparent);+ }++ 50% {+ box-shadow: 0 0 0 4px color-mix(in oklab, var(--research-preview-accent) 20%, transparent);+ }+}++@keyframes ResearchPreview__pulse {+ 0%,+ 100% {+ opacity: 1;+ }++ 50% {+ opacity: 0.35;+ }+}++// pathLength is normalized to 100, so the dash offset loops cleanly regardless of length.+@keyframes ResearchPreview__trace {+ to {+ stroke-dashoffset: -100;+ }+}++// Storybook snapshots and reduced motion drop all ambient motion; picking a topic+// still works (transitions only).+@include preview-motion-guards('ResearchPreview');diff --git a/products/user_interviews/frontend/emptyState/UserInterviewPreview.tsx b/products/user_interviews/frontend/emptyState/UserInterviewPreview.tsxnew file mode 100644index 000000000000..39c48abb0024--- /dev/null+++ b/products/user_interviews/frontend/emptyState/UserInterviewPreview.tsx@@ -0,0 +1,160 @@+import './UserInterviewPreview.scss'++import { LemonTag } from 'lib/lemon-ui/LemonTag'+import { cn } from 'lib/utils/css-classes'+import { inStorybook, inStorybookTestRunner } from 'lib/utils/dom'++// Hand-authored rising response series for the stat card sparkline, one per topic.+const LINE_A = 'M 0 34 L 10 32 L 20 32.6 L 30 29 L 40 29.8 L 50 26 L 60 26.8 L 70 22.5 L 80 21 L 90 17.5 L 100 15'+const LINE_B = 'M 0 35 L 10 34 L 20 34.4 L 30 32 L 40 32.6 L 50 30 L 60 30.6 L 70 28 L 80 27 L 90 24.5 L 100 23'++function areaPath(line: string): string {+ return `${line} L 100 40 L 0 40 Z`+}++/**+ * Example-data preview for the user research empty state: the topic list wired to a+ * live interview transcript and a responses stat card, so picking a topic swaps which+ * interview and response count show. The whole interaction is two hidden radios+ * driving `:checked ~` styles - no timers or state, per the preview rules in the+ * `building-product-empty-states` skill. Topic variants are stacked in `__swap` grids+ * and crossfaded, so switching never changes the layout's size.+ */+export function UserInterviewPreview(): JSX.Element {+ const isStatic = inStorybook() || inStorybookTestRunner()++ return (+ <div className={cn('ResearchPreview', isStatic && 'ResearchPreview--static')}>+ {/* Topic selection, before all three cards so `:checked ~` can style them. */}+ <input+ type="radio"+ name="research-preview-topic"+ id="research-preview-a"+ defaultChecked+ className="ResearchPreview__radio"+ />+ <input+ type="radio"+ name="research-preview-topic"+ id="research-preview-b"+ className="ResearchPreview__radio"+ />++ <div className="ResearchPreview__panel">+ <div className="ResearchPreview__head">+ <span className="ResearchPreview__title">Research topics</span>+ <LemonTag size="small">example data</LemonTag>+ </div>++ <div className="ResearchPreview__rows">+ <label htmlFor="research-preview-a" className="ResearchPreview__row ResearchPreview__row--a">+ <span className="ResearchPreview__vradio ResearchPreview__vradio--a" aria-hidden="true" />+ <span className="ResearchPreview__topic">Onboarding friction</span>+ <span className="ResearchPreview__targeting">12 emails + 4 IDs</span>+ <span className="ResearchPreview__questions">5 questions</span>+ </label>+ <label htmlFor="research-preview-b" className="ResearchPreview__row ResearchPreview__row--b">+ <span className="ResearchPreview__vradio ResearchPreview__vradio--b" aria-hidden="true" />+ <span className="ResearchPreview__topic">Churn reasons</span>+ <span className="ResearchPreview__targeting">26 emails</span>+ <span className="ResearchPreview__questions">4 questions</span>+ </label>+ </div>++ <div className="ResearchPreview__hint">Pick a topic to read one of its interviews.</div>+ </div>++ <div className="ResearchPreview__interview">+ <div className="ResearchPreview__interview-head">+ <span className="ResearchPreview__live">+ <span className="ResearchPreview__live-dot" aria-hidden="true" />+ Interview in progress+ </span>+ <span className="ResearchPreview__swap ResearchPreview__who">+ <span className="ResearchPreview__on-a">[email protected]</span>+ <span className="ResearchPreview__on-b">[email protected]</span>+ </span>+ </div>++ <div className="ResearchPreview__transcript">+ <div className="ResearchPreview__msg ResearchPreview__msg--ai">+ <span className="ResearchPreview__speaker">AI interviewer</span>+ <span className="ResearchPreview__swap ResearchPreview__bubble ResearchPreview__bubble--ai">+ <span className="ResearchPreview__on-a">+ What slowed you down when you first set up tracking?+ </span>+ <span className="ResearchPreview__on-b">What made you decide to cancel your plan?</span>+ </span>+ </div>+ <div className="ResearchPreview__msg ResearchPreview__msg--user">+ <span className="ResearchPreview__speaker">Participant</span>+ <span className="ResearchPreview__swap ResearchPreview__bubble ResearchPreview__bubble--user">+ <span className="ResearchPreview__on-a">+ I couldn't tell which steps were required, so I skipped the install and got stuck.+ </span>+ <span className="ResearchPreview__on-b">+ Nothing was wrong. We only needed it for one launch, and the project ended.+ </span>+ </span>+ </div>+ </div>+ </div>++ <div className="ResearchPreview__spark">+ <div className="ResearchPreview__spark-head">+ <span className="ResearchPreview__swap ResearchPreview__spark-title">+ <span className="ResearchPreview__on-a">Responses · Onboarding friction</span>+ <span className="ResearchPreview__on-b">Responses · Churn reasons</span>+ </span>+ <LemonTag size="small">example data</LemonTag>+ </div>++ <div className="ResearchPreview__spark-value">+ <span className="ResearchPreview__swap">+ <span className="ResearchPreview__on-a">18</span>+ <span className="ResearchPreview__on-b">11</span>+ </span>+ <span className="ResearchPreview__spark-note">completed interviews</span>+ </div>++ <div className="ResearchPreview__spark-chart">+ <svg+ className="ResearchPreview__spark-svg"+ viewBox="0 0 100 40"+ preserveAspectRatio="none"+ aria-hidden="true"+ >+ <g className="ResearchPreview__spark-g ResearchPreview__on-a">+ <path className="ResearchPreview__spark-area" d={areaPath(LINE_A)} />+ <path+ className="ResearchPreview__spark-line"+ d={LINE_A}+ vectorEffect="non-scaling-stroke"+ />+ <path+ className="ResearchPreview__spark-trace"+ d={LINE_A}+ pathLength={100}+ vectorEffect="non-scaling-stroke"+ />+ </g>+ <g className="ResearchPreview__spark-g ResearchPreview__on-b">+ <path className="ResearchPreview__spark-area" d={areaPath(LINE_B)} />+ <path+ className="ResearchPreview__spark-line"+ d={LINE_B}+ vectorEffect="non-scaling-stroke"+ />+ <path+ className="ResearchPreview__spark-trace"+ d={LINE_B}+ pathLength={100}+ vectorEffect="non-scaling-stroke"+ />+ </g>+ </svg>+ </div>+ </div>+ </div>+ )+}diff --git a/products/user_interviews/frontend/emptyState/userInterviewsEmptyState.tsx b/products/user_interviews/frontend/emptyState/userInterviewsEmptyState.tsxnew file mode 100644index 000000000000..4b1ee6dee0a8--- /dev/null+++ b/products/user_interviews/frontend/emptyState/userInterviewsEmptyState.tsx@@ -0,0 +1,38 @@+import * as reporterPng from '@posthog/brand/hoggies/png/reporter'+import { IconMicrophone } from '@posthog/icons'++import { pngHoggie } from 'lib/brand/hoggies'+import type { SceneProductEmptyState } from 'lib/components/ProductEmptyState/types'+import { FEATURE_FLAGS } from 'lib/constants'++import { ProductKey } from '~/queries/schema/schema-general'++import { NewTopicButton } from './NewTopicButton'+import { UserInterviewPreview } from './UserInterviewPreview'+import { userInterviewsSetupLogic } from './userInterviewsSetupLogic'++const HedgehogReporter = pngHoggie(reporterPng)++export const userInterviewsEmptyState: SceneProductEmptyState = {+ statusLogic: userInterviewsSetupLogic,+ // The whole product is behind this flag (nav-gated); flag-off users never reach the scene.+ featureFlag: FEATURE_FLAGS.USER_INTERVIEWS,+ config: {+ productKey: ProductKey.USER_INTERVIEWS,+ productName: 'User research',+ icon: <IconMicrophone />,+ accentColor: 'var(--color-product-user-interviews-light)',+ accentColorDark: 'var(--color-product-user-interviews-dark)',+ hedgehog: HedgehogReporter,+ text: {+ 'needs-setup': {+ headline: 'Run user interviews without booking a single call',+ lead: 'Create a research topic with the questions you want answered and the users to ask. An AI voice agent runs each interview, and transcripts and summaries land here as responses come in. You can then search across every response for what users said about any subject.',+ },+ },+ PrimaryAction: NewTopicButton,+ skippable: false,+ previewLabel: 'Your research, once responses arrive',+ Preview: UserInterviewPreview,+ },+}diff --git a/products/user_interviews/frontend/emptyState/userInterviewsSetupLogic.test.ts b/products/user_interviews/frontend/emptyState/userInterviewsSetupLogic.test.tsnew file mode 100644index 000000000000..61b2e6d1c8c1--- /dev/null+++ b/products/user_interviews/frontend/emptyState/userInterviewsSetupLogic.test.ts@@ -0,0 +1,51 @@+import { expectLogic } from 'kea-test-utils'++import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'++import { ProductKey } from '~/queries/schema/schema-general'+import { initKeaTests } from '~/test/init'++import { userInterviewTopicsList, userInterviewsList } from 'products/user_interviews/frontend/generated/api'++import { userInterviewsSetupLogic } from './userInterviewsSetupLogic'++jest.mock('products/user_interviews/frontend/generated/api', () => ({+ userInterviewTopicsList: jest.fn(),+ userInterviewsList: jest.fn(),+}))++const mockUserInterviewTopicsList = userInterviewTopicsList as jest.MockedFunction<typeof userInterviewTopicsList>+const mockUserInterviewsList = userInterviewsList as jest.MockedFunction<typeof userInterviewsList>++// Guards the connect + mapping into the app-wide setup-status layer: if either+// breaks, the scene empty-state gate strands on its spinner or shows the wrong surface.+describe('userInterviewsSetupLogic', () => {+ beforeEach(() => {+ jest.clearAllMocks()+ initKeaTests()+ })++ // Responses outlive their topic, so the count is the sum of topics and interviews.+ it.each([+ [0, 0, 'needs-setup'],+ [1, 0, 'has-data'],+ [17, 0, 'has-data'],+ [0, 4, 'has-data'],+ ])('pushes %i topics and %i interviews as status %s', async (topics, interviews, expected) => {+ mockUserInterviewTopicsList.mockResolvedValue({ count: topics, next: null, previous: null, results: [] })+ mockUserInterviewsList.mockResolvedValue({ count: interviews, next: null, previous: null, results: [] })+ const logic = userInterviewsSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.USER_INTERVIEWS }).values.status).toBe(expected)+ })++ it('fails open to unknown when the count query fails before any answer', async () => {+ mockUserInterviewTopicsList.mockRejectedValue(new Error('network down'))+ mockUserInterviewsList.mockResolvedValue({ count: 0, next: null, previous: null, results: [] })+ const logic = userInterviewsSetupLogic()+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(productSetupStatusLogic({ productKey: ProductKey.USER_INTERVIEWS }).values.status).toBe('unknown')+ })+})diff --git a/products/user_interviews/frontend/emptyState/userInterviewsSetupLogic.ts b/products/user_interviews/frontend/emptyState/userInterviewsSetupLogic.tsnew file mode 100644index 000000000000..7abcf4f3682c--- /dev/null+++ b/products/user_interviews/frontend/emptyState/userInterviewsSetupLogic.ts@@ -0,0 +1,126 @@+import { MakeLogicType, afterMount, connect, kea, listeners, path } from 'kea'+import { loaders } from 'kea-loaders'++import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'+import type { ProductSetupStatus } from 'lib/components/ProductEmptyState/types'+import { teamLogic } from 'scenes/teamLogic'++import { ProductKey } from '~/queries/schema/schema-general'++import { userInterviewTopicsList, userInterviewsList } from 'products/user_interviews/frontend/generated/api'++const POLL_INTERVAL_MS = 20000+// The poll exists to catch a topic created by PostHog AI while this screen is up. Roughly ten+// minutes of checks covers that; past it, a remount re-arms the poll. Without a cap, leaving+// the tab open issues a request every 20 seconds indefinitely, and a failing endpoint turns+// into an endless retry underneath a scene that already loads its own topics.+const POLL_MAX_TICKS = 30++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface userInterviewsSetupLogicValues {+ setupStatus: ProductSetupStatus // productSetupStatusLogic+ currentProjectId: number | string // teamLogic+ topicCount: number | null+ topicCountLoading: boolean+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface userInterviewsSetupLogicActions {+ setDetectedStatus: (status: ProductSetupStatus) => {+ status: ProductSetupStatus+ } // productSetupStatusLogic+ loadTopicCount: (_: void) => void+ loadTopicCountFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadTopicCountSuccess: (+ topicCount: number,+ payload?: void+ ) => {+ topicCount: number+ payload?: void+ }+}++export type userInterviewsSetupLogicType = MakeLogicType<+ userInterviewsSetupLogicValues,+ userInterviewsSetupLogicActions+>++/**+ * Setup detection for the user research empty state. User research is a+ * creation-first product, so "set up" simply means the project has at least one+ * research topic or interview response - no event or traffic signal involved.+ * Re-checks on every mount (the scene gate mounts it), which covers returning+ * after creating a topic.+ */+export const userInterviewsSetupLogic = kea<userInterviewsSetupLogicType>([+ path(['products', 'user_interviews', 'frontend', 'emptyState', 'userInterviewsSetupLogic']),+ connect(() => ({+ actions: [productSetupStatusLogic({ productKey: ProductKey.USER_INTERVIEWS }), ['setDetectedStatus']],+ values: [+ productSetupStatusLogic({ productKey: ProductKey.USER_INTERVIEWS }),+ ['status as setupStatus'],+ teamLogic,+ ['currentProjectId'],+ ],+ })),+ loaders(({ values }) => ({+ topicCount: [+ null as number | null,+ {+ loadTopicCount: async (_: void, breakpoint): Promise<number> => {+ // Responses outlive their topic: deleting a topic nulls the link rather than+ // cascading, and audio uploads never get one. Counting topics alone would hide+ // a project's responses behind the setup screen, and the scene's search box is+ // the only place to reach them.+ const [topics, interviews] = await Promise.all([+ userInterviewTopicsList(String(values.currentProjectId), { limit: 1 }),+ userInterviewsList(String(values.currentProjectId), { limit: 1 }),+ ])+ breakpoint()+ return topics.count + interviews.count+ },+ },+ ],+ })),+ listeners(({ actions, cache, values }) => ({+ loadTopicCountSuccess: () => {+ const hasData = (values.topicCount ?? 0) > 0+ if (hasData) {+ cache.disposables.dispose('poll')+ }+ actions.setDetectedStatus(hasData ? 'has-data' : 'needs-setup')+ },+ loadTopicCountFailure: () => {+ // Never strand the gate on its spinner: if nothing has answered yet, fail+ // open to the real scene. Don't downgrade an existing answer on a blip.+ if (values.setupStatus === 'loading') {+ actions.setDetectedStatus('unknown')+ }+ // The scene loads its own topics, so retrying a broken endpoint here buys nothing.+ cache.disposables.dispose('poll')+ },+ })),+ afterMount(({ actions, cache }) => {+ actions.loadTopicCount()+ // Topics are created by PostHog AI in the side panel while the gate stays on+ // screen, so poll until one lands rather than waiting for a remount.+ cache.disposables.add(() => {+ let ticks = 0+ const interval = setInterval(() => {+ ticks += 1+ if (ticks > POLL_MAX_TICKS) {+ cache.disposables.dispose('poll')+ return+ }+ actions.loadTopicCount()+ }, POLL_INTERVAL_MS)+ return () => clearInterval(interval)+ }, 'poll')+ }),+])diff --git a/products/user_interviews/frontend/newTopicMaxTool.ts b/products/user_interviews/frontend/newTopicMaxTool.tsnew file mode 100644index 000000000000..f113aaf9b904--- /dev/null+++ b/products/user_interviews/frontend/newTopicMaxTool.ts@@ -0,0 +1,14 @@+// Shared by the scene's "New topic" button and the empty state's primary action,+// so both open PostHog AI armed the same way.+export const NEW_TOPIC_PROMPT = `!I want to set up a new user research topic. Help me work through:+1. What I want to learn — the feature, behavior, or question to research.+2. Who to interview — let me give you emails or distinct IDs, or help me pick from a cohort.+3. The interview questions — 3-6 open-ended, conversational prompts in a sensible order.+Then create the topic using the create_user_interview_topic tool. Don't try to send emails or generate links yourself — once the topic exists I'll do that from the topic page.`++export const NEW_TOPIC_SUGGESTIONS = [+ 'Interview recent signups about their onboarding experience',+ 'Talk to power users about what they wish the product did better',+ 'Interview customers who churned in the last 30 days',+ 'Research how teams are using dashboards day-to-day',+]diff --git a/products/user_interviews/manifest.tsx b/products/user_interviews/manifest.tsxindex d8fe7b24a8f5..e8a48218d546 100644--- a/products/user_interviews/manifest.tsx+++ b/products/user_interviews/manifest.tsx@@ -48,7 +48,7 @@ export const manifest: ProductManifest = {name: 'User research',iconType: 'user_interview',href: (ref: string) => urls.userInterview(ref),- iconColor: ['var(--color-product-user-interviews-light)'],+ iconColor: ['var(--color-product-user-interviews-light)', 'var(--color-product-user-interviews-dark)'],filterKey: 'user_interview',flag: FEATURE_FLAGS.USER_INTERVIEWS,},@@ -63,7 +63,10 @@ export const manifest: ProductManifest = {flag: FEATURE_FLAGS.USER_INTERVIEWS,tags: ['alpha'],iconType: 'user_interview',- iconColor: ['var(--color-product-user-interviews-light)'] as FileSystemIconColor,+ iconColor: [+ 'var(--color-product-user-interviews-light)',+ 'var(--color-product-user-interviews-dark)',+ ] as FileSystemIconColor,sceneKey: 'UserInterviews',},],diff --git a/products/user_interviews/package.json b/products/user_interviews/package.jsonindex 42ac19553d55..1ba8b1a6b873 100644--- a/products/user_interviews/package.json+++ b/products/user_interviews/package.json@@ -9,6 +9,9 @@"kea-router": "catalog:","posthog-js": "catalog:"},+ "devDependencies": {+ "kea-test-utils": "catalog:"+ },"peerDependencies": {"@posthog/brand": "catalog:","@posthog/icons": "catalog:",diff --git a/products/visual_review/frontend/scenes/VisualReviewIndexScene.tsx b/products/visual_review/frontend/scenes/VisualReviewIndexScene.tsxindex a4a9340d167c..535483fa9c3f 100644--- a/products/visual_review/frontend/scenes/VisualReviewIndexScene.tsx+++ b/products/visual_review/frontend/scenes/VisualReviewIndexScene.tsx@@ -1,56 +1,37 @@-import { useValues } from 'kea'-import { router } from 'kea-router'-import { useEffect } from 'react'--import { LemonButton, LemonSkeleton, Link } from '@posthog/lemon-ui'+import { useActions, useValues } from 'kea'+import { LemonBanner } from 'lib/lemon-ui/LemonBanner'+import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'import { SceneExport } from 'scenes/sceneTypes'-import { urls } from 'scenes/urls'import { SceneContent } from '~/layout/scenes/components/SceneContent'import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'+import { ProductKey } from '~/queries/schema/schema-general'import { visualReviewIndexSceneLogic } from './visualReviewIndexSceneLogic'export const scene: SceneExport = {component: VisualReviewIndexScene,logic: visualReviewIndexSceneLogic,+ productKey: ProductKey.VISUAL_REVIEW,}-// /visual_review forwards straight to the first repo's Runs page once the-// repo list lands. There is no picker page — the in-header repo switcher-// covers the multi-repo case. Only the empty state and the brief loader-// state ever paint.+// /visual_review is a pure forwarder, so this renders only while the repo list is in flight,+// or when it failed and there is nothing to forward to. The forward itself lives in the logic.export function VisualReviewIndexScene(): JSX.Element {- const { repos, reposLoading } = useValues(visualReviewIndexSceneLogic)-- useEffect(() => {- if (!reposLoading && repos.length >= 1) {- router.actions.replace(urls.visualReviewRepoRuns(repos[0].id))- }- }, [reposLoading, repos])-- if (reposLoading || repos.length >= 1) {- return (- <SceneContent>- <SceneTitleSection name="Visual review" resourceType={{ type: 'visual_review' }} />- <LemonSkeleton className="h-32 w-full max-w-2xl" />- </SceneContent>- )- }+ const { reposLoadFailed } = useValues(visualReviewIndexSceneLogic)+ const { loadRepos } = useActions(visualReviewIndexSceneLogic)return (<SceneContent><SceneTitleSection name="Visual review" resourceType={{ type: 'visual_review' }} />- <div className="max-w-2xl">- <p className="text-muted">- No visual review repos yet. Connect one from <Link to={urls.visualReviewSettings()}>Settings</Link>{' '}- to get started.- </p>- <LemonButton type="primary" to={urls.visualReviewSettings()}>- Open settings- </LemonButton>- </div>+ {reposLoadFailed ? (+ <LemonBanner type="error" action={{ children: 'Try again', onClick: loadRepos }} className="max-w-2xl">+ Couldn't load your connected repos.+ </LemonBanner>+ ) : (+ <LemonSkeleton className="h-32 w-full max-w-2xl" />+ )}</SceneContent>)}diff --git a/products/visual_review/frontend/scenes/visualReviewIndexSceneLogic.ts b/products/visual_review/frontend/scenes/visualReviewIndexSceneLogic.tsindex cac011e34fb9..bca4aa13e58e 100644--- a/products/visual_review/frontend/scenes/visualReviewIndexSceneLogic.ts+++ b/products/visual_review/frontend/scenes/visualReviewIndexSceneLogic.ts@@ -1,4 +1,4 @@-import { MakeLogicType, afterMount, connect, kea, path, selectors } from 'kea'+import { MakeLogicType, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'import { loaders } from 'kea-loaders'import { router } from 'kea-router'@@ -15,6 +15,7 @@ export interface visualReviewIndexSceneLogicValues {currentProjectId: number | string // teamLogicbreadcrumbs: Breadcrumb[]repos: RepoApi[]+ reposLoadFailed: booleanreposLoading: boolean}@@ -42,10 +43,11 @@ export type visualReviewIndexSceneLogicType = MakeLogicType<visualReviewIndexSceneLogicActions>-// Index scene logic. Loads the team's repos and forwards to the first repo's-// Runs page. The header-bar repo switcher handles the multi-repo case, so-// the index URL itself never needs to render a picker — only the empty state-// when no repos are connected yet.+// Index scene logic. Loads the team's repos and forwards to the first repo's Runs page, or to+// Settings when none are connected. The header-bar repo switcher handles the multi-repo case.+// Forwarding from the success action rather than from the loaded list keeps a failed load+// distinguishable from an empty one: on failure `repos` is also `[]`, so a component deciding+// from the list alone would send a team with repos to the connect-a-repo page.export const visualReviewIndexSceneLogic = kea<visualReviewIndexSceneLogicType>([path(['products', 'visual_review', 'frontend', 'scenes', 'visualReviewIndexSceneLogic']),connect(() => ({@@ -62,16 +64,26 @@ export const visualReviewIndexSceneLogic = kea<visualReviewIndexSceneLogicType>(},],})),+ reducers({+ reposLoadFailed: [+ false,+ {+ loadRepos: () => false,+ loadReposFailure: () => true,+ },+ ],+ }),selectors({breadcrumbs: [() => [], (): Breadcrumb[] => [{ key: 'visual_review', name: 'Visual review' }]],}),- afterMount(({ values, actions }) => {+ listeners(({ values }) => ({+ loadReposSuccess: () => {+ router.actions.replace(+ values.repos.length >= 1 ? urls.visualReviewRepoRuns(values.repos[0].id) : urls.visualReviewSettings()+ )+ },+ })),+ afterMount(({ actions }) => {actions.loadRepos()- // If we navigated here while on /visual_review and the repo list is- // already cached (back/forward navigation re-entering the scene),- // forward straight away.- if (values.repos.length >= 1) {- router.actions.replace(urls.visualReviewRepoRuns(values.repos[0].id))- }}),])diff --git a/products/visual_review/manifest.tsx b/products/visual_review/manifest.tsxindex edd5f7bac86e..ff4891a8e7eb 100644--- a/products/visual_review/manifest.tsx+++ b/products/visual_review/manifest.tsx@@ -9,7 +9,7 @@ import { urls } from 'scenes/urls'import { FileSystemIconType, ProductKey } from '~/queries/schema/schema-general'import { ProductItemCategory } from '../../frontend/src/queries/schema/schema-general'-import { ProductManifest } from '../../frontend/src/types'+import { FileSystemIconColor, ProductManifest } from '../../frontend/src/types'export const manifest: ProductManifest = {name: 'VisualReview',@@ -85,6 +85,10 @@ export const manifest: ProductManifest = {category: ProductItemCategory.UNRELEASED,href: urls.visualReviewRuns(),iconType: 'visual_review' as FileSystemIconType,+ iconColor: [+ 'var(--color-product-visual-review-light)',+ 'var(--color-product-visual-review-dark)',+ ] as FileSystemIconColor,flag: FEATURE_FLAGS.VISUAL_REVIEW,tags: ['alpha'],sceneKey: 'VisualReviewIndex',