: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): let users pin account list column fields (#113083)
Christophe Eynius Tranbergb9a5b81c3451
diff --git a/docs/internal/customer-analytics/account-sidebar.md b/docs/internal/customer-analytics/account-sidebar.mdindex 3db1e6db6807..3b33b0cfc1dc 100644--- a/docs/internal/customer-analytics/account-sidebar.md+++ b/docs/internal/customer-analytics/account-sidebar.md@@ -1,6 +1,8 @@# Account detail sidebar properties-Each user can pin up to 50 account custom properties and relationships in their project.+Each user can pin up to 50 account custom properties, relationships, and account fields in their project.+You can pin any account field that the Accounts list offers as a column, such as the Stripe customer ID or the external ID.+Account fields show the account's value read-only. Use the account editor to change them.When `customer-analytics-account-scene` is enabled, the Accounts list also shows these pins in expanded rows.The left arrow expands or collapses the row. The account name opens account details.Expanded pins use the same Properties section and editable fields as the account sidebar.diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex f5c4592e76ef..799e106c3b57 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -9815,9 +9815,9 @@ snapshots:scenes-app-customer-analytics-account-detail-property-sidebar--empty--light:hash: v1.k794b7964.80932bda346697628be7627a1729c3fe6a5c860637dc9626bae39febdc22d3f5.tl_7hj4nr98S-dkzOcAIA7Cs4z6guQG7lR1IvbzsJgQscenes-app-customer-analytics-account-detail-property-sidebar--filled-and-scrollable--dark:- hash: v1.k794b7964.980a541d7fe7ee4cc8c3b9e379a8ef99e01e884823f734a2808d0d0152a1dd9f.hO8zv0Jb4416z9TNPYX8ZxlTbmzzoUwTI4q9zqh0m7I+ hash: v1.k794b7964.8684b9ee8561ab102196604612a7ecc4cbdd819b5f304d5d2cfbeeca3ba94b59.LCA9oBvZh7PC-TjEwZhSdQKp7X7XDZEUZZeKU_gpQ-Mscenes-app-customer-analytics-account-detail-property-sidebar--filled-and-scrollable--light:- hash: v1.k794b7964.4cb1c71c618a561dd35082a8c685a62ac9c40cab6a5e8d249937ea64e37d28a6.Rzc55hZFRDXwU0LRAXI4J0Etb5dI2HbSCljBV-Ra_Ho+ hash: v1.k794b7964.b4fd3e35312516759bc693ffec2376a932428da822e108072b899758a3d028f5.P_WCJW0sh0yCw07554esFsqvEOuj013448Z_fZVZ6-4scenes-app-customer-analytics-account-detail-property-sidebar--pin-and-reorder--dark:hash: v1.k794b7964.ae32ab54e49606fc28e9a68b1274acc5193d58e55a144e66a36de73ed5352687.lFgL26WepIZ4NNnjQP38vqOEAleJXw1HwqLgjJqSvi4scenes-app-customer-analytics-account-detail-property-sidebar--pin-and-reorder--light:diff --git a/frontend/src/generated/core/api.schemas.ts b/frontend/src/generated/core/api.schemas.tsindex 6e96c245b32c..748eca53ef20 100644--- a/frontend/src/generated/core/api.schemas.ts+++ b/frontend/src/generated/core/api.schemas.ts@@ -1698,6 +1698,7 @@ export interface TeamMarketingAnalyticsConfigApi {/*** * `custom_property` - Custom property* * `relationship` - Relationship+ * * `account_field` - Account field*/export type AccountPropertyPinKindEnumApi =(typeof AccountPropertyPinKindEnumApi)[keyof typeof AccountPropertyPinKindEnumApi]@@ -1705,15 +1706,20 @@ export type AccountPropertyPinKindEnumApi =export const AccountPropertyPinKindEnumApi = {CustomProperty: 'custom_property',Relationship: 'relationship',+ AccountField: 'account_field',} as constexport interface TeamCustomerAnalyticsPinnedAccountPropertyApi {- /** Definition type for this default pinned account property.+ /** Type of this default pinned account property: a custom property, a relationship, or a built-in account field.** * `custom_property` - Custom property- * * `relationship` - Relationship */+ * * `relationship` - Relationship+ * * `account_field` - Account field */kind: AccountPropertyPinKindEnumApi- /** Project-scoped custom property or relationship definition UUID. */+ /**+ * Project-scoped custom property or relationship definition UUID. For an account_field pin, the account field name, such as stripe_customer_id.+ * @maxLength 64+ */id: string}diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.jsonindex 4c70ace4a388..48631b5fc07e 100644--- a/frontend/src/queries/schema.json+++ b/frontend/src/queries/schema.json@@ -18582,7 +18582,7 @@"type": "string"},"kind": {- "enum": ["custom_property", "relationship"],+ "enum": ["custom_property", "relationship", "account_field"],"type": "string"}},diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.tsindex 0322725b54d6..82ebb44b42b2 100644--- a/frontend/src/queries/schema/schema-general.ts+++ b/frontend/src/queries/schema/schema-general.ts@@ -9109,7 +9109,7 @@ export interface EndpointsUsageTrendsQuery extends EndpointsUsageQueryBase<Endpo}export interface CustomerAnalyticsPinnedProperty {- kind: 'custom_property' | 'relationship'+ kind: 'custom_property' | 'relationship' | 'account_field'id: string}diff --git a/posthog/api/team/team_config.py b/posthog/api/team/team_config.pyindex cc9f6d120dfb..4dc308f91d24 100644--- a/posthog/api/team/team_config.py+++ b/posthog/api/team/team_config.py@@ -460,9 +460,18 @@ class TeamFeatureFlagPolicyConfigSerializer(serializers.ModelSerializer, UserAccclass TeamCustomerAnalyticsPinnedAccountPropertySerializer(serializers.Serializer):kind = serializers.ChoiceField(choices=AccountPropertyPinKind.choices,- help_text="Definition type for this default pinned account property.",+ help_text=(+ "Type of this default pinned account property: a custom property, a relationship, "+ "or a built-in account field."+ ),+ )+ id = serializers.CharField(+ max_length=64,+ help_text=(+ "Project-scoped custom property or relationship definition UUID. "+ "For an account_field pin, the account field name, such as stripe_customer_id."+ ),)- id = serializers.UUIDField(help_text="Project-scoped custom property or relationship definition UUID.")class Meta:ref_name = "TeamCustomerAnalyticsPinnedAccountProperty"@@ -525,12 +534,13 @@ class TeamCustomerAnalyticsConfigSerializer(serializers.ModelSerializer, UserAccdef validate_default_pinned_properties(self, value: list[dict[str, Any]]) -> list[dict[str, Any]]:if self.instance is None:return value- pinned_properties = [PinnedAccountProperty(kind=reference["kind"], id=reference["id"]) for reference in value]try:- validate_pinned_account_properties(+ pinned_properties = validate_pinned_account_properties(team_id=self.instance.team_id,- pinned_properties=pinned_properties,+ pinned_properties=[+ PinnedAccountProperty(kind=reference["kind"], id=reference["id"]) for reference in value+ ],)except InvalidPinnedAccountProperties as error:raise serializers.ValidationError(error.errors)- return [{"kind": reference["kind"], "id": str(reference["id"])} for reference in value]+ return [{"kind": reference.kind, "id": reference.id} for reference in pinned_properties]diff --git a/posthog/api/test/test_project.py b/posthog/api/test/test_project.pyindex b4e79b404842..0db6612dfe53 100644--- a/posthog/api/test/test_project.py+++ b/posthog/api/test/test_project.py@@ -1391,7 +1391,10 @@ class TestProjectAPI(team_api_test_factory()): # type: ignoreformat="json",)self.assertEqual(definition_response.status_code, status.HTTP_201_CREATED, definition_response.json())- default_pins = [{"kind": "custom_property", "id": definition_response.json()["id"]}]+ default_pins = [+ {"kind": "custom_property", "id": definition_response.json()["id"]},+ {"kind": "account_field", "id": "stripe_customer_id"},+ ]response = self.client.patch(f"/api/projects/{self.project.id}/",diff --git a/posthog/schema_enums.py b/posthog/schema_enums.pyindex b85ef25f1e97..ec165842e686 100644--- a/posthog/schema_enums.py+++ b/posthog/schema_enums.py@@ -1080,6 +1080,7 @@ class CustomChannelOperator(StrEnum):class Kind(StrEnum):CUSTOM_PROPERTY = "custom_property"RELATIONSHIP = "relationship"+ ACCOUNT_FIELD = "account_field"class DataColorToken(StrEnum):diff --git a/products/customer_analytics/backend/facade/account_property_pins.py b/products/customer_analytics/backend/facade/account_property_pins.pyindex 94f214c55235..199465c8a0ea 100644--- a/products/customer_analytics/backend/facade/account_property_pins.py+++ b/products/customer_analytics/backend/facade/account_property_pins.py@@ -1,15 +1,26 @@from collections.abc import Sequence+from typing import cast-from products.customer_analytics.backend.facade.contracts import InvalidPinnedAccountProperties, PinnedAccountProperty+from products.customer_analytics.backend.facade.contracts import (+ InvalidPinnedAccountProperties,+ PinnedAccountProperty,+ PinnedAccountPropertyKind,+)from products.customer_analytics.backend.facade.enums import AccountPropertyPinKindfrom products.customer_analytics.backend.logic.account_property_pins import validate_pinned_properties-def validate_pinned_account_properties(*, team_id: int, pinned_properties: Sequence[PinnedAccountProperty]) -> None:- validate_pinned_properties(+def validate_pinned_account_properties(+ *, team_id: int, pinned_properties: Sequence[PinnedAccountProperty]+) -> list[PinnedAccountProperty]:+ references = validate_pinned_properties(team_id=team_id,references=[(AccountPropertyPinKind(reference.kind), reference.id) for reference in pinned_properties],)+ return [+ PinnedAccountProperty(kind=cast(PinnedAccountPropertyKind, kind.value), id=reference_id)+ for kind, reference_id in references+ ]__all__ = ["InvalidPinnedAccountProperties", "validate_pinned_account_properties"]diff --git a/products/customer_analytics/backend/facade/api.py b/products/customer_analytics/backend/facade/api.pyindex ce4a0e47487b..d91a6aefeddf 100644--- a/products/customer_analytics/backend/facade/api.py+++ b/products/customer_analytics/backend/facade/api.py@@ -1362,8 +1362,8 @@ def _to_user_customer_analytics_config(return contracts.UserCustomerAnalyticsConfig(pinned_properties=[contracts.PinnedAccountProperty(- kind=cast(Literal["custom_property", "relationship"], reference["kind"]),- id=UUID(str(reference["id"])),+ kind=cast(contracts.PinnedAccountPropertyKind, reference["kind"]),+ id=str(reference["id"]),)for reference in raw_references],diff --git a/products/customer_analytics/backend/facade/contracts.py b/products/customer_analytics/backend/facade/contracts.pyindex b3fc486cf229..8a6e2caa40ec 100644--- a/products/customer_analytics/backend/facade/contracts.py+++ b/products/customer_analytics/backend/facade/contracts.py@@ -53,10 +53,14 @@ class AccountRelationshipDefinition:is_controlled: bool = False+PinnedAccountPropertyKind = Literal["custom_property", "relationship", "account_field"]++@dataclass(frozen=True)class PinnedAccountProperty:- kind: Literal["custom_property", "relationship"]- id: UUID+ kind: PinnedAccountPropertyKind+ # A definition UUID for custom properties and relationships, or a field name for account fields.+ id: strclass InvalidPinnedAccountProperties(ValueError):diff --git a/products/customer_analytics/backend/facade/enums.py b/products/customer_analytics/backend/facade/enums.pyindex 4e60727b1c3b..a85816329b0e 100644--- a/products/customer_analytics/backend/facade/enums.py+++ b/products/customer_analytics/backend/facade/enums.py@@ -4,6 +4,7 @@ from posthog.enums import LabeledStrEnumclass AccountPropertyPinKind(LabeledStrEnum):CUSTOM_PROPERTY = "custom_property", "Custom property"RELATIONSHIP = "relationship", "Relationship"+ ACCOUNT_FIELD = "account_field", "Account field"# Mirrors OPTION_COLOR_TOKENS in the frontend's customPropertyTypes.ts (DataColorToken presets).diff --git a/products/customer_analytics/backend/logic/account_property_pins.py b/products/customer_analytics/backend/logic/account_property_pins.pyindex f45595393a63..503dfb37e09d 100644--- a/products/customer_analytics/backend/logic/account_property_pins.py+++ b/products/customer_analytics/backend/logic/account_property_pins.py@@ -3,7 +3,7 @@ from uuid import UUIDfrom posthog.models.scoping.manager import resolve_effective_team_id-from products.customer_analytics.backend.facade.contracts import InvalidPinnedAccountProperties+from products.customer_analytics.backend.facade.contracts import AccountTableField, InvalidPinnedAccountPropertiesfrom products.customer_analytics.backend.facade.enums import AccountPropertyPinKindfrom products.customer_analytics.backend.models import (AccountRelationshipDefinition,@@ -12,22 +12,42 @@ from products.customer_analytics.backend.models import ()MAX_PINNED_PROPERTIES = 50+# Every native field the accounts list offers as a column can also be pinned.+PINNABLE_ACCOUNT_FIELDS = frozenset(field.value for field in AccountTableField)-def validate_pinned_properties(*, team_id: int, references: Sequence[tuple[AccountPropertyPinKind, UUID]]) -> None:+def _parse_definition_id(reference_id: str) -> UUID | None:+ try:+ return UUID(reference_id)+ except ValueError:+ return None+++def validate_pinned_properties(+ *, team_id: int, references: Sequence[tuple[AccountPropertyPinKind, str]]+) -> list[tuple[AccountPropertyPinKind, str]]:+ """Validate the references and return them with definition UUIDs in canonical form."""if len(references) > MAX_PINNED_PROPERTIES:raise InvalidPinnedAccountProperties([f"Pin at most {MAX_PINNED_PROPERTIES} account properties."])+ definition_ids: dict[int, UUID] = {}+ normalized: list[tuple[AccountPropertyPinKind, str]] = []+ for index, (kind, reference_id) in enumerate(references):+ definition_id = None if kind == AccountPropertyPinKind.ACCOUNT_FIELD else _parse_definition_id(reference_id)+ if definition_id is not None:+ definition_ids[index] = definition_id+ normalized.append((kind, str(definition_id) if definition_id is not None else reference_id))+errors: list[str] = []- first_index_by_reference: dict[tuple[AccountPropertyPinKind, UUID], int] = {}- for index, reference in enumerate(references):+ first_index_by_reference: dict[tuple[AccountPropertyPinKind, str], int] = {}+ for index, reference in enumerate(normalized):if reference in first_index_by_reference:errors.append(f"Item {index + 1} duplicates item {first_index_by_reference[reference] + 1}.")else:first_index_by_reference[reference] = indexcanonical_team_id = resolve_effective_team_id(team_id)- referenced_ids = {definition_id for _, definition_id in references}+ referenced_ids = set(definition_ids.values())custom_property_targets = dict(CustomPropertyDefinition.objects.for_team(canonical_team_id).filter(id__in=referenced_ids)@@ -39,9 +59,16 @@ def validate_pinned_properties(*, team_id: int, references: Sequence[tuple[Accou.values_list("id", flat=True))- for index, (kind, definition_id) in enumerate(references):+ for index, (kind, reference_id) in enumerate(normalized):item = index + 1- if kind == AccountPropertyPinKind.CUSTOM_PROPERTY:+ if kind == AccountPropertyPinKind.ACCOUNT_FIELD:+ if reference_id not in PINNABLE_ACCOUNT_FIELDS:+ errors.append(f"Item {item} is not an account field that can be pinned.")+ continue+ definition_id = definition_ids.get(index)+ if definition_id is None:+ errors.append(f"Item {item} must reference a definition by UUID.")+ elif kind == AccountPropertyPinKind.CUSTOM_PROPERTY:target_type = custom_property_targets.get(definition_id)if target_type is not None:if target_type != TargetType.ACCOUNT.value:@@ -59,3 +86,4 @@ def validate_pinned_properties(*, team_id: int, references: Sequence[tuple[Accouif errors:raise InvalidPinnedAccountProperties(errors)+ return normalizeddiff --git a/products/customer_analytics/backend/logic/user_customer_analytics_config.py b/products/customer_analytics/backend/logic/user_customer_analytics_config.pyindex b1531563a1d3..706a1cc22686 100644--- a/products/customer_analytics/backend/logic/user_customer_analytics_config.py+++ b/products/customer_analytics/backend/logic/user_customer_analytics_config.py@@ -66,17 +66,21 @@ def get_or_create_config(*, team_id: int, user_id: int) -> UserCustomerAnalytics@transaction.atomicdef update_pinned_properties(- *, team_id: int, user_id: int, references: Sequence[tuple[AccountPropertyPinKind, UUID]]+ *, team_id: int, user_id: int, references: Sequence[tuple[AccountPropertyPinKind, str]]) -> UserCustomerAnalyticsConfig:- validate_pinned_properties(team_id=team_id, references=references)+ validated_references = validate_pinned_properties(team_id=team_id, references=references)config = get_or_create_config(team_id=team_id, user_id=user_id)config.properties = {**config.properties,- PINNED_PROPERTIES_KEY: [{"kind": kind.value, "id": str(definition_id)} for kind, definition_id in references],+ PINNED_PROPERTIES_KEY: [+ {"kind": kind.value, "id": reference_id} for kind, reference_id in validated_references+ ],PINNED_PROPERTIES_OVERRIDE_KEY: True,}config.pinned_custom_property_definition_ids = [- definition_id for kind, definition_id in references if kind == AccountPropertyPinKind.CUSTOM_PROPERTY+ UUID(reference_id)+ for kind, reference_id in validated_references+ if kind == AccountPropertyPinKind.CUSTOM_PROPERTY]config.save(update_fields=["properties", "pinned_custom_property_definition_ids", "updated_at"])return configdiff --git a/products/customer_analytics/backend/presentation/views/serializers.py b/products/customer_analytics/backend/presentation/views/serializers.pyindex 2c35fc1f33eb..8cc2aac0a0fd 100644--- a/products/customer_analytics/backend/presentation/views/serializers.py+++ b/products/customer_analytics/backend/presentation/views/serializers.py@@ -2245,10 +2245,14 @@ class CustomPropertyValueSuggestionsResponseSerializer(serializers.Serializer):class PinnedAccountPropertySerializer(serializers.Serializer):kind = serializers.ChoiceField(choices=AccountPropertyPinKind.choices,- help_text="Definition type for this pinned account property.",+ help_text="Type of this pinned account property: a custom property, a relationship, or a built-in account field.",)- id = serializers.UUIDField(- help_text="Team-scoped custom property or relationship definition UUID.",+ id = serializers.CharField(+ max_length=64,+ help_text=(+ "Team-scoped custom property or relationship definition UUID. "+ "For an account_field pin, the account field name, such as stripe_customer_id."+ ),)diff --git a/products/customer_analytics/backend/presentation/views/views.py b/products/customer_analytics/backend/presentation/views/views.pyindex 92665bcdc905..52b6c0f8300c 100644--- a/products/customer_analytics/backend/presentation/views/views.py+++ b/products/customer_analytics/backend/presentation/views/views.py@@ -1128,7 +1128,7 @@ class UserCustomerAnalyticsConfigViewSet(TeamAndOrgViewSetMixin, viewsets.Generi"Replace the requesting user's ordered account sidebar properties when pinned_properties is provided, ""and change the task digest email preferences when task_digest is provided. ""Anything omitted keeps its current value. "- "At most 50 account custom properties and relationships can be pinned."+ "At most 50 account custom properties, relationships, and account fields can be pinned."),)def partial_update(self, request: ValidatedRequest, *args: Any, **kwargs: Any) -> Response:diff --git a/products/customer_analytics/backend/test/test_user_customer_analytics_config_api.py b/products/customer_analytics/backend/test/test_user_customer_analytics_config_api.pyindex 7b0350ae25fb..cbeb483b7d8a 100644--- a/products/customer_analytics/backend/test/test_user_customer_analytics_config_api.py+++ b/products/customer_analytics/backend/test/test_user_customer_analytics_config_api.py@@ -142,7 +142,9 @@ class TestUserCustomerAnalyticsConfigAPI(APIBaseTest):second_custom = self._custom_property()pinned_properties = [{"kind": "custom_property", "id": str(first_custom.id)},+ {"kind": "account_field", "id": "stripe_customer_id"},{"kind": "relationship", "id": str(relationship.id)},+ {"kind": "account_field", "id": "created_at"},{"kind": "custom_property", "id": str(second_custom.id)},]@@ -344,6 +346,13 @@ class TestUserCustomerAnalyticsConfigAPI(APIBaseTest):valid_reference = {"kind": "custom_property", "id": str(valid_custom.id)}cases = [("duplicates", [valid_reference, valid_reference], "duplicates"),+ (+ "duplicates in another UUID case",+ [valid_reference, {"kind": "custom_property", "id": str(valid_custom.id).upper()}],+ "duplicates",+ ),+ ("unknown account field", [{"kind": "account_field", "id": "not_a_column"}], "account field"),+ ("account field as custom", [{"kind": "custom_property", "id": "stripe_customer_id"}], "UUID"),("wrong target", [{"kind": "custom_property", "id": str(person_custom.id)}], "account property"),("relationship as custom", [{"kind": "custom_property", "id": str(relationship.id)}], "relationship"),("custom as relationship", [{"kind": "relationship", "id": str(valid_custom.id)}], "custom property"),diff --git a/products/customer_analytics/frontend/components/Accounts/AGENTS.md b/products/customer_analytics/frontend/components/Accounts/AGENTS.mdindex 1ddc6d4cc219..5dd35e9bb213 100644--- a/products/customer_analytics/frontend/components/Accounts/AGENTS.md+++ b/products/customer_analytics/frontend/components/Accounts/AGENTS.md@@ -173,9 +173,9 @@ The view-only Properties component stores ordered custom-property, relationship,`accountPropertyUpdatesLogic` broadcasts native account updates and refreshes mounted Relationships tiles.`accountNativeProperties.updateAccountNativeProperties` shares the account modal's fresh-read merge and serializes local modal and widget saves.See [Account sidebar properties](../../../../../docs/internal/customer-analytics/account-sidebar.md) when changing property editors, view selections, or refresh behavior.-The configuration is one ordered list containing both account custom-property and relationship references. Definitions load across every API page, account custom properties are filtered by target, and the shared limit is 50. Missing definitions remain visible as a stale warning; opening the configurator omits them from its draft, so the next save cleans them up.+The configuration is one ordered list containing account custom-property, relationship, and account-field references. Account fields are the native fields the list offers as columns: `PINNABLE_ACCOUNT_FIELDS` derives from `ACCOUNT_FIELD_TAXONOMIC_OPTIONS`, and the backend accepts every `AccountTableField`, so a new column field is pinnable with no extra change. Their values come read-only from the account in `accountPropertyDataLogic`, which the sidebar loads only while an account field is pinned. Definitions load across every API page, account custom properties are filtered by target, and the shared limit is 50. Missing definitions remain visible as a stale warning; opening the configurator omits them from its draft, so the next save cleans them up.The empty Properties state uses the hedgehog and primary **Pin properties** action, with no gear. Once at least one reference is pinned, the gear opens the same configurator.-Property reference keys at the component boundary are namespaced as `custom:<uuid>` and `relationship:<uuid>`; persistence maps custom keys back to the API's `custom_property` kind.+Property reference keys at the component boundary are namespaced as `custom:<uuid>`, `relationship:<uuid>`, and `field:<name>`; persistence maps custom and field keys back to the API's `custom_property` and `account_field` kinds.`accountSidebarPropertiesLogic({ projectId, accountId })` loads current custom values and relationship assignments, resolves them in pin order, and owns inline editing. Resource-level Customer analytics editors can change manual/workflow values and relationships; canonical and warehouse-backed rows are read-only.Clearing posts a null custom value and preserves history. Relationship removals end assignments; single-holder replacements let the server end the previous holder. Multi-holder retries reload current assignments to avoid duplicating a partially completed save. Failed saves keep the draft open.Sidebar saves refresh the mounted Relationships tab and account-list data nodes. Tab relationship reloads also refresh sidebar values. See `docs/internal/customer-analytics/account-sidebar.md` for the behavior and API contract.diff --git a/products/customer_analytics/frontend/generated/api.schemas.ts b/products/customer_analytics/frontend/generated/api.schemas.tsindex bc511e2ddd39..928df43d0c55 100644--- a/products/customer_analytics/frontend/generated/api.schemas.ts+++ b/products/customer_analytics/frontend/generated/api.schemas.ts@@ -4646,6 +4646,7 @@ export interface PatchedGroupUsageMetricApi {/*** * `custom_property` - Custom property* * `relationship` - Relationship+ * * `account_field` - Account field*/export type AccountPropertyPinKindEnumApi =(typeof AccountPropertyPinKindEnumApi)[keyof typeof AccountPropertyPinKindEnumApi]@@ -4653,15 +4654,20 @@ export type AccountPropertyPinKindEnumApi =export const AccountPropertyPinKindEnumApi = {CustomProperty: 'custom_property',Relationship: 'relationship',+ AccountField: 'account_field',} as constexport interface PinnedAccountPropertyApi {- /** Definition type for this pinned account property.+ /** Type of this pinned account property: a custom property, a relationship, or a built-in account field.** * `custom_property` - Custom property- * * `relationship` - Relationship */+ * * `relationship` - Relationship+ * * `account_field` - Account field */kind: AccountPropertyPinKindEnumApi- /** Team-scoped custom property or relationship definition UUID. */+ /**+ * Team-scoped custom property or relationship definition UUID. For an account_field pin, the account field name, such as stripe_customer_id.+ * @maxLength 64+ */id: string}diff --git a/products/customer_analytics/frontend/generated/api.ts b/products/customer_analytics/frontend/generated/api.tsindex 2f017b875248..f4b519a9c53d 100644--- a/products/customer_analytics/frontend/generated/api.ts+++ b/products/customer_analytics/frontend/generated/api.ts@@ -2712,7 +2712,7 @@ export const getUserCustomerAnalyticsConfigPartialUpdateUrl = (projectId: string}/**- * Replace the requesting user's ordered account sidebar properties when pinned_properties is provided, and change the task digest email preferences when task_digest is provided. Anything omitted keeps its current value. At most 50 account custom properties and relationships can be pinned.+ * Replace the requesting user's ordered account sidebar properties when pinned_properties is provided, and change the task digest email preferences when task_digest is provided. Anything omitted keeps its current value. At most 50 account custom properties, relationships, and account fields can be pinned.* @summary Update account sidebar configuration*/export const userCustomerAnalyticsConfigPartialUpdate = async (diff --git a/products/customer_analytics/frontend/generated/api.zod.ts b/products/customer_analytics/frontend/generated/api.zod.tsindex f639e709bd99..1debc1c0d88a 100644--- a/products/customer_analytics/frontend/generated/api.zod.ts+++ b/products/customer_analytics/frontend/generated/api.zod.ts@@ -1894,20 +1894,29 @@ export const GroupsTypesMetricsPartialUpdateBody = /* @__PURE__ */ zod.object({})/**- * Replace the requesting user's ordered account sidebar properties when pinned_properties is provided, and change the task digest email preferences when task_digest is provided. Anything omitted keeps its current value. At most 50 account custom properties and relationships can be pinned.+ * Replace the requesting user's ordered account sidebar properties when pinned_properties is provided, and change the task digest email preferences when task_digest is provided. Anything omitted keeps its current value. At most 50 account custom properties, relationships, and account fields can be pinned.* @summary Update account sidebar configuration*/+export const userCustomerAnalyticsConfigPartialUpdateBodyPinnedPropertiesItemIdMax = 64+export const UserCustomerAnalyticsConfigPartialUpdateBody = /* @__PURE__ */ zod.object({pinned_properties: zod.array(zod.object({kind: zod- .enum(['custom_property', 'relationship'])- .describe('\* `custom_property` - Custom property\n\* `relationship` - Relationship')+ .enum(['custom_property', 'relationship', 'account_field'])+ .describe(+ '\* `custom_property` - Custom property\n\* `relationship` - Relationship\n\* `account_field` - Account field'+ )+ .describe(+ 'Type of this pinned account property: a custom property, a relationship, or a built-in account field.\n\n\* `custom_property` - Custom property\n\* `relationship` - Relationship\n\* `account_field` - Account field'+ ),+ id: zod+ .string()+ .max(userCustomerAnalyticsConfigPartialUpdateBodyPinnedPropertiesItemIdMax).describe(- 'Definition type for this pinned account property.\n\n\* `custom_property` - Custom property\n\* `relationship` - Relationship'+ 'Team-scoped custom property or relationship definition UUID. For an account_field pin, the account field name, such as stripe_customer_id.'),- id: zod.uuid().describe('Team-scoped custom property or relationship definition UUID.'),})).optional()diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarConfigLogic.test.ts b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarConfigLogic.test.tsindex 5295231412e4..ae07a348321c 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarConfigLogic.test.ts+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarConfigLogic.test.ts@@ -102,16 +102,21 @@ describe('accountSidebarConfigLogic', () => {expect(pinnedPropertyToConfiguratorKey({ kind: 'relationship', id: 'shared-id' })).toBe('relationship:shared-id')+ expect(pinnedPropertyToConfiguratorKey({ kind: 'account_field', id: 'stripe_customer_id' })).toBe(+ 'field:stripe_customer_id'+ )expect(configuratorKeysToPinnedProperties(['relationship:relationship-1','custom:custom-1',+ 'field:stripe_customer_id','unknown:ignored','custom:',])).toEqual([{ kind: 'relationship', id: 'relationship-1' },{ kind: 'custom_property', id: 'custom-1' },+ { kind: 'account_field', id: 'stripe_customer_id' },])})@@ -184,8 +189,10 @@ describe('accountSidebarConfigLogic', () => {defaultMocks({pinned_properties: [{ kind: 'custom_property', id: 'custom-1' },+ { kind: 'account_field', id: 'stripe_customer_id' },{ kind: 'relationship', id: 'relationship-1' },{ kind: 'custom_property', id: 'missing' },+ { kind: 'account_field', id: 'unknown_field' },],}))@@ -194,9 +201,13 @@ describe('accountSidebarConfigLogic', () => {expect(logic.values.resolvedPinnedProperties.map(({ reference }) => reference.id)).toEqual(['custom-1',+ 'stripe_customer_id','relationship-1',])- expect(logic.values.stalePinnedProperties).toEqual([{ kind: 'custom_property', id: 'missing' }])+ expect(logic.values.stalePinnedProperties).toEqual([+ { kind: 'custom_property', id: 'missing' },+ { kind: 'account_field', id: 'unknown_field' },+ ])})it('supports configure, toggle, reorder, cancel, and the 50-property limit', async () => {@@ -290,6 +301,7 @@ describe('accountSidebarConfigLogic', () => {pinned_count: 2,custom_property_count: 1,relationship_count: 1,+ account_field_count: 0,})})diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarConfigLogic.ts b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarConfigLogic.tsindex 61bd58de57e0..9775e3bf29e1 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarConfigLogic.ts+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarConfigLogic.ts@@ -23,7 +23,12 @@ import type {UserCustomerAnalyticsConfigApi,} from 'products/customer_analytics/frontend/generated/api.schemas'-import { MAX_PINNED_ACCOUNT_PROPERTIES } from './components/accountPropertyTypes'+import {+ AccountPropertyOption,+ MAX_PINNED_ACCOUNT_PROPERTIES,+ PINNABLE_ACCOUNT_FIELDS,+ PinnableAccountField,+} from './components/accountPropertyTypes'export { MAX_PINNED_ACCOUNT_PROPERTIES } from './components/accountPropertyTypes'const DEFINITION_PAGE_SIZE = 100@@ -47,6 +52,11 @@ export type ResolvedPinnedAccountProperty =reference: PinnedAccountPropertydefinition: AccountRelationshipDefinitionApi}+ | {+ kind: 'account_field'+ reference: PinnedAccountProperty+ field: PinnableAccountField+ }export interface AvailableDefinitions {customProperties: CustomPropertyDefinitionApi[]@@ -58,9 +68,14 @@ interface PinnedPropertyResolution {stale: PinnedAccountProperty[]}+const CONFIGURATOR_KEY_PREFIXES: Record<PinnedAccountProperty['kind'], string> = {+ custom_property: 'custom',+ relationship: 'relationship',+ account_field: 'field',+}+export function pinnedPropertyToConfiguratorKey(reference: PinnedAccountProperty): string {- const kind = reference.kind === 'custom_property' ? 'custom' : 'relationship'- return `${kind}:${reference.id}`+ return `${CONFIGURATOR_KEY_PREFIXES[reference.kind]}:${reference.id}`}export function configuratorKeysToPinnedProperties(keys: string[]): PinnedAccountProperty[] {@@ -77,10 +92,33 @@ export function configuratorKeysToPinnedProperties(keys: string[]): PinnedAccounif (kind === 'relationship') {return [{ kind: 'relationship', id }]}+ if (kind === 'field') {+ return [{ kind: 'account_field', id }]+ }return []})}+export function buildPinnedPropertyOptions(definitions: AvailableDefinitions): AccountPropertyOption[] {+ return [+ ...definitions.customProperties.map((definition) => ({+ key: pinnedPropertyToConfiguratorKey({ kind: 'custom_property', id: definition.id }),+ label: definition.name,+ kind: 'custom' as const,+ })),+ ...definitions.relationships.map((definition) => ({+ key: pinnedPropertyToConfiguratorKey({ kind: 'relationship', id: definition.id }),+ label: definition.name,+ kind: 'relationship' as const,+ })),+ ...PINNABLE_ACCOUNT_FIELDS.map((field) => ({+ key: pinnedPropertyToConfiguratorKey({ kind: 'account_field', id: field.key }),+ label: field.label,+ kind: 'account_field' as const,+ })),+ ]+}+const referenceKey = (reference: PinnedAccountProperty): string => `${reference.kind}:${reference.id}`const pinnedPropertiesEqual = (@@ -114,6 +152,9 @@ export const resolvePinnedProperties = (): PinnedPropertyResolution => {const customPropertiesById = new Map(definitions.customProperties.map((definition) => [definition.id, definition]))const relationshipsById = new Map(definitions.relationships.map((definition) => [definition.id, definition]))+ const accountFieldsByKey = new Map<string, PinnableAccountField>(+ PINNABLE_ACCOUNT_FIELDS.map((field) => [field.key, field])+ )const resolved: ResolvedPinnedAccountProperty[] = []const stale: PinnedAccountProperty[] = []@@ -125,6 +166,13 @@ export const resolvePinnedProperties = (} else {stale.push(reference)}+ } else if (reference.kind === 'account_field') {+ const field = accountFieldsByKey.get(reference.id)+ if (field) {+ resolved.push({ kind: reference.kind, reference, field })+ } else {+ stale.push(reference)+ }} else {const definition = relationshipsById.get(reference.id)if (definition) {@@ -426,13 +474,13 @@ export const accountSidebarConfigLogic: LogicWrapper<accountSidebarConfigLogicTy},persistPinnedPropertiesSuccess: ({ config }) => {actions.setDraftPinnedProperties([...config.pinned_properties])- const customPropertyCount = config.pinned_properties.filter(- ({ kind }) => kind === 'custom_property'- ).length+ const countOf = (kind: PinnedAccountProperty['kind']): number =>+ config.pinned_properties.filter((reference) => reference.kind === kind).lengthposthog.capture(AccountsEvents.PinnedPropertiesSaved, {pinned_count: config.pinned_properties.length,- custom_property_count: customPropertyCount,- relationship_count: config.pinned_properties.length - customPropertyCount,+ custom_property_count: countOf('custom_property'),+ relationship_count: countOf('relationship'),+ account_field_count: countOf('account_field'),})},})),diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarProperties.ts b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarProperties.tsindex 5aac17256c01..67401e73810b 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarProperties.ts+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarProperties.ts@@ -1,4 +1,7 @@+import type { AccountsTableAccountField } from '~/queries/schema/schema-general'+import type {+ AccountApi,AccountRelationshipApi,CustomPropertyValueApi,} from 'products/customer_analytics/frontend/generated/api.schemas'@@ -11,17 +14,36 @@ export interface AccountSidebarPropertyData {relationships: AccountRelationshipApi[]}+// Some account fields are top-level attributes and the others live in `properties`.+function accountFieldValue(account: AccountApi | null, field: AccountsTableAccountField): string | null {+ if (!account) {+ return null+ }+ const values: Record<string, unknown> = { ...account.properties, ...account }+ const value = values[field]+ return typeof value === 'string' && value !== '' ? value : null+}+export function buildAccountSidebarProperties(pinnedProperties: ResolvedPinnedAccountProperty[],data: AccountSidebarPropertyData | null,+ account: AccountApi | null,editable: boolean): AccountSidebarProperty[] {- if (!data) {+ if (!data && pinnedProperties.some(({ kind }) => kind !== 'account_field')) {return []}- const valuesByDefinition = new Map(data.customValues.map((value) => [value.definition_id, value.value]))+ const valuesByDefinition = new Map((data?.customValues ?? []).map((value) => [value.definition_id, value.value]))return pinnedProperties.map((property): AccountSidebarProperty => {const key = pinnedPropertyToConfiguratorKey(property.reference)+ if (property.kind === 'account_field') {+ return {+ key,+ kind: 'account_field',+ field: property.field,+ value: accountFieldValue(account, property.field.key),+ }+ }if (property.kind === 'custom_property') {const { definition } = propertyreturn {@@ -44,7 +66,7 @@ export function buildAccountSidebarProperties(kind: 'relationship',definition: property.definition,editable,- members: data.relationships.flatMap((relationship) =>+ members: (data?.relationships ?? []).flatMap((relationship) =>relationship.definition.id === property.definition.id && !relationship.ended_at && relationship.user? [relationship.user]: []diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarPropertiesLogic.test.ts b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarPropertiesLogic.test.tsindex 3b7726df1c62..f91d10516593 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarPropertiesLogic.test.ts+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarPropertiesLogic.test.ts@@ -22,6 +22,7 @@ import type {} from '../../generated/api.schemas'import { accountSidebarConfigLogic } from './accountSidebarConfigLogic'import { accountSidebarPropertiesLogic } from './accountSidebarPropertiesLogic'+import { isAccountPropertyEditable } from './components/accountPropertyTypes'jest.mock('lib/utils/accessControlUtils', () => ({ userHasAccess: jest.fn(() => true) }))@@ -129,6 +130,38 @@ describe('accountSidebarPropertiesLogic', () => {jest.clearAllMocks()})+ it('shows pinned account fields from the account and keeps them read-only', async () => {+ silenceKeaLoadersErrors()+ const accountDataRequest = jest.fn(() => [500, { detail: 'Account data unavailable' }])+ useMocks({+ get: {+ [VALUES_URL]: accountDataRequest,+ [RELATIONSHIPS_URL]: accountDataRequest,+ '/api/projects/:project_id/user_customer_analytics_config/@me/': {+ pinned_properties: [+ { kind: 'account_field', id: 'stripe_customer_id' },+ { kind: 'account_field', id: 'external_id' },+ ],+ },+ '/api/projects/:project_id/accounts/:id/': ({ params }) => ({+ id: params.id,+ external_id: 'org-example',+ properties: { stripe_customer_id: 'cus_example' },+ }),+ },+ })++ await mount()+ const [stripeField, externalIdField] = logic.values.sidebarProperties+ logic.actions.editProperty(stripeField)++ expect(stripeField).toMatchObject({ key: 'field:stripe_customer_id', value: 'cus_example' })+ expect(externalIdField).toMatchObject({ key: 'field:external_id', value: 'org-example' })+ expect(logic.values.editingPropertyKey).toBeNull()+ expect(logic.values.propertiesPanelState).toBe('ready')+ expect(accountDataRequest).not.toHaveBeenCalled()+ })+it('defers account data until pinning and recovers the empty state after an account-data failure', async () => {silenceKeaLoadersErrors()const accountDataRequest = jest.fn(() => [500, { detail: 'Account data unavailable' }])@@ -529,7 +562,7 @@ describe('accountSidebarPropertiesLogic', () => {const write = jest.fn()useMocks({ post: { [VALUES_URL]: write, [RELATIONSHIPS_URL]: write } })for (const property of logic.values.sidebarProperties) {- expect(property.editable).toBe(false)+ expect(isAccountPropertyEditable(property)).toBe(false)logic.actions.editProperty(property)}await expectLogic(logic, () => {diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarPropertiesLogic.ts b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarPropertiesLogic.tsindex 0201b1287e19..39d44c35c675 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarPropertiesLogic.ts+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarPropertiesLogic.ts@@ -29,7 +29,10 @@ import {ACCOUNTS_TABLE_DATA_NODE_KEY,} from 'products/customer_analytics/frontend/constants'import * as api from 'products/customer_analytics/frontend/generated/api'-import type { UserCustomerAnalyticsConfigApi } from 'products/customer_analytics/frontend/generated/api.schemas'+import type {+ AccountApi,+ UserCustomerAnalyticsConfigApi,+} from 'products/customer_analytics/frontend/generated/api.schemas'import type { PinnedAccountPropertyApi } from '../../generated/api.schemas'import { accountPropertyDataLogic } from './accountPropertyDataLogic'@@ -47,6 +50,7 @@ import {AccountRelationshipProperty,AccountRelationshipMember,AccountSidebarProperty,+ isAccountPropertyEditable,isCustomPropertyEditable,} from './components/accountPropertyTypes'@@ -68,6 +72,9 @@ export interface RelationshipEditBaseline {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface accountSidebarPropertiesLogicValues {+ account: AccountApi | null // accountPropertyDataLogic+ accountLoadFailed: boolean // accountPropertyDataLogic+ accountLoading: boolean // accountPropertyDataLogicpropertyData: AccountSidebarPropertyData | null // accountPropertyDataLogicpropertyDataLoading: boolean // accountPropertyDataLogicsharedPropertyDataLoadFailed: boolean // accountPropertyDataLogic@@ -81,6 +88,8 @@ export interface accountSidebarPropertiesLogicValues {availableMembers: AccountRelationshipMember[]configuredPropertyReferences: PinnedAccountPropertyApi[] | nulleditingPropertyKey: string | null+ hasAccountFieldPin: boolean+ needsPropertyData: booleanpropertiesAvailable: booleanpropertiesLoadFailed: booleanpropertiesPanelState: AccountPropertiesPanelState@@ -97,6 +106,7 @@ export interface accountSidebarPropertiesLogicValues {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface accountSidebarPropertiesLogicActions {+ loadAccount: (_?: void | undefined) => void // accountPropertyDataLogicloadPropertyDataFailure: (error: string,errorObject?: any@@ -260,18 +270,18 @@ export interface accountSidebarPropertiesLogicActions {export interface accountSidebarPropertiesLogicMeta {key: string__keaTypeGenInternalSelectorTypes: {- propertyDataLoadFailed: (- resolvedPinnedProperties: ResolvedPinnedAccountProperty[],- sharedPropertyDataLoadFailed: boolean- ) => boolean+ propertyDataLoadFailed: (needsPropertyData: boolean, sharedPropertyDataLoadFailed: boolean) => booleanresolvedPinnedProperties: (sidebarPinnedProperties: ResolvedPinnedAccountProperty[],availableDefinitions: AvailableDefinitions | null,configuredPropertyReferences: PinnedAccountPropertyApi[] | null) => ResolvedPinnedAccountProperty[]+ hasAccountFieldPin: (resolvedPinnedProperties: ResolvedPinnedAccountProperty[]) => boolean+ needsPropertyData: (resolvedPinnedProperties: ResolvedPinnedAccountProperty[]) => booleansidebarProperties: (resolvedPinnedProperties: ResolvedPinnedAccountProperty[],- propertyData: AccountSidebarPropertyData | null+ propertyData: AccountSidebarPropertyData | null,+ account: AccountApi | null) => AccountSidebarProperty[]availableMembers: (members: OrganizationMemberType[] | null,@@ -280,16 +290,19 @@ export interface accountSidebarPropertiesLogicMeta {propertiesAvailable: (config: UserCustomerAnalyticsConfigApi | null,availableDefinitions: AvailableDefinitions | null,- resolvedPinnedProperties: ResolvedPinnedAccountProperty[],+ needsPropertyData: boolean,propertyData: AccountSidebarPropertyData | null,- configuredPropertyReferences: PinnedAccountPropertyApi[] | null+ configuredPropertyReferences: PinnedAccountPropertyApi[] | null,+ hasAccountFieldPin: boolean,+ account: AccountApi | null) => booleanpropertiesLoadFailed: (configLoadFailed: boolean,availableDefinitionsLoadFailed: boolean,- resolvedPinnedProperties: ResolvedPinnedAccountProperty[],propertyDataLoadFailed: boolean,- configuredPropertyReferences: PinnedAccountPropertyApi[] | null+ configuredPropertyReferences: PinnedAccountPropertyApi[] | null,+ hasAccountFieldPin: boolean,+ accountLoadFailed: boolean) => booleanpropertiesPanelState: (propertiesAvailable: boolean,@@ -322,7 +335,14 @@ export const accountSidebarPropertiesLogic: LogicWrapper<accountSidebarPropertie'resolvedPinnedProperties as sidebarPinnedProperties',],accountPropertyDataLogic({ projectId, accountId }),- ['propertyData', 'propertyDataLoading', 'propertyDataLoadFailed as sharedPropertyDataLoadFailed'],+ [+ 'account',+ 'accountLoading',+ 'accountLoadFailed',+ 'propertyData',+ 'propertyDataLoading',+ 'propertyDataLoadFailed as sharedPropertyDataLoadFailed',+ ],membersLogic,['members', 'membersLoading'],],@@ -330,7 +350,12 @@ export const accountSidebarPropertiesLogic: LogicWrapper<accountSidebarPropertiemembersLogic,['ensureAllMembersLoaded'],accountPropertyDataLogic({ projectId, accountId }),- ['loadPropertyData as reloadPropertyData', 'loadPropertyDataSuccess', 'loadPropertyDataFailure'],+ [+ 'loadAccount',+ 'loadPropertyData as reloadPropertyData',+ 'loadPropertyDataSuccess',+ 'loadPropertyDataFailure',+ ],],})),actions({@@ -470,11 +495,7 @@ export const accountSidebarPropertiesLogic: LogicWrapper<accountSidebarPropertieeditingPropertyKey: [null as string | null,{- editProperty: (state, { property }) =>- property.editable !== false &&- (property.kind === 'relationship' || isCustomPropertyEditable(property.provenance))- ? property.key- : state,+ editProperty: (state, { property }) => (isAccountPropertyEditable(property) ? property.key : state),cancelEditing: () => null,persistCustomPropertySuccess: () => null,persistRelationshipSuccess: () => null,@@ -505,9 +526,8 @@ export const accountSidebarPropertiesLogic: LogicWrapper<accountSidebarPropertie})),selectors({propertyDataLoadFailed: [- (s) => [s.resolvedPinnedProperties, s.sharedPropertyDataLoadFailed],- (references: ResolvedPinnedAccountProperty[], failed: boolean): boolean =>- references.length > 0 && failed,+ (s) => [s.needsPropertyData, s.sharedPropertyDataLoadFailed],+ (needsPropertyData: boolean, failed: boolean): boolean => needsPropertyData && failed,],resolvedPinnedProperties: [(s) => [s.sidebarPinnedProperties, s.availableDefinitions, s.configuredPropertyReferences],@@ -522,15 +542,27 @@ export const accountSidebarPropertiesLogic: LogicWrapper<accountSidebarPropertie? resolvePinnedProperties(references, definitions).resolved: [],],+ hasAccountFieldPin: [+ (s) => [s.resolvedPinnedProperties],+ (pinned: ResolvedPinnedAccountProperty[]): boolean =>+ pinned.some(({ kind }) => kind === 'account_field'),+ ],+ needsPropertyData: [+ (s) => [s.resolvedPinnedProperties],+ (pinned: ResolvedPinnedAccountProperty[]): boolean =>+ pinned.some(({ kind }) => kind !== 'account_field'),+ ],sidebarProperties: [- (s) => [s.resolvedPinnedProperties, s.propertyData],+ (s) => [s.resolvedPinnedProperties, s.propertyData, s.account],(pinned: ResolvedPinnedAccountProperty[],- data: AccountSidebarPropertyData | null+ data: AccountSidebarPropertyData | null,+ account: AccountApi | null): AccountSidebarProperty[] =>buildAccountSidebarProperties(pinned,data,+ account,userHasAccess(AccessControlResourceType.CustomerAnalytics, AccessControlLevel.Editor)),],@@ -560,37 +592,47 @@ export const accountSidebarPropertiesLogic: LogicWrapper<accountSidebarPropertie(s) => [s.config,s.availableDefinitions,- s.resolvedPinnedProperties,+ s.needsPropertyData,s.propertyData,s.configuredPropertyReferences,+ s.hasAccountFieldPin,+ s.account,],(config: UserCustomerAnalyticsConfigApi | null,definitions: AvailableDefinitions | null,- pinned: ResolvedPinnedAccountProperty[],+ needsPropertyData: boolean,data: AccountSidebarPropertyData | null,- references: PinnedAccountProperty[] | null+ references: PinnedAccountProperty[] | null,+ hasAccountFieldPin: boolean,+ account: AccountApi | null): boolean =>(references !== null || config !== null) &&definitions !== null &&- (pinned.length === 0 || data !== null),+ (!needsPropertyData || data !== null) &&+ (!hasAccountFieldPin || account !== null),],propertiesLoadFailed: [(s) => [s.configLoadFailed,s.availableDefinitionsLoadFailed,- s.resolvedPinnedProperties,s.propertyDataLoadFailed,s.configuredPropertyReferences,+ s.hasAccountFieldPin,+ s.accountLoadFailed,],(configFailed: boolean,definitionsFailed: boolean,- pinned: ResolvedPinnedAccountProperty[],dataFailed: boolean,- references: PinnedAccountProperty[] | null+ references: PinnedAccountProperty[] | null,+ hasAccountFieldPin: boolean,+ accountFailed: boolean): boolean =>- (references === null && configFailed) || definitionsFailed || (pinned.length > 0 && dataFailed),+ (references === null && configFailed) ||+ definitionsFailed ||+ dataFailed ||+ (hasAccountFieldPin && accountFailed),],// A failed load keeps the values of the previous successful load, so the blocking error// state is only for a panel that has nothing to show.@@ -627,9 +669,12 @@ export const accountSidebarPropertiesLogic: LogicWrapper<accountSidebarPropertie}},loadPropertyData: () => {- if (values.resolvedPinnedProperties.length > 0) {+ if (values.needsPropertyData) {actions.reloadPropertyData()}+ if (values.hasAccountFieldPin && !values.accountLoading) {+ actions.loadAccount()+ }},editProperty: ({ property }) => {if (props.instanceId?.startsWith('view:') && values.editingPropertyKey === property.key) {diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPinnedPropertiesPanel.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPinnedPropertiesPanel.tsxindex 50959f2d676f..4b554d793161 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPinnedPropertiesPanel.tsx+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPinnedPropertiesPanel.tsx@@ -7,13 +7,13 @@ import { projectLogic } from 'scenes/projectLogic'import {accountSidebarConfigLogic,+ buildPinnedPropertyOptions,configuratorKeysToPinnedProperties,pinnedPropertyToConfiguratorKey,} from '../accountSidebarConfigLogic'import { AccountPropertyEditSource, accountSidebarPropertiesLogic } from '../accountSidebarPropertiesLogic'import { AccountPinnedProperties, AccountPinnedPropertiesProps } from './AccountPinnedProperties'import { AccountPropertyConfigurator } from './AccountPropertyConfigurator'-import type { AccountPropertyOption } from './accountPropertyTypes'export interface AccountPinnedPropertiesPanelProps {accountId: string@@ -70,18 +70,9 @@ export function AccountPinnedPropertiesPanel({}}const configuratorKey = `${source}:${accountId}`- const propertyOptions: AccountPropertyOption[] = [- ...(availableDefinitions?.customProperties ?? []).map((definition) => ({- key: pinnedPropertyToConfiguratorKey({ kind: 'custom_property', id: definition.id }),- label: definition.name,- kind: 'custom' as const,- })),- ...(availableDefinitions?.relationships ?? []).map((definition) => ({- key: pinnedPropertyToConfiguratorKey({ kind: 'relationship', id: definition.id }),- label: definition.name,- kind: 'relationship' as const,- })),- ]+ const propertyOptions = buildPinnedPropertyOptions(+ availableDefinitions ?? { customProperties: [], relationships: [] }+ )return (<div className="flex flex-col flex-1 min-h-0" data-attr="account-rail-properties">diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertyComponents.stories.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertyComponents.stories.tsxindex 9b4cc7ab863d..fb0daacdaad0 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertyComponents.stories.tsx+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertyComponents.stories.tsx@@ -1,6 +1,8 @@import type { Meta, StoryObj } from '@storybook/react'import { useState } from 'react'+import { AccountsTableAccountField } from '~/queries/schema/schema-general'+import type {AccountRelationshipDefinitionApi,CustomPropertyDefinitionApi,@@ -10,9 +12,10 @@ import type {import { AccountPinnedProperties } from './AccountPinnedProperties'import { AccountPropertyConfigurator } from './AccountPropertyConfigurator'import { AccountPropertyField } from './AccountPropertyField'-import type {+import {AccountCustomProperty,AccountCustomPropertyValue,+ accountPropertyLabel,AccountPropertyOption,AccountRelationshipMember,AccountRelationshipProperty,@@ -103,6 +106,12 @@ const DISPLAY_PROPERTIES: AccountSidebarProperty[] = [definition: customDefinition('canonical', 'First seen', 'datetime', { is_canonical: true }),}),relationshipProperty('csm', 'Customer success manager', [MEMBERS[0]], true),+ {+ key: 'field:stripe_customer_id',+ kind: 'account_field',+ field: { key: AccountsTableAccountField.StripeCustomerId, label: 'Stripe customer ID', isDateTime: false },+ value: 'cus_example',+ },]const noop = (): void => {}@@ -234,7 +243,7 @@ export const RelationshipEditors: Story = {const CONFIG_OPTIONS: AccountPropertyOption[] = DISPLAY_PROPERTIES.map((property) => ({key: property.key,- label: property.definition.name,+ label: accountPropertyLabel(property),kind: property.kind,}))diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertyConfiguratorItem.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertyConfiguratorItem.tsxindex 22b92ddc0c5d..2741cee52659 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertyConfiguratorItem.tsx+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertyConfiguratorItem.tsx@@ -6,7 +6,7 @@ import { LemonButton } from '@posthog/lemon-ui'import { SortableDragIcon } from 'lib/lemon-ui/icons'-import type { AccountPropertyOption } from './accountPropertyTypes'+import { ACCOUNT_PROPERTY_KIND_LABELS, AccountPropertyOption } from './accountPropertyTypes'export interface AccountPropertyConfiguratorItemProps {option: AccountPropertyOption@@ -47,13 +47,7 @@ export function AccountPropertyConfiguratorItem({<SortableDragIcon /></button><span className="min-w-0 flex-1 truncate text-sm font-medium">{option.label}</span>- <span className="shrink-0 text-xs text-secondary">- {option.kind === 'custom'- ? 'Custom property'- : option.kind === 'account'- ? 'Account property'- : 'Relationship'}- </span>+ <span className="shrink-0 text-xs text-secondary">{ACCOUNT_PROPERTY_KIND_LABELS[option.kind]}</span><LemonButtonsize="xsmall"icon={<IconX />}diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertyField.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertyField.tsxindex 7742909e672c..647ca3c537bd 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertyField.tsx+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertyField.tsx@@ -7,8 +7,9 @@ import {AccountCustomPropertyValue,AccountRelationshipMember,AccountRelationshipProperty,+ accountPropertyLabel,AccountSidebarProperty,- isCustomPropertyEditable,+ isAccountPropertyEditable,} from './accountPropertyTypes'import { AccountPropertyValue } from './AccountPropertyValue'import { AccountRelationshipEditor } from './AccountRelationshipEditor'@@ -42,9 +43,8 @@ export function AccountPropertyField({onSaveCustomProperty,onSaveRelationship,}: AccountPropertyFieldProps): JSX.Element {- const editable =- property.editable !== false &&- (property.kind === 'relationship' || isCustomPropertyEditable(property.provenance))+ const editable = isAccountPropertyEditable(property)+ const label = accountPropertyLabel(property)const provenance =property.kind === 'custom' && property.provenance !== 'manual' ? PROVENANCE[property.provenance] : null@@ -52,13 +52,13 @@ export function AccountPropertyField({return (<div className="flex flex-col gap-1 min-w-0" data-attr="account-property-row"><div className="flex items-center gap-2 min-w-0 min-h-7">- <span className="min-w-0 text-xs text-secondary truncate">{property.definition.name}</span>+ <span className="min-w-0 text-xs text-secondary truncate">{label}</span>{editable && !editing ? (<LemonButtonsize="xsmall"icon={<IconPencil />}tooltip="Edit value"- aria-label={`Edit ${property.definition.name}`}+ aria-label={`Edit ${label}`}onClick={onEdit}className="shrink-0"data-attr="account-property-edit"@@ -72,7 +72,7 @@ export function AccountPropertyField({</div>{editing && editable ? (<div className="flex flex-col gap-1.5">- {property.kind === 'custom' ? (+ {property.kind === 'account_field' ? null : property.kind === 'custom' ? (<AccountCustomPropertyEditorkey={property.key}definition={property.definition}diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertySelection.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertySelection.tsxindex 8da7fe52be2e..9182587e268a 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertySelection.tsx+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertySelection.tsx@@ -5,7 +5,11 @@ import { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable'import { LemonInputSelect } from '@posthog/lemon-ui'import { AccountPropertyConfiguratorItem } from './AccountPropertyConfiguratorItem'-import { AccountPropertyOption, MAX_PINNED_ACCOUNT_PROPERTIES } from './accountPropertyTypes'+import {+ ACCOUNT_PROPERTY_KIND_LABELS,+ AccountPropertyOption,+ MAX_PINNED_ACCOUNT_PROPERTIES,+} from './accountPropertyTypes'export interface AccountPropertySelectionProps {options: AccountPropertyOption[]@@ -32,9 +36,11 @@ export function AccountPropertySelection({label: key,kind: key.startsWith('account:')? 'account'- : key.startsWith('relationship:')- ? 'relationship'- : 'custom',+ : key.startsWith('field:')+ ? 'account_field'+ : key.startsWith('relationship:')+ ? 'relationship'+ : 'custom',})const availableOptions = options.filter((option) => !selectedKeys.includes(option.key))@@ -97,13 +103,7 @@ export function AccountPropertySelection({labelComponent: (<span className="flex w-full items-center justify-between gap-2"><span className="truncate">{option.label}</span>- <span className="text-xs text-secondary">- {option.kind === 'custom'- ? 'Custom property'- : option.kind === 'account'- ? 'Account property'- : 'Relationship'}- </span>+ <span className="text-xs text-secondary">{ACCOUNT_PROPERTY_KIND_LABELS[option.kind]}</span></span>),}))}diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertyValue.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertyValue.tsxindex d4c4a3092a74..0ae6112b8d3e 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertyValue.tsx+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/AccountPropertyValue.tsx@@ -32,6 +32,20 @@ export function AccountPropertyValue({ property }: AccountPropertyValueProps): J)}+ if (property.kind === 'account_field') {+ if (!property.value) {+ return <span className="text-sm text-muted">Not set</span>+ }+ const parsed = property.field.isDateTime ? dayjs(property.value) : null+ return parsed?.isValid() ? (+ <span className="text-sm font-medium">+ <TZLabel time={parsed} formatDate="MMM D, YYYY" formatTime="HH:mm" />+ </span>+ ) : (+ <span className="text-sm font-medium truncate select-all">{property.value}</span>+ )+ }+const { definition, value } = propertyif (value === null || value === '') {return <span className="text-sm text-muted">Not set</span>diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/accountPropertyTypes.ts b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/accountPropertyTypes.tsindex 730c2083f2ca..da3cfca779a4 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/accountPropertyTypes.ts+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/components/accountPropertyTypes.ts@@ -1,3 +1,7 @@+import { AccountsTableAccountField } from '~/queries/schema/schema-general'+import { PropertyType } from '~/types'++import { ACCOUNT_FIELD_TAXONOMIC_OPTIONS } from 'products/customer_analytics/frontend/components/Accounts/accountsPropertyFilters'import type {AccountRelationshipDefinitionApi,CustomPropertyDefinitionApi,@@ -32,7 +36,25 @@ export interface AccountRelationshipProperty {editable?: boolean}-export type AccountSidebarProperty = AccountCustomProperty | AccountRelationshipProperty+export interface PinnableAccountField {+ key: AccountsTableAccountField+ label: string+ isDateTime: boolean+}++// The same native fields the accounts list offers as columns.+export const PINNABLE_ACCOUNT_FIELDS: PinnableAccountField[] = ACCOUNT_FIELD_TAXONOMIC_OPTIONS.map(+ ({ id, name, property_type }) => ({ key: id, label: name, isDateTime: property_type === PropertyType.DateTime })+)++export interface AccountFieldProperty {+ key: string+ kind: 'account_field'+ field: PinnableAccountField+ value: string | null+}++export type AccountSidebarProperty = AccountCustomProperty | AccountRelationshipProperty | AccountFieldPropertyexport interface AccountPropertyOption {key: string@@ -40,6 +62,24 @@ export interface AccountPropertyOption {kind: AccountSidebarProperty['kind'] | 'account'}+export const ACCOUNT_PROPERTY_KIND_LABELS: Record<AccountPropertyOption['kind'], string> = {+ custom: 'Custom property',+ relationship: 'Relationship',+ account_field: 'Account field',+ account: 'Account property',+}+export function isCustomPropertyEditable(provenance: AccountCustomPropertyProvenance): boolean {return provenance === 'manual' || provenance === 'workflow'}++export function isAccountPropertyEditable(property: AccountSidebarProperty): boolean {+ if (property.kind === 'account_field' || property.editable === false) {+ return false+ }+ return property.kind === 'relationship' || isCustomPropertyEditable(property.provenance)+}++export function accountPropertyLabel(property: AccountSidebarProperty): string {+ return property.kind === 'account_field' ? property.field.label : property.definition.name+}diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/defaultPinnedAccountPropertiesLogic.ts b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/defaultPinnedAccountPropertiesLogic.tsindex de3df3c3bf24..83da726034fc 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/defaultPinnedAccountPropertiesLogic.ts+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/defaultPinnedAccountPropertiesLogic.ts@@ -6,6 +6,7 @@ import type { CustomerAnalyticsConfig } from '~/queries/schema/schema-general'import type { PinnedAccountPropertyApi } from 'products/customer_analytics/frontend/generated/api.schemas'import {+ buildPinnedPropertyOptions,configuratorKeysToPinnedProperties,pinnedPropertyToConfiguratorKey,} from 'products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/accountSidebarConfigLogic'@@ -212,22 +213,13 @@ export const defaultPinnedAccountPropertiesLogic = kea<defaultPinnedAccountPropepropertyOptions: [(s) => [s.customPropertyDefinitions, s.relationshipDefinitions],(- customProperties: import('products/customer_analytics/frontend/generated/api.schemas').CustomPropertyDefinitionApi[],- relationships: import('products/customer_analytics/frontend/generated/api.schemas').AccountRelationshipDefinitionApi[]- ): AccountPropertyOption[] => [- ...customProperties- .filter(({ target_type }) => target_type === 'account')- .map((definition) => ({- key: pinnedPropertyToConfiguratorKey({ kind: 'custom_property', id: definition.id }),- label: definition.name,- kind: 'custom' as const,- })),- ...relationships.map((definition) => ({- key: pinnedPropertyToConfiguratorKey({ kind: 'relationship', id: definition.id }),- label: definition.name,- kind: 'relationship' as const,- })),- ],+ customProperties: CustomPropertyDefinitionApi[],+ relationships: AccountRelationshipDefinitionApi[]+ ): AccountPropertyOption[] =>+ buildPinnedPropertyOptions({+ customProperties: customProperties.filter(({ target_type }) => target_type === 'account'),+ relationships,+ }),],resolvedPinnedPropertyKeys: [(s) => [s.defaultPinnedProperties, s.propertyOptions],diff --git a/products/desktop/packages/api-client/src/generated.ts b/products/desktop/packages/api-client/src/generated.tsindex 1ef73b1610f1..6aabca591b87 100644--- a/products/desktop/packages/api-client/src/generated.ts+++ b/products/desktop/packages/api-client/src/generated.ts@@ -82,8 +82,12 @@ export namespace Schemas {/*** * `custom_property` - Custom property* * `relationship` - Relationship+ * * `account_field` - Account field*/- export type AccountPropertyPinKindEnum = "custom_property" | "relationship";+ export type AccountPropertyPinKindEnum =+ | "custom_property"+ | "relationship"+ | "account_field";export type BounceRatePageViewMode =| "count_pageviews"| "uniq_urls"@@ -19951,14 +19955,15 @@ export namespace Schemas {}>;export type TeamCustomerAnalyticsPinnedAccountProperty = {/**- * Definition type for this default pinned account property.+ * Type of this default pinned account property: a custom property, a relationship, or a built-in account field.** * `custom_property` - Custom property* * `relationship` - Relationship+ * * `account_field` - Account field*/kind: AccountPropertyPinKindEnum;/**- * Project-scoped custom property or relationship definition UUID.+ * Project-scoped custom property or relationship definition UUID. For an account_field pin, the account field name, such as stripe_customer_id.*/id: string;};diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 85398b7d1e9b..ab90571e17e7 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -2170,6 +2170,7 @@ export namespace Schemas {/*** * `custom_property` - Custom property* * `relationship` - Relationship+ * * `account_field` - Account field*/export type AccountPropertyPinKindEnum = typeof AccountPropertyPinKindEnum[keyof typeof AccountPropertyPinKindEnum];@@ -2177,6 +2178,7 @@ export namespace Schemas {export const AccountPropertyPinKindEnum = {CustomProperty: 'custom_property',Relationship: 'relationship',+ AccountField: 'account_field',} as const;/**@@ -86215,12 +86217,16 @@ export namespace Schemas {}export interface TeamCustomerAnalyticsPinnedAccountProperty {- /** Definition type for this default pinned account property.+ /** Type of this default pinned account property: a custom property, a relationship, or a built-in account field.** * `custom_property` - Custom property- * * `relationship` - Relationship */+ * * `relationship` - Relationship+ * * `account_field` - Account field */kind: AccountPropertyPinKindEnum;- /** Project-scoped custom property or relationship definition UUID. */+ /**+ * Project-scoped custom property or relationship definition UUID. For an account_field pin, the account field name, such as stripe_customer_id.+ * @maxLength 64+ */id: string;}@@ -90174,12 +90180,16 @@ export namespace Schemas {}export interface PinnedAccountProperty {- /** Definition type for this pinned account property.+ /** Type of this pinned account property: a custom property, a relationship, or a built-in account field.** * `custom_property` - Custom property- * * `relationship` - Relationship */+ * * `relationship` - Relationship+ * * `account_field` - Account field */kind: AccountPropertyPinKindEnum;- /** Team-scoped custom property or relationship definition UUID. */+ /**+ * Team-scoped custom property or relationship definition UUID. For an account_field pin, the account field name, such as stripe_customer_id.+ * @maxLength 64+ */id: string;}diff --git a/services/mcp/src/generated/core/api.ts b/services/mcp/src/generated/core/api.tsindex 9b0bf337a0ab..bf8970098c97 100644--- a/services/mcp/src/generated/core/api.ts+++ b/services/mcp/src/generated/core/api.ts@@ -349,6 +349,8 @@ export const organizationsProjectsCreateBodyMarketingAnalyticsConfigConversionGoexport const organizationsProjectsCreateBodyMarketingAnalyticsConfigConversionGoalsOneItemThreePropertiesOneItemSixTypeDefault = `data_warehouse`export const organizationsProjectsCreateBodyMarketingAnalyticsConfigAttributionWindowDaysMax = 90+export const organizationsProjectsCreateBodyCustomerAnalyticsConfigDefaultPinnedPropertiesItemIdMax = 64+export const organizationsProjectsCreateBodyWorkflowsConfigEmailUtmParamsOneUtmSourceMax = 500export const organizationsProjectsCreateBodyWorkflowsConfigEmailUtmParamsOneUtmMediumMax = 500@@ -2782,14 +2784,21 @@ export const OrganizationsProjectsCreateBody = () => zod.array(zod.object({kind: zod- .enum(['custom_property', 'relationship'])- .describe('\* `custom_property` - Custom property\n\* `relationship` - Relationship')+ .enum(['custom_property', 'relationship', 'account_field'])+ .describe(+ '\* `custom_property` - Custom property\n\* `relationship` - Relationship\n\* `account_field` - Account field'+ ).describe(- 'Definition type for this default pinned account property.\n\n\* `custom_property` - Custom property\n\* `relationship` - Relationship'+ 'Type of this default pinned account property: a custom property, a relationship, or a built-in account field.\n\n\* `custom_property` - Custom property\n\* `relationship` - Relationship\n\* `account_field` - Account field'),id: zod.string()- .describe('Project-scoped custom property or relationship definition UUID.'),+ .max(+ organizationsProjectsCreateBodyCustomerAnalyticsConfigDefaultPinnedPropertiesItemIdMax+ )+ .describe(+ 'Project-scoped custom property or relationship definition UUID. For an account_field pin, the account field name, such as stripe_customer_id.'+ ),})).optional()@@ -3193,6 +3202,8 @@ export const organizationsProjectsPartialUpdateBodyMarketingAnalyticsConfigConveexport const organizationsProjectsPartialUpdateBodyMarketingAnalyticsConfigConversionGoalsOneItemThreePropertiesOneItemSixTypeDefault = `data_warehouse`export const organizationsProjectsPartialUpdateBodyMarketingAnalyticsConfigAttributionWindowDaysMax = 90+export const organizationsProjectsPartialUpdateBodyCustomerAnalyticsConfigDefaultPinnedPropertiesItemIdMax = 64+export const organizationsProjectsPartialUpdateBodyWorkflowsConfigEmailUtmParamsOneUtmSourceMax = 500export const organizationsProjectsPartialUpdateBodyWorkflowsConfigEmailUtmParamsOneUtmMediumMax = 500@@ -5640,14 +5651,21 @@ export const OrganizationsProjectsPartialUpdateBody = () => zod.array(zod.object({kind: zod- .enum(['custom_property', 'relationship'])- .describe('\* `custom_property` - Custom property\n\* `relationship` - Relationship')+ .enum(['custom_property', 'relationship', 'account_field'])+ .describe(+ '\* `custom_property` - Custom property\n\* `relationship` - Relationship\n\* `account_field` - Account field'+ ).describe(- 'Definition type for this default pinned account property.\n\n\* `custom_property` - Custom property\n\* `relationship` - Relationship'+ 'Type of this default pinned account property: a custom property, a relationship, or a built-in account field.\n\n\* `custom_property` - Custom property\n\* `relationship` - Relationship\n\* `account_field` - Account field'),id: zod.string()- .describe('Project-scoped custom property or relationship definition UUID.'),+ .max(+ organizationsProjectsPartialUpdateBodyCustomerAnalyticsConfigDefaultPinnedPropertiesItemIdMax+ )+ .describe(+ 'Project-scoped custom property or relationship definition UUID. For an account_field pin, the account field name, such as stripe_customer_id.'+ ),})).optional()diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/project-settings-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/project-settings-update.jsonindex 04261ac8699f..095c9db25e34 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/project-settings-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/project-settings-update.json@@ -339,12 +339,13 @@"items": {"properties": {"id": {- "description": "Project-scoped custom property or relationship definition UUID.",+ "description": "Project-scoped custom property or relationship definition UUID. For an account_field pin, the account field name, such as stripe_customer_id.",+ "maxLength": 64,"type": "string"},"kind": {- "description": "Definition type for this default pinned account property.\n\n* `custom_property` - Custom property\n* `relationship` - Relationship",- "enum": ["custom_property", "relationship"],+ "description": "Type of this default pinned account property: a custom property, a relationship, or a built-in account field.\n\n* `custom_property` - Custom property\n* `relationship` - Relationship\n* `account_field` - Account field",+ "enum": ["custom_property", "relationship", "account_field"],"type": "string"}},