: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
chore(frontend): move FeaturePreviews out of layout into lib/components (#91054)
Rafael Audibertb9048369f9b9
diff --git a/common/storybook/storybook-timings.json b/common/storybook/storybook-timings.jsonindex 925a3a84865a..78fdecea4df2 100644--- a/common/storybook/storybook-timings.json+++ b/common/storybook/storybook-timings.json@@ -19,7 +19,7 @@"chromium": 11.882,"webkit": 2.322},- "frontend/src/layout/FeaturePreviews/FeaturePreviews.stories.tsx": {+ "frontend/src/lib/components/FeaturePreviews/FeaturePreviews.stories.tsx": {"chromium": 8.528,"webkit": 1.752},diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 8f78d5242342..f4426fb0b51f 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -544,6 +544,14 @@ snapshots:hash: v1.k794b7964.acbbd66bb3841f17a58d897e19c4b073fcbbf0452e959355276b012c7cd6b463.n89wKvwy5vfBtTTyqqi5InfW-EdZ8-pjfT0N1pRafQ0components-eventdetails--nested-properties--light:hash: v1.k794b7964.6f1c381cb3e974066a9b11169cf51b0ecaf39e636598a67e9a7d695bfcadd866.7oJQgvEiijwBqHCOAfPbYAKW6yAnMwtdzUbgdks_Xf0+ components-feature-previews--basic--dark:+ hash: v1.k794b7964.c66cfff16795578a873fcd4e7b2db735978055147ca45980f1e4ffa39e16141a.ZI1lTFkvtZwhkp4X7-p81_7OYGXZwbBYh06mbiXeDdc+ components-feature-previews--basic--light:+ hash: v1.k794b7964.90292410ce2f9bb854ec5b7f60d38836c4bc3de766a725f55b59380bdee3dfe9.8iCe4nwSmQ00mZsN20Kwp2zWm-lG6ISaYqjiAxxpmJk+ components-feature-previews--empty--dark:+ hash: v1.k794b7964.991e5f44ceae5eced661d06ca75fdd314fea213b73791c697078d601655b3876.pDXTpK6DyIMq248_s0s0QZJxOnwPiQKzjoJanIrQL-8+ components-feature-previews--empty--light:+ hash: v1.k794b7964.6fa703c825304215f198e3c1c37821a15fdec4772505a4b5db2e4e0ce491ff8d.Xp_4MqTRyevKnhM7Q2mIK9B_PhsbXY-R_lTqCpViZVYcomponents-hedgehogmode--profile-picture-hog--dark:hash: v1.k794b7964.969bdab0c4f15b4457bc162b9ad87ec0341d5e98ed3a9279494cc2f019c12250.5eEGiofVhJFttdE4ETVy01n1PTA-WrkIsgHZEB9rG5Icomponents-hedgehogmode--profile-picture-hog--light:@@ -3128,14 +3136,6 @@ snapshots:hash: v1.k794b7964.33dac53a2c2f3c8945bb52917b010f00a24b8d8b213106939af1037022d4ed5e.QNBv_MCq5SJyqzj3G7AuQxGF1qLYQLIQotnO3MfqpREinsights-worldmap--default--light:hash: v1.k794b7964.a4f523dbe2e78f12ddf6c95d6e1e0b1da4457008aa42a9b83fb5e21bc4519915.sRV9jpfMOemd-Hss7Y7z4hMMwHYzM7l8Dq9i4uoJBiE- layout-feature-previews--basic--dark:- hash: v1.k794b7964.c66cfff16795578a873fcd4e7b2db735978055147ca45980f1e4ffa39e16141a.ostnaazHLWdTtrGt0nr_xgvRw0jFrBsF3QIM52HtvSk- layout-feature-previews--basic--light:- hash: v1.k794b7964.90292410ce2f9bb854ec5b7f60d38836c4bc3de766a725f55b59380bdee3dfe9.7-WB7_aNzuLpQ3dPw59R1YhdITfL81ogyZgoFFfhFso- layout-feature-previews--empty--dark:- hash: v1.k794b7964.991e5f44ceae5eced661d06ca75fdd314fea213b73791c697078d601655b3876.oYIeuhsUskKn04mPwRQIt2PxlPCn2vDgjSEAs3gCEo0- layout-feature-previews--empty--light:- hash: v1.k794b7964.6fa703c825304215f198e3c1c37821a15fdec4772505a4b5db2e4e0ce491ff8d.alVq_s9UO6kwXke420wed5rTIxA8rc1hxARcxqEU9lMlayout-impersonation-reason-modal--loading--dark:hash: v1.k794b7964.56bc03177fcbe93f212232c9025d90ec672e9043881ce4e9a3dbbb612b501066.mkYeZ8C0UhPLy7CKjURxERYeFMjyvXrOyEpykdHmmrMlayout-impersonation-reason-modal--loading--light:diff --git a/frontend/src/layout/scenes/components/FeaturePreviewSceneGate.test.tsx b/frontend/src/layout/scenes/components/FeaturePreviewSceneGate.test.tsxindex f5aa337f7783..14f1c3bcb516 100644--- a/frontend/src/layout/scenes/components/FeaturePreviewSceneGate.test.tsx+++ b/frontend/src/layout/scenes/components/FeaturePreviewSceneGate.test.tsx@@ -4,13 +4,13 @@ import { cleanup, render, screen } from '@testing-library/react'import userEvent from '@testing-library/user-event'import { useActions, useMountedLogic, useValues } from 'kea'+import { featurePreviewsLogic } from 'lib/components/FeaturePreviews/featurePreviewsLogic'import { supportLogic } from 'lib/components/Support/supportLogic'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { preflightLogic } from 'lib/logic/preflightLogic'import { FeaturePreviewGateConfig } from '~/types'-import { featurePreviewsLogic } from '../../FeaturePreviews/featurePreviewsLogic'import { FeaturePreviewSceneGate } from './FeaturePreviewSceneGate'jest.mock('posthog-js')diff --git a/frontend/src/layout/scenes/components/FeaturePreviewSceneGate.tsx b/frontend/src/layout/scenes/components/FeaturePreviewSceneGate.tsxindex 36902702ebe8..d3b7a07a9ef6 100644--- a/frontend/src/layout/scenes/components/FeaturePreviewSceneGate.tsx+++ b/frontend/src/layout/scenes/components/FeaturePreviewSceneGate.tsx@@ -3,6 +3,7 @@ import { useEffect } from 'react'import { LemonButton, LemonSwitch } from '@posthog/lemon-ui'+import { featurePreviewsLogic } from 'lib/components/FeaturePreviews/featurePreviewsLogic'import { ProductIntroduction } from 'lib/components/ProductIntroduction/ProductIntroduction'import { supportLogic } from 'lib/components/Support/supportLogic'import {@@ -15,7 +16,6 @@ import { sceneLogic } from 'scenes/sceneLogic'import { sceneConfigurations } from 'scenes/scenes'import { urls } from 'scenes/urls'-import { featurePreviewsLogic } from '~/layout/FeaturePreviews/featurePreviewsLogic'import { FeaturePreviewGateConfig } from '~/types'import { SceneContent } from './SceneContent'diff --git a/frontend/src/layout/FeaturePreviews/FeaturePreviews.stories.tsx b/frontend/src/lib/components/FeaturePreviews/FeaturePreviews.stories.tsxsimilarity index 97%rename from frontend/src/layout/FeaturePreviews/FeaturePreviews.stories.tsxrename to frontend/src/lib/components/FeaturePreviews/FeaturePreviews.stories.tsxindex ec07f686efa3..d06ee345ac79 100644--- a/frontend/src/layout/FeaturePreviews/FeaturePreviews.stories.tsx+++ b/frontend/src/lib/components/FeaturePreviews/FeaturePreviews.stories.tsx@@ -12,7 +12,7 @@ interface StoryProps {type Story = StoryObj<(props: StoryProps) => JSX.Element>const meta: Meta<(props: StoryProps) => JSX.Element> = {- title: 'Layout/Feature Previews',+ title: 'Components/Feature Previews',parameters: {layout: 'fullscreen',viewMode: 'story',diff --git a/frontend/src/layout/FeaturePreviews/FeaturePreviews.test.tsx b/frontend/src/lib/components/FeaturePreviews/FeaturePreviews.test.tsxsimilarity index 100%rename from frontend/src/layout/FeaturePreviews/FeaturePreviews.test.tsxrename to frontend/src/lib/components/FeaturePreviews/FeaturePreviews.test.tsxdiff --git a/frontend/src/layout/FeaturePreviews/FeaturePreviews.tsx b/frontend/src/lib/components/FeaturePreviews/FeaturePreviews.tsxsimilarity index 100%rename from frontend/src/layout/FeaturePreviews/FeaturePreviews.tsxrename to frontend/src/lib/components/FeaturePreviews/FeaturePreviews.tsxdiff --git a/frontend/src/layout/FeaturePreviews/featurePreviewsLogic.test.ts b/frontend/src/lib/components/FeaturePreviews/featurePreviewsLogic.test.tssimilarity index 100%rename from frontend/src/layout/FeaturePreviews/featurePreviewsLogic.test.tsrename to frontend/src/lib/components/FeaturePreviews/featurePreviewsLogic.test.tsdiff --git a/frontend/src/layout/FeaturePreviews/featurePreviewsLogic.tsx b/frontend/src/lib/components/FeaturePreviews/featurePreviewsLogic.tsxsimilarity index 97%rename from frontend/src/layout/FeaturePreviews/featurePreviewsLogic.tsxrename to frontend/src/lib/components/FeaturePreviews/featurePreviewsLogic.tsxindex f3cb4894a77e..b556653e3ff8 100644--- a/frontend/src/layout/FeaturePreviews/featurePreviewsLogic.tsx+++ b/frontend/src/lib/components/FeaturePreviews/featurePreviewsLogic.tsx@@ -3,21 +3,20 @@ import { loaders } from 'kea-loaders'import { EarlyAccessFeature, posthog } from 'posthog-js'import { supportLogic } from 'lib/components/Support/supportLogic'+import type { SupportFormFields } from 'lib/components/Support/supportLogic'import { FEATURE_FLAGS, FeatureFlagKey } from 'lib/constants'import { lemonToast } from 'lib/lemon-ui/LemonToast'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import type { FeatureFlagsSet } from 'lib/logic/featureFlagLogic'import { copyToClipboard } from 'lib/utils/copyToClipboard'import { createFeaturePreviewSearch } from 'lib/utils/fuseSearch'+import type { ProductCrossSellProperties } from 'lib/utils/product-intents'import { teamLogic } from 'scenes/teamLogic'import { urls } from 'scenes/urls'import { userLogic } from 'scenes/userLogic'import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'--import type { SupportFormFields } from '../../lib/components/Support/supportLogic'-import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'-import type { ProductCrossSellProperties } from '../../lib/utils/product-intents'-import type { UserType } from '../../types'+import type { UserType } from '~/types'export interface EnrichedEarlyAccessFeature extends Omit<EarlyAccessFeature, 'flagKey'> {flagKey: string@@ -140,7 +139,7 @@ export type featurePreviewsLogicType = MakeLogicType<>export const featurePreviewsLogic = kea<featurePreviewsLogicType>([- path(['layout', 'FeaturePreviews', 'featurePreviewsLogic']),+ path(['lib', 'components', 'FeaturePreviews', 'featurePreviewsLogic']),connect(() => ({values: [featureFlagLogic, ['featureFlags'], userLogic, ['user']],actions: [supportLogic, ['submitSupportTicket'], teamLogic, ['addProductIntentForCrossSell']],diff --git a/frontend/src/scenes/settings/SettingsMap.tsx b/frontend/src/scenes/settings/SettingsMap.tsxindex fda82980b211..9ffb0f977d8c 100644--- a/frontend/src/scenes/settings/SettingsMap.tsx+++ b/frontend/src/scenes/settings/SettingsMap.tsx@@ -15,6 +15,7 @@ import { ExternalDataSourceConfiguration } from '@posthog/products-revenue-analyimport { FilterTestAccountsConfiguration as RevenueAnalyticsFilterTestAccountsConfiguration } from '@posthog/products-revenue-analytics/frontend/settings/FilterTestAccountsConfiguration'import { BaseCurrency } from 'lib/components/BaseCurrency/BaseCurrency'+import { FeaturePreviews, FeaturePreviewsComingSoon } from 'lib/components/FeaturePreviews/FeaturePreviews'import { FlaggedFeature } from 'lib/components/FlaggedFeature'import { FEATURE_SUPPORT } from 'lib/components/SupportedPlatforms/featureSupport'import { FEATURE_FLAGS, OrganizationMembershipLevel } from 'lib/constants'@@ -99,7 +100,6 @@ import {FlagsSecureApiKeys,RequireEvaluationContexts,} from './environment/FeatureFlagSettings'-import { FeaturePreviewsComingSoon, FeaturePreviewsSettings } from './environment/FeaturePreviewsSettings'import { GroupAnalyticsConfig } from './environment/GroupAnalyticsConfig'import { HeatmapsSettings } from './environment/HeatmapsSettings'import { HumanFriendlyComparisonPeriodsSetting } from './environment/HumanFriendlyComparisonPeriodsSetting'@@ -2167,7 +2167,7 @@ export const SETTINGS_MAP: SettingSection[] = [title: 'Feature previews',description:'Try out upcoming PostHog features before they are generally available. Toggling a preview enables it for your account only.',- component: <FeaturePreviewsSettings />,+ component: <FeaturePreviews />,keywords: ['beta', 'early access', 'preview', 'opt-in'],},{diff --git a/frontend/src/scenes/settings/environment/FeaturePreviewsSettings.tsx b/frontend/src/scenes/settings/environment/FeaturePreviewsSettings.tsxdeleted file mode 100644index 555baad46cbf..000000000000--- a/frontend/src/scenes/settings/environment/FeaturePreviewsSettings.tsx+++ /dev/null@@ -1,4 +0,0 @@-export {- FeaturePreviews as FeaturePreviewsSettings,- FeaturePreviewsComingSoon,-} from '~/layout/FeaturePreviews/FeaturePreviews'