: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(onboarding): add quickstart landing page after onboarding (#70809)
Fernando Gomes33c4dab64d88
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 7260758f4a58..203aced86c7f 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -6750,6 +6750,14 @@ snapshots:hash: v1.k794b7964.224e8a5e493e290b4ae4bbc2e03034a73b2ecfce20c86bcde08eab86b57b712e.xYn7md33k3lh0Oj7If1WzYPDgW9aiqbZ4aux_4bhOUcscenes-app-project-homepage--project-homepage--light:hash: v1.k794b7964.2eafc7385bf39f5be7d4d6d0ad1b70897952bcf37a16bd3ae6c644716cd16d25.25OmRYioQX_VF2kc2AVnvYlE0yve6YNcY2FDdJwV5kE+ scenes-app-quickstart-product-card--all-states--dark:+ hash: v1.k794b7964.73f58c4247d194cdf5416d066a434816f003ac93fea1c319bc22e3753f99ccdf.iCrGK5sYWLKMEyIcdG4Yz_sU4crC06CROJuJO68Cgoo+ scenes-app-quickstart-product-card--all-states--light:+ hash: v1.k794b7964.f102ea94159c9f504a9614dfae0f36ed2d608bd29bf873a3e3af47674a1327f5.gwilG-dC5olu1ZefJBTe9u0AfZpHAJx7ByaKR-xPH94+ scenes-app-quickstart-product-card--playground--dark:+ hash: v1.k794b7964.db711c55fbba74ec6c076121fad873037a9f9fdaa68a9fecf5cad96d4aac77a1.n4BzdM9Lx-eVP3ooCb6_tD9x7BfjEuOc1oks9ji5S8c+ scenes-app-quickstart-product-card--playground--light:+ hash: v1.k794b7964.b85349f783d2e37dc3d8f34c47a0cf0279472dd5f4b57a98972274fc6a08fac5.KzPnkFBWU41BKwOOklmvlpw3U_7UfSmDr-9HBibnCrcscenes-app-replay-vision--scanners-list--dark:hash: v1.k794b7964.daa9f38b95aa3296a6f7f6afd822e0016ffb7877c2397ad7ce23b2be1d67640f.DD8sIGjdkm46sZUGxHk84xhn3jk4Umrnx4ecrNUrrCsscenes-app-replay-vision--scanners-list--light:diff --git a/frontend/src/layout/navigation/projectNoticeLogic.test.tsx b/frontend/src/layout/navigation/projectNoticeLogic.test.tsxindex 749684c1bab1..b9ed4dc55ad1 100644--- a/frontend/src/layout/navigation/projectNoticeLogic.test.tsx+++ b/frontend/src/layout/navigation/projectNoticeLogic.test.tsx@@ -9,12 +9,13 @@ import { reverseProxyCheckerLogic } from 'lib/components/ReverseProxyChecker/revimport { LemonBanner } from 'lib/lemon-ui/LemonBanner'import { verifyEmailLogic } from 'scenes/authentication/verify-email/verifyEmailLogic'import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'+import { Scene } from 'scenes/sceneTypes'import { useMocks } from '~/mocks/jest'import { initKeaTests } from '~/test/init'import { AppContext } from '~/types'-import { projectNoticeLogic } from './projectNoticeLogic'+import { projectNoticeLogic, shouldShowNoEventsProjectNotice } from './projectNoticeLogic'const DISMISS_KEY = 'project-notice-dismissed.missing_reverse_proxy'@@ -24,6 +25,16 @@ window.POSTHOG_APP_CONTEXT = {} as unknown as AppContextdescribe('projectNoticeLogic', () => {+ describe('no-events notice visibility', () => {+ test.each([+ { scene: Scene.Quickstart, liveEventCount: 0, expected: false },+ { scene: Scene.LiveEvents, liveEventCount: 1, expected: false },+ { scene: Scene.Dashboard, liveEventCount: 0, expected: true },+ ])('returns $expected for $scene with $liveEventCount live events', ({ scene, liveEventCount, expected }) => {+ expect(shouldShowNoEventsProjectNotice(scene, liveEventCount)).toBe(expected)+ })+ })+describe('proxy records conditional loading', () => {let getItemSpy: jest.SpyInstancediff --git a/frontend/src/layout/navigation/projectNoticeLogic.tsx b/frontend/src/layout/navigation/projectNoticeLogic.tsxindex bfd2332095d6..a7e3130ddb57 100644--- a/frontend/src/layout/navigation/projectNoticeLogic.tsx+++ b/frontend/src/layout/navigation/projectNoticeLogic.tsx@@ -47,6 +47,10 @@ export interface ProjectNoticeBlueprint {mountNoEventsBannerLogic?: boolean}+export function shouldShowNoEventsProjectNotice(activeSceneId: string | null, liveEventCount: number): boolean {+ return activeSceneId !== Scene.Quickstart && !(activeSceneId === Scene.LiveEvents && liveEventCount > 0)+}+const NOTICE_DISMISS_PREFIX = 'project-notice-dismissed.'function isNoticeDismissed(key: string): boolean {@@ -371,7 +375,7 @@ export const projectNoticeLogic = kea<projectNoticeLogicType>([// Belt-and-braces: never claim "no events" while the live activity feed is// actively rendering events on the same screen — `currentTeam.ingested_event`// can lag behind the live SSE stream during the first ingestion window.- !(activeSceneId === Scene.LiveEvents && liveEventCount > 0)+ shouldShowNoEventsProjectNotice(activeSceneId, liveEventCount)) {return 'real_project_with_no_events'} else if (hasEventIngestionRestriction) {diff --git a/frontend/src/layout/panel-layout/ai-first/tabs/NavTabBrowse.tsx b/frontend/src/layout/panel-layout/ai-first/tabs/NavTabBrowse.tsxindex 64336837088b..4ad019562724 100644--- a/frontend/src/layout/panel-layout/ai-first/tabs/NavTabBrowse.tsx+++ b/frontend/src/layout/panel-layout/ai-first/tabs/NavTabBrowse.tsx@@ -12,14 +12,17 @@ import {IconNotification,IconCheck,IconPencil,+ IconRocket,IconStar,} from '@posthog/icons'import { Tooltip } from '@posthog/lemon-ui'import { ScrollableShadows } from 'lib/components/ScrollableShadows/ScrollableShadows'+import { FEATURE_FLAGS } from 'lib/constants'import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'import { Link } from 'lib/lemon-ui/Link'import { Spinner } from 'lib/lemon-ui/Spinner/Spinner'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'import { Collapsible } from 'lib/ui/Collapsible/Collapsible'import { DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator } from 'lib/ui/DropdownMenu/DropdownMenu'@@ -160,6 +163,7 @@ export function NavTabBrowse(): JSX.Element {activePanelIdentifierFromUrlAiFirst,pathname,} = useValues(panelLayoutLogic)+ const { featureFlags } = useValues(featureFlagLogic)const isProductAutonomyEnabled = useFeatureFlag('PRODUCT_AUTONOMY')const { recentItems, recentItemsLoading } = useValues(navRecentsLogic)const { isEditMode, checkedTools } = useValues(editToolsLogic)@@ -201,6 +205,17 @@ export function NavTabBrowse(): JSX.Element {<SectionTrigger icon={<IconFolder />} label="Project" isCollapsed={isLayoutNavCollapsed} />)}<Collapsible.Panel className={cn('pl-2 pt-1', isLayoutNavCollapsed && 'items-center pl-0')}>+ {featureFlags[FEATURE_FLAGS.QUICKSTART_HOMEPAGE] === 'test' && (+ <NavLink+ to={urls.quickstart()}+ label="Quickstart"+ icon={<IconRocket />}+ isCollapsed={isLayoutNavCollapsed}+ data-attr="nav-item-quickstart"+ onClick={() => posthog.capture('nav item clicked', { item: 'quickstart' })}+ />+ )}+<NavLinkto={urls.projectRoot()}label="Home"diff --git a/frontend/src/layout/scenes/ConfigureHomeModal.tsx b/frontend/src/layout/scenes/ConfigureHomeModal.tsxindex 6523914bca13..eb6e431bd5f8 100644--- a/frontend/src/layout/scenes/ConfigureHomeModal.tsx+++ b/frontend/src/layout/scenes/ConfigureHomeModal.tsx@@ -4,11 +4,14 @@ import { useEffect, useState } from 'react'import { LemonSearchableSelect, LemonSegmentedButton, LemonSelectOptions, LemonTag } from '@posthog/lemon-ui'+import { FEATURE_FLAGS } from 'lib/constants'import { LemonModal } from 'lib/lemon-ui/LemonModal'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { iconForType } from '~/layout/panel-layout/ProjectTree/defaultTree'import { dashboardsModel } from '~/models/dashboardsModel'import { FileSystemIconType } from '~/queries/schema/schema-general'+import { quickstartHomepageTab } from '~/scenes/quickstart/quickstartHomepage'import { sceneLogic } from '~/scenes/sceneLogic'import { emptySceneParams } from '~/scenes/scenes'import { Scene, SceneTab } from '~/scenes/sceneTypes'@@ -20,14 +23,42 @@ export interface ConfigureHomeModalProps {onClose: () => void}+type HomepageMode = 'launchpad' | 'quickstart' | 'search' | 'default_dashboard'++function getHomepageMode(+ isUsingProjectDefault: boolean,+ isUsingQuickstart: boolean,+ isUsingNewTabHomepage: boolean,+ isUsingDefaultDashboard: boolean+): HomepageMode | null {+ if (isUsingProjectDefault) {+ return 'launchpad'+ }+ if (isUsingQuickstart) {+ return 'quickstart'+ }+ if (isUsingNewTabHomepage) {+ return 'search'+ }+ if (isUsingDefaultDashboard) {+ return 'default_dashboard'+ }+ return null+}+export function ConfigureHomeModal({ isOpen, onClose }: ConfigureHomeModalProps): JSX.Element {const { homepage } = useValues(sceneLogic)const { currentTeam } = useValues(teamLogic)const { nameSortedDashboards, dashboardsLoading } = useValues(dashboardsModel)const { setHomepage } = useActions(sceneLogic)const { updateCurrentTeam } = useActions(teamLogic)+ const { featureFlags } = useValues(featureFlagLogic)const isUsingProjectDefault = !homepage+ const isUsingQuickstart = homepage?.sceneId === Scene.Quickstart+ // Keep the option visible for anyone whose homepage already points at Quickstart,+ // even after their flag enrollment ends, so the selection isn't orphaned+ const quickstartEnabled = featureFlags[FEATURE_FLAGS.QUICKSTART_HOMEPAGE] === 'test' || isUsingQuickstartconst isUsingNewTabHomepage = homepage?.sceneId === Scene.NewTabconst isUsingDefaultDashboard =homepage?.sceneId === Scene.Dashboard && homepage?.id?.startsWith('homepage-dashboard-')@@ -35,14 +66,13 @@ export function ConfigureHomeModal({ isOpen, onClose }: ConfigureHomeModalProps)// Local UI selection so users can preview the "Default dashboard" picker even// when no `primary_dashboard` is set yet — otherwise the picker is hidden behind// a disabled tile, and the only place to set it is the same hidden picker.- const [pendingMode, setPendingMode] = useState<'launchpad' | 'search' | 'default_dashboard' | null>(null)- const currentMode = isUsingProjectDefault- ? 'launchpad'- : isUsingNewTabHomepage- ? 'search'- : isUsingDefaultDashboard- ? 'default_dashboard'- : null+ const [pendingMode, setPendingMode] = useState<HomepageMode | null>(null)+ const currentMode = getHomepageMode(+ isUsingProjectDefault,+ isUsingQuickstart,+ isUsingNewTabHomepage,+ isUsingDefaultDashboard+ )useEffect(() => setPendingMode(null), [currentMode])const activeMode = pendingMode ?? currentModeconst showDashboardPicker = activeMode === 'default_dashboard'@@ -111,6 +141,9 @@ export function ConfigureHomeModal({ isOpen, onClose }: ConfigureHomeModalProps)if (newValue === 'launchpad') {setPendingMode(null)setHomepage(null)+ } else if (newValue === 'quickstart') {+ setPendingMode(null)+ setHomepage(quickstartHomepageTab())} else if (newValue === 'search') {setPendingMode(null)setHomepage(newTabHomepage)@@ -150,6 +183,16 @@ export function ConfigureHomeModal({ isOpen, onClose }: ConfigureHomeModalProps)'data-attr': 'configure-home-modal-set-launchpad',tooltip: 'An AI-powered home with quick actions and recent items',},+ ...(quickstartEnabled+ ? [+ {+ value: 'quickstart' as const,+ label: 'Quickstart',+ 'data-attr': 'configure-home-modal-set-quickstart',+ tooltip: 'A getting-started hub with setup status and all tools',+ },+ ]+ : []),{value: 'search' as const,label: 'Search',diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex f0a7f09e2184..ec240c0c30b6 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -445,6 +445,7 @@ export const FEATURE_FLAGS = {PROPERTY_ACCESS_CONTROL: 'property-access-control', // owner: @reecejones #team-platform-featuresPULSE: 'pulse', // owner: #team-analytics-platformQUICK_START_PULSE_INDICATOR: 'quick-start-pulse-indicator', // owner: @fercgomes #team-growth multivariate=control,test+ QUICKSTART_HOMEPAGE: 'quickstart-homepage', // owner: @fercgomes #team-growth, multivariate (control/test): 'test' gets the quickstart landing page as the default post-onboarding experienceQUILL_CHART_STYLE_REFRESH: 'quill-chart-style-refresh', // owner: #team-product-analytics, gates refreshed quill chart styling (monotone curves, axis lines + tick marks, faint dashed grid, crosshair)QUILL_DATE_PICKER: 'quill-date-picker', // owner: @pauldambra, flips the lib/components/DatePicker seam from LemonUI to QuillQUILL_SPARKLINE: 'quill-sparkline', // owner: @sampennington #team-product-analytics, gates rendering the shared lib Sparkline via @posthog/quill-charts (docs/internal/quill-migration-sparkline.md)diff --git a/frontend/src/scenes/appScenes.ts b/frontend/src/scenes/appScenes.tsindex e2c040a257cb..c59189c28980 100644--- a/frontend/src/scenes/appScenes.ts+++ b/frontend/src/scenes/appScenes.ts@@ -88,6 +88,7 @@ export const appScenes: Record<Scene | string, () => any> = {[Scene.PreflightCheck]: () => import('./PreflightCheck/PreflightCheck'),[Scene.ProjectCreateFirst]: () => import('./project/Create'),[Scene.ProjectHomepage]: () => import('./project-homepage/ProjectHomepage'),+ [Scene.Quickstart]: () => import('./quickstart/Quickstart'),[Scene.PropertyDefinitionEdit]: () => import('./data-management/definition/DefinitionEdit'),[Scene.PropertyDefinition]: () => import('./data-management/definition/DefinitionView'),[Scene.SqlVariableEdit]: () => import('./data-management/variables/SqlVariableEditScene'),diff --git a/frontend/src/scenes/onboarding/legacy/onboardingLogic.test.ts b/frontend/src/scenes/onboarding/legacy/onboardingLogic.test.tsindex ed2d079c250d..b9ed2b737071 100644--- a/frontend/src/scenes/onboarding/legacy/onboardingLogic.test.ts+++ b/frontend/src/scenes/onboarding/legacy/onboardingLogic.test.ts@@ -422,6 +422,16 @@ describe('onboardingLogic — flow composition', () => {type: logic.actionTypes.recordProductIntentOnboardingComplete,payload: { product_type: ProductKey.PRODUCT_ANALYTICS } as any,},+ (action) => {+ if (action.type !== logic.actionTypes.updateCurrentTeam) {+ return false+ }+ expect(action.payload).toMatchObject({+ completed_snippet_onboarding: true,+ has_completed_onboarding_for: { [ProductKey.PRODUCT_ANALYTICS]: true },+ })+ return true+ },])})@@ -477,6 +487,25 @@ describe('onboardingLogic — flow composition', () => {})})+ describe('completeContextOnboarding', () => {+ it('persists both onboarding completion signals', async () => {+ await expectLogic(logic, () => {+ logic.actions.completeContextOnboarding()+ }).toDispatchActions([+ (action) => {+ if (action.type !== logic.actionTypes.updateCurrentTeam) {+ return false+ }+ expect(action.payload).toMatchObject({+ completed_snippet_onboarding: true,+ has_completed_onboarding_for: { [ProductKey.PRODUCT_ANALYTICS]: true },+ })+ return true+ },+ ])+ })+ })+describe('URL → state', () => {it('parses /onboarding/<productKey> and sets primary', async () => {await expectLogic(logic, () => {@@ -583,8 +612,7 @@ describe('onboardingLogic — flow composition', () => {describe('completion redirect URL', () => {// Each entry: [primary, expected redirect path-substring].// Verifies that each per-product provider's `completeRedirectUrl` is wired up.- // EXPERIMENTS intentionally falls through to urls.default() — same behaviour as- // the original central switch.+ // EXPERIMENTS has no provider URL, so it falls through to the Quickstart page.const cases: Array<[ProductKey, RegExp]> = [[ProductKey.PRODUCT_ANALYTICS, /quickstart|insight/i],[ProductKey.WEB_ANALYTICS, /web/i],@@ -604,11 +632,37 @@ describe('onboardingLogic — flow composition', () => {expect(logic.values.onCompleteOnboardingRedirectUrl).toMatch(pattern)})- it('experiments falls through to urls.default()', () => {+ it('experiments falls through to home, or quickstart in the test variant', () => {logic.actions.setProductKey(ProductKey.EXPERIMENTS)expect(logic.values.onCompleteOnboardingRedirectUrl).toBe('/')++ featureFlagLogic.findMounted()?.actions.setFeatureFlags([FEATURE_FLAGS.QUICKSTART_HOMEPAGE], {+ [FEATURE_FLAGS.QUICKSTART_HOMEPAGE]: 'control',+ })+ expect(logic.values.onCompleteOnboardingRedirectUrl).toBe('/')++ featureFlagLogic.findMounted()?.actions.setFeatureFlags([FEATURE_FLAGS.QUICKSTART_HOMEPAGE], {+ [FEATURE_FLAGS.QUICKSTART_HOMEPAGE]: 'test',+ })+ expect(logic.values.onCompleteOnboardingRedirectUrl).toBe('/quickstart')++ featureFlagLogic.findMounted()?.actions.setFeatureFlags([], {})})+ it.each(cases.map(([product]) => product))(+ '%s lands on quickstart when the quickstart flag is enabled',+ (product) => {+ featureFlagLogic.findMounted()?.actions.setFeatureFlags([FEATURE_FLAGS.QUICKSTART_HOMEPAGE], {+ [FEATURE_FLAGS.QUICKSTART_HOMEPAGE]: 'test',+ })+ logic.actions.setProductKey(product)++ expect(logic.values.onCompleteOnboardingRedirectUrl).toBe('/quickstart')++ featureFlagLogic.findMounted()?.actions.setFeatureFlags([], {})+ }+ )+it('redirect override takes precedence over the per-product URL', () => {logic.actions.setProductKey(ProductKey.WEB_ANALYTICS)logic.actions.setOnCompleteOnboardingRedirectUrl('/custom-target')diff --git a/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsx b/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsxindex 4f7cd09e9223..d0236bfe2743 100644--- a/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsx+++ b/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsx@@ -5,7 +5,7 @@ import { lemonToast } from '@posthog/lemon-ui'import { type SetupTaskId } from 'lib/components/ProductSetup'import { globalSetupLogic } from 'lib/components/ProductSetup/globalSetupLogic'-import { OrganizationMembershipLevel } from 'lib/constants'+import { FEATURE_FLAGS, OrganizationMembershipLevel } from 'lib/constants'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { eventUsageLogic } from 'lib/utils/eventUsageLogic'import { isKeyOf } from 'lib/utils/guards'@@ -16,6 +16,7 @@ import { resolveOnboardingFlowVariant } from 'scenes/onboarding/onboardingVarianimport { availableOnboardingProducts } from 'scenes/onboarding/shared/utils'import { organizationLogic } from 'scenes/organizationLogic'import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'+import { setQuickstartAsDefaultHomepageOnce } from 'scenes/quickstart/quickstartHomepage'import { Scene } from 'scenes/sceneTypes'import { teamLogic } from 'scenes/teamLogic'import { urls } from 'scenes/urls'@@ -216,7 +217,8 @@ export interface onboardingLogicMeta {) => Breadcrumb[]onCompleteOnboardingRedirectUrl: (productKey: ProductKey | null,- onCompleteOnboardingRedirectUrlOverride: string | null+ onCompleteOnboardingRedirectUrlOverride: string | null,+ featureFlags: FeatureFlagsSet) => string}}@@ -630,11 +632,18 @@ export const onboardingLogic = kea<onboardingLogicType>([},],onCompleteOnboardingRedirectUrl: [- (s) => [s.productKey, s.onCompleteOnboardingRedirectUrlOverride],- (productKey: ProductKey | null, onCompleteOnboardingRedirectUrlOverride: string | null): string => {+ (s) => [s.productKey, s.onCompleteOnboardingRedirectUrlOverride, s.featureFlags],+ (+ productKey: ProductKey | null,+ onCompleteOnboardingRedirectUrlOverride: string | null,+ featureFlags: Record<string, string | boolean | undefined>+ ): string => {if (onCompleteOnboardingRedirectUrlOverride) {return onCompleteOnboardingRedirectUrlOverride}+ if (featureFlags[FEATURE_FLAGS.QUICKSTART_HOMEPAGE] === 'test') {+ return urls.quickstart()+ }if (!productKey) {return urls.default()}@@ -699,7 +708,7 @@ export const onboardingLogic = kea<onboardingLogicType>([}eventUsageLogic.actions.reportSubscribedDuringOnboarding(productKey)},- completeOnboarding: ({ redirectUrlOverride }) => {+ completeOnboarding: async ({ redirectUrlOverride }) => {// Idempotency guard. Without this, a double-click on Finish, a re-render// calling advance() twice, or back-then-forward into the last step plus// pressing Finish again all fire duplicate product-intent writes,@@ -781,11 +790,23 @@ export const onboardingLogic = kea<onboardingLogicType>([for (const productKey of visitedProducts) {actions.recordProductIntentOnboardingComplete({ product_type: productKey as ProductKey })}- const completedMap: Record<string, boolean> = { ...values.currentTeam?.has_completed_onboarding_for }+ const previouslyOnboardedMap = values.currentTeam?.has_completed_onboarding_for+ const completedMap: Record<string, boolean> = { ...previouslyOnboardedMap }for (const productKey of visitedProducts) {completedMap[productKey] = true}- teamLogic.actions.updateCurrentTeam({ has_completed_onboarding_for: completedMap })+ try {+ // Keep both completion signals in sync so every bootstrapped team shape prevents+ // sceneLogic from redirecting a completed user back into onboarding after refresh.+ await teamLogic.asyncActions.updateCurrentTeam({+ completed_snippet_onboarding: true,+ has_completed_onboarding_for: completedMap,+ })+ setQuickstartAsDefaultHomepageOnce(previouslyOnboardedMap)+ } catch {+ // The completion update failed, so leave the user's homepage untouched+ lemonToast.error("Couldn't save onboarding progress. Please try again.")+ }},completeContextOnboarding: async () => {// Idempotency guard — Finish can fire twice on a double-click.@@ -812,18 +833,23 @@ export const onboardingLogic = kea<onboardingLogicType>([actions.reportContextOnboardingCompleted(productKey)actions.recordProductIntentOnboardingComplete({ product_type: productKey })}- // Populating has_completed_onboarding_for flips teamLogic.hasOnboardedAnyProduct true, so- // sceneLogic stops redirecting back into onboarding. Await the PATCH before navigating —- // updateCurrentTeam is NOT optimistic, so leaving early would race a still-stale currentTeam- // and sceneLogic could bounce a not-yet-ingested team straight back here.+ // Persist both completion signals before navigating. updateCurrentTeam is not optimistic,+ // so leaving early would race stale state and bounce a not-yet-ingested team back here.const completedMap: Record<string, boolean> = { ...team?.has_completed_onboarding_for }for (const productKey of products) {completedMap[productKey] = true}try {- await teamLogic.asyncActions.updateCurrentTeam({ has_completed_onboarding_for: completedMap })+ await teamLogic.asyncActions.updateCurrentTeam({+ completed_snippet_onboarding: true,+ has_completed_onboarding_for: completedMap,+ })+ setQuickstartAsDefaultHomepageOnce(team?.has_completed_onboarding_for)router.actions.push(- getRelativeNextPath(router.values.searchParams['next'], window.location) ?? urls.default()+ getRelativeNextPath(router.values.searchParams['next'], window.location) ??+ (values.featureFlags[FEATURE_FLAGS.QUICKSTART_HOMEPAGE] === 'test'+ ? urls.quickstart()+ : urls.default()))} catch {lemonToast.error("Couldn't finish onboarding. Please try again.")diff --git a/frontend/src/scenes/onboarding/legacy/types.ts b/frontend/src/scenes/onboarding/legacy/types.tsindex 60d0ebcf561d..ff14f9e0c4ad 100644--- a/frontend/src/scenes/onboarding/legacy/types.ts+++ b/frontend/src/scenes/onboarding/legacy/types.ts@@ -83,7 +83,8 @@ export interface ProductOnboardingProvider {steps: StepProvider/*** Where to redirect when this product's onboarding completes (used when this- * product is the primary). Falls back to `urls.default()` if not provided.+ * product is the primary). Falls back to the quickstart page (behind the+ * quickstart-homepage flag) or the homepage if not provided.*/completeRedirectUrl?: () => string}diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/WizardSyncFab.test.ts b/frontend/src/scenes/onboarding/shared/wizard-sync/WizardSyncFab.test.tsnew file mode 100644index 000000000000..563037eedc2b--- /dev/null+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/WizardSyncFab.test.ts@@ -0,0 +1,13 @@+import { Scene } from 'scenes/sceneTypes'++import { shouldHideWizardSyncCard } from './WizardSyncFab'++describe('WizardSyncFab', () => {+ test.each([+ { scene: Scene.Quickstart, expected: true },+ { scene: Scene.Onboarding, expected: false },+ { scene: Scene.Dashboard, expected: false },+ ])('returns $expected for $scene', ({ scene, expected }) => {+ expect(shouldHideWizardSyncCard(scene)).toBe(expected)+ })+})diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/WizardSyncFab.tsx b/frontend/src/scenes/onboarding/shared/wizard-sync/WizardSyncFab.tsxindex 56188d941396..e16f45c9234c 100644--- a/frontend/src/scenes/onboarding/shared/wizard-sync/WizardSyncFab.tsx+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/WizardSyncFab.tsx@@ -6,6 +6,8 @@ import { LemonButton, LemonModal } from '@posthog/lemon-ui'import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'import { cn } from 'lib/utils/css-classes'import { elapsedSecondsFrom } from 'lib/utils/datetime'+import { sceneLogic } from 'scenes/sceneLogic'+import { Scene } from 'scenes/sceneTypes'import { onboardingEventUsageLogic } from '../../onboardingEventUsageLogic'import { activeCloudRunLogic, CloudRunHandle } from './activeCloudRunLogic'@@ -26,6 +28,10 @@ import { wizardSyncUiLogic } from './wizardSyncUiLogic'// positions itself.const CORNER = 'fixed bottom-5 right-5 z-[60]'+export function shouldHideWizardSyncCard(activeSceneId: string | null): boolean {+ return activeSceneId === Scene.Quickstart+}+// 1Hz clock for the elapsed timer, scoped to a mounted run so nothing ticks when no run is active.// `frozen` stops the interval entirely — a finished run shows its fixed duration, so ticking for it// would be pure re-render churn.@@ -130,6 +136,7 @@ function WizardSyncSurface({mode,runKey,onClear,+ hideCard = false,}: {progress: InstallationProgressstartedAt: string | undefined@@ -139,6 +146,7 @@ function WizardSyncSurface({mode: WizardSyncModerunKey: stringonClear?: () => void+ hideCard?: boolean}): JSX.Element {const { dismissedKey, dialogOpen } = useValues(wizardSyncUiLogic)const { dismiss, restore, openDialog, closeDialog } = useActions(wizardSyncUiLogic)@@ -198,35 +206,37 @@ function WizardSyncSurface({return (<>- <div className={CORNER}>- {minimized ? (- <WizardSyncLauncher- progress={progress}- elapsedSeconds={elapsedSeconds}- onRestore={() => {- reportWizardSyncRestored(eventProps)- restore()- }}- />- ) : (- <WizardSyncCard- progress={progress}- elapsedSeconds={elapsedSeconds}- mode={mode}- dashboard={dashboard}- onDashboardClick={handleDashboardClick}- onExpand={() => {- reportWizardSyncExpanded(eventProps)- openDialog()- }}- // Mid-run, the X only minimizes — hiding a live run for good would orphan- // it. Once the run is terminal or the PR exists, the user's part is done,- // so the X becomes the real dismissal (the run never leaves on its own).- onDismiss={(isTerminal || prOpened) && handleClear ? handleClear : handleMinimize}- dismissTooltip={(isTerminal || prOpened) && handleClear ? 'Dismiss' : 'Minimize'}- />- )}- </div>+ {!hideCard && (+ <div className={CORNER}>+ {minimized ? (+ <WizardSyncLauncher+ progress={progress}+ elapsedSeconds={elapsedSeconds}+ onRestore={() => {+ reportWizardSyncRestored(eventProps)+ restore()+ }}+ />+ ) : (+ <WizardSyncCard+ progress={progress}+ elapsedSeconds={elapsedSeconds}+ mode={mode}+ dashboard={dashboard}+ onDashboardClick={handleDashboardClick}+ onExpand={() => {+ reportWizardSyncExpanded(eventProps)+ openDialog()+ }}+ // Mid-run, the X only minimizes — hiding a live run for good would orphan+ // it. Once the run is terminal or the PR exists, the user's part is done,+ // so the X becomes the real dismissal (the run never leaves on its own).+ onDismiss={(isTerminal || prOpened) && handleClear ? handleClear : handleMinimize}+ dismissTooltip={(isTerminal || prOpened) && handleClear ? 'Dismiss' : 'Minimize'}+ />+ )}+ </div>+ )}<WizardSyncDialogprogress={progress}elapsedSeconds={elapsedSeconds}@@ -242,7 +252,7 @@ function WizardSyncSurface({}// A cloud run: the Installation layer streams the pipeline; elapsed comes from the handle's kickoff stamp.-function WizardSyncCloudFab({ handle }: { handle: CloudRunHandle }): JSX.Element {+function WizardSyncCloudFab({ handle, hideCard }: { handle: CloudRunHandle; hideCard: boolean }): JSX.Element {const { installationProgress, taskRunState } = useValues(installationProgressLogic({ mode: 'cloud', runId: handle.runId, taskId: handle.taskId }))@@ -256,13 +266,14 @@ function WizardSyncCloudFab({ handle }: { handle: CloudRunHandle }): JSX.Elementmode="cloud"runKey={handle.runId}onClear={clearActiveCloudRun}+ hideCard={hideCard}/>)}// A finished local run rendered from its persisted snapshot: the session stream gates itself off// shortly after a terminal phase (INC-886), but the handoff stays until the user dismisses it.-function WizardSyncFinishedLocalFab(): JSX.Element | null {+function WizardSyncFinishedLocalFab({ hideCard }: { hideCard: boolean }): JSX.Element | null {const { finishedLocalRun } = useValues(finishedLocalRunLogic)const { dismissLocalRun } = useActions(finishedLocalRunLogic)if (!finishedLocalRun) {@@ -276,19 +287,20 @@ function WizardSyncFinishedLocalFab(): JSX.Element | null {mode="local"runKey={finishedLocalRun.sessionId}onClear={() => dismissLocalRun(finishedLocalRun.sessionId)}+ hideCard={hideCard}/>)}// A live local run: the wizard session stream is the source; elapsed comes from its started_at.-function WizardSyncLocalFab(): JSX.Element | null {+function WizardSyncLocalFab({ hideCard }: { hideCard: boolean }): JSX.Element | null {const { installationProgress, latestSession } = useValues(installationProgressLogic({ mode: 'local' }))const { dismissedSessionId } = useValues(finishedLocalRunLogic)const { dismissLocalRun } = useActions(finishedLocalRunLogic)// No session on the stream yet, or the user already dismissed this one — fall back to the// persisted finished run (if any) rather than rendering nothing.if (!latestSession || latestSession.session_id === dismissedSessionId) {- return <WizardSyncFinishedLocalFab />+ return <WizardSyncFinishedLocalFab hideCard={hideCard} />}const isTerminal = installationProgress.phase === 'completed' || installationProgress.phase === 'error'return (@@ -299,6 +311,7 @@ function WizardSyncLocalFab(): JSX.Element | null {mode="local"runKey={latestSession.session_id}onClear={() => dismissLocalRun(latestSession.session_id)}+ hideCard={hideCard}/>)}@@ -306,13 +319,13 @@ function WizardSyncLocalFab(): JSX.Element | null {// Gate the local SSE behind the cheap detector poll, so a stream is opened only when a run is in// flight. Once the detector gates the stream off (terminal grace expired), the persisted finished// run keeps the handoff on screen without any stream.-function WizardSyncLocalGate(): JSX.Element | null {+function WizardSyncLocalGate({ hideCard }: { hideCard: boolean }): JSX.Element | null {useMountedLogic(wizardActiveSessionDetectorLogic)const { shouldStream } = useValues(wizardActiveSessionDetectorLogic)if (!shouldStream) {- return <WizardSyncFinishedLocalFab />+ return <WizardSyncFinishedLocalFab hideCard={hideCard} />}- return <WizardSyncLocalFab />+ return <WizardSyncLocalFab hideCard={hideCard} />}/**@@ -325,6 +338,8 @@ function WizardSyncLocalGate(): JSX.Element | null {export function WizardSyncFab(): JSX.Element | null {const syncEnabled = useFeatureFlag('ONBOARDING_WIZARD_SYNC', 'test')const { activeCloudRun, panelMounted } = useValues(activeCloudRunLogic)+ const { activeSceneId } = useValues(sceneLogic)+ const hideCard = shouldHideWizardSyncCard(activeSceneId)// An inline install-step progress view is already showing this run, so stay out of its way. The FAB// is for after the user moves on from the install step. Both inline views (cloud and local) claim@@ -336,12 +351,12 @@ export function WizardSyncFab(): JSX.Element | null {// while the user was on the test arm, and a mid-experiment flag change must not strand an// in-flight run with no surface (and no way to dismiss it). Only STARTING runs is flag-gated.if (activeCloudRun) {- return <WizardSyncCloudFab handle={activeCloudRun} />+ return <WizardSyncCloudFab handle={activeCloudRun} hideCard={hideCard} />}if (syncEnabled) {- return <WizardSyncLocalGate />+ return <WizardSyncLocalGate hideCard={hideCard} />}// Same reasoning as the cloud handle: a persisted finished run is proof it happened under the// test arm, and it must stay dismissible if the flag flips mid-experiment.- return <WizardSyncFinishedLocalFab />+ return <WizardSyncFinishedLocalFab hideCard={hideCard} />}diff --git a/frontend/src/scenes/quickstart/Quickstart.stories.tsx b/frontend/src/scenes/quickstart/Quickstart.stories.tsxnew file mode 100644index 000000000000..3e1ea7044b9d--- /dev/null+++ b/frontend/src/scenes/quickstart/Quickstart.stories.tsx@@ -0,0 +1,330 @@+import { Meta, StoryObj } from '@storybook/react'+import { waitFor } from '@testing-library/dom'+import { useMountedLogic } from 'kea'+import { useEffect } from 'react'++import { FEATURE_FLAGS } from 'lib/constants'+import { App } from 'scenes/App'+import { activeCloudRunLogic } from 'scenes/onboarding/shared/wizard-sync/activeCloudRunLogic'+import { wizardActiveSessionDetectorLogic } from 'scenes/onboarding/shared/wizard-sync/wizardActiveSessionDetectorLogic'+import { projectLogic } from 'scenes/projectLogic'+import { teamLogic } from 'scenes/teamLogic'+import { urls } from 'scenes/urls'++import { mswDecorator } from '~/mocks/browser'+import { billingJson } from '~/mocks/fixtures/_billing'+import preflightJson from '~/mocks/fixtures/_preflight.json'+import { Mocks } from '~/mocks/utils'+import type { TeamType } from '~/types'++import { QuickstartToolSignals, clearQuickstartActivationCache } from './quickstartLogic'++// Deterministic stand-in for the posthog.com blog feed the publications rail streams+const BLOG_RSS = `<?xml version="1.0" encoding="UTF-8"?>+<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">+ <channel>+ <title>PostHog blog</title>+ <item>+ <title>How we built the quickstart page</title>+ <link>https://posthog.com/blog/quickstart-page</link>+ <description>Every tool on one screen, powered by the same events.</description>+ <pubDate>Mon, 13 Jul 2026 10:00:00 GMT</pubDate>+ <dc:creator>Max Hedgehog</dc:creator>+ </item>+ <item>+ <title>Session replay, now with hogs</title>+ <link>https://posthog.com/blog/replay-hogs</link>+ <description>Watch real users navigate your app, narrated by hedgehogs.</description>+ <pubDate>Thu, 09 Jul 2026 10:00:00 GMT</pubDate>+ <dc:creator>Max Hedgehog</dc:creator>+ </item>+ <item>+ <title>Feature flags without the foot-guns</title>+ <link>https://posthog.com/blog/safe-flags</link>+ <description>Roll out changes to the right users, safely.</description>+ <pubDate>Wed, 01 Jul 2026 10:00:00 GMT</pubDate>+ <dc:creator>Max Hedgehog</dc:creator>+ </item>+ </channel>+</rss>`++const sseEvent = (data: object): string => `data: ${JSON.stringify(data)}\n\n`+const sseStep = (group: string, step: string, status: string, label: string, detail: string | null = null): string =>+ sseEvent({+ type: 'notification',+ notification: { method: '_posthog/progress', params: { group, step, status, label, detail } },+ })++const TASK_RUN_STREAM_BODY = [+ sseEvent({+ type: 'task_run_state',+ status: 'in_progress',+ stage: 'work',+ output: null,+ branch: null,+ error_message: null,+ updated_at: '2026-07-15T12:00:00Z',+ completed_at: null,+ }),+ sseStep('setup', 'sandbox', 'completed', 'Set up sandbox'),+ sseStep('setup', 'clone', 'completed', 'Cloned repository'),+ sseStep('setup', 'wizard', 'in_progress', 'Running setup wizard', 'Installing the PostHog SDK'),+ sseStep('deliver', 'pr', 'pending', 'Opening pull request'),+ 'event: stream-end\ndata: {}\n\n',+].join('')++/** Column order of the tool-signals HogQL aggregate in quickstartLogic's loadActivationData */+const signalsRow = (signals: Partial<QuickstartToolSignals>): number[] => [+ signals.totalEvents ?? 0,+ signals.prodEvents ?? 0,+ signals.customEvents ?? 0,+ signals.distinctCustomEvents ?? 0,+ signals.identifyCalls ?? 0,+ signals.exceptions ?? 0,+ signals.serverExceptions ?? 0,+ signals.backendEvents ?? 0,+ signals.flagCalls ?? 0,+ signals.prodFlagCalls ?? 0,+ signals.pageviews ?? 0,+ signals.prodPageviews ?? 0,+ signals.surveyResponses ?? 0,+ signals.aiGenerations ?? 0,+ signals.aiTraceEvents ?? 0,+ signals.mcpInitialize ?? 0,+ signals.mcpToolCalls ?? 0,+]++interface ScenarioResources {+ hasLogs?: boolean+ sources?: number+ workflows?: number+ eventTriggeredWorkflows?: number+ symbolSets?: number+ errorAlerts?: number+ tickets?: number+}++/** One place to shape every data source the scene reads, so each story is a plain scenario */+const scenarioMocks = (signals: Partial<QuickstartToolSignals>, resources: ScenarioResources = {}): Mocks => ({+ get: {+ '/_preflight': { ...preflightJson, cloud: true, realm: 'cloud' },+ '/api/billing/': billingJson,+ // liveEventsHostOrigin() points at the Storybook origin, so the live users chip gets a count+ '/stats': { users_on_product: 342 },+ '/api/environments/:team_id/logs/has_logs': { hasLogs: resources.hasLogs ?? false },+ '/api/environments/:team_id/external_data_sources/': {+ results: Array.from({ length: resources.sources ?? 0 }, (_, index) => ({ id: String(index) })),+ },+ '/api/environments/:team_id/hog_flows/': {+ results: Array.from({ length: resources.workflows ?? 0 }, (_, index) => ({+ id: String(index),+ status: 'active',+ trigger: { type: index < (resources.eventTriggeredWorkflows ?? 0) ? 'event' : 'manual' },+ })),+ },+ '/api/environments/:team_id/error_tracking/symbol_sets/': { count: resources.symbolSets ?? 0, results: [] },+ '/api/environments/:team_id/hog_functions/': { count: resources.errorAlerts ?? 0, results: [] },+ '/api/projects/:team_id/conversations/tickets/': { count: resources.tickets ?? 0, results: [] },+ '/api/projects/:projectId/wizard/sessions/latest/': () => [204, ''],+ '/api/projects/:project_id/tasks/:task_id/runs/:run_id/stream': () =>+ new Response(TASK_RUN_STREAM_BODY, {+ status: 200,+ headers: { 'Content-Type': 'text/event-stream' },+ }),+ '/api/projects/:project_id/wizard/sessions/stream': () => [404],+ 'https://posthog.com/rss.xml': () =>+ new Response(BLOG_RSS, { status: 200, headers: { 'Content-Type': 'application/rss+xml' } }),+ },+ post: {+ // Serves both the signals aggregate and the replay count: the replay loader+ // reads the first column, so keep totalEvents as a plausible recordings number+ '/api/environments/:team_id/query': { results: [signalsRow(signals)] },+ },+})++// The activation data cache is keyed by team id, which every story shares — drop it+// between stories so each scenario's mocks actually load+const CacheBuster = (Story: React.ComponentType): JSX.Element => {+ clearQuickstartActivationCache()+ return <Story />+}++type InstallationState = 'complete' | 'not_started' | 'running'++function QuickstartInstallationState({+ state,+ children,+}: {+ state: InstallationState+ children: React.ReactNode+}): JSX.Element {+ useMountedLogic(teamLogic)+ useMountedLogic(activeCloudRunLogic)+ useMountedLogic(wizardActiveSessionDetectorLogic)++ useEffect(() => {+ const currentTeam = teamLogic.values.currentTeam+ if (!currentTeam) {+ return+ }+ const installationComplete = state === 'complete'+ teamLogic.actions.loadCurrentTeamSuccess({+ ...currentTeam,+ completed_snippet_onboarding: installationComplete,+ has_completed_onboarding_for: installationComplete ? { product_analytics: true } : {},+ ingested_event: installationComplete,+ } as TeamType)+ activeCloudRunLogic.actions.clearActiveCloudRun()+ activeCloudRunLogic.actions.setPanelMounted(false)+ wizardActiveSessionDetectorLogic.actions.markInactive()++ if (state === 'running') {+ activeCloudRunLogic.actions.setActiveCloudRun(+ 'storybook-task',+ 'storybook-run',+ new Date(Date.now() - 90_000).toISOString(),+ projectLogic.values.currentProjectId ?? currentTeam.id+ )+ activeCloudRunLogic.actions.setPanelMounted(true)+ }++ return () => {+ teamLogic.actions.loadCurrentTeamSuccess(currentTeam)+ activeCloudRunLogic.actions.clearActiveCloudRun()+ activeCloudRunLogic.actions.setPanelMounted(false)+ wizardActiveSessionDetectorLogic.actions.markInactive()+ }+ }, [state])++ return <>{children}</>+}++const installationStateDecorator =+ (state: InstallationState) =>+ (Story: React.ComponentType): JSX.Element => (+ <QuickstartInstallationState state={state}>+ <Story />+ </QuickstartInstallationState>+ )++const meta: Meta = {+ component: App,+ title: 'Scenes-App/Quickstart',+ parameters: {+ layout: 'fullscreen',+ viewMode: 'story',+ mockDate: '2026-07-15',+ pageUrl: urls.quickstart(),+ // The scene only renders for the test variant of the experiment flag+ featureFlags: {+ [FEATURE_FLAGS.QUICKSTART_HOMEPAGE]: 'test',+ [FEATURE_FLAGS.ONBOARDING_WIZARD_SYNC]: 'test',+ },+ },+ // External artwork (Substack covers) makes pixel snapshots nondeterministic+ tags: ['test-skip'],+ decorators: [CacheBuster],+}+export default meta++type Story = StoryObj<{}>++/** A team mid-journey: several tools live, several waiting, quality partially climbed */+export const Base: Story = {+ decorators: [+ mswDecorator(+ scenarioMocks(+ {+ totalEvents: 54210,+ prodEvents: 32480,+ customEvents: 1800,+ distinctCustomEvents: 8,+ identifyCalls: 900,+ exceptions: 42,+ serverExceptions: 3,+ backendEvents: 5400,+ flagCalls: 1200,+ prodFlagCalls: 800,+ pageviews: 27904,+ prodPageviews: 21000,+ surveyResponses: 12,+ },+ { sources: 2, workflows: 1, eventTriggeredWorkflows: 1, symbolSets: 1, tickets: 12 }+ )+ ),+ ],+}++/** Nothing has sent data in the window: every event-based tool decays back to ready/needs setup */+export const QuietProject: Story = {+ decorators: [mswDecorator(scenarioMocks({}))],+}++/** Fresh account without a wizard run: the header links back to the onboarding installation step. */+export const InstallationNotStarted: Story = {+ decorators: [installationStateDecorator('not_started'), mswDecorator(scenarioMocks({}))],+}++/** Fresh account with a wizard run: a compact status chip gets its own row below the token and the global FAB stays hidden. */+export const InstallationRunning: Story = {+ decorators: [installationStateDecorator('running'), mswDecorator(scenarioMocks({}))],+ parameters: { testOptions: { waitForLoadersToDisappear: false } },+ play: async () => {+ await waitFor(+ () => {+ const installationProgress = document.querySelector('[data-attr="quickstart-installation-progress"]')+ const productAnalyticsProgress = document.querySelector('[data-attr="quickstart-product-installing"]')+ if (!installationProgress?.textContent?.includes('Installing the PostHog SDK')) {+ throw new Error('Quickstart installation task is not ready')+ }+ if (!productAnalyticsProgress?.textContent?.includes('Installing the PostHog SDK')) {+ throw new Error('Product analytics installation state is not ready')+ }+ },+ { timeout: 8000, interval: 200 }+ )+ },+}++/** Installed project without a wizard run: no installation CTA is shown in the header. */+export const InstallationComplete: Story = {+ decorators: [installationStateDecorator('complete'), mswDecorator(scenarioMocks({ totalEvents: 120 }))],+}++/** Everything wired: all tools live with deep quality — the "topped out" look */+export const EverythingLive: Story = {+ decorators: [+ mswDecorator(+ scenarioMocks(+ {+ totalEvents: 812000,+ prodEvents: 640000,+ customEvents: 90000,+ distinctCustomEvents: 42,+ identifyCalls: 51000,+ exceptions: 3100,+ serverExceptions: 1200,+ backendEvents: 210000,+ flagCalls: 88000,+ prodFlagCalls: 61000,+ pageviews: 402000,+ prodPageviews: 350000,+ surveyResponses: 640,+ aiGenerations: 12000,+ aiTraceEvents: 4000,+ mcpInitialize: 90,+ mcpToolCalls: 4200,+ },+ {+ hasLogs: true,+ sources: 3,+ workflows: 4,+ eventTriggeredWorkflows: 2,+ symbolSets: 5,+ errorAlerts: 2,+ tickets: 230,+ }+ )+ ),+ ],+}diff --git a/frontend/src/scenes/quickstart/Quickstart.test.ts b/frontend/src/scenes/quickstart/Quickstart.test.tsnew file mode 100644index 000000000000..83d6c3b59086--- /dev/null+++ b/frontend/src/scenes/quickstart/Quickstart.test.ts@@ -0,0 +1,24 @@+import { ProductKey } from '~/queries/schema/schema-general'++import { InstallationProgress } from '../onboarding/shared/wizard-sync/installationProgressLogic'+import { isQuickstartProductInstalling } from './QuickstartWizardProgress'++function progress(phase: InstallationProgress['phase']): InstallationProgress {+ return { phase, steps: [], error: null, prUrl: null, prMerged: false, isCurrent: true }+}++describe('Quickstart wizard integration', () => {+ test.each([+ ['connecting', true],+ ['running', true],+ ['completed', false],+ ['error', false],+ ['idle', false],+ ] as const)('marks Product analytics as installing while the wizard is %s', (phase, expected) => {+ expect(isQuickstartProductInstalling(ProductKey.PRODUCT_ANALYTICS, progress(phase))).toBe(expected)+ })++ it('does not infer installation progress for other products', () => {+ expect(isQuickstartProductInstalling(ProductKey.AI_OBSERVABILITY, progress('running'))).toBe(false)+ })+})diff --git a/frontend/src/scenes/quickstart/Quickstart.tsx b/frontend/src/scenes/quickstart/Quickstart.tsxnew file mode 100644index 000000000000..63df85f563ba--- /dev/null+++ b/frontend/src/scenes/quickstart/Quickstart.tsx@@ -0,0 +1,1650 @@+import { useActions, useValues } from 'kea'+import posthog from 'posthog-js'+import { useEffect, useRef } from 'react'++import {+ IconApps,+ IconArrowLeft,+ IconArrowRight,+ IconBook,+ IconBuilding,+ IconCheckCircle,+ IconChevronDown,+ IconCopy,+ IconFolder,+ IconGear,+ IconGraduationCap,+ IconLogomark,+ IconPeople,+ IconPin,+ IconPinFilled,+ IconReceipt,+ IconRocket,+ IconSearch,+ IconSparkles,+ IconTerminal,+} from '@posthog/icons'+import { LemonButton, LemonDropdown, LemonSkeleton, LemonTag, SpinnerOverlay } from '@posthog/lemon-ui'++import { CodeSnippet } from 'lib/components/CodeSnippet'+import { commandLogic } from 'lib/components/Command/commandLogic'+import { liveUserCountLogic } from 'lib/components/LiveUserCount'+import { ScrollableShadows } from 'lib/components/ScrollableShadows/ScrollableShadows'+import { RenderKeybind } from 'lib/components/Shortcuts/ShortcutMenu'+import { keyBinds } from 'lib/components/Shortcuts/shortcuts'+import { FEATURE_FLAGS } from 'lib/constants'+import { dayjs } from 'lib/dayjs'+import { usePageVisibility } from 'lib/hooks/usePageVisibility'+import { IconSlack } from 'lib/lemon-ui/icons'+import { LemonCard } from 'lib/lemon-ui/LemonCard'+import { LemonLabel } from 'lib/lemon-ui/LemonLabel'+import { LemonModal } from 'lib/lemon-ui/LemonModal'+import { Link } from 'lib/lemon-ui/Link'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import { copyToClipboard } from 'lib/utils/copyToClipboard'+import { humanFriendlyCurrency, humanFriendlyLargeNumber } from 'lib/utils/numbers'+import { billingLogic } from 'scenes/billing/billingLogic'+import { SlackIntegration } from 'scenes/integrations/components/SlackIntegration'+import {+ AIObservabilitySDKInstructions,+ AIObservabilitySDKTagOverrides,+} from 'scenes/onboarding/legacy/sdks/ai-observability/AIObservabilitySDKInstructions'+import { ErrorTrackingSDKInstructions } from 'scenes/onboarding/legacy/sdks/error-tracking/ErrorTrackingSDKInstructions'+import { ExperimentsSDKInstructions } from 'scenes/onboarding/legacy/sdks/experiments/ExperimentsSDKInstructions'+import { FeatureFlagsSDKInstructions } from 'scenes/onboarding/legacy/sdks/feature-flags/FeatureFlagsSDKInstructions'+import { useAdblockDetection } from 'scenes/onboarding/legacy/sdks/hooks/useAdblockDetection'+import { useInstallationComplete } from 'scenes/onboarding/legacy/sdks/hooks/useInstallationComplete'+import { LogsSDKInstructions } from 'scenes/onboarding/legacy/sdks/logs/LogsSDKInstructions'+import { SDKGrid } from 'scenes/onboarding/legacy/sdks/OnboardingInstallStep/SDKGrid'+import { ProductAnalyticsSDKInstructions } from 'scenes/onboarding/legacy/sdks/product-analytics/ProductAnalyticsSDKInstructions'+import { AdblockWarning } from 'scenes/onboarding/legacy/sdks/RealtimeCheckIndicator'+import { sdksLogic } from 'scenes/onboarding/legacy/sdks/sdksLogic'+import { SDKSnippet } from 'scenes/onboarding/legacy/sdks/SDKSnippet'+import { SessionReplaySDKInstructions } from 'scenes/onboarding/legacy/sdks/session-replay/SessionReplaySDKInstructions'+import { SurveysSDKInstructions } from 'scenes/onboarding/legacy/sdks/surveys/SurveysSDKInstructions'+import { WebAnalyticsSDKInstructions } from 'scenes/onboarding/legacy/sdks/web-analytics/WebAnalyticsSDKInstructions'+import { getProductIcon } from 'scenes/onboarding/shared/utils'+import { currentTaskLabel } from 'scenes/onboarding/shared/wizard-sync/helpers'+import { InstallationProgress } from 'scenes/onboarding/shared/wizard-sync/installationProgressLogic'+import { wizardSyncUiLogic } from 'scenes/onboarding/shared/wizard-sync/wizardSyncUiLogic'+import { organizationLogic } from 'scenes/organizationLogic'+import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'+import { SceneExport } from 'scenes/sceneTypes'+import MCPServerSettings from 'scenes/settings/environment/MCPServerSettings'+import { inviteLogic } from 'scenes/settings/organization/inviteLogic'+import { isAuthenticatedTeam, teamLogic } from 'scenes/teamLogic'+import { urls } from 'scenes/urls'++import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'+import { SceneContent } from '~/layout/scenes/components/SceneContent'+import { ProductKey } from '~/queries/schema/schema-general'+import {+ BillingProductV2Type,+ OnboardingStepKey,+ SDK,+ SDKInstructionsMap,+ SDKKey,+ SDKTagOverrides,+ SidePanelTab,+} from '~/types'++import { QUICKSTART_PRODUCT_LAYOUT } from './productLayout'+import {+ PublicationFeedKey,+ QUICKSTART_BLOG_URL,+ QUICKSTART_NEWSLETTER_URL,+ QuickstartPublication,+} from './publications'+import {+ QuickstartJourneyStep,+ QuickstartProduct,+ QuickstartToolStatus,+ getQuickstartTrackingProperties,+ quickstartLogic,+} from './quickstartLogic'+import {+ isQuickstartProductInstalling,+ QuickstartInstallationProgress,+ QuickstartWizardProgress,+} from './QuickstartWizardProgress'++const QUICKSTART_LIVE_USERS_POLL_INTERVAL_MS = 1000++export const scene: SceneExport = {+ component: Quickstart,+ logic: quickstartLogic,+}++function captureQuickstartAction(action: string, productKey?: string, properties?: Record<string, unknown>): void {+ const quickstartValues = quickstartLogic.findMounted()?.values+ const currentTeam = quickstartValues?.currentTeam+ const products = quickstartValues?.products ?? []+ const product = productKey ? products.find((candidate) => candidate.key === productKey) : undefined+ const trackingProperties = isAuthenticatedTeam(currentTeam)+ ? getQuickstartTrackingProperties(currentTeam, products)+ : {}+ const onboardedProducts = new Set(+ Array.isArray(trackingProperties.onboarded_products) ? trackingProperties.onboarded_products : []+ )+ const isCrossSell =+ !!product &&+ trackingProperties.is_post_onboarding === true &&+ !onboardedProducts.has(product.key) &&+ product.status.level !== 'live'++ posthog.capture('quickstart action clicked', {+ ...trackingProperties,+ action,+ ...(productKey ? { product_key: productKey } : {}),+ ...(product+ ? {+ product_status: product.status.level,+ product_was_onboarded: onboardedProducts.has(product.key),+ is_cross_sell: isCrossSell,+ }+ : {}),+ ...properties,+ })+}++function SectionHeader({ title, subtitle }: { title: string; subtitle?: string }): JSX.Element {+ return (+ <div className="mb-4">+ <h2 className="text-lg font-semibold mb-0">{title}</h2>+ {subtitle && <p className="text-secondary mb-0 mt-1">{subtitle}</p>}+ </div>+ )+}++function LiveUsersRightNow(): JSX.Element {+ const logicProps = { pollIntervalMs: QUICKSTART_LIVE_USERS_POLL_INTERVAL_MS }+ const { liveUserCount } = useValues(liveUserCountLogic(logicProps))+ const { pauseStream, resumeStream } = useActions(liveUserCountLogic(logicProps))+ const { isVisible } = usePageVisibility()+ const hasLiveUsers = (liveUserCount ?? 0) > 0++ useEffect(() => {+ if (isVisible) {+ resumeStream()+ } else {+ pauseStream()+ }+ }, [isVisible, resumeStream, pauseStream])++ return (+ <Link+ to={urls.webAnalyticsLive()}+ onClick={() => captureQuickstartAction('view_live_users')}+ className="flex items-center gap-1.5 text-xs text-tertiary hover:text-primary"+ data-attr="quickstart-live-users"+ >+ <span className="relative flex items-center justify-center shrink-0">+ {hasLiveUsers && (+ <span className="absolute size-2.5 bg-success rounded-full animate-pulse opacity-30" />+ )}+ <span className={`relative size-1.5 rounded-full ${hasLiveUsers ? 'bg-success' : 'bg-muted-alt'}`} />+ </span>+ {liveUserCount === null ? (+ <span>View live users</span>+ ) : (+ <span>+ <strong className="font-semibold text-primary">{humanFriendlyLargeNumber(liveUserCount)}</strong>{' '}+ live {liveUserCount === 1 ? 'user' : 'users'}+ </span>+ )}+ </Link>+ )+}++function ProjectToken({ inline = false }: { inline?: boolean }): JSX.Element | null {+ const { currentTeam } = useValues(teamLogic)++ if (!currentTeam?.api_token) {+ return null+ }+ const projectToken = currentTeam.api_token++ // Once data is flowing the token is reference material, not a setup step, so it+ // collapses to a quiet single line+ if (inline) {+ return (+ <div className="inline-flex items-stretch rounded border bg-bg-light overflow-hidden max-w-full min-w-0">+ <span className="flex items-center px-3 border-r bg-fill-tertiary text-xs font-medium text-secondary whitespace-nowrap">+ Project token+ </span>+ <span className="font-mono text-xs min-w-0 max-w-80 px-3 py-2 truncate">{projectToken}</span>+ <div className="flex items-center px-2 border-l">+ <LemonButton+ noPadding+ icon={<IconCopy />}+ tooltip="Copy project token"+ onClick={() => {+ captureQuickstartAction('copy_project_token')+ void copyToClipboard(projectToken, 'project token')+ }}+ data-attr="quickstart-copy-project-token"+ />+ </div>+ </div>+ )+ }++ return (+ <div+ className="flex flex-col gap-1 w-fit max-w-full min-w-0"+ onClick={() => captureQuickstartAction('copy_project_token')}+ data-attr="quickstart-copy-project-token"+ >+ <LemonLabel info="Every SDK snippet uses it. Write-only, so it's safe in public apps.">+ Project token+ </LemonLabel>+ <CodeSnippet compact wrap thing="project token">+ {projectToken}+ </CodeSnippet>+ </div>+ )+}++function UsageThisPeriod(): JSX.Element | null {+ const { isCloudOrDev } = useValues(preflightLogic)+ const { billing, canAccessBilling } = useValues(billingLogic)++ if (!isCloudOrDev || !canAccessBilling || !billing) {+ return null+ }++ const interval = billing.billing_period?.interval === 'year' ? 'year' : 'month'+ const eventsUsage = billing.products?.find(+ (product: BillingProductV2Type) => product.type === ProductKey.PRODUCT_ANALYTICS+ )?.current_usage++ let label: string | null = null+ if (billing.has_active_subscription && billing.current_total_amount_usd !== undefined) {+ label = `${humanFriendlyCurrency(billing.current_total_amount_usd)} this ${interval}`+ } else if (eventsUsage !== undefined) {+ // Free plans have no spend to show, but usage against the free tier is still meaningful+ label = `${humanFriendlyLargeNumber(eventsUsage)} events this ${interval}`+ }+ if (!label) {+ return null+ }++ return (+ <Link+ to={urls.organizationBilling()}+ onClick={() => captureQuickstartAction('view_billing_usage')}+ className="flex items-center gap-1 text-xs text-tertiary hover:text-primary"+ data-attr="quickstart-billing-usage"+ >+ <IconReceipt />+ <span>{label}</span>+ </Link>+ )+}++/** Workspace chrome: where you are, what it costs, what's happening right now */+function WorkspaceStrip(): JSX.Element {+ const { currentOrganization } = useValues(organizationLogic)+ const { currentTeam } = useValues(teamLogic)+ const { toggleCommand } = useActions(commandLogic)++ return (+ <div className="flex flex-wrap items-center justify-between gap-x-4 gap-y-1 text-xs text-tertiary">+ <div className="flex flex-wrap items-center gap-x-1.5 min-w-0">+ {currentOrganization?.name ? (+ <span className="flex items-center gap-1">+ <IconBuilding />+ {currentOrganization.name}+ </span>+ ) : null}+ {currentOrganization?.name && currentTeam?.name ? <span>/</span> : null}+ {currentTeam?.name ? (+ <span className="flex items-center gap-1">+ <IconFolder />+ {currentTeam.name}+ </span>+ ) : null}+ </div>+ <div className="flex flex-wrap items-center gap-x-3">+ <LemonButton+ size="xsmall"+ icon={<IconSearch />}+ onClick={() => {+ captureQuickstartAction('open_search_shortcut')+ toggleCommand()+ }}+ data-attr="quickstart-search-shortcut"+ >+ <span>Search</span>+ <RenderKeybind keybind={[keyBinds.search]} minimal />+ </LemonButton>+ <UsageThisPeriod />+ <LiveUsersRightNow />+ </div>+ </div>+ )+}++function HeaderStat({ icon, children }: { icon: JSX.Element; children: React.ReactNode }): JSX.Element {+ return (+ <div className="flex items-center gap-1.5 text-sm text-secondary">+ <span className="text-base leading-none">{icon}</span>+ {children}+ </div>+ )+}++function QuickstartInstallationPrompt({ installationComplete }: { installationComplete: boolean }): JSX.Element | null {+ return (+ <QuickstartWizardProgress fallback={installationComplete ? null : <QuickstartInstallationLink />}>+ {(progress) => <QuickstartInstallationProgress progress={progress} />}+ </QuickstartWizardProgress>+ )+}++function QuickstartInstallationLink(): JSX.Element {+ return (+ <LemonButton+ type="primary"+ size="small"+ icon={<IconRocket />}+ to={urls.onboarding({+ productKey: ProductKey.PRODUCT_ANALYTICS,+ stepKey: OnboardingStepKey.INSTALL,+ })}+ onClick={() => captureQuickstartAction('return_to_installation')}+ data-attr="quickstart-return-to-installation"+ >+ Run setup wizard+ </LemonButton>+ )+}++function SubsectionHeader({ title }: { title: string }): JSX.Element {+ return <h3 className="text-sm font-semibold mb-3">{title}</h3>+}++function JourneyOverlay({+ journey,+ productKey,+}: {+ journey: QuickstartJourneyStep[]+ productKey: ProductKey+}): JSX.Element {+ const { openTaskGuidance } = useActions(quickstartLogic)+ const sections = [+ { title: 'Get it live', steps: journey.filter((step) => step.kind === 'activation') },+ { title: 'Improve quality', steps: journey.filter((step) => step.kind === 'quality') },+ ].filter((section) => section.steps.length > 0)++ return (+ <div className="p-2 max-w-100 flex flex-col gap-3">+ {sections.map((section) => (+ <div key={section.title}>+ <div className="text-xs font-semibold text-secondary mb-1">{section.title}</div>+ <ul className="flex flex-col gap-1 mb-0">+ {section.steps.map((step) => (+ <li key={step.key}>+ <LemonButton+ type="tertiary"+ size="small"+ fullWidth+ center={false}+ icon={+ step.achieved ? (+ <IconCheckCircle className="text-success" />+ ) : (+ <span className="w-3 h-3 rounded-full border-2 border-current text-muted-alt" />+ )+ }+ sideIcon={<IconArrowRight />}+ onClick={() => {+ captureQuickstartAction('open_tool_task', productKey, { step_key: step.key })+ openTaskGuidance(productKey, step.key)+ }}+ data-attr={`quickstart-task-${productKey}-${step.key}`}+ >+ <span+ className={`whitespace-normal text-left ${step.achieved ? 'text-tertiary' : ''}`}+ >+ {step.label}+ </span>+ </LemonButton>+ </li>+ ))}+ </ul>+ </div>+ ))}+ </div>+ )+}++function JourneyMeter({ status, productKey }: { status: QuickstartToolStatus; productKey: ProductKey }): JSX.Element {+ const achievedStepCount = status.journey.filter((step) => step.achieved).length++ return (+ <LemonDropdown+ overlay={<JourneyOverlay journey={status.journey} productKey={productKey} />}+ placement="bottom-end"+ onVisibilityChange={(visible) => visible && captureQuickstartAction('view_tool_journey', productKey)}+ >+ <button+ type="button"+ className="flex items-center gap-2 w-full p-0 border-0 bg-transparent cursor-pointer group"+ aria-label="Show setup details"+ data-attr={`quickstart-journey-${productKey}`}+ >+ <span className="flex items-center gap-1 flex-1">+ {status.journey.map((step, index) => (+ <span+ key={step.key}+ className={`h-1 flex-1 rounded-full transition-colors ${+ index < achievedStepCount+ ? 'bg-success'+ : index === achievedStepCount && status.nextStep+ ? 'bg-accent'+ : 'bg-fill-tertiary'+ }`}+ />+ ))}+ </span>+ <span className="text-xs text-tertiary group-hover:text-primary">Setup details</span>+ <IconChevronDown className="text-tertiary group-hover:text-primary" />+ </button>+ </LemonDropdown>+ )+}++function ToolActivitySummary({+ product,+ status,+ installationInProgress,+}: {+ product: QuickstartProduct+ status: QuickstartToolStatus+ installationInProgress: boolean+}): JSX.Element {+ if (installationInProgress) {+ return (+ <div className="flex items-center gap-1.5 min-h-5 min-w-0" data-attr="quickstart-product-installing">+ <span className="relative flex items-center justify-center size-2">+ <span className="absolute size-2 rounded-full bg-accent opacity-25 animate-pulse" />+ <span className="relative size-1.5 rounded-full bg-accent" />+ </span>+ <span className="text-sm text-secondary">Installing the PostHog SDK</span>+ </div>+ )+ }+ if (status.stat) {+ return (+ <div className="flex items-baseline gap-1.5 min-h-5 min-w-0">+ <span className="size-1.5 rounded-full bg-success shrink-0" />+ <Link+ to={product.url}+ onClick={() => captureQuickstartAction('view_tool_activity', product.key)}+ className="inline-flex items-baseline gap-1 min-w-0"+ data-attr={`quickstart-activity-${product.key}`}+ >+ <span className="text-sm font-semibold tabular-nums text-primary">+ {humanFriendlyLargeNumber(status.stat.value)}+ </span>+ <span className="text-sm text-secondary truncate">{status.stat.label}</span>+ </Link>+ </div>+ )+ }+ if (status.level === 'live') {+ return (+ <div className="flex items-center gap-1.5 min-h-5 min-w-0">+ <span className="size-1.5 rounded-full bg-success shrink-0" />+ <span className="text-sm text-secondary">Active in the last 30 days</span>+ </div>+ )+ }+ if (status.level === 'ready') {+ return (+ <div className="flex items-center gap-1.5 min-h-5 min-w-0">+ <span className="relative flex items-center justify-center size-2">+ <span className="absolute size-2 rounded-full bg-warning opacity-25 animate-pulse" />+ <span className="relative size-1.5 rounded-full bg-warning" />+ </span>+ <span className="text-sm text-secondary">Waiting for first signal</span>+ </div>+ )+ }+ return (+ <div className="flex items-center gap-1.5 min-h-5 min-w-0">+ <span className="size-1.5 rounded-full bg-muted-alt shrink-0" />+ <span className="text-sm text-secondary">Not collecting data yet</span>+ </div>+ )+}++/** Activity evidence and the best available improvement, without implying a finite completion goal. */+function ToolStatusPanel({+ status,+ productKey,+ installationProgress,+}: {+ status: QuickstartToolStatus+ productKey: ProductKey+ installationProgress?: InstallationProgress+}): JSX.Element {+ const { openTaskGuidance } = useActions(quickstartLogic)+ const nextStep = status.nextStep+ const installationInProgress = isQuickstartProductInstalling(productKey, installationProgress)++ return (+ <div className="flex flex-col gap-2 border-t pt-3">+ <JourneyMeter status={status} productKey={productKey} />+ <div className="min-h-11 text-xs">+ {installationInProgress && installationProgress ? (+ <>+ <div className="font-medium text-secondary mb-0.5">Setup in progress</div>+ <div className="font-medium text-accent line-clamp-2" data-attr="quickstart-current-task">+ {currentTaskLabel(installationProgress)}+ </div>+ </>+ ) : (+ nextStep && (+ <>+ <div className="font-medium text-secondary mb-0.5">Next improvement</div>+ <Link+ onClick={() => {+ captureQuickstartAction('open_recommended_task', productKey, {+ step_key: nextStep.key,+ })+ openTaskGuidance(productKey, nextStep.key)+ }}+ className="font-medium text-accent whitespace-normal text-left line-clamp-2"+ data-attr={`quickstart-recommended-task-${productKey}`}+ >+ {nextStep.label}+ </Link>+ </>+ )+ )}+ </div>+ </div>+ )+}++function ProductActions({+ product,+ compact = false,+ installationProgress,+}: {+ product: QuickstartProduct+ compact?: boolean+ installationProgress?: InstallationProgress+}): JSX.Element {+ const { enablingProducts } = useValues(quickstartLogic)+ const { enableProduct, openToolSetupModal } = useActions(quickstartLogic)+ const { openDialog } = useActions(wizardSyncUiLogic)+ const { status } = product+ const installationInProgress = isQuickstartProductInstalling(product.key, installationProgress)++ const setUpButton = (+ <LemonButton+ type={compact ? 'secondary' : 'primary'}+ size="small"+ to={PRODUCT_SDK_SETUP[product.key] ? undefined : product.setupUrl}+ onClick={() => {+ captureQuickstartAction('set_up_product', product.key)+ if (PRODUCT_SDK_SETUP[product.key]) {+ openToolSetupModal(product.key)+ }+ }}+ data-attr={`quickstart-setup-${product.key}`}+ >+ {status.cta === 'install' ? 'Install' : 'Set up'}+ </LemonButton>+ )+ const enableButton = (type: 'primary' | 'secondary'): JSX.Element => (+ <LemonButton+ type={type}+ size="small"+ loading={!!enablingProducts[product.key]}+ onClick={() => {+ captureQuickstartAction('enable_product', product.key)+ enableProduct(product.key)+ }}+ data-attr={`quickstart-enable-${product.key}`}+ >+ Enable+ </LemonButton>+ )+ const openButton = (+ <LemonButton+ type={compact ? 'secondary' : 'primary'}+ size="small"+ to={product.url}+ onClick={() => captureQuickstartAction('open_product', product.key)}+ data-attr={`quickstart-open-${product.key}`}+ >+ Open+ </LemonButton>+ )+ const installingButton = (+ <LemonButton+ type={compact ? 'secondary' : 'primary'}+ size="small"+ icon={<span className="inline-block size-2 rounded-full bg-accent animate-pulse" />}+ onClick={openDialog}+ data-attr={`quickstart-installing-${product.key}`}+ >+ Installing SDK+ </LemonButton>+ )++ if (compact) {+ return installationInProgress+ ? installingButton+ : status.level === 'live'+ ? openButton+ : status.cta === 'enable'+ ? enableButton('secondary')+ : status.cta === 'open'+ ? openButton+ : setUpButton+ }++ return (+ <div className="flex items-center gap-2 mt-1">+ {installationInProgress ? (+ installingButton+ ) : status.level === 'live' ? (+ <>+ {openButton}+ {/* e.g. error tracking live from a server SDK can still turn on web autocapture */}+ {status.cta === 'enable' && enableButton('secondary')}+ </>+ ) : status.cta === 'enable' ? (+ enableButton('primary')+ ) : status.cta === 'open' ? (+ <>+ {openButton}+ {PRODUCT_SDK_SETUP[product.key] && (+ <LemonButton+ type="secondary"+ size="small"+ onClick={() => {+ captureQuickstartAction('open_sdk_guide', product.key)+ openToolSetupModal(product.key)+ }}+ data-attr={`quickstart-sdk-guide-${product.key}`}+ >+ SDK guide+ </LemonButton>+ )}+ </>+ ) : (+ setUpButton+ )}+ {product.docsUrl && (+ <LemonButton+ size="small"+ to={product.docsUrl}+ targetBlank+ onClick={() => captureQuickstartAction('open_docs', product.key)}+ data-attr={`quickstart-docs-${product.key}`}+ >+ Docs+ </LemonButton>+ )}+ </div>+ )+}++export function ProductCard({+ product,+ installationProgress,+}: {+ product: QuickstartProduct+ installationProgress?: InstallationProgress+}): JSX.Element {+ const { setProductFeatured } = useActions(quickstartLogic)+ const installationInProgress = isQuickstartProductInstalling(product.key, installationProgress)++ return (+ <LemonCard hoverEffect={false} className="flex flex-col gap-2 p-4 rounded-lg border-transparent shadow-sm">+ <div className="flex items-start justify-between gap-3">+ <div className="flex flex-col gap-2 min-w-0">+ <span className="text-2xl leading-none">+ {getProductIcon(product.icon, { iconColor: product.iconColor })}+ </span>+ <h3 className="font-semibold text-base mb-0">{product.name}</h3>+ </div>+ <LemonButton+ size="xsmall"+ icon={<IconPinFilled />}+ tooltip="Remove from Your tools"+ aria-label={`Remove ${product.name} from Your tools`}+ onClick={() => setProductFeatured(product.key, false)}+ data-attr={`quickstart-unfeature-${product.key}`}+ />+ </div>+ <div className="flex flex-col gap-1">+ <p className="text-secondary text-sm leading-relaxed mb-0">{product.description}</p>+ <ToolActivitySummary+ product={product}+ status={product.status}+ installationInProgress={installationInProgress}+ />+ </div>+ <ToolStatusPanel+ status={product.status}+ productKey={product.key}+ installationProgress={installationProgress}+ />+ <ProductActions product={product} installationProgress={installationProgress} />+ </LemonCard>+ )+}++function CompactProductCard({+ product,+ installationProgress,+}: {+ product: QuickstartProduct+ installationProgress?: InstallationProgress+}): JSX.Element {+ const { setProductFeatured } = useActions(quickstartLogic)+ const installationInProgress = isQuickstartProductInstalling(product.key, installationProgress)+ const statusLabel = installationInProgress+ ? 'Installing'+ : product.status.level === 'live'+ ? 'Live'+ : product.status.level === 'ready'+ ? 'Waiting for data'+ : 'Needs setup'++ return (+ <LemonCard hoverEffect={false} className="flex items-center gap-3 p-3 rounded-lg min-w-0">+ <span className="text-xl leading-none shrink-0">+ {getProductIcon(product.icon, { iconColor: product.iconColor })}+ </span>+ <div className="flex-1 min-w-0">+ <div className="flex items-center gap-2 min-w-0">+ <h3 className="font-semibold text-sm mb-0 truncate">{product.name}</h3>+ <LemonTag+ size="small"+ type={+ installationInProgress+ ? 'primary'+ : product.status.level === 'live'+ ? 'success'+ : product.status.level === 'ready'+ ? 'warning'+ : 'muted'+ }+ className="shrink-0"+ >+ {statusLabel}+ </LemonTag>+ </div>+ <p className="text-secondary text-xs mb-0 truncate">{product.description}</p>+ </div>+ <div className="flex items-center gap-1 shrink-0">+ <ProductActions product={product} compact installationProgress={installationProgress} />+ <LemonButton+ size="small"+ icon={<IconPin />}+ tooltip="Add to Your tools"+ aria-label={`Add ${product.name} to Your tools`}+ onClick={() => setProductFeatured(product.key, true)}+ data-attr={`quickstart-feature-${product.key}`}+ />+ </div>+ </LemonCard>+ )+}++function QuickstartProductCard({+ product,+ compact = false,+}: {+ product: QuickstartProduct+ compact?: boolean+}): JSX.Element {+ const renderCard = (installationProgress?: InstallationProgress): JSX.Element =>+ compact ? (+ <CompactProductCard product={product} installationProgress={installationProgress} />+ ) : (+ <ProductCard product={product} installationProgress={installationProgress} />+ )++ if (product.key !== ProductKey.PRODUCT_ANALYTICS) {+ return renderCard()+ }++ return (+ <QuickstartWizardProgress fallback={renderCard()}>+ {(progress) => renderCard(progress)}+ </QuickstartWizardProgress>+ )+}++const PRODUCT_SDK_SETUP: Partial<+ Record<ProductKey, { instructionsMap: SDKInstructionsMap; tagOverrides?: SDKTagOverrides; verifyingName?: string }>+> = {+ [ProductKey.PRODUCT_ANALYTICS]: { instructionsMap: ProductAnalyticsSDKInstructions },+ [ProductKey.WEB_ANALYTICS]: { instructionsMap: WebAnalyticsSDKInstructions },+ [ProductKey.SESSION_REPLAY]: { instructionsMap: SessionReplaySDKInstructions },+ [ProductKey.ERROR_TRACKING]: { instructionsMap: ErrorTrackingSDKInstructions },+ [ProductKey.SURVEYS]: { instructionsMap: SurveysSDKInstructions },+ [ProductKey.FEATURE_FLAGS]: { instructionsMap: FeatureFlagsSDKInstructions },+ [ProductKey.EXPERIMENTS]: { instructionsMap: ExperimentsSDKInstructions },+ [ProductKey.AI_OBSERVABILITY]: {+ instructionsMap: AIObservabilitySDKInstructions,+ tagOverrides: AIObservabilitySDKTagOverrides,+ verifyingName: 'LLM generation',+ },+ [ProductKey.LOGS]: { instructionsMap: LogsSDKInstructions },+}++function ToolSetupModalContent({+ product,+ installationComplete,+}: {+ product: QuickstartProduct+ installationComplete: boolean+}): JSX.Element {+ const setup = PRODUCT_SDK_SETUP[product.key]+ const { filteredSDKs, selectedSDK, tags, searchTerm, selectedTag } = useValues(sdksLogic)+ const {+ setAvailableSDKInstructionsMap,+ setSDKTagOverrides,+ selectSDK,+ setSelectedSDK,+ setSearchTerm,+ setSelectedTag,+ } = useActions(sdksLogic)+ const { currentTeam } = useValues(teamLogic)+ const adblockResult = useAdblockDetection()++ useEffect(() => {+ setSDKTagOverrides(setup?.tagOverrides ?? {})+ setAvailableSDKInstructionsMap(setup?.instructionsMap ?? {})+ setSelectedSDK(null)+ }, [setup, setAvailableSDKInstructionsMap, setSDKTagOverrides, setSelectedSDK])++ if (!setup) {+ return <p className="text-secondary mb-0">Follow the setup guide to get {product.name} running.</p>+ }++ if (!selectedSDK) {+ return (+ <SDKGrid+ filteredSDKs={filteredSDKs ?? []}+ searchTerm={searchTerm}+ selectedTag={selectedTag}+ tags={tags}+ onSDKClick={(sdk: SDK) => {+ captureQuickstartAction('select_sdk', product.key, { sdk_key: sdk.key })+ selectSDK(sdk)+ }}+ onSearchChange={setSearchTerm}+ onTagChange={setSelectedTag}+ currentTeam={currentTeam}+ showTopControls+ installationComplete={installationComplete}+ showTopSkipButton={false}+ />+ )+ }++ const instructions = setup.instructionsMap[selectedSDK.key as SDKKey] as (() => JSX.Element) | undefined++ return (+ <div className="flex flex-col gap-3">+ <div>+ <LemonButton+ icon={<IconArrowLeft />}+ size="xsmall"+ onClick={() => {+ captureQuickstartAction('view_all_sdks', product.key, { sdk_key: selectedSDK.key })+ setSelectedSDK(null)+ }}+ data-attr="quickstart-sdk-back"+ >+ All SDKs+ </LemonButton>+ </div>+ {instructions ? (+ <SDKSnippet sdk={selectedSDK} sdkInstructions={instructions} />+ ) : (+ <p className="text-secondary mb-0">Instructions for this SDK live in the full setup guide.</p>+ )}+ <AdblockWarning adblockResult={adblockResult} />+ </div>+ )+}++function ToolSetupModal({ installationComplete }: { installationComplete: boolean }): JSX.Element {+ const { setupModalProduct } = useValues(quickstartLogic)+ const { closeToolSetupModal } = useActions(quickstartLogic)++ return (+ <LemonModal+ isOpen={!!setupModalProduct}+ onClose={closeToolSetupModal}+ title={setupModalProduct ? `Set up ${setupModalProduct.name}` : ''}+ width="52rem"+ footer={+ setupModalProduct && (+ <div className="flex items-center justify-end gap-2">+ {setupModalProduct.docsUrl && (+ <LemonButton+ to={setupModalProduct.docsUrl}+ targetBlank+ onClick={() => captureQuickstartAction('open_docs', setupModalProduct.key)}+ data-attr="quickstart-setup-modal-docs"+ >+ Docs+ </LemonButton>+ )}+ <LemonButton+ type="primary"+ to={setupModalProduct.setupUrl}+ onClick={() => {+ captureQuickstartAction('open_setup_guide', setupModalProduct.key)+ closeToolSetupModal()+ }}+ data-attr="quickstart-setup-modal-guide"+ >+ Open full setup guide+ </LemonButton>+ </div>+ )+ }+ >+ {setupModalProduct && (+ <ToolSetupModalContent product={setupModalProduct} installationComplete={installationComplete} />+ )}+ </LemonModal>+ )+}++function TaskGuidanceModal(): JSX.Element {+ const { selectedTask, enablingProducts } = useValues(quickstartLogic)+ const { closeTaskGuidance, enableProduct, openToolSetupModal } = useActions(quickstartLogic)++ const primaryAction = (): JSX.Element | null => {+ if (!selectedTask) {+ return null+ }++ const { product, step } = selectedTask+ const captureAction = (): void => {+ captureQuickstartAction('start_tool_task', product.key, {+ step_key: step.key,+ task_action: step.guide.action,+ })+ }++ if (step.guide.action === 'enable') {+ return (+ <LemonButton+ type="primary"+ loading={!!enablingProducts[product.key]}+ disabledReason={step.achieved ? 'This is already enabled' : undefined}+ onClick={() => {+ captureAction()+ enableProduct(product.key)+ }}+ data-attr="quickstart-task-enable"+ >+ {step.achieved ? 'Enabled' : step.guide.actionLabel}+ </LemonButton>+ )+ }++ if (step.guide.action === 'setup' && PRODUCT_SDK_SETUP[product.key]) {+ return (+ <LemonButton+ type="primary"+ onClick={() => {+ captureAction()+ closeTaskGuidance()+ openToolSetupModal(product.key)+ }}+ data-attr="quickstart-task-setup"+ >+ {step.guide.actionLabel}+ </LemonButton>+ )+ }++ const destination =+ step.guide.action === 'docs'+ ? (step.guide.url ?? product.docsUrl ?? product.setupUrl)+ : step.guide.action === 'open_url'+ ? (step.guide.url ?? product.url)+ : step.guide.action === 'open_product'+ ? product.url+ : product.setupUrl++ return (+ <LemonButton+ type="primary"+ to={destination}+ targetBlank={step.guide.action === 'docs'}+ onClick={() => {+ captureAction()+ closeTaskGuidance()+ }}+ data-attr="quickstart-task-open"+ >+ {step.guide.actionLabel}+ </LemonButton>+ )+ }++ return (+ <LemonModal+ isOpen={!!selectedTask}+ onClose={closeTaskGuidance}+ title={selectedTask?.step.label ?? ''}+ width="32rem"+ footer={+ selectedTask && (+ <div className="flex items-center justify-end gap-2">+ <LemonButton onClick={closeTaskGuidance}>Close</LemonButton>+ {primaryAction()}+ </div>+ )+ }+ >+ {selectedTask && (+ <div className="flex flex-col gap-4">+ <div className="flex items-center gap-2">+ <span className="text-xl leading-none">+ {getProductIcon(selectedTask.product.icon, { iconColor: selectedTask.product.iconColor })}+ </span>+ <span className="font-medium">{selectedTask.product.name}</span>+ {selectedTask.step.achieved && <LemonTag type="success">Done</LemonTag>}+ </div>+ <p className="text-secondary mb-0">{selectedTask.step.guide.description}</p>+ <div>+ <div className="font-semibold mb-2">How to do it</div>+ <ol className="flex flex-col gap-2 list-decimal pl-5 mb-0">+ {selectedTask.step.guide.instructions.map((instruction) => (+ <li key={instruction} className="pl-1">+ {instruction}+ </li>+ ))}+ </ol>+ </div>+ </div>+ )}+ </LemonModal>+ )+}++interface LearnQuickLink {+ label: string+ to?: string+ targetBlank?: boolean+ onClick?: () => void+}++function LearnCard({+ icon,+ title,+ description,+ buttonLabel,+ to,+ targetBlank,+ onClick,+ action,+ quickLinks,+}: {+ icon: JSX.Element+ title: string+ description: string+ buttonLabel: string+ to?: string+ targetBlank?: boolean+ onClick?: () => void+ action: string+ quickLinks?: LearnQuickLink[]+}): JSX.Element {+ return (+ <LemonCard hoverEffect={false} className="flex flex-col gap-2 p-4 rounded-lg border-transparent shadow-sm">+ <span className="text-xl text-secondary">{icon}</span>+ <h3 className="font-semibold text-base mb-0">{title}</h3>+ <p className="text-secondary text-sm mb-0">{description}</p>+ {quickLinks ? (+ <>+ <ul className="flex flex-col gap-1.5 my-1 flex-1">+ {quickLinks.map((link) => (+ <li key={link.label}>+ <Link+ to={link.to}+ target={link.targetBlank ? '_blank' : undefined}+ targetBlankIcon={false}+ onClick={() => {+ captureQuickstartAction(`${action}_quick_link`, undefined, {+ link_label: link.label,+ })+ link.onClick?.()+ }}+ subtle+ className="text-sm font-normal"+ data-attr={`quickstart-learn-${action}-quick-link`}+ >+ {link.label}+ </Link>+ </li>+ ))}+ </ul>+ <div className="mt-auto flex">+ <LemonButton+ type="secondary"+ size="small"+ to={to}+ targetBlank={targetBlank}+ onClick={() => {+ captureQuickstartAction(action)+ onClick?.()+ }}+ data-attr={`quickstart-learn-${action}`}+ >+ {buttonLabel}+ </LemonButton>+ </div>+ </>+ ) : (+ <div className="mt-auto flex">+ <LemonButton+ type="secondary"+ size="small"+ to={to}+ targetBlank={targetBlank}+ onClick={() => {+ captureQuickstartAction(action)+ onClick?.()+ }}+ data-attr={`quickstart-learn-${action}`}+ >+ {buttonLabel}+ </LemonButton>+ </div>+ )}+ </LemonCard>+ )+}++function CompanionSetupModal(): JSX.Element {+ const { companionSetup } = useValues(quickstartLogic)+ const { closeCompanionSetup } = useActions(quickstartLogic)++ return (+ <LemonModal+ isOpen={companionSetup !== null}+ onClose={closeCompanionSetup}+ title={companionSetup === 'slack' ? 'Set up Slack' : 'Set up MCP'}+ width={640}+ >+ {companionSetup === 'slack' ? (+ <div className="flex flex-col gap-4">+ <p className="mb-0">+ Connect a Slack workspace to ask PostHog AI questions and send insights or alerts to channels.+ </p>+ <div className="rounded border bg-bg-light p-4">+ <SlackIntegration next={urls.quickstart()} />+ </div>+ <Link+ to={urls.integration('slack')}+ onClick={() => captureQuickstartAction('open_slack_integration_settings')}+ >+ Open the full Slack integration settings+ </Link>+ </div>+ ) : companionSetup === 'mcp' ? (+ <MCPServerSettings />+ ) : null}+ </LemonModal>+ )+}++function PublicationCard({+ publication,+ feed,+}: {+ publication: QuickstartPublication+ feed: PublicationFeedKey+}): JSX.Element {+ return (+ <LemonCard hoverEffect className="p-0 overflow-hidden h-full rounded-lg border-transparent shadow-sm">+ <Link+ to={publication.url}+ target="_blank"+ className="flex flex-col h-full text-primary hover:text-primary"+ onClick={() =>+ captureQuickstartAction('open_publication', undefined, {+ feed,+ publication_title: publication.title,+ url: publication.url,+ })+ }+ data-attr={`quickstart-publication-card-${feed}`}+ >+ {publication.imageUrl && (+ <img+ src={publication.imageUrl}+ alt=""+ className="w-full aspect-video object-cover bg-surface-secondary"+ loading="lazy"+ onError={(e) => {+ e.currentTarget.style.display = 'none'+ }}+ />+ )}+ <div className="flex flex-col gap-1 p-3 flex-1">+ <h3 className="font-semibold text-sm mb-0 line-clamp-2">{publication.title}</h3>+ <p className="text-secondary text-xs mb-0 line-clamp-2 flex-1">{publication.description}</p>+ <div className="text-xs text-tertiary mt-1">+ {[+ publication.author,+ dayjs(publication.publishedAt).isValid() ? dayjs(publication.publishedAt).fromNow() : null,+ ]+ .filter(Boolean)+ .join(' · ')}+ </div>+ </div>+ </Link>+ </LemonCard>+ )+}++function LoadMoreSentinel({ onVisible }: { onVisible: () => void }): JSX.Element {+ const ref = useRef<HTMLDivElement | null>(null)++ useEffect(() => {+ const element = ref.current+ if (!element) {+ return+ }+ const observer = new IntersectionObserver(+ (entries) => {+ if (entries.some((entry) => entry.isIntersecting)) {+ onVisible()+ }+ },+ { rootMargin: '400px' }+ )+ observer.observe(element)+ return () => observer.disconnect()+ }, [onVisible])++ return <div ref={ref} className="h-px" />+}++function PublicationSkeletonCard(): JSX.Element {+ return (+ <LemonCard+ hoverEffect={false}+ className="flex flex-col gap-2 p-3 h-full rounded-lg border-transparent shadow-sm"+ >+ <LemonSkeleton className="w-full h-24 rounded" />+ <LemonSkeleton className="w-3/4 h-4" />+ <LemonSkeleton className="w-full h-3" />+ </LemonCard>+ )+}++function PublicationRail({+ feed,+ title,+ viewAllUrl,+ viewAllLabel,+ endLabel,+ publications,+ loading,+ hasMore,+ onLoadMore,+}: {+ feed: PublicationFeedKey+ title: string+ viewAllUrl: string+ viewAllLabel: string+ endLabel: string+ publications: QuickstartPublication[]+ loading: boolean+ hasMore: boolean+ onLoadMore: () => void+}): JSX.Element | null {+ if (!loading && publications.length === 0) {+ return null+ }++ return (+ <div className="flex flex-col gap-2">+ <div className="flex items-center justify-between gap-2">+ <h3 className="text-sm font-semibold mb-0">{title}</h3>+ <Link+ to={viewAllUrl}+ target="_blank"+ className="text-sm"+ onClick={() => captureQuickstartAction(`view_all_${feed}`)}+ data-attr={`quickstart-publications-view-all-${feed}`}+ >+ {viewAllLabel}+ </Link>+ </div>+ <ScrollableShadows+ direction="horizontal"+ innerClassName="snap-x"+ contentClassName="flex w-max min-w-full items-stretch gap-4 pb-1"+ styledScrollbars+ >+ {publications.map((publication) => (+ <div key={publication.url} className="w-72 shrink-0 snap-start">+ <PublicationCard publication={publication} feed={feed} />+ </div>+ ))}+ {loading &&+ Array.from({ length: publications.length === 0 ? 4 : 2 }, (_, index) => (+ <div key={`skeleton-${index}`} className="w-72 shrink-0">+ <PublicationSkeletonCard />+ </div>+ ))}+ {!loading && hasMore && <LoadMoreSentinel onVisible={onLoadMore} />}+ {!loading && !hasMore && publications.length > 0 && (+ <div className="w-56 shrink-0 snap-start flex items-center justify-center rounded border border-dashed p-4 text-center">+ <Link+ to={viewAllUrl}+ target="_blank"+ className="text-sm"+ onClick={() => captureQuickstartAction(`view_all_${feed}`)}+ data-attr={`quickstart-publications-feed-end-${feed}`}+ >+ {endLabel}+ </Link>+ </div>+ )}+ </ScrollableShadows>+ </div>+ )+}++function PublicationsSection(): JSX.Element | null {+ const {+ blogPublications,+ blogPublicationsLoading,+ newsletterPublications,+ newsletterPublicationsLoading,+ publicationsHasMore,+ } = useValues(quickstartLogic)+ const { loadMoreBlogPublications, loadMoreNewsletterPublications } = useActions(quickstartLogic)++ const nothingToShow =+ !blogPublicationsLoading &&+ blogPublications.length === 0 &&+ !newsletterPublicationsLoading &&+ newsletterPublications.length === 0+ if (nothingToShow) {+ return null+ }++ return (+ <div className="flex flex-col gap-6">+ <PublicationRail+ feed="blog"+ title="Recent blog posts"+ viewAllUrl={QUICKSTART_BLOG_URL}+ viewAllLabel="View all posts"+ endLabel="Keep reading on the blog"+ publications={blogPublications}+ loading={blogPublicationsLoading}+ hasMore={publicationsHasMore.blog}+ onLoadMore={loadMoreBlogPublications}+ />+ <PublicationRail+ feed="newsletter"+ title="Recent build mode newsletter issues"+ viewAllUrl={QUICKSTART_NEWSLETTER_URL}+ viewAllLabel="Read & subscribe"+ endLabel="More issues + subscribe"+ publications={newsletterPublications}+ loading={newsletterPublicationsLoading}+ hasMore={publicationsHasMore.newsletter}+ onLoadMore={loadMoreNewsletterPublications}+ />+ </div>+ )+}++export function Quickstart(): JSX.Element {+ const { featuredProducts, additionalProducts, activeProductCount, totalProductCount } = useValues(quickstartLogic)+ const { showInviteModal } = useActions(inviteLogic)+ const { openCompanionSetup } = useActions(quickstartLogic)+ const { openSidePanel } = useActions(sidePanelStateLogic)+ const { featureFlags } = useValues(featureFlagLogic)+ const installationComplete = useInstallationComplete('ingested_event')++ const quickstartVariant = featureFlags[FEATURE_FLAGS.QUICKSTART_HOMEPAGE]+ if (quickstartVariant !== 'test') {+ // Flags are still loading, or quickstartLogic is redirecting home+ return <SpinnerOverlay sceneLevel />+ }++ return (+ // Capped and centered like onboarding's product selection: full-width reads stretched+ // and empty on large monitors, a ~72rem column keeps the page dense+ <SceneContent className="gap-y-8 py-4 w-full max-w-6xl mx-auto">+ {/* Workspace chrome hugs the hero: tighter within the zone than between zones */}+ <div className="flex flex-col gap-4">+ <WorkspaceStrip />+ {/* Standard scene header: title left, actions right. This page is a recurring+ homepage, so it gets utility, not a one-time welcome ceremony. */}+ <section>+ <div className="flex flex-wrap items-center justify-between gap-x-8 gap-y-2">+ <h1 className="text-2xl font-bold mb-0">Quickstart</h1>+ <div className="flex flex-wrap items-center gap-2">+ <LemonButton+ type="secondary"+ size="small"+ icon={<IconSparkles />}+ onClick={() => {+ captureQuickstartAction('ask_posthog_ai_header')+ openSidePanel(SidePanelTab.Max)+ }}+ data-attr="quickstart-header-ask-posthog-ai"+ >+ Ask PostHog AI+ </LemonButton>+ <LemonButton+ type="secondary"+ size="small"+ icon={<IconPeople />}+ onClick={() => {+ captureQuickstartAction('invite_teammate_header')+ showInviteModal()+ }}+ data-attr="quickstart-header-invite"+ >+ Invite teammates+ </LemonButton>+ <LemonButton+ size="small"+ icon={<IconGear />}+ to={urls.settings('project')}+ onClick={() => captureQuickstartAction('open_project_settings_header')}+ data-attr="quickstart-header-settings"+ >+ Project settings+ </LemonButton>+ </div>+ </div>+ <p className="text-secondary mb-0 mt-1 max-w-140">+ Connect your product's context, configure Tools, and choose how you work with PostHog.+ </p>+ <div className="mt-3 flex flex-wrap items-center gap-2">+ <ProjectToken inline />+ <QuickstartInstallationPrompt installationComplete={installationComplete} />+ </div>+ </section>+ </div>++ <section>+ <div className="flex flex-wrap items-start justify-between gap-x-8">+ <SectionHeader+ title={QUICKSTART_PRODUCT_LAYOUT.featured.title}+ subtitle={QUICKSTART_PRODUCT_LAYOUT.featured.description}+ />+ <HeaderStat icon={<IconApps />}>+ {activeProductCount} of {totalProductCount} live+ </HeaderStat>+ </div>+ {featuredProducts.length > 0 ? (+ <div className="grid grid-cols-1 @2xl/main-content:grid-cols-2 @5xl/main-content:grid-cols-3 gap-4">+ {featuredProducts.map((product) => (+ <QuickstartProductCard key={product.key} product={product} />+ ))}+ </div>+ ) : (+ <div className="rounded border border-dashed p-6 text-center text-secondary">+ Add a product from Explore more tools to keep its setup and activity here.+ </div>+ )}+ </section>++ {additionalProducts.length > 0 && (+ <section>+ <SectionHeader+ title={QUICKSTART_PRODUCT_LAYOUT.additional.title}+ subtitle={QUICKSTART_PRODUCT_LAYOUT.additional.description}+ />+ <div className="grid grid-cols-1 @3xl/main-content:grid-cols-2 gap-3">+ {additionalProducts.map((product) => (+ <QuickstartProductCard key={product.key} product={product} compact />+ ))}+ </div>+ </section>+ )}++ <section>+ <SectionHeader+ title="Guides, Products, and publications"+ subtitle="Open setup guides, configure Slack or MCP, install PostHog Code, and read recent publications."+ />+ <div className="flex flex-col gap-6">+ <div>+ <SubsectionHeader title="Documentation and tutorials" />+ <div className="grid grid-cols-1 @3xl/main-content:grid-cols-3 gap-4">+ <LearnCard+ icon={<IconSparkles className="text-ai" />}+ title="Ask PostHog AI"+ description="Ask questions about the events and properties in this project. Example questions:"+ buttonLabel="Ask PostHog AI"+ onClick={() => openSidePanel(SidePanelTab.Max)}+ action="ask_posthog_ai"+ quickLinks={[+ 'What are my most visited pages this week?',+ 'How many daily active users this week?',+ 'Where do users drop off in my app?',+ ].map((question) => ({+ label: question,+ // The ! prefix makes the side panel submit the question right away+ onClick: () => openSidePanel(SidePanelTab.Max, `!${question}`),+ }))}+ />+ <LearnCard+ icon={<IconBook />}+ title="Documentation"+ description="Reference guides for Tools, SDKs, frameworks, and configuration:"+ buttonLabel="Browse all docs"+ to="https://posthog.com/docs"+ targetBlank+ action="open_docs_home"+ quickLinks={[+ {+ label: 'Capture custom events',+ to: 'https://posthog.com/docs/product-analytics/capture-events',+ targetBlank: true,+ },+ {+ label: 'Identify your users',+ to: 'https://posthog.com/docs/product-analytics/identify',+ targetBlank: true,+ },+ {+ label: 'Define actions from events',+ to: 'https://posthog.com/docs/data/actions',+ targetBlank: true,+ },+ ]}+ />+ <LearnCard+ icon={<IconGraduationCap />}+ title="Tutorials"+ description="Step-by-step examples for common setups and workflows:"+ buttonLabel="Browse all tutorials"+ to="https://posthog.com/tutorials"+ targetBlank+ action="open_tutorials"+ quickLinks={[+ {+ label: 'Complete guide to event tracking',+ to: 'https://posthog.com/tutorials/event-tracking-guide',+ targetBlank: true,+ },+ {+ label: 'Understand behavior with session replays',+ to: 'https://posthog.com/tutorials/explore-insights-session-recordings',+ targetBlank: true,+ },+ {+ label: 'Track new and returning users',+ to: 'https://posthog.com/tutorials/track-new-returning-users',+ targetBlank: true,+ },+ ]}+ />+ </div>+ </div>+ <div>+ <SubsectionHeader title="Slack, MCP, and PostHog Code" />+ <div className="grid grid-cols-1 @3xl/main-content:grid-cols-3 gap-4">+ <LearnCard+ icon={<IconLogomark />}+ title="PostHog Code"+ description="Use context from PostHog while querying data or changing code from your editor or terminal."+ buttonLabel="Get PostHog Code"+ to="https://posthog.com/code"+ targetBlank+ action="open_posthog_code"+ />+ <LearnCard+ icon={<IconSlack />}+ title="Slack"+ description="Use PostHog AI, insights, alerts, and replies from a Slack workspace."+ buttonLabel="Set up Slack"+ action="open_slack_app"+ onClick={() => openCompanionSetup('slack')}+ />+ <LearnCard+ icon={<IconTerminal />}+ title="MCP"+ description="Connect an AI assistant to context and actions in PostHog."+ buttonLabel="Set up MCP"+ action="open_mcp_docs"+ onClick={() => openCompanionSetup('mcp')}+ />+ </div>+ </div>+ <PublicationsSection />+ </div>+ </section>++ <TaskGuidanceModal />+ <ToolSetupModal installationComplete={installationComplete} />+ <CompanionSetupModal />+ </SceneContent>+ )+}++export default Quickstartdiff --git a/frontend/src/scenes/quickstart/QuickstartProductCard.stories.tsx b/frontend/src/scenes/quickstart/QuickstartProductCard.stories.tsxnew file mode 100644index 000000000000..cbd95e99ed6a--- /dev/null+++ b/frontend/src/scenes/quickstart/QuickstartProductCard.stories.tsx@@ -0,0 +1,227 @@+import { Meta, StoryFn, StoryObj } from '@storybook/react'++import { mswDecorator } from '~/mocks/browser'+import { ProductKey } from '~/queries/schema/schema-general'++import { ProductCard } from './Quickstart'+import {+ QuickstartJourneyStep,+ QuickstartProduct,+ QuickstartTaskGuide,+ QuickstartToolCta,+ QuickstartToolLevel,+} from './quickstartLogic'++interface CardArgs {+ name: string+ bestFor: string+ description: string+ level: QuickstartToolLevel+ cta: QuickstartToolCta+ statValue: number+ statLabel: string+ stepsAchieved: number+ stepsTotal: number+ nextStep: string+ showDocs: boolean+}++const JOURNEY_LABELS = [+ 'Install a PostHog SDK',+ 'Capture your first event',+ 'Deploy your instrumentation to production',+ 'Capture your first custom event',+ 'Track 5+ distinct custom events',+ 'Identify your users',+ 'Set up an alert',+]++const STORY_GUIDE: QuickstartTaskGuide = {+ description: 'Complete this task to improve the tool setup.',+ instructions: ['Open the relevant setup.', 'Follow the instructions.', 'Return after data arrives.'],+ action: 'setup',+ actionLabel: 'Open setup',+}++function buildJourney(achieved: number, total: number): QuickstartJourneyStep[] {+ return Array.from({ length: total }, (_, index) => ({+ key: `step-${index}`,+ label: JOURNEY_LABELS[index] ?? `Example step ${index + 1}`,+ kind: index < 2 ? ('activation' as const) : ('quality' as const),+ achieved: index < achieved,+ guide: STORY_GUIDE,+ }))+}++function buildProduct(args: CardArgs): QuickstartProduct {+ const journey = buildJourney(args.stepsAchieved, args.stepsTotal)+ const nextStep = args.nextStep+ ? { ...(journey.find((step) => !step.achieved) ?? journey[0]), label: args.nextStep }+ : null++ return {+ key: ProductKey.PRODUCT_ANALYTICS,+ name: args.name,+ description: args.description,+ icon: 'IconGraph',+ iconColor: 'blue',+ bestFor: args.bestFor,+ requiresEvents: true,+ url: '#',+ setupUrl: '#',+ docsUrl: args.showDocs ? 'https://posthog.com/docs' : undefined,+ status: {+ level: args.level,+ journey,+ nextStep,+ stat: args.statValue > 0 ? { value: args.statValue, label: args.statLabel } : null,+ cta: args.cta,+ },+ }+}++const meta: Meta<CardArgs> = {+ title: 'Scenes-App/Quickstart/Product card',+ parameters: {+ viewMode: 'story',+ mockDate: '2026-07-15',+ },+ decorators: [+ // The card mounts quickstartLogic, whose loaders fire on mount — keep them quiet+ mswDecorator({+ get: {+ '/api/environments/:team_id/logs/has_logs': { hasLogs: false },+ '/api/environments/:team_id/external_data_sources/': { results: [] },+ '/api/environments/:team_id/hog_flows/': { results: [] },+ '/api/environments/:team_id/error_tracking/symbol_sets/': { count: 0, results: [] },+ '/api/environments/:team_id/hog_functions/': { count: 0, results: [] },+ '/api/projects/:team_id/conversations/tickets/': { count: 0, results: [] },+ 'https://posthog.com/rss.xml': () => new Response('', { status: 404 }),+ },+ post: {+ '/api/environments/:team_id/query': { results: [[]] },+ },+ }),+ ],+}+export default meta++const Template: StoryFn<CardArgs> = (args) => (+ <div className="max-w-100 p-4">+ <ProductCard product={buildProduct(args)} />+ </div>+)++/** Every knob of a card's status, to preview any state a tool can be in */+export const Playground: StoryObj<CardArgs> = {+ render: Template,+ args: {+ name: 'Product analytics',+ bestFor: 'understanding user behavior',+ description: 'See what users do in your app',+ level: 'live',+ cta: 'open',+ statValue: 53,+ statLabel: 'custom events',+ stepsAchieved: 4,+ stepsTotal: 6,+ nextStep: 'Track 5+ distinct custom events',+ showDocs: true,+ },+ argTypes: {+ level: { control: 'select', options: ['needs_setup', 'ready', 'live'] },+ cta: { control: 'select', options: ['install', 'enable', 'setup', 'open'] },+ stepsAchieved: { control: { type: 'number', min: 0, max: 7 } },+ stepsTotal: { control: { type: 'number', min: 1, max: 7 } },+ },+}++/** One card per representative state, for at-a-glance visual QA of the whole vocabulary */+export const AllStates: StoryObj = {+ render: () => {+ const states: Array<Partial<CardArgs> & { title: string }> = [+ {+ title: 'Needs setup, install pending',+ level: 'needs_setup',+ cta: 'install',+ statValue: 0,+ stepsAchieved: 0,+ stepsTotal: 6,+ nextStep: 'Install a PostHog SDK',+ },+ {+ title: 'Needs setup, one-click enable',+ level: 'needs_setup',+ cta: 'enable',+ statValue: 0,+ stepsAchieved: 1,+ stepsTotal: 5,+ nextStep: 'Turn on session recordings',+ },+ {+ title: 'Ready, waiting for first data',+ level: 'ready',+ cta: 'open',+ statValue: 0,+ stepsAchieved: 2,+ stepsTotal: 6,+ nextStep: 'Capture your first exception',+ },+ {+ title: 'Live, early quality',+ level: 'live',+ cta: 'open',+ statValue: 53,+ statLabel: 'custom events',+ stepsAchieved: 3,+ stepsTotal: 7,+ nextStep: 'Deploy your instrumentation to production',+ },+ {+ title: 'Live, secondary enable available',+ level: 'live',+ cta: 'enable',+ statValue: 42,+ statLabel: 'exceptions · 30d',+ stepsAchieved: 4,+ stepsTotal: 7,+ nextStep: 'Turn on exception autocapture for the web',+ },+ {+ title: 'Live, no current suggestion',+ level: 'live',+ cta: 'open',+ statValue: 4200,+ statLabel: 'tool calls · 30d',+ stepsAchieved: 5,+ stepsTotal: 5,+ nextStep: '',+ },+ ]+ return (+ <div className="grid grid-cols-2 xl:grid-cols-3 gap-4 p-4 max-w-300">+ {states.map(({ title, ...overrides }) => (+ <div key={title} className="flex flex-col gap-2">+ <div className="text-xs font-semibold text-secondary">{title}</div>+ <ProductCard+ product={buildProduct({+ name: 'Product analytics',+ bestFor: 'understanding user behavior',+ description: 'See what users do in your app',+ level: 'live',+ cta: 'open',+ statValue: 0,+ statLabel: 'custom events',+ stepsAchieved: 0,+ stepsTotal: 5,+ nextStep: '',+ showDocs: true,+ ...overrides,+ })}+ />+ </div>+ ))}+ </div>+ )+ },+}diff --git a/frontend/src/scenes/quickstart/QuickstartWizardProgress.tsx b/frontend/src/scenes/quickstart/QuickstartWizardProgress.tsxnew file mode 100644index 000000000000..55a584445779--- /dev/null+++ b/frontend/src/scenes/quickstart/QuickstartWizardProgress.tsx@@ -0,0 +1,157 @@+import { useActions, useMountedLogic, useValues } from 'kea'++import { IconCheckCircle, IconPullRequest, IconWarning } from '@posthog/icons'++import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'+import { cn } from 'lib/utils/css-classes'+import { activeCloudRunLogic, CloudRunHandle } from 'scenes/onboarding/shared/wizard-sync/activeCloudRunLogic'+import { finishedLocalRunLogic } from 'scenes/onboarding/shared/wizard-sync/finishedLocalRunLogic'+import { currentTaskLabel, pipClass, stepCounts, syncHeadline } from 'scenes/onboarding/shared/wizard-sync/helpers'+import {+ InstallationProgress,+ installationProgressLogic,+ progressFromFinishedLocalRun,+} from 'scenes/onboarding/shared/wizard-sync/installationProgressLogic'+import { wizardActiveSessionDetectorLogic } from 'scenes/onboarding/shared/wizard-sync/wizardActiveSessionDetectorLogic'+import { wizardSyncUiLogic } from 'scenes/onboarding/shared/wizard-sync/wizardSyncUiLogic'++import { ProductKey } from '~/queries/schema/schema-general'++interface QuickstartWizardProgressProps {+ children: (progress: InstallationProgress) => React.ReactNode+ fallback: React.ReactNode+}++function QuickstartCloudProgress({+ activeCloudRun,+ children,+}: {+ activeCloudRun: CloudRunHandle+ children: QuickstartWizardProgressProps['children']+}): JSX.Element {+ const { installationProgress } = useValues(+ installationProgressLogic({+ mode: 'cloud',+ runId: activeCloudRun.runId,+ taskId: activeCloudRun.taskId,+ })+ )++ return <>{children(installationProgress)}</>+}++function QuickstartLocalProgress({ children }: { children: QuickstartWizardProgressProps['children'] }): JSX.Element {+ const { installationProgress } = useValues(installationProgressLogic({ mode: 'local' }))++ return <>{children(installationProgress)}</>+}++function QuickstartLocalProgressDetector({ children, fallback }: QuickstartWizardProgressProps): JSX.Element {+ useMountedLogic(wizardActiveSessionDetectorLogic)+ const { hasActiveSession } = useValues(wizardActiveSessionDetectorLogic)+ const { finishedLocalRun } = useValues(finishedLocalRunLogic)++ if (hasActiveSession) {+ return <QuickstartLocalProgress>{children}</QuickstartLocalProgress>+ }+ if (finishedLocalRun) {+ return <>{children(progressFromFinishedLocalRun(finishedLocalRun))}</>+ }+ return <>{fallback}</>+}++export function QuickstartWizardProgress({ children, fallback }: QuickstartWizardProgressProps): JSX.Element {+ const syncEnabled = useFeatureFlag('ONBOARDING_WIZARD_SYNC', 'test')+ const { activeCloudRun } = useValues(activeCloudRunLogic)+ const { finishedLocalRun } = useValues(finishedLocalRunLogic)++ if (activeCloudRun) {+ return <QuickstartCloudProgress activeCloudRun={activeCloudRun}>{children}</QuickstartCloudProgress>+ }+ if (syncEnabled) {+ return <QuickstartLocalProgressDetector fallback={fallback}>{children}</QuickstartLocalProgressDetector>+ }+ if (finishedLocalRun) {+ return <>{children(progressFromFinishedLocalRun(finishedLocalRun))}</>+ }+ return <>{fallback}</>+}++// The chip's leading glyph: the page signals live activity with pulsing dots (not spinners),+// so working phases reuse that idiom and terminal phases get a small static icon.+function InstallationStatusDot({ progress }: { progress: InstallationProgress }): JSX.Element {+ if (progress.phase === 'completed') {+ return <IconCheckCircle className="text-sm text-success shrink-0" />+ }+ if (progress.phase === 'error') {+ return <IconWarning className="text-sm text-danger shrink-0" />+ }+ if (progress.prMerged) {+ return <IconPullRequest className="text-sm text-purple shrink-0" />+ }+ return (+ <span className="relative flex items-center justify-center size-2 shrink-0" aria-hidden="true">+ <span className="absolute size-2 rounded-full bg-accent opacity-25 animate-pulse" />+ <span className="relative size-1.5 rounded-full bg-accent" />+ </span>+ )+}++/**+ * Wizard progress as a one-line status chip on its own row below the project token, height-matched+ * to the token chip so the two stack as one quiet family. The whole chip opens the detailed dialog.+ */+export function QuickstartInstallationProgress({ progress }: { progress: InstallationProgress }): JSX.Element {+ const { openDialog } = useActions(wizardSyncUiLogic)+ const task = currentTaskLabel(progress)+ const { completed, total } = stepCounts(progress.steps)++ return (+ <div+ className="basis-full min-w-0"+ role="status"+ aria-live="polite"+ data-attr="quickstart-installation-progress"+ >+ <button+ type="button"+ onClick={openDialog}+ className="group flex w-fit max-w-full min-w-0 cursor-pointer items-center gap-2 rounded border bg-bg-light px-3 py-2 transition-colors hover:bg-fill-highlight-50"+ data-attr="quickstart-installation-status"+ >+ <InstallationStatusDot progress={progress} />+ <span className="text-xs font-medium text-secondary whitespace-nowrap">{syncHeadline(progress)}</span>+ {task && (+ <span className="min-w-0 max-w-72 truncate text-xs text-tertiary" title={task}>+ {task}+ </span>+ )}+ {total > 0 && (+ <span className="flex shrink-0 items-center gap-2">+ <span className="flex w-16 items-center gap-0.5">+ {progress.steps.map((step) => (+ <span key={step.id} className={cn('h-1 flex-1 rounded-full', pipClass(step.status))} />+ ))}+ </span>+ <span className="text-xs text-tertiary tabular-nums">+ {completed}/{total}+ </span>+ </span>+ )}+ <span className="shrink-0 border-l pl-2 text-xs whitespace-nowrap text-tertiary group-hover:text-primary">+ View details+ </span>+ </button>+ </div>+ )+}++export function isQuickstartProductInstalling(+ productKey: ProductKey,+ installationProgress?: InstallationProgress+): boolean {+ return (+ productKey === ProductKey.PRODUCT_ANALYTICS &&+ (installationProgress?.phase === 'connecting' || installationProgress?.phase === 'running')+ )+}diff --git a/frontend/src/scenes/quickstart/productLayout.ts b/frontend/src/scenes/quickstart/productLayout.tsnew file mode 100644index 000000000000..3084a9b42aff--- /dev/null+++ b/frontend/src/scenes/quickstart/productLayout.ts@@ -0,0 +1,68 @@+import { ProductKey } from '~/queries/schema/schema-general'++export interface QuickstartProductLayoutConfig {+ featured: {+ title: string+ description: string+ productKeys: ProductKey[]+ }+ additional: {+ title: string+ description: string+ }+}++export const QUICKSTART_PRODUCT_ORDER: ProductKey[] = [+ ProductKey.PRODUCT_ANALYTICS,+ ProductKey.WEB_ANALYTICS,+ ProductKey.SESSION_REPLAY,+ ProductKey.ERROR_TRACKING,+ ProductKey.FEATURE_FLAGS,+ ProductKey.SURVEYS,+ ProductKey.EXPERIMENTS,+ ProductKey.AI_OBSERVABILITY,+ ProductKey.DATA_WAREHOUSE,+ ProductKey.WORKFLOWS,+ ProductKey.LOGS,+ ProductKey.MCP_ANALYTICS,+ ProductKey.CONVERSATIONS,+]++export const QUICKSTART_PRODUCT_LAYOUT: QuickstartProductLayoutConfig = {+ featured: {+ title: 'Your tools',+ description: 'Focus on the products that matter most to you right now.',+ productKeys: [ProductKey.PRODUCT_ANALYTICS, ProductKey.SESSION_REPLAY, ProductKey.FEATURE_FLAGS],+ },+ additional: {+ title: 'Explore more tools',+ description: 'Add another product when it becomes relevant to your work.',+ },+}++export type QuickstartFeaturedProductOverrides = Partial<Record<ProductKey, boolean>>++export function isQuickstartProductFeatured(+ productKey: ProductKey,+ overrides: QuickstartFeaturedProductOverrides+): boolean {+ return overrides[productKey] ?? QUICKSTART_PRODUCT_LAYOUT.featured.productKeys.includes(productKey)+}++export function getQuickstartProductSections<T extends { key: ProductKey }>(+ products: T[],+ overrides: QuickstartFeaturedProductOverrides+): { featuredProducts: T[]; additionalProducts: T[] } {+ const featuredProducts: T[] = []+ const additionalProducts: T[] = []++ for (const product of products) {+ if (isQuickstartProductFeatured(product.key, overrides)) {+ featuredProducts.push(product)+ } else {+ additionalProducts.push(product)+ }+ }++ return { featuredProducts, additionalProducts }+}diff --git a/frontend/src/scenes/quickstart/publications.ts b/frontend/src/scenes/quickstart/publications.tsnew file mode 100644index 000000000000..627501d4a629--- /dev/null+++ b/frontend/src/scenes/quickstart/publications.ts@@ -0,0 +1,326 @@+export interface QuickstartPublication {+ title: string+ url: string+ description: string+ publishedAt: string+ author?: string+ imageUrl?: string+}++export type PublicationFeedKey = 'blog' | 'newsletter'++export const QUICKSTART_PUBLICATIONS_PAGE_SIZE = 8+export const QUICKSTART_BLOG_URL = 'https://posthog.com/blog'+export const QUICKSTART_NEWSLETTER_URL = 'https://newsletter.posthog.com'++const BLOG_RSS_URL = 'https://posthog.com/rss.xml'+// Versioned: caches written by earlier revisions held fewer items than a full+// page and must not be served as page one of the feed+const BLOG_CACHE_KEY = 'ph-quickstart-publications-v4-blog'+const CACHE_TTL_MS = 6 * 60 * 60 * 1000+// The blog feed embeds full post bodies, so reading it whole costs several MB. Items are+// newest first: the response is streamed and more bytes are pulled only as the user scrolls+// deeper. The cap is a runaway guard sitting above the full feed size.+const MAX_FEED_CHARS = 8 * 1024 * 1024++export interface PublicationsPage {+ publications: QuickstartPublication[]+ hasMore: boolean+}++interface PublicationsCache {+ fetchedAt: number+ publications: QuickstartPublication[]+ hasMore: boolean+}++const readCache = (): PublicationsCache | null => {+ try {+ const raw = window.localStorage.getItem(BLOG_CACHE_KEY)+ if (!raw) {+ return null+ }+ const cache = JSON.parse(raw) as PublicationsCache+ if (+ !Array.isArray(cache.publications) ||+ // A short first page is only legitimate when the feed itself ended there+ (cache.publications.length < QUICKSTART_PUBLICATIONS_PAGE_SIZE && cache.hasMore !== false) ||+ Date.now() - cache.fetchedAt > CACHE_TTL_MS ||+ // A corrupted entry must fall through to a fresh fetch, not crash the render+ !cache.publications.every(+ (publication) =>+ publication && typeof publication.title === 'string' && typeof publication.url === 'string'+ )+ ) {+ return null+ }+ return cache+ } catch {+ return null+ }+}++const writeCache = (publications: QuickstartPublication[], hasMore: boolean): void => {+ try {+ window.localStorage.setItem(BLOG_CACHE_KEY, JSON.stringify({ fetchedAt: Date.now(), publications, hasMore }))+ } catch {+ // Storage unavailable or full. Caching is best-effort.+ }+}++// The feed glues the site origin onto already-absolute CDN image URLs. Only https URLs+// survive: feed (and cached-feed) content must never inject another scheme into the DOM.+const fixImageUrl = (url: string | null): string | undefined => {+ const fixed = url?.replace(/^https:\/\/posthog\.com(?=https?:\/\/)/, '')+ return fixed?.startsWith('https://') ? fixed : undefined+}++const countItems = (xml: string): number => xml.split('</item>').length - 1++const textOf = (item: Element, tag: string): string => item.getElementsByTagName(tag)[0]?.textContent?.trim() ?? ''++export function parsePublicationsRss(xml: string, limit: number): QuickstartPublication[] {+ // A partial download usually cuts off mid-item: keep only complete items and+ // re-close the document so DOMParser accepts it.+ const lastItemEnd = xml.lastIndexOf('</item>')+ if (lastItemEnd === -1) {+ return []+ }+ const doc = new DOMParser().parseFromString(+ xml.slice(0, lastItemEnd + '</item>'.length) + '</channel></rss>',+ 'text/xml'+ )+ return Array.from(doc.getElementsByTagName('item'))+ .slice(0, limit)+ .map((item) => ({+ title: textOf(item, 'title'),+ url: textOf(item, 'link'),+ description: textOf(item, 'description'),+ publishedAt: textOf(item, 'pubDate'),+ author: textOf(item, 'dc:creator') || undefined,+ imageUrl: fixImageUrl(item.getElementsByTagName('enclosure')[0]?.getAttribute('url') ?? null),+ }))+ .filter((publication) => publication.title && publication.url.startsWith('https://'))+}++/**+ * Lazily consumes the RSS response across pages: each ensureItems call reads just enough+ * additional bytes for the requested number of items, so scrolling the feed streams the+ * download instead of fetching megabytes upfront.+ */+class FeedStream {+ private reader: ReadableStreamDefaultReader<Uint8Array> | null = null+ private decoder = new TextDecoder()+ private xml = ''+ // Tracked incrementally per chunk: recounting the whole buffer on every read is+ // quadratic over a multi-MB feed+ private itemCount = 0+ private exhausted = false+ private startPromise: Promise<void> | null = null+ // Serializes readers: the initial page load and the eager scroll sentinel can+ // overlap, and interleaved reader.read() calls would corrupt both results+ private pending: Promise<unknown> = Promise.resolve()++ private async start(): Promise<void> {+ const response = await fetch(BLOG_RSS_URL)+ if (!response.ok) {+ this.exhausted = true+ throw new Error(`Failed to load the PostHog RSS feed: ${response.status}`)+ }+ if (response.body) {+ this.reader = response.body.getReader()+ } else {+ this.xml = await response.text()+ this.itemCount = countItems(this.xml)+ this.exhausted = true+ }+ }++ async ensureItems(count: number): Promise<{ xml: string; exhausted: boolean }> {+ const run = this.pending.then(() => this.readUntil(count))+ this.pending = run.catch(() => undefined)+ return await run+ }++ private async readUntil(count: number): Promise<{ xml: string; exhausted: boolean }> {+ if (!this.startPromise) {+ this.startPromise = this.start()+ }+ await this.startPromise+ while (this.reader && !this.exhausted && this.itemCount < count) {+ if (this.xml.length >= MAX_FEED_CHARS) {+ this.exhausted = true+ break+ }+ const { done, value } = await this.reader.read()+ if (done) {+ this.exhausted = true+ break+ }+ const chunk = this.decoder.decode(value, { stream: true })+ // A closing tag can straddle the chunk boundary, so scan a tag-length tail with it+ // (the tail alone is too short to ever contain a full tag, so no double count)+ const tail = this.xml.slice(-('</item>'.length - 1))+ this.itemCount += countItems(tail + chunk)+ this.xml += chunk+ }+ return { xml: this.xml, exhausted: this.exhausted }+ }+}++let feedStream: FeedStream | null = null++async function fetchBlogPage(offset: number): Promise<PublicationsPage> {+ if (offset === 0) {+ const cached = readCache()+ if (cached) {+ return { publications: cached.publications, hasMore: cached.hasMore }+ }+ }+ if (!feedStream) {+ feedStream = new FeedStream()+ }+ let xml: string+ let exhausted: boolean+ try {+ ;({ xml, exhausted } = await feedStream.ensureItems(offset + QUICKSTART_PUBLICATIONS_PAGE_SIZE))+ } catch (error) {+ // A failed stream can't be resumed. The next call starts fresh.+ feedStream = null+ throw error+ }+ const parsed = parsePublicationsRss(xml, offset + QUICKSTART_PUBLICATIONS_PAGE_SIZE)+ const publications = parsed.slice(offset)+ const hasMore = !exhausted || countItems(xml) > offset + QUICKSTART_PUBLICATIONS_PAGE_SIZE+ if (offset === 0 && publications.length > 0) {+ writeCache(publications, hasMore)+ }+ return { publications, hasMore }+}++// Substack sends no CORS headers, so the newsletter feed can't be fetched from the+// browser. Until it's proxied server-side, the rail ships with a static seed of recent+// issues served through the same paging interface as the live blog feed.+const NEWSLETTER_ISSUES: QuickstartPublication[] = [+ {+ title: 'Product for Engineers is now build mode',+ url: 'https://newsletter.posthog.com/p/product-for-engineers-is-now-build',+ description: 'Same team, same posts. New brand, new focus.',+ publishedAt: 'Mon, 13 Jul 2026 18:39:17 GMT',+ author: 'Ian Vanagas',+ imageUrl:+ 'https://substack-post-media.s3.amazonaws.com/public/images/fd61ab64-b689-4d1e-b577-eb1849b29f0f_1456x1048.png',+ },+ {+ title: 'Stop being the code review bottleneck',+ url: 'https://newsletter.posthog.com/p/code-review-tips',+ description: '4 ways to make AI code review suck less (with prompts)',+ publishedAt: 'Thu, 09 Jul 2026 19:15:14 GMT',+ author: 'Jina Yoon',+ imageUrl:+ 'https://substack-post-media.s3.amazonaws.com/public/images/1018b66a-6d94-4190-b34b-60e0072e3840_1317x988.png',+ },+ {+ title: 'We used context engineering to 5x conversion and 2x activation',+ url: 'https://newsletter.posthog.com/p/we-used-ai-to-5x-conversion-and-2x',+ description: 'The magic behind our AI onboarding wizard',+ publishedAt: 'Wed, 24 Jun 2026 20:01:49 GMT',+ author: 'Edwin Lim',+ imageUrl:+ 'https://substack-post-media.s3.amazonaws.com/public/images/8b27cd51-6130-413b-bd94-a61af1985aa9_2912x2096.jpeg',+ },+ {+ title: "Why we're bullish on loops",+ url: 'https://newsletter.posthog.com/p/why-were-bullish-on-loops',+ description: 'WTF are loops, why is everyone arguing about them, and why do they actually matter?',+ publishedAt: 'Wed, 17 Jun 2026 17:48:56 GMT',+ author: 'Ian Vanagas',+ imageUrl:+ 'https://substack-post-media.s3.amazonaws.com/public/images/67da4d23-4902-4607-9536-1440c2fb5a8c_2912x2096.jpeg',+ },+ {+ title: "LLMs are picking winners. Here's how to become one",+ url: 'https://newsletter.posthog.com/p/llms-are-picking-winners-heres-how',+ description: "A startup's guide to answer engine optimization",+ publishedAt: 'Mon, 08 Jun 2026 18:11:58 GMT',+ author: 'Natalia Amorim',+ imageUrl:+ 'https://substack-post-media.s3.amazonaws.com/public/images/540f98b0-57fc-4156-99a6-b499d4736334_1569x1048.png',+ },+ {+ title: '24 tips for giving S-tier demos',+ url: 'https://newsletter.posthog.com/p/how-to-demo',+ description: "An engineer's guide to giving S-tier project demos",+ publishedAt: 'Thu, 28 May 2026 18:01:25 GMT',+ author: 'Jina Yoon',+ imageUrl:+ 'https://substack-post-media.s3.amazonaws.com/public/images/7b486099-4af3-4730-bd94-85219da88749_1456x1048.png',+ },+ {+ title: 'The stuff nobody tells you about startup marketing',+ url: 'https://newsletter.posthog.com/p/the-stuff-nobody-tells-you-about',+ description: 'Doing weird stuff on the internet is optional but recommended',+ publishedAt: 'Wed, 06 May 2026 18:01:37 GMT',+ author: 'Charles Cook',+ imageUrl:+ 'https://substack-post-media.s3.amazonaws.com/public/images/81aa278c-cc30-4ac1-b99c-c929bb846051_2912x2096.jpeg',+ },+ {+ title: 'Great companies are built in hackathons',+ url: 'https://newsletter.posthog.com/p/great-companies-are-built-in-hackathons',+ description: "You should run more hackathons. Here's how to do them well.",+ publishedAt: 'Tue, 21 Apr 2026 18:12:27 GMT',+ author: 'Ian Vanagas',+ imageUrl:+ 'https://substack-post-media.s3.amazonaws.com/public/images/7bf0320b-e7db-4bee-9814-0a38c84bb44c_2912x2096.jpeg',+ },+ {+ title: 'The golden rules of agent-first product engineering',+ url: 'https://newsletter.posthog.com/p/the-golden-rules-of-agent-first-product',+ description: 'Five principles to develop your product intuition for agents',+ publishedAt: 'Wed, 08 Apr 2026 19:01:23 GMT',+ author: 'Jina Yoon',+ imageUrl:+ 'https://substack-post-media.s3.amazonaws.com/public/images/29ab8f16-efac-4eaa-a09c-6124ef07b6de_2912x2096.jpeg',+ },+ {+ title: 'What we wish we knew about building AI agents',+ url: 'https://newsletter.posthog.com/p/what-we-wish-we-knew-before-building',+ description: 'Lessons learned from two years of building AI agents at PostHog',+ publishedAt: 'Tue, 24 Mar 2026 18:04:41 GMT',+ author: 'Ian Vanagas',+ imageUrl:+ 'https://substack-post-media.s3.amazonaws.com/public/images/c76757e8-e900-405e-b4a2-e97823ebf2f0_1456x1048.png',+ },+ {+ title: 'WTF does a product manager do? (and why engineers should care)',+ url: 'https://newsletter.posthog.com/p/an-engineers-guide-to-product-management',+ description: 'Skills for developers from the product manager playbook',+ publishedAt: 'Wed, 11 Mar 2026 21:11:01 GMT',+ author: 'Jina Yoon',+ },+ {+ title: 'The engineeringification of everything',+ url: 'https://newsletter.posthog.com/p/the-engineeringification-of-everything',+ description: 'Why every role seems like an engineering role now (and what it means for you)',+ publishedAt: 'Mon, 23 Feb 2026 19:04:07 GMT',+ author: 'Ian Vanagas',+ imageUrl:+ 'https://substack-post-media.s3.amazonaws.com/public/images/b06de6cd-5664-4964-93ca-949d8a287664_3840x2742.png',+ },+]++function newsletterPage(offset: number): PublicationsPage {+ return {+ publications: NEWSLETTER_ISSUES.slice(offset, offset + QUICKSTART_PUBLICATIONS_PAGE_SIZE),+ hasMore: offset + QUICKSTART_PUBLICATIONS_PAGE_SIZE < NEWSLETTER_ISSUES.length,+ }+}++/** Load one page of a feed. The blog's first page may be served from the local cache. */+export async function fetchPublicationsPage(feed: PublicationFeedKey, offset: number): Promise<PublicationsPage> {+ if (feed === 'newsletter') {+ return newsletterPage(offset)+ }+ return await fetchBlogPage(offset)+}diff --git a/frontend/src/scenes/quickstart/quickstartHomepage.ts b/frontend/src/scenes/quickstart/quickstartHomepage.tsnew file mode 100644index 000000000000..acb019eec027--- /dev/null+++ b/frontend/src/scenes/quickstart/quickstartHomepage.ts@@ -0,0 +1,43 @@+import { FEATURE_FLAGS } from 'lib/constants'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import { sceneLogic } from 'scenes/sceneLogic'+import { emptySceneParams } from 'scenes/scenes'+import { Scene, SceneTab } from 'scenes/sceneTypes'+import { urls } from 'scenes/urls'++export function quickstartHomepageTab(): SceneTab {+ return {+ id: 'homepage-quickstart',+ pathname: urls.quickstart(),+ search: '',+ hash: '',+ title: 'Quickstart',+ // 'early_access_feature' renders IconRocket, matching the Quickstart nav item+ iconType: 'early_access_feature',+ sceneId: Scene.Quickstart,+ sceneKey: 'quickstart',+ sceneParams: emptySceneParams,+ }+}++/**+ * Makes Quickstart the user's default screen when they complete onboarding for the first+ * time, so the Home button lands there until they pick something else in the Configure+ * homepage modal. Users who already onboarded a product or configured a homepage keep+ * whatever they have.+ */+export function setQuickstartAsDefaultHomepageOnce(+ hasCompletedOnboardingFor: Record<string, boolean> | undefined+): void {+ if (featureFlagLogic.findMounted()?.values.featureFlags[FEATURE_FLAGS.QUICKSTART_HOMEPAGE] !== 'test') {+ return+ }+ const scene = sceneLogic.findMounted()+ if (!scene || scene.values.homepage) {+ return+ }+ if (Object.values(hasCompletedOnboardingFor ?? {}).some(Boolean)) {+ return+ }+ scene.actions.setHomepage(quickstartHomepageTab())+}diff --git a/frontend/src/scenes/quickstart/quickstartLogic.test.ts b/frontend/src/scenes/quickstart/quickstartLogic.test.tsnew file mode 100644index 000000000000..defd4bf711ae--- /dev/null+++ b/frontend/src/scenes/quickstart/quickstartLogic.test.ts@@ -0,0 +1,115 @@+import { ProductKey } from '~/queries/schema/schema-general'++import { QUICKSTART_PRODUCT_LAYOUT, getQuickstartProductSections } from './productLayout'+import {+ QuickstartJourneyStep,+ QuickstartTaskGuide,+ orderJourneyAchievements,+ shouldRedirectFromQuickstart,+} from './quickstartLogic'++const guide: QuickstartTaskGuide = {+ description: 'Test guidance',+ instructions: ['Test instruction'],+ action: 'open_product',+ actionLabel: 'Open product',+}++function journeyStep(key: string, kind: QuickstartJourneyStep['kind'], achieved: boolean): QuickstartJourneyStep {+ return { key, label: key, kind, achieved, guide }+}++describe('quickstartLogic', () => {+ describe('product sections', () => {+ const products = [+ { key: ProductKey.PRODUCT_ANALYTICS },+ { key: ProductKey.WEB_ANALYTICS },+ { key: ProductKey.SESSION_REPLAY },+ { key: ProductKey.ERROR_TRACKING },+ { key: ProductKey.FEATURE_FLAGS },+ ]++ it('uses the code-configured featured products by default', () => {+ const sections = getQuickstartProductSections(products, {})++ expect(sections.featuredProducts.map(({ key }) => key)).toEqual(+ QUICKSTART_PRODUCT_LAYOUT.featured.productKeys+ )+ expect(sections.additionalProducts.map(({ key }) => key)).toEqual([+ ProductKey.WEB_ANALYTICS,+ ProductKey.ERROR_TRACKING,+ ])+ })++ it('applies explicit promotion and demotion overrides without changing product order', () => {+ const sections = getQuickstartProductSections(products, {+ [ProductKey.SESSION_REPLAY]: false,+ [ProductKey.ERROR_TRACKING]: true,+ })++ expect(sections.featuredProducts.map(({ key }) => key)).toEqual([+ ProductKey.PRODUCT_ANALYTICS,+ ProductKey.ERROR_TRACKING,+ ProductKey.FEATURE_FLAGS,+ ])+ expect(sections.additionalProducts.map(({ key }) => key)).toEqual([+ ProductKey.WEB_ANALYTICS,+ ProductKey.SESSION_REPLAY,+ ])+ })+ })++ describe('orderJourneyAchievements', () => {+ test.each([+ {+ name: 'keeps quality pending until the tool is live',+ live: false,+ journey: [+ journeyStep('install', 'activation', true),+ journeyStep('signal', 'activation', false),+ journeyStep('quality-one', 'quality', true),+ ],+ expected: [true, false, false],+ },+ {+ name: 'treats activation as complete once live and stops quality at the first gap',+ live: true,+ journey: [+ journeyStep('install', 'activation', false),+ journeyStep('signal', 'activation', true),+ journeyStep('quality-one', 'quality', true),+ journeyStep('quality-two', 'quality', false),+ journeyStep('quality-three', 'quality', true),+ ],+ expected: [true, true, true, false, false],+ },+ {+ name: 'keeps a fully ordered live journey complete',+ live: true,+ journey: [+ journeyStep('install', 'activation', true),+ journeyStep('signal', 'activation', true),+ journeyStep('quality-one', 'quality', true),+ journeyStep('quality-two', 'quality', true),+ ],+ expected: [true, true, true, true],+ },+ ])('$name', ({ live, journey, expected }) => {+ expect(orderJourneyAchievements(journey, live).map((step) => step.achieved)).toEqual(expected)+ })+ })++ describe('shouldRedirectFromQuickstart', () => {+ test.each([+ { receivedFeatureFlags: false, variant: undefined, expected: false },+ { receivedFeatureFlags: true, variant: 'test', expected: false },+ { receivedFeatureFlags: true, variant: 'control', expected: true },+ { receivedFeatureFlags: true, variant: undefined, expected: true },+ ])(+ 'returns $expected for received=$receivedFeatureFlags and variant=$variant',+ ({ receivedFeatureFlags, variant, expected }) => {+ expect(shouldRedirectFromQuickstart(receivedFeatureFlags, variant)).toBe(expected)+ }+ )+ })+})diff --git a/frontend/src/scenes/quickstart/quickstartLogic.ts b/frontend/src/scenes/quickstart/quickstartLogic.tsnew file mode 100644index 000000000000..d2a379b7ab44--- /dev/null+++ b/frontend/src/scenes/quickstart/quickstartLogic.ts@@ -0,0 +1,1753 @@+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'+import { loaders } from 'kea-loaders'+import { router } from 'kea-router'+import posthog from 'posthog-js'++import api from 'lib/api'+import { FEATURE_FLAGS } from 'lib/constants'+import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import { addProductIntent } from 'lib/utils/product-intents'+import type { HealthIssuesResponse } from 'scenes/health/healthSceneLogic'+import type { HealthIssue } from 'scenes/health/types'+import { getFiltersFromSubTemplateId } from 'scenes/hog-functions/list/LinkedHogFunctions'+import { availableOnboardingProducts, toSentenceCase } from 'scenes/onboarding/shared/utils'+import { sceneLogic } from 'scenes/sceneLogic'+import { Scene } from 'scenes/sceneTypes'+import { teamLogic } from 'scenes/teamLogic'+import { urls } from 'scenes/urls'++import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'+import { hogql } from '~/queries/utils'+import type { CyclotronJobFiltersType, OnboardingProduct, TeamPublicType, TeamType } from '~/types'++import { ERROR_TRACKING_SUB_TEMPLATE_IDS } from 'products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/alerting/alertWizardConfig'++import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'+import type { SceneTab } from '../sceneTypes'+import { QUICKSTART_PRODUCT_ORDER, getQuickstartProductSections, isQuickstartProductFeatured } from './productLayout'+import { PublicationFeedKey, QuickstartPublication, fetchPublicationsPage } from './publications'++/** How far along the activation ladder a tool is. Quality lives past 'live', not as extra levels. */+export type QuickstartToolLevel = 'needs_setup' | 'ready' | 'live'++/** Which primary action the card should offer */+export type QuickstartToolCta = 'install' | 'enable' | 'setup' | 'open'++export type QuickstartTaskAction = 'setup' | 'enable' | 'open_product' | 'open_url' | 'docs'++export type QuickstartCompanionSetup = 'slack' | 'mcp'++export interface QuickstartTaskGuide {+ description: string+ instructions: string[]+ action: QuickstartTaskAction+ actionLabel: string+ url?: string+}++/** Event-derived counters for the last 30 days */+export interface QuickstartToolSignals {+ totalEvents: number+ prodEvents: number+ customEvents: number+ distinctCustomEvents: number+ identifyCalls: number+ exceptions: number+ serverExceptions: number+ backendEvents: number+ flagCalls: number+ prodFlagCalls: number+ pageviews: number+ prodPageviews: number+ surveyResponses: number+ aiGenerations: number+ aiTraceEvents: number+ mcpInitialize: number+ mcpToolCalls: number+}++const EMPTY_TOOL_SIGNALS: QuickstartToolSignals = {+ totalEvents: 0,+ prodEvents: 0,+ customEvents: 0,+ distinctCustomEvents: 0,+ identifyCalls: 0,+ exceptions: 0,+ serverExceptions: 0,+ backendEvents: 0,+ flagCalls: 0,+ prodFlagCalls: 0,+ pageviews: 0,+ prodPageviews: 0,+ surveyResponses: 0,+ aiGenerations: 0,+ aiTraceEvents: 0,+ mcpInitialize: 0,+ mcpToolCalls: 0,+}++/** Non-event facts: resource counts and dedicated proof-of-life checks. Null while unknown. */+export interface QuickstartResources {+ replayRecordings: number | null+ hasLogs: boolean | null+ sourcesCount: number | null+ workflowsCount: number | null+ eventTriggeredWorkflows: number | null+ symbolSetsCount: number | null+ errorAlertsCount: number | null+ ticketsCount: number | null+}++const EMPTY_RESOURCES: QuickstartResources = {+ replayRecordings: null,+ hasLogs: null,+ sourcesCount: null,+ workflowsCount: null,+ eventTriggeredWorkflows: null,+ symbolSetsCount: null,+ errorAlertsCount: null,+ ticketsCount: null,+}++// The same hog function filters the error tracking alerting scene lists: an alert exists+// when a destination matches one of the product's alert sub-templates+const ERROR_TRACKING_ALERT_FILTERS = ERROR_TRACKING_SUB_TEMPLATE_IDS.map(getFiltersFromSubTemplateId).filter(+ (filters): filters is CyclotronJobFiltersType => !!filters+)++export interface QuickstartActivationData {+ signals: QuickstartToolSignals | null+ resources: QuickstartResources+}++interface StatusContext {+ team: TeamType+ signals: QuickstartToolSignals+ resources: QuickstartResources+ healthIssues: HealthIssue[] | null+}++/**+ * One rung of a tool's ladder. Activation rungs take the tool from nothing to live;+ * quality rungs deepen the data past that. The label doubles as the card's next step.+ */+interface ToolMilestone {+ key: string+ label: string+ achieved: (ctx: StatusContext) => boolean+ applies?: (ctx: StatusContext) => boolean+ recommended?: boolean+ guide: QuickstartTaskGuide+}++export interface QuickstartJourneyStep {+ key: string+ label: string+ kind: 'activation' | 'quality'+ achieved: boolean+ recommended?: boolean+ guide: QuickstartTaskGuide+}++export interface QuickstartToolStatus {+ level: QuickstartToolLevel+ /** The full ladder, activation rungs first, shown as setup details rather than completion progress */+ journey: QuickstartJourneyStep[]+ /** The best current improvement, activation first, then quality. Null when none is suggested. */+ nextStep: QuickstartJourneyStep | null+ /** The tool's headline number, e.g. sources connected or custom events captured */+ stat: { value: number; label: string } | null+ cta: QuickstartToolCta+}++export interface QuickstartProduct {+ key: ProductKey+ name: string+ description: string+ icon: string+ iconColor: string+ /** Short audience hint rendered as "Best for …" on the card */+ bestFor: string+ status: QuickstartToolStatus+ /** Whether the setup dialog with SDK instructions applies */+ requiresEvents: boolean+ /** Where "Open" points */+ url: string+ /** Where "Set up" points when the tool has a setup flow */+ setupUrl: string+ docsUrl?: string+}++export interface QuickstartTaskGuidanceSelection {+ productKey: ProductKey+ stepKey: string+}++export interface QuickstartSelectedTask {+ product: QuickstartProduct+ step: QuickstartJourneyStep+}++interface QuickstartProductDefinition {+ bestFor: string+ docsUrl?: string+ /** Overrides the onboarding metadata copy when the quickstart card needs different framing */+ description?: string+ /** Team settings patched to turn the tool on in one click, with the predicate proving it's on */+ optInPayload?: Partial<TeamType>+ enabled?: (team: TeamType) => boolean+ /** The tool is pointless without SDK events, so its setup dialog shows install instructions */+ requiresEvents?: boolean+ /** Usable from day one with nothing configured (workflows, warehouse) — never below 'ready' */+ usableByDefault?: boolean+ /** Ordered rungs from nothing to live. The LAST rung is the proof-of-life signal. */+ activation: ToolMilestone[]+ /** Ordered rungs that deepen the data once live */+ quality: ToolMilestone[]+ stat?: (ctx: StatusContext) => { value: number; label: string } | null+}++export function orderJourneyAchievements(journey: QuickstartJourneyStep[], live: boolean): QuickstartJourneyStep[] {+ let activationBlocked = false+ let qualityBlocked = !live++ return journey.map((step) => {+ if (step.kind === 'activation') {+ const achieved = live || (!activationBlocked && step.achieved)+ activationBlocked ||= !step.achieved+ return { ...step, achieved }+ }++ const achieved = !qualityBlocked && step.achieved+ qualityBlocked ||= !step.achieved+ return { ...step, achieved }+ })+}++function deriveToolStatus(definition: QuickstartProductDefinition, ctx: StatusContext): QuickstartToolStatus {+ const signalRung = definition.activation[definition.activation.length - 1]+ const earlierRungs = definition.activation.slice(0, -1)+ // The signal always wins: real data proves the tool works even if a setup rung+ // looks incomplete (e.g. server-side exceptions without the browser opt-in)+ const live = signalRung.achieved(ctx)++ let level: QuickstartToolLevel+ if (live) {+ level = 'live'+ } else if (earlierRungs.every((rung) => rung.achieved(ctx))) {+ level = 'ready'+ } else {+ level = definition.usableByDefault ? 'ready' : 'needs_setup'+ }++ const rawJourney: QuickstartJourneyStep[] = [+ ...definition.activation.map((rung) => ({+ key: rung.key,+ label: rung.label,+ kind: 'activation' as const,+ achieved: rung.achieved(ctx),+ guide: rung.guide,+ })),+ ...definition.quality+ .filter((rung) => rung.applies?.(ctx) ?? true)+ .map((rung) => ({+ key: rung.key,+ label: rung.label,+ kind: 'quality' as const,+ achieved: rung.achieved(ctx),+ recommended: rung.recommended,+ guide: rung.guide,+ })),+ ]+ const journey = orderJourneyAchievements(rawJourney, live)+ const nextStep = live+ ? (journey.find((step) => step.kind === 'quality' && !step.achieved && step.recommended) ??+ journey.find((step) => step.kind === 'quality' && !step.achieved) ??+ null)+ : (journey.find((step) => step.kind === 'activation' && !step.achieved) ?? null)++ let cta: QuickstartToolCta+ if (definition.requiresEvents && !ctx.team.ingested_event) {+ cta = 'install'+ } else if (definition.optInPayload && definition.enabled && !definition.enabled(ctx.team)) {+ cta = 'enable'+ } else if (level === 'needs_setup') {+ cta = 'setup'+ } else {+ cta = 'open'+ }++ const stat = definition.stat?.(ctx) ?? null+ return {+ level,+ journey,+ nextStep,+ stat: stat && stat.value > 0 ? stat : null,+ cta,+ }+}++// Shared rungs. Each is a plain predicate over the context, so ladders can reuse them freely.+const installAnySdk: ToolMilestone = {+ key: 'install_sdk',+ label: 'Install a PostHog SDK',+ achieved: ({ team }) => !!team.ingested_event,+ guide: {+ description: 'Connect your app to PostHog so it can start sending data.',+ instructions: [+ 'Choose the SDK for your framework or language.',+ 'Add your project token and initialize PostHog.',+ 'Run your app and send a test event.',+ ],+ action: 'setup',+ actionLabel: 'Choose an SDK',+ },+}+const installWebSdk: ToolMilestone = {+ key: 'install_web_sdk',+ label: 'Install posthog-js on your site',+ achieved: ({ team }) => !!team.ingested_event,+ guide: {+ description: 'Add the PostHog web SDK to start capturing activity from your site.',+ instructions: [+ 'Choose your web framework.',+ 'Add the generated install snippet to your app.',+ 'Load your site and confirm an event arrives.',+ ],+ action: 'setup',+ actionLabel: 'Open web setup',+ },+}+const productionTraffic: ToolMilestone = {+ key: 'production_traffic',+ label: 'Deploy your instrumentation to production',+ achieved: ({ signals }) => signals.prodEvents > 0,+ guide: {+ description: 'Move the same PostHog setup you tested locally into your production deployment.',+ instructions: [+ 'Make your PostHog configuration available in production.',+ 'Deploy the instrumented version of your app.',+ 'Use the production app once, then return here after data arrives.',+ ],+ action: 'setup',+ actionLabel: 'Review setup',+ },+}+const firstCustomEvent: ToolMilestone = {+ key: 'first_custom_event',+ label: 'Capture your first custom event',+ achieved: ({ signals }) => signals.customEvents > 0,+ guide: {+ description: 'Track a meaningful action that is specific to your product.',+ instructions: [+ 'Pick one user action you want to measure.',+ 'Call posthog.capture with a clear event name when it happens.',+ 'Trigger the action once and confirm the event appears in PostHog.',+ ],+ action: 'docs',+ actionLabel: 'View capture guide',+ url: 'https://posthog.com/docs/product-analytics/capture-events',+ },+}++const QUICKSTART_PRODUCT_DEFINITIONS: Partial<Record<ProductKey, QuickstartProductDefinition>> = {+ [ProductKey.PRODUCT_ANALYTICS]: {+ bestFor: 'understanding user behavior',+ docsUrl: 'https://posthog.com/docs/product-analytics',+ requiresEvents: true,+ activation: [+ installAnySdk,+ {+ key: 'events',+ label: 'Capture your first event',+ achieved: ({ signals }) => signals.totalEvents > 0,+ guide: {+ description: 'Send one event from your app to confirm the SDK is connected.',+ instructions: [+ 'Open the SDK setup for your framework.',+ 'Run your app with PostHog initialized.',+ 'Interact with the app or capture a test event.',+ ],+ action: 'setup',+ actionLabel: 'Open SDK setup',+ },+ },+ ],+ quality: [+ productionTraffic,+ firstCustomEvent,+ {+ key: 'custom_breadth',+ label: 'Track 5+ distinct custom events',+ achieved: ({ signals }) => signals.distinctCustomEvents >= 5,+ guide: {+ description: 'Build a useful event vocabulary around the main actions in your product.',+ instructions: [+ 'List the key actions in your activation and retention paths.',+ 'Capture each action with a stable, descriptive event name.',+ 'Add properties that explain the context of each action.',+ ],+ action: 'docs',+ actionLabel: 'Plan your events',+ url: 'https://posthog.com/docs/product-analytics/capture-events',+ },+ },+ {+ key: 'identify',+ label: 'Identify your users to unlock person-level analysis',+ achieved: ({ signals }) => signals.identifyCalls > 0,+ guide: {+ description: 'Associate anonymous activity with the people using your product.',+ instructions: [+ 'Choose a stable unique ID from your own user database.',+ 'Call posthog.identify after the user signs in.',+ 'Include useful person properties such as plan or company.',+ ],+ action: 'docs',+ actionLabel: 'View identify guide',+ url: 'https://posthog.com/docs/product-analytics/identify',+ },+ },+ ],+ stat: ({ signals }) => ({ value: signals.distinctCustomEvents, label: 'custom events' }),+ },+ [ProductKey.WEB_ANALYTICS]: {+ bestFor: 'marketing & traffic',+ docsUrl: 'https://posthog.com/docs/web-analytics',+ requiresEvents: true,+ activation: [+ installWebSdk,+ {+ key: 'pageviews',+ label: 'Get pageviews flowing',+ achieved: ({ signals }) => signals.pageviews > 0,+ guide: {+ description: 'Confirm the web SDK is capturing visits to your site.',+ instructions: [+ 'Install posthog-js with pageview capture enabled.',+ 'Open a page in your instrumented site.',+ 'Check web analytics after the pageview arrives.',+ ],+ action: 'setup',+ actionLabel: 'Open web setup',+ },+ },+ ],+ quality: [+ {+ key: 'prod_pageviews',+ label: 'Deploy to production to see real visitors',+ achieved: ({ signals }) => signals.prodPageviews > 0,+ guide: productionTraffic.guide,+ },+ { ...firstCustomEvent, label: 'Capture custom events to measure conversions' },+ {+ key: 'authorized_urls',+ label: 'Add your web analytics domains',+ achieved: () => false,+ applies: ({ healthIssues }) => healthIssues?.some((issue) => issue.kind === 'authorized_urls') ?? false,+ recommended: true,+ guide: {+ description:+ 'Add the domains where your site runs so web analytics filters and toolbar links use the right URLs.',+ instructions: [+ 'Open Settings and select Web analytics.',+ 'Under Web analytics domains, add the full URL for each production domain.',+ 'Save your changes. This recommendation will disappear after PostHog checks the project again.',+ ],+ action: 'open_url',+ actionLabel: 'Configure domains',+ url: urls.settings('environment-web-analytics', 'web-analytics-authorized-urls'),+ },+ },+ ],+ stat: ({ signals }) => ({ value: signals.pageviews, label: 'pageviews · 30d' }),+ },+ [ProductKey.SESSION_REPLAY]: {+ bestFor: 'debugging UX issues',+ docsUrl: 'https://posthog.com/docs/session-replay',+ requiresEvents: true,+ // Same payload the replay onboarding step applies+ optInPayload: {+ session_recording_opt_in: true,+ capture_console_log_opt_in: true,+ capture_performance_opt_in: true,+ },+ enabled: (team) => !!team.session_recording_opt_in,+ activation: [+ installWebSdk,+ {+ key: 'opt_in',+ label: 'Turn on session recordings',+ achieved: ({ team }) => !!team.session_recording_opt_in,+ guide: {+ description: 'Enable recording, console logs, and performance capture for this project.',+ instructions: [+ 'Turn on session replay for the project.',+ 'Open your instrumented app in a new session.',+ 'Use the app for a minute so PostHog can create a recording.',+ ],+ action: 'enable',+ actionLabel: 'Enable session replay',+ },+ },+ {+ key: 'recordings',+ label: 'Record your first session',+ achieved: ({ resources }) => (resources.replayRecordings ?? 0) > 0,+ guide: {+ description: 'Generate a real session so you can verify replay quality.',+ instructions: [+ 'Open your instrumented app in a fresh browser session.',+ 'Navigate through a few screens and interact with the UI.',+ 'Wait for the session to end, then open session replay.',+ ],+ action: 'open_product',+ actionLabel: 'Open session replay',+ },+ },+ ],+ quality: [+ {+ key: 'console_logs',+ label: 'Capture console logs with recordings',+ achieved: ({ team }) => !!team.capture_console_log_opt_in,+ guide: {+ description: 'Include browser console output to add debugging context to replays.',+ instructions: [+ 'Enable console log capture for session replay.',+ 'Start a new recorded session.',+ 'Open the replay and inspect the console panel.',+ ],+ action: 'enable',+ actionLabel: 'Enable console logs',+ },+ },+ {+ key: 'performance',+ label: 'Capture network performance with recordings',+ achieved: ({ team }) => !!team.capture_performance_opt_in,+ guide: {+ description: 'Include network timing so slow requests are visible beside the replay.',+ instructions: [+ 'Enable performance capture for session replay.',+ 'Start a new recorded session.',+ 'Open the replay and inspect network activity.',+ ],+ action: 'enable',+ actionLabel: 'Enable performance capture',+ },+ },+ productionTraffic,+ ],+ stat: ({ resources }) => ({ value: resources.replayRecordings ?? 0, label: 'recordings · 30d' }),+ },+ [ProductKey.ERROR_TRACKING]: {+ bestFor: 'catching bugs early',+ docsUrl: 'https://posthog.com/docs/error-tracking',+ requiresEvents: true,+ // Browser autocapture only: server SDKs capture exceptions without this opt-in+ optInPayload: { autocapture_exceptions_opt_in: true },+ enabled: (team) => !!team.autocapture_exceptions_opt_in,+ activation: [+ installAnySdk,+ {+ key: 'exceptions',+ label: 'Capture your first exception',+ achieved: ({ signals }) => signals.exceptions > 0,+ guide: {+ description: 'Send one handled or unhandled exception to verify error tracking.',+ instructions: [+ 'Open the setup instructions for your SDK.',+ 'Enable exception capture or send a test exception.',+ 'Open error tracking after the exception arrives.',+ ],+ action: 'setup',+ actionLabel: 'Open error setup',+ },+ },+ ],+ quality: [+ {+ key: 'web_autocapture',+ label: 'Turn on exception autocapture for the web',+ achieved: ({ team }) => !!team.autocapture_exceptions_opt_in,+ guide: {+ description: 'Automatically capture unhandled browser errors and promise rejections.',+ instructions: [+ 'Enable exception autocapture for the project.',+ 'Deploy the setting with your web SDK.',+ 'Trigger a safe test error and verify it appears.',+ ],+ action: 'enable',+ actionLabel: 'Enable autocapture',+ },+ },+ {+ key: 'server_exceptions',+ label: 'Capture exceptions from a server SDK too',+ achieved: ({ signals }) => signals.serverExceptions > 0,+ guide: {+ description: 'Add backend exceptions so errors can be traced across your stack.',+ instructions: [+ 'Choose the SDK for your backend language.',+ 'Configure exception capture in the server process.',+ 'Send a safe test exception from a non-production request.',+ ],+ action: 'setup',+ actionLabel: 'Choose a server SDK',+ },+ },+ {+ key: 'source_maps',+ label: 'Upload source maps for readable stack traces',+ achieved: ({ resources }) => (resources.symbolSetsCount ?? 0) > 0,+ guide: {+ description:+ 'Upload source maps during deployment so minified browser stacks resolve to your source code.',+ instructions: [+ 'Generate source maps in your production build.',+ 'Upload them with the PostHog CLI during deployment.',+ 'Verify a new exception shows readable file names and lines.',+ ],+ action: 'docs',+ actionLabel: 'View source map guide',+ url: 'https://posthog.com/docs/error-tracking/upload-source-maps',+ },+ },+ {+ key: 'alert',+ label: 'Set up an alert for new exceptions',+ achieved: ({ resources }) => (resources.errorAlertsCount ?? 0) > 0,+ guide: {+ description: 'Notify your team when an important new exception appears.',+ instructions: [+ 'Open error tracking and choose an alert destination.',+ 'Select which new or recurring exceptions should notify you.',+ 'Send a test notification before saving the alert.',+ ],+ action: 'open_product',+ actionLabel: 'Open error tracking',+ },+ },+ productionTraffic,+ ],+ stat: ({ signals }) => ({ value: signals.exceptions, label: 'exceptions · 30d' }),+ },+ [ProductKey.FEATURE_FLAGS]: {+ bestFor: 'safe rollouts',+ docsUrl: 'https://posthog.com/docs/feature-flags',+ requiresEvents: true,+ activation: [+ installAnySdk,+ {+ key: 'flag_called',+ label: 'Create a flag and call it from your code',+ achieved: ({ signals }) => signals.flagCalls > 0,+ guide: {+ description: 'Create a feature flag, add its key to your app, and evaluate it once.',+ instructions: [+ 'Create a flag and choose its initial rollout conditions.',+ 'Copy the generated code for your SDK.',+ 'Run the code once and confirm the evaluation appears.',+ ],+ action: 'open_product',+ actionLabel: 'Create a feature flag',+ },+ },+ ],+ quality: [+ {+ key: 'prod_flag_calls',+ label: 'Evaluate flags in production',+ achieved: ({ signals }) => signals.prodFlagCalls > 0,+ guide: {+ description: 'Deploy your flag evaluation so real users can enter the rollout.',+ instructions: [+ 'Add the flag check to the production code path.',+ 'Deploy the change with the same project configuration.',+ 'Confirm production evaluations appear in PostHog.',+ ],+ action: 'docs',+ actionLabel: 'View implementation guide',+ url: 'https://posthog.com/docs/feature-flags/installation',+ },+ },+ ],+ stat: ({ signals }) => ({ value: signals.flagCalls, label: 'flag calls · 30d' }),+ },+ [ProductKey.SURVEYS]: {+ bestFor: 'user feedback',+ docsUrl: 'https://posthog.com/docs/surveys',+ requiresEvents: true,+ optInPayload: { surveys_opt_in: true },+ enabled: (team) => !!team.surveys_opt_in,+ activation: [+ installWebSdk,+ {+ key: 'opt_in',+ label: 'Turn on surveys',+ achieved: ({ team }) => !!team.surveys_opt_in,+ guide: {+ description: 'Enable surveys for the project so they can be shown in your app.',+ instructions: [+ 'Turn on surveys for this project.',+ 'Confirm the web SDK is installed.',+ 'Create a survey and preview it before launch.',+ ],+ action: 'enable',+ actionLabel: 'Enable surveys',+ },+ },+ {+ key: 'responses',+ label: 'Launch a survey and collect your first response',+ achieved: ({ signals }) => signals.surveyResponses > 0,+ guide: {+ description: 'Publish a focused survey and collect one real response.',+ instructions: [+ 'Create a survey with one clear question.',+ 'Choose who should see it and publish it.',+ 'Answer it once in your instrumented app to verify the flow.',+ ],+ action: 'open_product',+ actionLabel: 'Create a survey',+ },+ },+ ],+ quality: [{ ...productionTraffic, label: 'Collect responses from production traffic' }],+ stat: ({ signals }) => ({ value: signals.surveyResponses, label: 'responses · 30d' }),+ },+ [ProductKey.EXPERIMENTS]: {+ bestFor: 'A/B testing',+ docsUrl: 'https://posthog.com/docs/experiments',+ requiresEvents: true,+ activation: [+ installAnySdk,+ // Experiments require a feature flag: exposure rides on flag evaluations+ {+ key: 'flag_called',+ label: 'Call a feature flag from your code',+ achieved: ({ signals }) => signals.flagCalls > 0,+ guide: {+ description: 'Use the experiment flag in your app so PostHog can assign variants.',+ instructions: [+ 'Create or open an experiment and copy its feature flag key.',+ 'Evaluate the flag where the tested experience is rendered.',+ 'Run the code once and verify an exposure is captured.',+ ],+ action: 'open_product',+ actionLabel: 'Open experiments',+ },+ },+ ],+ quality: [+ { ...firstCustomEvent, label: 'Track your goal metric with a custom event' },+ {+ key: 'prod_flag_calls',+ label: 'Run experiments on production traffic',+ achieved: ({ signals }) => signals.prodFlagCalls > 0,+ guide: {+ description: 'Ship the experiment code path so real users can be assigned to variants.',+ instructions: [+ 'Confirm the experiment flag controls the intended experience.',+ 'Deploy the change to production.',+ 'Check that exposures and goal events arrive before interpreting results.',+ ],+ action: 'open_product',+ actionLabel: 'Open experiments',+ },+ },+ ],+ },+ [ProductKey.AI_OBSERVABILITY]: {+ bestFor: 'LLM-powered apps',+ docsUrl: 'https://posthog.com/docs/llm-analytics',+ activation: [+ {+ key: 'server_sdk',+ label: 'Install a server SDK',+ achieved: ({ signals }) => signals.backendEvents > 0,+ guide: {+ description: 'Install PostHog in the service that makes your LLM calls.',+ instructions: [+ 'Choose the SDK for your backend language.',+ 'Initialize it with your project token.',+ 'Run the service and confirm it can send an event.',+ ],+ action: 'setup',+ actionLabel: 'Choose a server SDK',+ },+ },+ {+ key: 'ai_events',+ label: 'Wrap your LLM calls to capture generations',+ achieved: ({ signals }) => signals.aiGenerations + signals.aiTraceEvents > 0,+ guide: {+ description:+ 'Instrument the LLM call so prompts, responses, latency, and cost are captured together.',+ instructions: [+ 'Open the setup for your model provider and SDK.',+ 'Wrap the LLM client or capture a generation explicitly.',+ 'Make one test request and inspect the generation in PostHog.',+ ],+ action: 'setup',+ actionLabel: 'Open LLM setup',+ },+ },+ ],+ quality: [+ {+ key: 'traces',+ label: 'Capture full traces, not just generations',+ achieved: ({ signals }) => signals.aiTraceEvents > 0,+ guide: {+ description:+ 'Group generations and application work into traces so the full request can be debugged.',+ instructions: [+ 'Start a trace when the AI request enters your app.',+ 'Attach generations and spans to the same trace ID.',+ 'End the trace after the user-visible response is ready.',+ ],+ action: 'docs',+ actionLabel: 'View tracing guide',+ url: 'https://posthog.com/docs/llm-analytics',+ },+ },+ ],+ stat: ({ signals }) => ({+ value: signals.aiGenerations + signals.aiTraceEvents,+ label: 'AI events · 30d',+ }),+ },+ [ProductKey.DATA_WAREHOUSE]: {+ bestFor: 'joining external data',+ docsUrl: 'https://posthog.com/docs/data-warehouse',+ usableByDefault: true,+ activation: [+ {+ key: 'first_source',+ label: 'Connect your first source',+ achieved: ({ resources }) => (resources.sourcesCount ?? 0) > 0,+ guide: {+ description: 'Connect a database or SaaS source so its data is available in PostHog.',+ instructions: [+ 'Choose the source you want to connect.',+ 'Enter credentials with the narrowest required permissions.',+ 'Select the tables and start the first sync.',+ ],+ action: 'open_product',+ actionLabel: 'Connect a source',+ },+ },+ ],+ quality: [+ {+ key: 'second_source',+ label: 'Connect a second source to join across systems',+ achieved: ({ resources }) => (resources.sourcesCount ?? 0) >= 2,+ guide: {+ description: 'Add another source so product activity can be joined with business data.',+ instructions: [+ 'Choose a source that adds useful context to your product data.',+ 'Connect it with read-only credentials where possible.',+ 'Create a model or query that joins the two systems.',+ ],+ action: 'open_product',+ actionLabel: 'Connect another source',+ },+ },+ ],+ stat: ({ resources }) => ({ value: resources.sourcesCount ?? 0, label: 'sources connected' }),+ },+ [ProductKey.WORKFLOWS]: {+ bestFor: 'automations & messaging',+ description: 'Automate messages and actions. No install needed, though it works best with events flowing.',+ usableByDefault: true,+ activation: [+ {+ key: 'first_workflow',+ label: 'Create your first workflow',+ achieved: ({ resources }) => (resources.workflowsCount ?? 0) > 0,+ guide: {+ description: 'Automate one useful message or action from a product signal.',+ instructions: [+ 'Choose a workflow template or start from scratch.',+ 'Add a trigger and the action it should run.',+ 'Test the workflow before turning it on.',+ ],+ action: 'open_product',+ actionLabel: 'Create a workflow',+ },+ },+ ],+ quality: [+ {+ key: 'event_trigger',+ label: 'Trigger a workflow from an event',+ achieved: ({ resources }) => (resources.eventTriggeredWorkflows ?? 0) > 0,+ guide: {+ description: 'Start a workflow when a meaningful event happens in your product.',+ instructions: [+ 'Open a workflow and add an event trigger.',+ 'Choose the event and any property filters.',+ 'Trigger the event once and inspect the test run.',+ ],+ action: 'open_product',+ actionLabel: 'Open workflows',+ },+ },+ { ...firstCustomEvent, label: 'Capture custom events for smarter triggers' },+ ],+ stat: ({ resources }) => ({ value: resources.workflowsCount ?? 0, label: 'workflows' }),+ },+ [ProductKey.LOGS]: {+ bestFor: 'backend debugging',+ docsUrl: 'https://posthog.com/docs/logs',+ activation: [+ {+ key: 'logs_flowing',+ label: 'Point your OpenTelemetry logs at PostHog',+ achieved: ({ resources }) => resources.hasLogs === true,+ guide: {+ description: 'Send OpenTelemetry logs from your service to the PostHog ingestion endpoint.',+ instructions: [+ 'Choose your OpenTelemetry collector or SDK.',+ 'Configure the PostHog logs endpoint and authentication.',+ 'Emit a test log and confirm it appears in the logs explorer.',+ ],+ action: 'setup',+ actionLabel: 'Open logs setup',+ },+ },+ ],+ quality: [],+ },+ [ProductKey.MCP_ANALYTICS]: {+ bestFor: 'MCP server owners',+ activation: [+ {+ key: 'instrumented',+ label: 'Instrument your MCP server',+ achieved: ({ signals }) => signals.mcpInitialize > 0 || signals.mcpToolCalls > 0,+ guide: {+ description:+ 'Add PostHog instrumentation to your MCP server so sessions and tool calls can be analyzed.',+ instructions: [+ 'Open the MCP analytics setup guide.',+ 'Add instrumentation around server initialization and tool execution.',+ 'Connect a client once and confirm the session appears.',+ ],+ action: 'setup',+ actionLabel: 'Open MCP setup',+ },+ },+ {+ key: 'tool_calls',+ label: 'See real tool calls come in',+ achieved: ({ signals }) => signals.mcpToolCalls > 0,+ guide: {+ description: 'Run a real MCP tool through an instrumented client connection.',+ instructions: [+ 'Connect your MCP server to a client.',+ 'Ask the client to invoke one of your tools.',+ 'Open MCP analytics and inspect the captured call.',+ ],+ action: 'open_product',+ actionLabel: 'Open MCP analytics',+ },+ },+ ],+ quality: [+ {+ // The product's own dashboard graduates to its metrics view around this volume+ key: 'volume',+ label: 'Reach 300 tool calls to unlock usage metrics',+ achieved: ({ signals }) => signals.mcpToolCalls >= 300,+ guide: {+ description:+ 'Keep real traffic instrumented until there is enough usage to show stable tool-level patterns.',+ instructions: [+ 'Verify all production tool calls use the instrumented path.',+ 'Use MCP analytics to watch call volume grow.',+ 'Review usage metrics after enough real calls have arrived.',+ ],+ action: 'open_product',+ actionLabel: 'View tool calls',+ },+ },+ ],+ stat: ({ signals }) => ({ value: signals.mcpToolCalls, label: 'tool calls · 30d' }),+ },+ [ProductKey.CONVERSATIONS]: {+ bestFor: 'customer support',+ // Admin-gated team field: the enable listener explains the permission on a 403+ optInPayload: { conversations_enabled: true },+ enabled: (team) => !!team.conversations_enabled,+ activation: [+ {+ key: 'enabled',+ label: 'Turn on Support',+ achieved: ({ team }) => !!team.conversations_enabled,+ guide: {+ description: 'Enable Support for this project so your team can receive and manage tickets.',+ instructions: [+ 'Turn on Support for the project.',+ 'Open the inbox and choose a channel to connect.',+ 'Send a test message through the connected channel.',+ ],+ action: 'enable',+ actionLabel: 'Enable Support',+ },+ },+ {+ key: 'first_ticket',+ label: 'Connect a channel and receive your first ticket',+ achieved: ({ resources }) => (resources.ticketsCount ?? 0) > 0,+ guide: {+ description: 'Connect a customer channel and verify the first conversation reaches your inbox.',+ instructions: [+ 'Open Support and connect a channel.',+ 'Complete the channel-specific installation.',+ 'Send a test message and confirm a ticket is created.',+ ],+ action: 'open_product',+ actionLabel: 'Open Support',+ },+ },+ ],+ quality: [],+ stat: ({ resources }) => ({ value: resources.ticketsCount ?? 0, label: 'tickets' }),+ },+}++const isFullTeam = (team: TeamType | TeamPublicType | null): team is TeamType =>+ !!team && 'has_completed_onboarding_for' in team++// The scene is many users' homepage, so it can remount on every "Home" click. The signals+// query aggregates 30 days of events — too expensive to re-run per mount, and statuses+// don't need to be fresher than a few minutes.+const ACTIVATION_DATA_CACHE_TTL_MS = 5 * 60 * 1000+let activationDataCache: { teamId: number; fetchedAt: number; data: QuickstartActivationData } | null = null++/** The cache outlives logic mounts by design; stories and tests switching mock data must drop it. */+export function clearQuickstartActivationCache(): void {+ activationDataCache = null+}++function buildProduct(key: ProductKey, ctx: StatusContext): QuickstartProduct | null {+ const definition = QUICKSTART_PRODUCT_DEFINITIONS[key]+ const meta = (availableOnboardingProducts as Partial<Record<ProductKey, OnboardingProduct>>)[key]+ if (!definition || !meta) {+ return null+ }+ return {+ key,+ name: toSentenceCase(meta.name),+ description: definition.description ?? meta.userCentricDescription ?? meta.description,+ icon: meta.icon,+ iconColor: meta.iconColor,+ bestFor: definition.bestFor,+ status: deriveToolStatus(definition, ctx),+ requiresEvents: !!definition.requiresEvents,+ url: meta.url,+ setupUrl: urls.onboarding({ productKey: key }),+ docsUrl: definition.docsUrl,+ }+}++export function getQuickstartTrackingProperties(+ team: TeamType,+ products: QuickstartProduct[]+): Record<string, unknown> {+ const onboardedProducts = Object.entries(team.has_completed_onboarding_for ?? {})+ .filter(([, completed]) => completed)+ .map(([productKey]) => productKey)+ const liveProducts = products.filter((product) => product.status.level === 'live').map((product) => product.key)+ const isPostOnboarding = team.completed_snippet_onboarding || onboardedProducts.length > 0++ return {+ is_post_onboarding: isPostOnboarding,+ has_ingested_event: team.ingested_event,+ onboarded_products: onboardedProducts,+ live_products: liveProducts,+ live_product_count: liveProducts.length,+ }+}++export function shouldRedirectFromQuickstart(+ receivedFeatureFlags: boolean,+ quickstartVariant: string | boolean | undefined+): boolean {+ return receivedFeatureFlags && quickstartVariant !== 'test'+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface quickstartLogicValues {+ featureFlags: FeatureFlagsSet // featureFlagLogic+ receivedFeatureFlags: boolean // featureFlagLogic+ homepage: SceneTab | null // sceneLogic+ currentTeam: TeamPublicType | TeamType | null // teamLogic+ activationData: QuickstartActivationData+ activationDataLoading: boolean+ activeProductCount: number+ additionalProducts: QuickstartProduct[]+ blogPublications: QuickstartPublication[]+ blogPublicationsLoading: boolean+ companionSetup: QuickstartCompanionSetup | null+ enablingProducts: Record<string, boolean>+ featuredProductOverrides: Partial<Record<ProductKey, boolean>>+ featuredProducts: QuickstartProduct[]+ hasIngestedEvent: boolean+ healthIssues: HealthIssue[] | null+ healthIssuesLoading: boolean+ newsletterPublications: QuickstartPublication[]+ newsletterPublicationsLoading: boolean+ products: QuickstartProduct[]+ publicationsHasMore: Record<PublicationFeedKey, boolean>+ selectedTask: QuickstartSelectedTask | null+ setupModalProduct: QuickstartProduct | null+ setupModalProductKey: ProductKey | null+ taskGuidanceSelection: QuickstartTaskGuidanceSelection | null+ totalProductCount: number+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface quickstartLogicActions {+ setFeatureFlags: (+ flags: string[],+ variants: Record<string, boolean | string>+ ) => {+ flags: string[]+ variants: Record<string, boolean | string>+ } // featureFlagLogic+ setHomepage: (tab: SceneTab | null) => {+ tab: SceneTab | null+ } // sceneLogic+ closeCompanionSetup: () => {+ value: true+ }+ closeTaskGuidance: () => {+ value: true+ }+ closeToolSetupModal: () => {+ value: true+ }+ enableProduct: (productKey: ProductKey) => {+ productKey: ProductKey+ }+ loadActivationData: () => any+ loadActivationDataFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadActivationDataSuccess: (+ activationData: QuickstartActivationData,+ payload?: any+ ) => {+ activationData: QuickstartActivationData+ payload?: any+ }+ loadBlogPublications: () => any+ loadBlogPublicationsFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadBlogPublicationsSuccess: (+ blogPublications: QuickstartPublication[],+ payload?: any+ ) => {+ blogPublications: QuickstartPublication[]+ payload?: any+ }+ loadHealthIssues: () => any+ loadHealthIssuesFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadHealthIssuesSuccess: (+ healthIssues: HealthIssue[] | null,+ payload?: any+ ) => {+ healthIssues: HealthIssue[] | null+ payload?: any+ }+ loadMoreBlogPublications: () => any+ loadMoreBlogPublicationsFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadMoreBlogPublicationsSuccess: (+ blogPublications: QuickstartPublication[],+ payload?: any+ ) => {+ blogPublications: QuickstartPublication[]+ payload?: any+ }+ loadMoreNewsletterPublications: () => any+ loadMoreNewsletterPublicationsFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadMoreNewsletterPublicationsSuccess: (+ newsletterPublications: QuickstartPublication[],+ payload?: any+ ) => {+ newsletterPublications: QuickstartPublication[]+ payload?: any+ }+ loadNewsletterPublications: () => any+ loadNewsletterPublicationsFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadNewsletterPublicationsSuccess: (+ newsletterPublications: QuickstartPublication[],+ payload?: any+ ) => {+ newsletterPublications: QuickstartPublication[]+ payload?: any+ }+ openCompanionSetup: (companion: QuickstartCompanionSetup) => {+ companion: QuickstartCompanionSetup+ }+ openTaskGuidance: (+ productKey: ProductKey,+ stepKey: string+ ) => {+ productKey: ProductKey+ stepKey: string+ }+ openToolSetupModal: (productKey: ProductKey) => {+ productKey: ProductKey+ }+ productEnableFinished: (productKey: ProductKey) => {+ productKey: ProductKey+ }+ redirectIfUnavailable: () => {+ value: true+ }+ setProductFeatured: (+ productKey: ProductKey,+ featured: boolean+ ) => {+ featured: boolean+ productKey: ProductKey+ }+ setPublicationsHasMore: (+ feed: PublicationFeedKey,+ hasMore: boolean+ ) => {+ feed: PublicationFeedKey+ hasMore: boolean+ }+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface quickstartLogicMeta {+ __keaTypeGenInternalSelectorTypes: {+ hasIngestedEvent: (currentTeam: TeamPublicType | TeamType | null) => boolean+ products: (+ currentTeam: TeamPublicType | TeamType | null,+ activationData: QuickstartActivationData,+ healthIssues: HealthIssue[] | null+ ) => QuickstartProduct[]+ featuredProducts: (+ products: QuickstartProduct[],+ featuredProductOverrides: Partial<Record<ProductKey, boolean>>+ ) => QuickstartProduct[]+ additionalProducts: (+ products: QuickstartProduct[],+ featuredProductOverrides: Partial<Record<ProductKey, boolean>>+ ) => QuickstartProduct[]+ activeProductCount: (products: QuickstartProduct[]) => number+ totalProductCount: (products: QuickstartProduct[]) => number+ setupModalProduct: (+ setupModalProductKey: ProductKey | null,+ products: QuickstartProduct[]+ ) => QuickstartProduct | null+ selectedTask: (+ taskGuidanceSelection: QuickstartTaskGuidanceSelection | null,+ products: QuickstartProduct[]+ ) => QuickstartSelectedTask | null+ }+}++export type quickstartLogicType = MakeLogicType<+ quickstartLogicValues,+ quickstartLogicActions,+ Record<string, any>,+ quickstartLogicMeta+>++export const quickstartLogic = kea<quickstartLogicType>([+ path(['scenes', 'quickstart', 'quickstartLogic']),+ connect(() => ({+ values: [+ teamLogic,+ ['currentTeam'],+ featureFlagLogic,+ ['featureFlags', 'receivedFeatureFlags'],+ sceneLogic,+ ['homepage'],+ ],+ actions: [featureFlagLogic, ['setFeatureFlags'], sceneLogic, ['setHomepage']],+ })),+ actions({+ redirectIfUnavailable: true,+ setProductFeatured: (productKey: ProductKey, featured: boolean) => ({ productKey, featured }),+ enableProduct: (productKey: ProductKey) => ({ productKey }),+ productEnableFinished: (productKey: ProductKey) => ({ productKey }),+ openToolSetupModal: (productKey: ProductKey) => ({ productKey }),+ closeToolSetupModal: true,+ openTaskGuidance: (productKey: ProductKey, stepKey: string) => ({ productKey, stepKey }),+ closeTaskGuidance: true,+ openCompanionSetup: (companion: QuickstartCompanionSetup) => ({ companion }),+ closeCompanionSetup: true,+ setPublicationsHasMore: (feed: PublicationFeedKey, hasMore: boolean) => ({ feed, hasMore }),+ }),+ loaders(({ actions, values }) => {+ // Swallow errors: without data the rail simply doesn't render, and a feed+ // hiccup must never toast at a brand-new user.+ const loadFeedPage = async (+ feed: PublicationFeedKey,+ current: QuickstartPublication[]+ ): Promise<QuickstartPublication[]> => {+ if (current.length > 0 && !values.publicationsHasMore[feed]) {+ return current+ }+ try {+ const page = await fetchPublicationsPage(feed, current.length)+ actions.setPublicationsHasMore(feed, page.hasMore)+ if (current.length === 0) {+ return page.publications+ }+ // The feed can shift between pages (a new post lands), so drop+ // anything already shown instead of rendering duplicate cards+ const seen = new Set(current.map((publication) => publication.url))+ const merged = [...current, ...page.publications.filter((publication) => !seen.has(publication.url))]+ posthog.capture('quickstart publications loaded more', { feed, total: merged.length })+ return merged+ } catch {+ actions.setPublicationsHasMore(feed, false)+ return current+ }+ }+ return {+ activationData: [+ { signals: null, resources: EMPTY_RESOURCES } as QuickstartActivationData,+ {+ // Every sub-fetch is best-effort: a failure leaves its facts null and the+ // affected rungs simply read as unachieved+ loadActivationData: async (): Promise<QuickstartActivationData> => {+ const teamId = values.currentTeam?.id+ const cached = activationDataCache+ if (+ teamId &&+ cached &&+ cached.teamId === teamId &&+ Date.now() - cached.fetchedAt < ACTIVATION_DATA_CACHE_TTL_MS+ ) {+ return cached.data+ }++ const queryTags = { scene: 'Quickstart', productKey: 'platform_and_support' } as const+ // Approximates posthog/models/team/production_event_activation.py: hostless+ // events count as production only when they come from a server SDK, and+ // dev hosts include tunnels and reserved TLDs, not just localhost+ const signalsQuery = hogql`+ SELECT+ count() AS total_events,+ countIf(is_prod) AS prod_events,+ countIf(is_custom) AS custom_events,+ uniqIf(event, is_custom) AS distinct_custom_events,+ countIf(event = '$identify') AS identify_calls,+ countIf(event = '$exception') AS exceptions,+ countIf(event = '$exception' AND is_backend) AS server_exceptions,+ countIf(is_backend) AS backend_events,+ countIf(event = '$feature_flag_called') AS flag_calls,+ countIf(event = '$feature_flag_called' AND is_prod) AS prod_flag_calls,+ countIf(event = '$pageview') AS pageviews,+ countIf(event = '$pageview' AND is_prod) AS prod_pageviews,+ countIf(event = 'survey sent') AS survey_responses,+ countIf(event = '$ai_generation') AS ai_generations,+ countIf(event IN ('$ai_trace', '$ai_span', '$ai_embedding')) AS ai_trace_events,+ countIf(event = '$mcp_initialize') AS mcp_initialize,+ countIf(event = '$mcp_tool_call') AS mcp_tool_calls+ FROM (+ SELECT+ event,+ properties.$lib IN ('posthog-node', 'posthog-python', 'posthog-go', 'posthog-ruby', 'posthog-php', 'posthog-java', 'posthog-dotnet', 'posthog-elixir', 'posthog-rs') AS is_backend,+ event NOT LIKE '$%' AND event NOT IN ('survey sent', 'survey shown', 'survey dismissed') AS is_custom,+ if(+ properties.$host IS NULL,+ properties.$lib IN ('posthog-node', 'posthog-python', 'posthog-go', 'posthog-ruby', 'posthog-php', 'posthog-java', 'posthog-dotnet', 'posthog-elixir', 'posthog-rs'),+ NOT (+ properties.$host LIKE 'localhost%'+ OR properties.$host LIKE '127.0.0.1%'+ OR properties.$host LIKE '0.0.0.0%'+ OR properties.$host LIKE '192.168.%'+ OR properties.$host LIKE '%.local'+ OR properties.$host LIKE '%.local:%'+ OR properties.$host LIKE '%.test'+ OR properties.$host LIKE '%.test:%'+ OR properties.$host LIKE '%.internal'+ OR properties.$host LIKE '%.internal:%'+ OR properties.$host LIKE '%.example'+ OR properties.$host LIKE '%.example:%'+ OR properties.$host LIKE '%.ngrok%'+ OR properties.$host LIKE '%.nip.io%'+ OR properties.$host LIKE '%.ts.net%'+ OR properties.$host LIKE '%.trycloudflare.com%'+ OR properties.$host LIKE '%.loca.lt%'+ )+ ) AS is_prod+ FROM events+ WHERE timestamp >= now() - INTERVAL 30 DAY AND timestamp <= now()+ )`+ const replayQuery = hogql`+ SELECT count(DISTINCT session_id)+ FROM raw_session_replay_events+ WHERE min_first_timestamp >= now() - INTERVAL 30 DAY`++ const [+ signalsResult,+ replayResult,+ hasLogsResult,+ sourcesResult,+ flowsResult,+ symbolSetsResult,+ alertsResult,+ ticketsResult,+ ] = await Promise.allSettled([+ api.queryHogQL(signalsQuery, queryTags),+ api.queryHogQL(replayQuery, queryTags),+ api.logs.hasLogs(),+ api.externalDataSources.list(),+ api.hogFlows.getHogFlows(),+ api.errorTracking.symbolSets.list({ offset: 0, limit: 1 }),+ api.hogFunctions.list({+ types: ['destination'],+ filter_groups: ERROR_TRACKING_ALERT_FILTERS,+ limit: 1,+ }),+ api.conversationsTickets.list({ limit: 1 }),+ ])++ let signals: QuickstartToolSignals | null = null+ if (signalsResult.status === 'fulfilled') {+ const row = signalsResult.value.results?.[0]+ if (row) {+ signals = {+ totalEvents: Number(row[0]) || 0,+ prodEvents: Number(row[1]) || 0,+ customEvents: Number(row[2]) || 0,+ distinctCustomEvents: Number(row[3]) || 0,+ identifyCalls: Number(row[4]) || 0,+ exceptions: Number(row[5]) || 0,+ serverExceptions: Number(row[6]) || 0,+ backendEvents: Number(row[7]) || 0,+ flagCalls: Number(row[8]) || 0,+ prodFlagCalls: Number(row[9]) || 0,+ pageviews: Number(row[10]) || 0,+ prodPageviews: Number(row[11]) || 0,+ surveyResponses: Number(row[12]) || 0,+ aiGenerations: Number(row[13]) || 0,+ aiTraceEvents: Number(row[14]) || 0,+ mcpInitialize: Number(row[15]) || 0,+ mcpToolCalls: Number(row[16]) || 0,+ }+ }+ }++ const workflows = flowsResult.status === 'fulfilled' ? flowsResult.value.results : null+ const activeWorkflows = workflows?.filter((flow) => flow.status !== 'archived') ?? null+ const resources: QuickstartResources = {+ replayRecordings:+ replayResult.status === 'fulfilled'+ ? Number(replayResult.value.results?.[0]?.[0]) || 0+ : null,+ hasLogs: hasLogsResult.status === 'fulfilled' ? hasLogsResult.value : null,+ sourcesCount:+ sourcesResult.status === 'fulfilled'+ ? (sourcesResult.value.results?.length ?? 0)+ : null,+ workflowsCount: activeWorkflows ? activeWorkflows.length : null,+ eventTriggeredWorkflows: activeWorkflows+ ? activeWorkflows.filter((flow) => flow.trigger?.type === 'event').length+ : null,+ symbolSetsCount:+ symbolSetsResult.status === 'fulfilled'+ ? (symbolSetsResult.value.count ?? symbolSetsResult.value.results?.length ?? 0)+ : null,+ errorAlertsCount:+ alertsResult.status === 'fulfilled'+ ? (alertsResult.value.count ?? alertsResult.value.results?.length ?? 0)+ : null,+ ticketsCount:+ ticketsResult.status === 'fulfilled'+ ? (ticketsResult.value.count ?? ticketsResult.value.results?.length ?? 0)+ : null,+ }++ const data: QuickstartActivationData = { signals, resources }+ if (teamId) {+ activationDataCache = { teamId, fetchedAt: Date.now(), data }+ }+ return data+ },+ },+ ],+ healthIssues: [+ null as HealthIssue[] | null,+ {+ loadHealthIssues: async (): Promise<HealthIssue[] | null> => {+ const teamId = values.currentTeam?.id+ if (!teamId) {+ return null+ }+ try {+ const response = await api.get<HealthIssuesResponse>(+ `api/projects/${teamId}/health_issues/?status=active&dismissed=false&kind=authorized_urls`+ )+ return response.results+ } catch {+ return null+ }+ },+ },+ ],+ blogPublications: [+ [] as QuickstartPublication[],+ {+ loadBlogPublications: async (): Promise<QuickstartPublication[]> => await loadFeedPage('blog', []),+ loadMoreBlogPublications: async (): Promise<QuickstartPublication[]> =>+ await loadFeedPage('blog', values.blogPublications),+ },+ ],+ newsletterPublications: [+ [] as QuickstartPublication[],+ {+ loadNewsletterPublications: async (): Promise<QuickstartPublication[]> =>+ await loadFeedPage('newsletter', []),+ loadMoreNewsletterPublications: async (): Promise<QuickstartPublication[]> =>+ await loadFeedPage('newsletter', values.newsletterPublications),+ },+ ],+ }+ }),+ reducers({+ featuredProductOverrides: [+ {} as Partial<Record<ProductKey, boolean>>,+ { persist: true },+ {+ setProductFeatured: (state, { productKey, featured }) => {+ const defaultFeatured = isQuickstartProductFeatured(productKey, {})+ if (featured === defaultFeatured) {+ const { [productKey]: _, ...rest } = state+ return rest+ }+ return { ...state, [productKey]: featured }+ },+ },+ ],+ enablingProducts: [+ {} as Record<string, boolean>,+ {+ enableProduct: (state, { productKey }) => ({ ...state, [productKey]: true }),+ productEnableFinished: (state, { productKey }) => {+ const { [productKey]: _, ...rest } = state+ return rest+ },+ },+ ],+ publicationsHasMore: [+ { blog: true, newsletter: true } as Record<PublicationFeedKey, boolean>,+ {+ setPublicationsHasMore: (state, { feed, hasMore }) => ({ ...state, [feed]: hasMore }),+ },+ ],+ setupModalProductKey: [+ null as ProductKey | null,+ {+ openToolSetupModal: (_, { productKey }) => productKey,+ closeToolSetupModal: () => null,+ },+ ],+ taskGuidanceSelection: [+ null as QuickstartTaskGuidanceSelection | null,+ {+ openTaskGuidance: (_, { productKey, stepKey }) => ({ productKey, stepKey }),+ closeTaskGuidance: () => null,+ },+ ],+ companionSetup: [+ null as QuickstartCompanionSetup | null,+ {+ openCompanionSetup: (_, { companion }) => companion,+ closeCompanionSetup: () => null,+ },+ ],+ }),+ selectors({+ hasIngestedEvent: [+ (s) => [s.currentTeam],+ (currentTeam: TeamPublicType | TeamType | null): boolean => !!currentTeam?.ingested_event,+ ],+ products: [+ (s) => [s.currentTeam, s.activationData, s.healthIssues],+ (+ currentTeam: TeamPublicType | TeamType | null,+ activationData: QuickstartActivationData,+ healthIssues: HealthIssue[] | null+ ): QuickstartProduct[] => {+ if (!isFullTeam(currentTeam)) {+ return []+ }+ const ctx: StatusContext = {+ team: currentTeam,+ signals: activationData.signals ?? EMPTY_TOOL_SIGNALS,+ resources: activationData.resources,+ healthIssues,+ }+ return QUICKSTART_PRODUCT_ORDER.map((key) => buildProduct(key, ctx)).filter(+ (product): product is QuickstartProduct => product !== null+ )+ },+ ],+ featuredProducts: [+ (s) => [s.products, s.featuredProductOverrides],+ (products: QuickstartProduct[], featuredProductOverrides: Partial<Record<ProductKey, boolean>>) =>+ getQuickstartProductSections(products, featuredProductOverrides).featuredProducts,+ ],+ additionalProducts: [+ (s) => [s.products, s.featuredProductOverrides],+ (products: QuickstartProduct[], featuredProductOverrides: Partial<Record<ProductKey, boolean>>) =>+ getQuickstartProductSections(products, featuredProductOverrides).additionalProducts,+ ],+ activeProductCount: [+ (s) => [s.products],+ (products: QuickstartProduct[]): number =>+ products.filter((product) => product.status.level === 'live').length,+ ],+ totalProductCount: [(s) => [s.products], (products: QuickstartProduct[]): number => products.length],+ setupModalProduct: [+ (s) => [s.setupModalProductKey, s.products],+ (setupModalProductKey: ProductKey | null, products: QuickstartProduct[]): QuickstartProduct | null =>+ (setupModalProductKey && products.find((product) => product.key === setupModalProductKey)) || null,+ ],+ selectedTask: [+ (s) => [s.taskGuidanceSelection, s.products],+ (+ selection: QuickstartTaskGuidanceSelection | null,+ products: QuickstartProduct[]+ ): QuickstartSelectedTask | null => {+ if (!selection) {+ return null+ }+ const product = products.find(({ key }) => key === selection.productKey)+ const step = product?.status.journey.find(({ key }) => key === selection.stepKey)+ return product && step ? { product, step } : null+ },+ ],+ }),+ listeners(({ actions, values }) => ({+ setProductFeatured: ({ productKey, featured }) => {+ const product = values.products.find(({ key }) => key === productKey)+ if (!product) {+ return+ }+ posthog.capture('quickstart product featured changed', {+ product_key: productKey,+ featured,+ })+ lemonToast.success(+ featured ? `${product.name} added to Your tools` : `${product.name} moved to Explore more tools`,+ {+ button: {+ label: 'Undo',+ action: () => actions.setProductFeatured(productKey, !featured),+ },+ }+ )+ },+ setFeatureFlags: () => actions.redirectIfUnavailable(),+ redirectIfUnavailable: () => {+ if (+ !shouldRedirectFromQuickstart(+ values.receivedFeatureFlags,+ values.featureFlags[FEATURE_FLAGS.QUICKSTART_HOMEPAGE]+ )+ ) {+ return+ }+ if (values.homepage?.sceneId === Scene.Quickstart) {+ actions.setHomepage(null)+ }+ router.actions.replace(urls.projectHomepage())+ },+ enableProduct: async ({ productKey }) => {+ const definition = QUICKSTART_PRODUCT_DEFINITIONS[productKey]+ if (!definition?.optInPayload) {+ actions.productEnableFinished(productKey)+ return+ }+ try {+ await teamLogic.asyncActions.updateCurrentTeam(definition.optInPayload)+ } catch (error) {+ // The opt-in didn't apply, so don't record an enable that never happened.+ // Some team fields (e.g. conversations_enabled) are admin-only.+ const status = (error as { status?: number } | null)?.status+ lemonToast.error(+ status === 403+ ? 'Only project admins can turn this on. Ask an admin to enable it.'+ : "Couldn't enable it. Please try again."+ )+ return+ } finally {+ actions.productEnableFinished(productKey)+ }+ posthog.capture('quickstart product enabled', { product_key: productKey })+ void addProductIntent({+ product_type: productKey,+ intent_context: ProductIntentContext.QUICK_START_PRODUCT_SELECTED,+ })+ },+ // Fires after signals settle so the payload reflects real data, not the empty fallback+ loadActivationDataSuccess: () => {+ if (!isFullTeam(values.currentTeam)) {+ return+ }+ posthog.capture('quickstart viewed', {+ ...getQuickstartTrackingProperties(values.currentTeam, values.products),+ activation_signals_loaded: values.activationData.signals !== null,+ })+ },+ })),+ afterMount(({ actions }) => {+ actions.redirectIfUnavailable()+ actions.loadActivationData()+ actions.loadHealthIssues()+ actions.loadBlogPublications()+ actions.loadNewsletterPublications()+ }),+])diff --git a/frontend/src/scenes/sceneTypes.ts b/frontend/src/scenes/sceneTypes.tsindex f4d7479f57a8..15164d08894e 100644--- a/frontend/src/scenes/sceneTypes.ts+++ b/frontend/src/scenes/sceneTypes.ts@@ -130,6 +130,7 @@ export enum Scene {PropertyDefinitions = 'PropertyDefinitions',PropertyDefinitionEdit = 'PropertyDefinitionEdit',QueryPerformance = 'QueryPerformance',+ Quickstart = 'Quickstart',Replay = 'Replay',ReplayFilePlayback = 'ReplayFilePlayback',ReplayPlaylist = 'ReplayPlaylist',diff --git a/frontend/src/scenes/scenes.ts b/frontend/src/scenes/scenes.tsindex 184557af8666..ad6f13deab8e 100644--- a/frontend/src/scenes/scenes.ts+++ b/frontend/src/scenes/scenes.ts@@ -384,6 +384,11 @@ export const sceneConfigurations: Record<Scene | string, SceneConfig> = {name: 'Homepage',layout: 'app-raw-no-header',},+ [Scene.Quickstart]: {+ projectBased: true,+ name: 'Quickstart',+ layout: 'app-container',+ },[Scene.PropertyDefinitionEdit]: {projectBased: true,name: 'Data management',@@ -855,6 +860,7 @@ export const routes: Record<string, [Scene | string, string]> = {[urls.variables()]: [Scene.DataManagement, 'variables'],[urls.variableEdit(':id')]: [Scene.SqlVariableEdit, 'sqlVariableEdit'],[urls.projectHomepage()]: [Scene.ProjectHomepage, 'projectHomepage'],+ [urls.quickstart()]: [Scene.Quickstart, 'quickstart'],[urls.aiHistory()]: [Scene.Max, 'maxHistory'],[urls.ai()]: [Scene.Max, 'max'],[urls.projectCreateFirst()]: [Scene.ProjectCreateFirst, 'projectCreateFirst'],diff --git a/frontend/src/scenes/urls.ts b/frontend/src/scenes/urls.tsindex a77f7527b362..99594292546e 100644--- a/frontend/src/scenes/urls.ts+++ b/frontend/src/scenes/urls.ts@@ -146,6 +146,7 @@ export const urls = {projectCreateFirst: (): string => '/organization/create-project',projectRoot: (): string => '/',projectHomepage: (): string => '/home',+ quickstart: (): string => '/quickstart',ai: (chat?: string, ask?: string): string => combineUrl('/ai', { ask, chat }).url,aiHistory: (): string => '/ai/history',settings: (section: SettingSectionId | SettingLevelId = 'project', setting?: SettingId): string =>