: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(data-warehouse): lead the source catalog with featured sources (#73236)
Tom Owers27bb29e94c93
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.tsindex 3067645e284b..94bc605a0d26 100644--- a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts@@ -81,6 +81,8 @@ export interface CatalogItem {existingSource?: boolean/** Self-managed: the user keeps the data in their own bucket, PostHog only links to it. */selfManaged?: boolean+ /** The sources most people connect (Stripe, Postgres, the ad platforms, ...). Led with when browsing. */+ featured?: boolean}export interface CatalogCategory {@@ -1512,6 +1514,7 @@ export const sourceCatalogLogic = kea<sourceCatalogLogicType>([name: connector.name,label: connector.label ?? connector.name,keywords: connector.keywords ?? [],+ featured: connector.featured,url: urls.dataWarehouseSourceNew(connector.name),},]@@ -1603,16 +1606,23 @@ export const sourceCatalogLogic = kea<sourceCatalogLogicType>([? base: base.filter((item) => item.category === selectedCategory)// Keep fuzzy-search relevance order when searching. When browsing, lead with the- // sources the user can connect right now (alphabetically), then "Coming soon" ones,- // so the catalog doesn't open on a wall of unavailable tiles.+ // featured sources people connect most (Stripe, Postgres, the ad platforms, ...),+ // then the rest of the connectable sources, then "Coming soon" ones — all+ // alphabetical within a tier — so the catalog doesn't open on a wall of obscure or+ // unavailable tiles.if (trimmed) {return filtered}+ const browseRank = (item: CatalogItem): number => {+ if (item.status === 'coming_soon') {+ return 2+ }+ return item.featured ? 0 : 1+ }return [...filtered].sort((a, b) => {- const aComingSoon = a.status === 'coming_soon'- const bComingSoon = b.status === 'coming_soon'- if (aComingSoon !== bComingSoon) {- return aComingSoon ? 1 : -1+ const rankDiff = browseRank(a) - browseRank(b)+ if (rankDiff !== 0) {+ return rankDiff}return a.label.localeCompare(b.label)})diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.tsindex f43aefe72ea8..61d60235e472 100644--- a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts@@ -8,10 +8,12 @@ import { availableSourcesLogic } from '../availableSourcesLogic'import { sourceCatalogLogic } from '../sourceCatalogLogic'const AVAILABLE_SOURCES: Record<string, SourceConfig> = {+ // Featured, so it must lead the browse list even though `Stripe` sorts after `Mango`.Stripe: {name: 'Stripe',iconPath: '',caption: '',+ featured: true,fields: [],} as unknown as SourceConfig,// `Apple` sorts alphabetically first but is unreleased, so connectable-first ordering must@@ -71,6 +73,16 @@ describe('sourceCatalogLogic', () => {expect(names.indexOf('Zebra')).toBeLessThan(names.indexOf('Apple'))})+ it('leads the browse list with featured sources', () => {+ const logic = sourceCatalogLogic()+ const names = logic.values.filteredItems.map((item) => item.name)++ // `Stripe` is featured, so it must come before the plain connectable sources even though+ // it sorts after `Mango` alphabetically.+ expect(names.indexOf('Stripe')).toBeLessThan(names.indexOf('Mango'))+ expect(names.indexOf('Stripe')).toBeLessThan(names.indexOf('Zebra'))+ })+it('surfaces self-managed file-storage connectors when searching for a file format', () => {const logic = sourceCatalogLogic()logic.actions.setSearch('csv')