: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(customer-analytics): custom property polish + copy account link (#76079)
Arthur Moreira de Deusf9d399a7acd1
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex e47ef456b64e..48f3a6216a46 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -5387,21 +5387,21 @@ snapshots:scenes-app-customer-analytics-accounts--feature-gate-off--light:hash: v1.k794b7964.e8b91bf6a0dd1b5d31064f4cbb94e9791e999c210831c455a498d0c7cc7e6bbb.IkZPJrJz33sKS8zzKwoy8V3s0GvmKpe5EGYTCIljhLsscenes-app-customer-analytics-accounts--row-expanded-empty--dark:- hash: v1.k794b7964.83cfbb84f16c3d0ef3abc3482d39f05b6f370ddceda6a575f4cdad3de2a48592.XU8BEsPctrrW5BDHOAAseUOUEKN4uaXWN6bmdlqGTSQ+ hash: v1.k794b7964.a383176831b0ebf2861e39ef8c51e4101ac680a76791b9d3788c3a4c7a5c69e8.RuvhFxLwOrB3phJx2c2ODXhiQxNsvHHVvWTj1VTwj0Escenes-app-customer-analytics-accounts--row-expanded-empty--light:- hash: v1.k794b7964.f3960b655dedb62b3d7b0a807e65d24b2688b2770e5c1c76f49f1d14841d86fc.Kyl-jkCUoFrfuqKGelDegqf8r3bskXIMdirKAVWES3g+ hash: v1.k794b7964.6b518220b91cff7ea974da8fe6e753abc42cba6349ce4034da9e761e55e54a3a.KMHSrirCnAIKbSLt9MoRAJXd4Jw937PDyTgUz8yC4u0scenes-app-customer-analytics-accounts--row-expanded-links-disabled--dark:- hash: v1.k794b7964.97520330492106e18e17465da86b5871772b9eccb4b8708d75f1437e9cea693f.ES1BsntsZKFYAHcfd5KQ2WNAoxhU7oG6jhfDK4teUfM+ hash: v1.k794b7964.50070e51329d53d9bd8e2a3d3ac7de5c0fcea2a41b45ada94bbe92606dd47b77.QGHFTHV0y2Yhyo8idOVqnjTxkeXKGU6grBvDXIEmRLoscenes-app-customer-analytics-accounts--row-expanded-links-disabled--light:- hash: v1.k794b7964.773b061ddeb81cddf27973258ca773905fe5d3e04d71d7fb5bea5d3567df3b39._NwLnY6RY6RB5IyDTvQG-6YS7yippEG9pbd9y8xl_n4+ hash: v1.k794b7964.afafa36ea188644ed6530cae825cb99aa320939c21d5b95a72f4481bdee62ae7.yW1V7yaSl4o_ddcF9iC91zMVTwnILOmXhjBPfs63clQscenes-app-customer-analytics-accounts--row-expanded-usage-not-found--dark:- hash: v1.k794b7964.8e92b27c0a63fafbd74a631f60b1bdea1b9983c7abbd30a4258e1f818ef63ecb.wvCGmys9jG3ZUP_O-3_k5uuNda7hMWnCsRypRDGtrBM+ hash: v1.k794b7964.8bd7486f2b15f90d463f39fd447c71ef14f037e67b181332938ae22f9f9b1512.6g4GcZDm3J396htOBYLxm64-pdJ0ze8u8PjhxkY24wQscenes-app-customer-analytics-accounts--row-expanded-usage-not-found--light:- hash: v1.k794b7964.9b934a54cfcdee0d1448d2d8bfd579acd6ef2898d844498a8b06688b54c891fa.SK_-r5YH_iaVhdenzRzQMZK7XFMnOuBGUrMxXA9A-Hc+ hash: v1.k794b7964.07cdc60aac4d54b6ef86e48e4e0edd71eb480ce16e6293a6dd5f8c6d018c7139.-63YcQgoEWb4xgACeP2HdXleFzbO8q-LQdsS9Posxo8scenes-app-customer-analytics-accounts--row-expanded-with-note--dark:- hash: v1.k794b7964.c9b6f7b53e6c726a4578c832e45190e25544b8393de528d30edbed057ac44791.Ly4hzt_3vfZKOBOWl_agi_l3br3UxMEIRN9qfmLO1Js+ hash: v1.k794b7964.cffe67e064b3b805bea6d329c50adaf707bf3301fe1b2f3238de95892f4891a6.DV5QQ7TSYsDgkK6keu8_sR-FHdZ3pZze9S7c5fXGuTgscenes-app-customer-analytics-accounts--row-expanded-with-note--light:- hash: v1.k794b7964.d8bf466f479ff1d959eb4bcc623791a9bb5d0679bb4603551330a41b195d21ca.OrdGvoj-FidEK77CCv6wrGfEKYjLduhFHA9Zft14W3I+ hash: v1.k794b7964.dba927090806c0d069eef568d8fc90ed12d4e6829ddb8c82126ea8958e1e7adb.jxpKvcSTRjyCgkzKolV5udbLmFeipTN1ZOdS1qsKFHAscenes-app-customer-analytics-dashboard--b-2-b-mode-with-groups-enabled--dark:hash: v1.k794b7964.cf03f6a65f846aec287042028193b834c567f01226d2e91f6389df5af935530d.bXzRv9MkU0nXN-4tvGbenagVaJuhFr86goke8HVYFJYscenes-app-customer-analytics-dashboard--b-2-b-mode-with-groups-enabled--light:diff --git a/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsxindex eded96efa8cc..7f55d6daf44e 100644--- a/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx@@ -68,6 +68,7 @@ import { objectsEqual } from 'lib/utils/objects'import { capitalizeFirstLetter, pluralize } from 'lib/utils/strings'import { toParams } from 'lib/utils/url'import {+ getAccountCustomPropertyDefinitionIcon,getEventDefinitionIcon,getEventMetadataDefinitionIcon,getPersonPropertyDefinitionIcon,@@ -1345,8 +1346,9 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([type: TaxonomicFilterGroupType.AccountCustomProperties,// Account custom property definitions are per-team API data, so the// options come from the consumer via `optionsFromProp` — items carry- // `{ id, name, property_type }` with the definition id as the value.- getIcon: getPropertyDefinitionIcon,+ // `{ id, name, description, is_canonical, property_type }` with the+ // definition id as the value.+ getIcon: getAccountCustomPropertyDefinitionIcon,getName: (option: PropertyDefinition) => option.name,getValue: (option: PropertyDefinition) => option.id,valuesEndpoint: (key) =>diff --git a/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsx b/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsxindex 3a9c05bf48d2..51cadaf681e1 100644--- a/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsx@@ -30,6 +30,7 @@ import { Link } from 'lib/lemon-ui/Link'import { isString } from 'lib/utils/guards'import { pluralize } from 'lib/utils/strings'import {+ getAccountCustomPropertyDefinitionIcon,getEventDefinitionIcon,getEventMetadataDefinitionIcon,getPersonPropertyDefinitionIcon,@@ -535,8 +536,9 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomitype: TaxonomicFilterGroupType.AccountCustomProperties,// Mirrors the legacy taxonomicFilterLogic group: account custom property definitions// are per-team API data, so the options come from the consumer via `optionsFromProp` —- // items carry `{ id, name, property_type }` with the definition id as the value.- getIcon: getPropertyDefinitionIcon,+ // items carry `{ id, name, description, is_canonical, property_type }` with the+ // definition id as the value.+ getIcon: getAccountCustomPropertyDefinitionIcon,getName: (option: PropertyDefinition) => option.name,getValue: (option: PropertyDefinition) => option.id,valuesEndpoint: (key) =>diff --git a/frontend/src/scenes/data-management/events/DefinitionHeader.tsx b/frontend/src/scenes/data-management/events/DefinitionHeader.tsxindex 2366b2dadd8f..1f69592fc4c1 100644--- a/frontend/src/scenes/data-management/events/DefinitionHeader.tsx+++ b/frontend/src/scenes/data-management/events/DefinitionHeader.tsx@@ -75,6 +75,21 @@ export function getPropertyDefinitionIcon(definition: PropertyDefinition): JSX.E)}+export function getAccountCustomPropertyDefinitionIcon(+ definition: PropertyDefinition & { is_canonical?: boolean }+): JSX.Element {+ if (definition.is_canonical) {+ return (+ <IconWithBadge+ icon={<IconLogomark />}+ tooltipTitle="PostHog sets this property automatically"+ className="taxonomy-icon taxonomy-icon-muted"+ />+ )+ }+ return getPropertyDefinitionIcon(definition)+}+export function getPersonPropertyDefinitionIcon(definition: PropertyDefinition): JSX.Element {if (CORE_FILTER_DEFINITIONS_BY_GROUP.person_properties[definition.name]) {return (diff --git a/products/customer_analytics/backend/facade/api.py b/products/customer_analytics/backend/facade/api.pyindex fb8c13fee352..22ffabb00f8e 100644--- a/products/customer_analytics/backend/facade/api.py+++ b/products/customer_analytics/backend/facade/api.py@@ -142,6 +142,7 @@ def _to_account_properties(properties: _ModelAccountProperties) -> contracts.Acczendesk_id=properties.zendesk_id,slack_channel_id=properties.slack_channel_id,usage_dashboard_link=properties.usage_dashboard_link,+ metabase_link=properties.metabase_link,)diff --git a/products/customer_analytics/backend/facade/contracts.py b/products/customer_analytics/backend/facade/contracts.pyindex 61203bbd9b59..e5e5a264d3b5 100644--- a/products/customer_analytics/backend/facade/contracts.py+++ b/products/customer_analytics/backend/facade/contracts.py@@ -80,6 +80,7 @@ class AccountProperties:zendesk_id: str | None = Noneslack_channel_id: str | None = Noneusage_dashboard_link: str | None = None+ metabase_link: str | None = None@dataclass(frozen=True)diff --git a/products/customer_analytics/backend/models/account.py b/products/customer_analytics/backend/models/account.pyindex 17f0db8c832a..dc6b3ceb8cc0 100644--- a/products/customer_analytics/backend/models/account.py+++ b/products/customer_analytics/backend/models/account.py@@ -34,6 +34,7 @@ class AccountProperties(BaseModel):zendesk_id: str | None = Noneslack_channel_id: str | None = Noneusage_dashboard_link: str | None = None+ metabase_link: str | None = None@classmethoddef from_input(cls, data: "dict | AccountProperties") -> "AccountProperties":diff --git a/products/customer_analytics/backend/presentation/views/serializers.py b/products/customer_analytics/backend/presentation/views/serializers.pyindex 4353f2de47f9..57665fe8cbc1 100644--- a/products/customer_analytics/backend/presentation/views/serializers.py+++ b/products/customer_analytics/backend/presentation/views/serializers.py@@ -89,6 +89,7 @@ _ACCOUNT_PROPERTIES_SCHEMA = {"zendesk_id": {"type": "string", "nullable": True},"slack_channel_id": {"type": "string", "nullable": True},"usage_dashboard_link": {"type": "string", "nullable": True},+ "metabase_link": {"type": "string", "nullable": True},},}@@ -175,7 +176,7 @@ class AccountSerializer(DataclassSerializer):help_text=("Typed account properties: assignment fields (csm, account_executive, account_owner) ""and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, "- "sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link). Defaults to an empty "+ "sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link). Defaults to an empty ""object. Unknown keys are rejected."),)diff --git a/products/customer_analytics/frontend/components/Accounts/AGENTS.md b/products/customer_analytics/frontend/components/Accounts/AGENTS.mdindex 11f8a1b36218..3a21c155bd43 100644--- a/products/customer_analytics/frontend/components/Accounts/AGENTS.md+++ b/products/customer_analytics/frontend/components/Accounts/AGENTS.md@@ -132,6 +132,8 @@ Anywhere we know the account, prefer a deep-link over the bare list. The notific(Separately, `openAccount` — reveal + expand + scroll **within the current list** — remains the Max contextual-tool entry point for surfacing an account during an active session. It's not URL-driven.)+The expanded row's Useful links sidebar ends with a "Copy link to account" row that copies the absolute deep-link (`urls.absolute(urls.currentProject(urls.customerAnalyticsAccount(id)))`) for sharing; it reports through the existing link-clicked event with `link_key: 'copy-account-link'`.+## Saved viewsA saved view is a named snapshot of the full Accounts list state (columns, sort, filters, overview tiles).@@ -216,7 +218,7 @@ We track user actions on the Accounts list with `posthog.capture()`. Conventions| `customer analytics accounts view selected` | `accountsViewsLogic` `applyView` listener | `visibility` || `customer analytics accounts view deleted` | `accountsViewsLogic` `deleteViewSuccess` listener | _(none)_ || `customer analytics account role assigned` | `accountsLogic` `updateAccountRole` | `role` (`csm` \| `account_executive` \| `account_owner` for the seeded definitions, else the definition name), `is_assigned`, `assigned_user_id`, `source` (`list_row` from `accountsLogic.updateAccountRole` \| `relationships_tab` from `accountRelationshipsLogic` assign/end) |-| `customer analytics account link clicked` | `AccountNotebooksExpansion.tsx` useful-link `onClick` | `link_key`, `has_destination` |+| `customer analytics account link clicked` | `AccountNotebooksExpansion.tsx` useful-link `onClick` (incl. the "Copy link to account" row, `link_key: 'copy-account-link'`) | `link_key`, `has_destination` || `customer analytics account note clicked` | `AccountNotebooksExpansion.tsx` note `<Link>` `onClick` | `notebook_short_id` || `customer analytics accounts note created` | `accountNotebooksLogic` `createNoteSuccess` listener | `notebook_short_id` || `customer analytics accounts notes searched` | `accountNotebooksLogic` `setSearchTerm` listener (post-debounce) | `has_query`, `query_length` (no raw text) |diff --git a/products/customer_analytics/frontend/components/Accounts/AccountNotebooksExpansion.tsx b/products/customer_analytics/frontend/components/Accounts/AccountNotebooksExpansion.tsxindex ef50d98b7a68..b9f508d79ee0 100644--- a/products/customer_analytics/frontend/components/Accounts/AccountNotebooksExpansion.tsx+++ b/products/customer_analytics/frontend/components/Accounts/AccountNotebooksExpansion.tsx@@ -1,7 +1,16 @@import { useActions, useMountedLogic, useValues } from 'kea'import posthog from 'posthog-js'-import { IconCloud, IconGraph, IconPencil, IconPeople, IconPiggyBank, IconReceipt } from '@posthog/icons'+import {+ IconCloud,+ IconCopy,+ IconDatabase,+ IconGraph,+ IconPencil,+ IconPeople,+ IconPiggyBank,+ IconReceipt,+} from '@posthog/icons'import {LemonButton,LemonInput,@@ -18,6 +27,7 @@ import { TZLabel } from 'lib/components/TZLabel'import { FEATURE_FLAGS } from 'lib/constants'import { IconSlack } from 'lib/lemon-ui/icons'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import { copyToClipboard } from 'lib/utils/copyToClipboard'import { fullName } from 'lib/utils/strings'import { notebookPanelLogic } from 'scenes/notebooks/NotebookPanel/notebookPanelLogic'import { urls } from 'scenes/urls'@@ -58,6 +68,7 @@ const LINK_ICONS: Record<string, JSX.Element> = {organization: <IconPeople />,revenue: <IconPiggyBank />,'usage-dashboard': <IconGraph />,+ metabase: <IconDatabase />,slack: <IconSlack />,'billing-admin': <IconReceipt />,salesforce: <IconCloud />,@@ -126,6 +137,24 @@ function UsefulLinks({ accountId }: { accountId: string }): JSX.Element {</LemonButton>)))}+ <LemonButton+ type="tertiary"+ size="small"+ fullWidth+ icon={<IconCopy />}+ onClick={() => {+ void copyToClipboard(+ urls.absolute(urls.currentProject(urls.customerAnalyticsAccount(accountId))),+ 'link to this account'+ )+ posthog.capture(AccountsEvents.LinkClicked, {+ link_key: 'copy-account-link',+ has_destination: true,+ })+ }}+ >+ Copy link to account+ </LemonButton></div>)}diff --git a/products/customer_analytics/frontend/components/Accounts/accountLinksLogic.test.ts b/products/customer_analytics/frontend/components/Accounts/accountLinksLogic.test.tsindex 7671cb5393cb..0a938fe89ed1 100644--- a/products/customer_analytics/frontend/components/Accounts/accountLinksLogic.test.ts+++ b/products/customer_analytics/frontend/components/Accounts/accountLinksLogic.test.ts@@ -72,6 +72,7 @@ describe('accountLinksLogic', () => {billing_id: 'cus_1',slack_channel_id: 'C1',usage_dashboard_link: '',+ metabase_link: '',sfdc_id: '',})})@@ -92,6 +93,7 @@ describe('accountLinksLogic', () => {billing_id: 'new',slack_channel_id: 'C9',usage_dashboard_link: '',+ metabase_link: '',sfdc_id: '001abc',})logic.actions.saveLinks()@@ -104,6 +106,7 @@ describe('accountLinksLogic', () => {billing_id: 'new',slack_channel_id: 'C9',usage_dashboard_link: null,+ metabase_link: null,sfdc_id: '001abc',},})@@ -120,6 +123,7 @@ describe('accountLinksLogic', () => {billing_id: '',slack_channel_id: ' ',usage_dashboard_link: '',+ metabase_link: '',sfdc_id: '',})logic.actions.saveLinks()@@ -127,7 +131,13 @@ describe('accountLinksLogic', () => {expect(mockAccountsPartialUpdate).toHaveBeenCalledWith(TEAM, 'acc-1', {external_id: null,- properties: { billing_id: null, slack_channel_id: null, usage_dashboard_link: null, sfdc_id: null },+ properties: {+ billing_id: null,+ slack_channel_id: null,+ usage_dashboard_link: null,+ metabase_link: null,+ sfdc_id: null,+ },})})diff --git a/products/customer_analytics/frontend/components/Accounts/accountLinksLogic.ts b/products/customer_analytics/frontend/components/Accounts/accountLinksLogic.tsindex 5a11060004ac..50b1cf42ac23 100644--- a/products/customer_analytics/frontend/components/Accounts/accountLinksLogic.ts+++ b/products/customer_analytics/frontend/components/Accounts/accountLinksLogic.ts@@ -25,7 +25,13 @@ export interface AccountLinksLogicProps {accountId: string}-export type AccountLinkFieldKey = 'external_id' | 'billing_id' | 'slack_channel_id' | 'usage_dashboard_link' | 'sfdc_id'+export type AccountLinkFieldKey =+ | 'external_id'+ | 'billing_id'+ | 'slack_channel_id'+ | 'usage_dashboard_link'+ | 'metabase_link'+ | 'sfdc_id'export interface AccountLinkFieldDef {key: AccountLinkFieldKey@@ -40,6 +46,7 @@ export const ACCOUNT_LINK_FIELDS: AccountLinkFieldDef[] = [{ key: 'billing_id', label: 'Billing ID', placeholder: 'e.g. cus_acme_123' },{ key: 'slack_channel_id', label: 'Slack channel ID', placeholder: 'e.g. C0123456789' },{ key: 'usage_dashboard_link', label: 'Usage dashboard link', placeholder: 'https://…' },+ { key: 'metabase_link', label: 'Metabase link', placeholder: 'https://…' },{ key: 'sfdc_id', label: 'Salesforce ID', placeholder: 'e.g. 0011t00000AbCdEfGhI' },]@@ -48,6 +55,7 @@ const EMPTY_FIELDS: AccountLinkFieldValues = {billing_id: '',slack_channel_id: '',usage_dashboard_link: '',+ metabase_link: '',sfdc_id: '',}@@ -208,6 +216,7 @@ export const accountLinksLogic = kea<accountLinksLogicType>([billing_id: account?.properties?.billing_id ?? '',slack_channel_id: account?.properties?.slack_channel_id ?? '',usage_dashboard_link: account?.properties?.usage_dashboard_link ?? '',+ metabase_link: account?.properties?.metabase_link ?? '',sfdc_id: account?.properties?.sfdc_id ?? '',}),],@@ -228,6 +237,7 @@ export const accountLinksLogic = kea<accountLinksLogicType>([const billingId = account?.properties?.billing_id ?? nullconst slackChannelId = account?.properties?.slack_channel_id ?? nullconst usageDashboardLink = account?.properties?.usage_dashboard_link ?? null+ const metabaseLink = account?.properties?.metabase_link ?? nullconst sfdcId = account?.properties?.sfdc_id ?? nullconst backUrl =removeProjectIdIfPresent(currentLocation.pathname) + currentLocation.search + currentLocation.hash@@ -258,6 +268,13 @@ export const accountLinksLogic = kea<accountLinksLogicType>([targetBlank: true,disabledReason: usageDashboardLink ? null : 'No usage dashboard link set',},+ {+ key: 'metabase',+ label: 'Metabase',+ to: metabaseLink,+ targetBlank: true,+ disabledReason: metabaseLink ? null : 'No Metabase link set',+ },{key: 'slack',label: 'Slack channel',@@ -304,6 +321,7 @@ export const accountLinksLogic = kea<accountLinksLogicType>([billing_id: orNull(form.billing_id),slack_channel_id: orNull(form.slack_channel_id),usage_dashboard_link: orNull(form.usage_dashboard_link),+ metabase_link: orNull(form.metabase_link),sfdc_id: orNull(form.sfdc_id),} as PatchedAccountApiProperties,})diff --git a/products/customer_analytics/frontend/components/Accounts/accountsColumnConfigLogic.ts b/products/customer_analytics/frontend/components/Accounts/accountsColumnConfigLogic.tsindex e43d88478bd6..d846025c4776 100644--- a/products/customer_analytics/frontend/components/Accounts/accountsColumnConfigLogic.ts+++ b/products/customer_analytics/frontend/components/Accounts/accountsColumnConfigLogic.ts@@ -388,7 +388,9 @@ export interface accountsColumnConfigLogicValues {customPropertyDefinitionsById: Record<string, CustomPropertyDefinitionApi>customPropertyDefinitionsLoading: booleancustomPropertyTaxonomicOptions: (SimpleOption & {+ description?: stringid: string+ is_canonical?: booleanproperty_type: PropertyType})[]defaultSelectColumns: string[]@@ -551,7 +553,9 @@ export interface accountsColumnConfigLogicMeta {customPropertyDefinitionsById: Record<string, CustomPropertyDefinitionApi>) => Record<string, CustomPropertyDefinitionApi>customPropertyTaxonomicOptions: (customPropertyDefinitions: CustomPropertyDefinitionApi[]) => (SimpleOption & {+ description?: stringid: string+ is_canonical?: booleanproperty_type: PropertyType})[]aliasToRelationshipDefinition: (@@ -840,10 +844,17 @@ export const accountsColumnConfigLogic = kea<accountsColumnConfigLogicType>([(s) => [s.customPropertyDefinitions],(customPropertyDefinitions: CustomPropertyDefinitionApi[]- ): (SimpleOption & { id: string; property_type: PropertyType })[] =>+ ): (SimpleOption & {+ id: string+ description?: string+ is_canonical?: boolean+ property_type: PropertyType+ })[] =>customPropertyDefinitions.map((definition) => ({id: definition.id,name: definition.name,+ description: definition.description ?? undefined,+ is_canonical: definition.is_canonical,property_type: propertyTypeForDisplayType(definition.display_type),})),],diff --git a/products/customer_analytics/frontend/generated/api.schemas.ts b/products/customer_analytics/frontend/generated/api.schemas.tsindex 18c704f1a73c..3a7d53922ed5 100644--- a/products/customer_analytics/frontend/generated/api.schemas.ts+++ b/products/customer_analytics/frontend/generated/api.schemas.ts@@ -210,7 +210,7 @@ export const SlackSummaryCadenceEnumApi = {} as const/**- * Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link). Defaults to an empty object. Unknown keys are rejected.+ * Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link). Defaults to an empty object. Unknown keys are rejected.* @nullable*/export type AccountApiProperties = {@@ -243,6 +243,8 @@ export type AccountApiProperties = {slack_channel_id?: string | null/** @nullable */usage_dashboard_link?: string | null+ /** @nullable */+ metabase_link?: string | null} | null/**@@ -262,7 +264,7 @@ export interface AccountApi {*/external_id?: string | null/**- * Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link). Defaults to an empty object. Unknown keys are rejected.+ * Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link). Defaults to an empty object. Unknown keys are rejected.* @nullable*/properties?: AccountApiProperties@@ -391,7 +393,7 @@ export interface AccountRelationshipWriteApi {}/**- * Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link). Defaults to an empty object. Unknown keys are rejected.+ * Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link). Defaults to an empty object. Unknown keys are rejected.* @nullable*/export type PatchedAccountApiProperties = {@@ -424,6 +426,8 @@ export type PatchedAccountApiProperties = {slack_channel_id?: string | null/** @nullable */usage_dashboard_link?: string | null+ /** @nullable */+ metabase_link?: string | null} | null/**@@ -443,7 +447,7 @@ export interface PatchedAccountApi {*/external_id?: string | null/**- * Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link). Defaults to an empty object. Unknown keys are rejected.+ * Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link). Defaults to an empty object. Unknown keys are rejected.* @nullable*/properties?: PatchedAccountApiPropertiesdiff --git a/products/customer_analytics/frontend/generated/api.zod.ts b/products/customer_analytics/frontend/generated/api.zod.tsindex ffce13ce390d..80013e240537 100644--- a/products/customer_analytics/frontend/generated/api.zod.ts+++ b/products/customer_analytics/frontend/generated/api.zod.ts@@ -126,10 +126,11 @@ export const AccountsCreateBody = /* @__PURE__ */ zodzendesk_id: zod.string().nullish(),slack_channel_id: zod.string().nullish(),usage_dashboard_link: zod.string().nullish(),+ metabase_link: zod.string().nullish(),}).nullish().describe(- 'Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link). Defaults to an empty object. Unknown keys are rejected.'+ 'Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link). Defaults to an empty object. Unknown keys are rejected.'),tags: zod.array(zod.string())@@ -218,10 +219,11 @@ export const AccountsUpdateBody = /* @__PURE__ */ zodzendesk_id: zod.string().nullish(),slack_channel_id: zod.string().nullish(),usage_dashboard_link: zod.string().nullish(),+ metabase_link: zod.string().nullish(),}).nullish().describe(- 'Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link). Defaults to an empty object. Unknown keys are rejected.'+ 'Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link). Defaults to an empty object. Unknown keys are rejected.'),tags: zod.array(zod.string())@@ -286,10 +288,11 @@ export const AccountsPartialUpdateBody = /* @__PURE__ */ zodzendesk_id: zod.string().nullish(),slack_channel_id: zod.string().nullish(),usage_dashboard_link: zod.string().nullish(),+ metabase_link: zod.string().nullish(),}).nullish().describe(- 'Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link). Defaults to an empty object. Unknown keys are rejected.'+ 'Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link). Defaults to an empty object. Unknown keys are rejected.'),tags: zod.array(zod.string())diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertiesConfig.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertiesConfig.tsxindex 3e265afcc14c..183584eee496 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertiesConfig.tsx+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertiesConfig.tsx@@ -1,8 +1,8 @@import { useActions, useValues } from 'kea'import { useState } from 'react'-import { IconInfo, IconPencil, IconTrash } from '@posthog/icons'-import { LemonButton, LemonTable, LemonTableColumns, Tooltip } from '@posthog/lemon-ui'+import { IconInfo, IconLogomark, IconPencil, IconTrash } from '@posthog/icons'+import { LemonButton, LemonInput, LemonTable, LemonTableColumns, Tooltip } from '@posthog/lemon-ui'import { RestrictionScope, useRestrictedArea } from 'lib/components/RestrictedArea'import { TZLabel } from 'lib/components/TZLabel'@@ -30,8 +30,9 @@ const TAG_TYPE_BY_SYNC_LEVEL: Record<SourceSyncStatusLevel, LemonTagType> = {}export function CustomPropertiesConfig(): JSX.Element {- const { definitions, definitionsLoading } = useValues(customPropertyDefinitionsLogic)- const { openCreateModal, openEditModal, deleteDefinition } = useActions(customPropertyDefinitionsLogic)+ const { filteredDefinitions, definitionsLoading, searchTerm } = useValues(customPropertyDefinitionsLogic)+ const { openCreateModal, openEditModal, deleteDefinition, setSearchTerm } =+ useActions(customPropertyDefinitionsLogic)const restrictionReason = useRestrictedArea({scope: RestrictionScope.Project,minimumAccessLevel: TeamMembershipLevel.Admin,@@ -54,7 +55,16 @@ export function CustomPropertiesConfig(): JSX.Element {{title: 'Name',dataIndex: 'name',- render: (_, definition) => <span className="font-semibold">{definition.name}</span>,+ render: (_, definition) => (+ <span className="flex items-center gap-1 font-semibold">+ {definition.is_canonical && (+ <Tooltip title="PostHog sets this property automatically">+ <IconLogomark className="text-lg shrink-0" />+ </Tooltip>+ )}+ {definition.name}+ </span>+ ),},{title: 'Attach to',@@ -105,6 +115,9 @@ export function CustomPropertiesConfig(): JSX.Element {{title: 'Sync',render: (_, definition) => {+ if (definition.is_canonical) {+ return <span className="text-secondary">Auto</span>+ }if (!definition.source) {return <span className="text-secondary">Manual</span>}@@ -124,25 +137,30 @@ export function CustomPropertiesConfig(): JSX.Element {{title: '',width: 0,- render: (_, definition) => (- <div className="flex gap-1 justify-end">- <LemonButton- size="small"- icon={<IconPencil />}- tooltip="Edit"- onClick={() => openEditModal(definition)}- disabledReason={restrictionReason}- />- <LemonButton- size="small"- status="danger"- icon={<IconTrash />}- tooltip="Delete"- onClick={() => confirmDelete(definition)}- disabledReason={restrictionReason}- />- </div>- ),+ render: (_, definition) => {+ const canonicalReason = definition.is_canonical+ ? "PostHog sets this property automatically, so it can't be edited or deleted."+ : undefined+ return (+ <div className="flex gap-1 justify-end">+ <LemonButton+ size="small"+ icon={<IconPencil />}+ tooltip="Edit"+ onClick={() => openEditModal(definition)}+ disabledReason={canonicalReason ?? restrictionReason}+ />+ <LemonButton+ size="small"+ status="danger"+ icon={<IconTrash />}+ tooltip="Delete"+ onClick={() => confirmDelete(definition)}+ disabledReason={canonicalReason ?? restrictionReason}+ />+ </div>+ )+ },},]@@ -157,12 +175,23 @@ export function CustomPropertiesConfig(): JSX.Element {New custom property</LemonButton></div>+ <LemonInput+ type="search"+ placeholder="Search custom properties"+ value={searchTerm}+ onChange={setSearchTerm}+ className="max-w-80"+ /><LemonTablecolumns={columns}- dataSource={definitions}+ dataSource={filteredDefinitions}loading={definitionsLoading}rowKey="id"- emptyState="No custom properties yet. Create one to get started."+ emptyState={+ searchTerm+ ? 'No custom properties match your search.'+ : 'No custom properties yet. Create one to get started.'+ }/><CustomPropertyModal /></div>diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertyModal.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertyModal.tsxindex 253be8057c57..86c134e22aaa 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertyModal.tsx+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertyModal.tsx@@ -383,8 +383,6 @@ export function CustomPropertyModal(): JSX.Element {const profileTargetAvailable = !!featureFlags[FEATURE_FLAGS.WAREHOUSE_PERSON_PROPERTIES] || isProfileTargetconst hasExistingSource = !!editingDefinition?.sourceconst noViews = !savedQueriesLoading && materializedViews.length === 0- const isCanonical = !!editingDefinition?.is_canonical- const canonicalReason = 'PostHog sets this property automatically, so its name and type are fixed.'// While a workflow references the property it stays workflow-sourced no matter what is picked// here, so the other options are locked until it's removed from the workflow(s).@@ -448,8 +446,8 @@ export function CustomPropertyModal(): JSX.Element {enableFormOnSubmitclassName="flex flex-col gap-4">- <LemonField name="name" label="Name" help={isCanonical ? canonicalReason : undefined}>- <LemonInput placeholder="e.g. ARR" autoFocus={!isCanonical} disabled={isCanonical} />+ <LemonField name="name" label="Name">+ <LemonInput placeholder="e.g. ARR" autoFocus /></LemonField><LemonField name="description" label="Description"><LemonTextArea placeholder="Optional description" minRows={2} />@@ -479,12 +477,8 @@ export function CustomPropertyModal(): JSX.Element {person property is a raw $set value, so these are account-only. */}{targetType === 'account' && (<>- <LemonField name="displayType" label="Type" help={isCanonical ? canonicalReason : undefined}>- <LemonSelect- options={DISPLAY_TYPE_OPTIONS}- fullWidth- disabledReason={isCanonical ? canonicalReason : undefined}- />+ <LemonField name="displayType" label="Type">+ <LemonSelect options={DISPLAY_TYPE_OPTIONS} fullWidth /></LemonField>{showBigNumberSwitch && (<LemonField name="isBigNumber">diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.ts b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.tsindex c27208a06f02..8e488f1baaa3 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.ts+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.ts@@ -189,6 +189,7 @@ export interface customPropertyDefinitionsLogicValues {definitionsLoading: booleaneditingDefinition: CustomPropertyDefinitionApi | nulleditingReferences: readonly CustomPropertyReferenceApi[]+ filteredDefinitions: CustomPropertyDefinitionApi[]isCustomPropertyFormSubmitting: booleanisCustomPropertyFormValid: booleanmaterializedViews: DataWarehouseSavedQuery[]@@ -201,6 +202,7 @@ export interface customPropertyDefinitionsLogicValues {runsLoadingBySourceId: Record<string, boolean>savedQueries: DataWarehouseSavedQuery[]savedQueriesLoading: boolean+ searchTerm: stringselectedSourceColumns: string[]selectedTableColumns: WarehouseColumn[]selectedTableColumnsLoading: boolean@@ -390,6 +392,9 @@ export interface customPropertyDefinitionsLogicActions {setEditingDefinition: (definition: CustomPropertyDefinitionApi) => {definition: CustomPropertyDefinitionApi}+ setSearchTerm: (searchTerm: string) => {+ searchTerm: string+ }submitCustomPropertyForm: () => {value: boolean}@@ -435,6 +440,10 @@ export interface customPropertyDefinitionsLogicMeta {customPropertyForm: CustomPropertyFormValues,personPropertyDefinitions: PropertyDefinition[]) => (string | null)[]+ filteredDefinitions: (+ definitions: CustomPropertyDefinitionApi[],+ searchTerm: string+ ) => CustomPropertyDefinitionApi[]editingReferences: (definitions: CustomPropertyDefinitionApi[],editingDefinition: CustomPropertyDefinitionApi | null@@ -473,6 +482,7 @@ export const customPropertyDefinitionsLogic = kea<customPropertyDefinitionsLogic}),openEditModal: (definition: CustomPropertyDefinitionApi) => ({ definition }),closeModal: true,+ setSearchTerm: (searchTerm: string) => ({ searchTerm }),setEditingDefinition: (definition: CustomPropertyDefinitionApi) => ({ definition }),// Person sources only. triggerSync re-runs the underlying warehouse sync; triggerBackfill// starts a full-table backfill. add/removeTriggeringSource drive the per-row double-submit@@ -494,6 +504,12 @@ export const customPropertyDefinitionsLogic = kea<customPropertyDefinitionsLogicpollRunsStatus: ({ sourceId }: { sourceId: string }) => ({ sourceId }),}),reducers({+ searchTerm: [+ '',+ {+ setSearchTerm: (_, { searchTerm }) => searchTerm,+ },+ ],modalVisible: [false,{@@ -868,6 +884,20 @@ export const customPropertyDefinitionsLogic = kea<customPropertyDefinitionsLogic})},],+ filteredDefinitions: [+ (s) => [s.definitions, s.searchTerm],+ (definitions: CustomPropertyDefinitionApi[], searchTerm: string): CustomPropertyDefinitionApi[] => {+ const query = searchTerm.trim().toLowerCase()+ if (!query) {+ return definitions+ }+ return definitions.filter(+ (definition) =>+ definition.name.toLowerCase().includes(query) ||+ definition.description?.toLowerCase().includes(query)+ )+ },+ ],editingReferences: [(s) => [s.definitions, s.editingDefinition],(diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 8b411e44ab5b..a1a3410a1952 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -143,7 +143,7 @@ export namespace Schemas {} as const;/**- * Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link). Defaults to an empty object. Unknown keys are rejected.+ * Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link). Defaults to an empty object. Unknown keys are rejected.* @nullable*/export type AccountProperties = {@@ -176,6 +176,8 @@ export namespace Schemas {slack_channel_id?: string | null;/** @nullable */usage_dashboard_link?: string | null;+ /** @nullable */+ metabase_link?: string | null;} | null;/**@@ -209,7 +211,7 @@ export namespace Schemas {*/external_id?: string | null;/**- * Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link). Defaults to an empty object. Unknown keys are rejected.+ * Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link). Defaults to an empty object. Unknown keys are rejected.* @nullable*/properties?: AccountProperties;@@ -49141,7 +49143,7 @@ export namespace Schemas {}/**- * Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link). Defaults to an empty object. Unknown keys are rejected.+ * Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link). Defaults to an empty object. Unknown keys are rejected.* @nullable*/export type PatchedAccountProperties = {@@ -49174,6 +49176,8 @@ export namespace Schemas {slack_channel_id?: string | null;/** @nullable */usage_dashboard_link?: string | null;+ /** @nullable */+ metabase_link?: string | null;} | null;/**@@ -49193,7 +49197,7 @@ export namespace Schemas {*/external_id?: string | null;/**- * Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link). Defaults to an empty object. Unknown keys are rejected.+ * Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link). Defaults to an empty object. Unknown keys are rejected.* @nullable*/properties?: PatchedAccountProperties;diff --git a/services/mcp/src/generated/customer_analytics/api.ts b/services/mcp/src/generated/customer_analytics/api.tsindex 41376d7f8ca3..6410ab6ce261 100644--- a/services/mcp/src/generated/customer_analytics/api.ts+++ b/services/mcp/src/generated/customer_analytics/api.ts@@ -188,10 +188,11 @@ export const AccountsCreateBody = /* @__PURE__ */ zodzendesk_id: zod.string().nullish(),slack_channel_id: zod.string().nullish(),usage_dashboard_link: zod.string().nullish(),+ metabase_link: zod.string().nullish(),}).nullish().describe(- 'Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link). Defaults to an empty object. Unknown keys are rejected.'+ 'Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link). Defaults to an empty object. Unknown keys are rejected.'),tags: zod.array(zod.string())@@ -400,10 +401,11 @@ export const AccountsPartialUpdateBody = /* @__PURE__ */ zodzendesk_id: zod.string().nullish(),slack_channel_id: zod.string().nullish(),usage_dashboard_link: zod.string().nullish(),+ metabase_link: zod.string().nullish(),}).nullish().describe(- 'Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link). Defaults to an empty object. Unknown keys are rejected.'+ 'Typed account properties: assignment fields (csm, account_executive, account_owner) and external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link). Defaults to an empty object. Unknown keys are rejected.'),tags: zod.array(zod.string())