diff --git a/.changeset/witty-walls-wave.md b/.changeset/witty-walls-wave.md new file mode 100644 index 00000000000..2ccde570ace --- /dev/null +++ b/.changeset/witty-walls-wave.md @@ -0,0 +1,6 @@ +--- +'@clerk/ui': patch +--- + +Fix personal account display in `OrganizationSwitcher` and `OrganizationList` to exclude `primaryWeb3Wallet` from user identifiers + diff --git a/packages/ui/src/components/OrganizationList/UserMembershipList.tsx b/packages/ui/src/components/OrganizationList/UserMembershipList.tsx index 48e9029515c..a7dec64439b 100644 --- a/packages/ui/src/components/OrganizationList/UserMembershipList.tsx +++ b/packages/ui/src/components/OrganizationList/UserMembershipList.tsx @@ -82,7 +82,7 @@ export const PersonalAccountPreview = withCardStateProvider(() => { return null; } - const { username, primaryEmailAddress, primaryPhoneNumber, ...userWithoutIdentifiers } = user; + const { primaryEmailAddress, primaryPhoneNumber, primaryWeb3Wallet, username, ...userWithoutIdentifiers } = user; const handlePersonalClicked = () => { if (!isLoaded) { diff --git a/packages/ui/src/components/OrganizationSwitcher/OrganizationSwitcherPopover.tsx b/packages/ui/src/components/OrganizationSwitcher/OrganizationSwitcherPopover.tsx index aec8b0f21de..886df9d9ef0 100644 --- a/packages/ui/src/components/OrganizationSwitcher/OrganizationSwitcherPopover.tsx +++ b/packages/ui/src/components/OrganizationSwitcher/OrganizationSwitcherPopover.tsx @@ -48,7 +48,7 @@ export const OrganizationSwitcherPopover = React.forwardRef { return null; } - const { username, primaryEmailAddress, primaryPhoneNumber, ...userWithoutIdentifiers } = user; + const { primaryEmailAddress, primaryPhoneNumber, primaryWeb3Wallet, username, ...userWithoutIdentifiers } = user; const { isLoading, hasNextPage } = userMemberships; diff --git a/packages/ui/src/components/OrganizationSwitcher/__tests__/OrganizationSwitcher.test.tsx b/packages/ui/src/components/OrganizationSwitcher/__tests__/OrganizationSwitcher.test.tsx index 7f9a6d32169..a6a7750f1ab 100644 --- a/packages/ui/src/components/OrganizationSwitcher/__tests__/OrganizationSwitcher.test.tsx +++ b/packages/ui/src/components/OrganizationSwitcher/__tests__/OrganizationSwitcher.test.tsx @@ -97,6 +97,46 @@ describe('OrganizationSwitcher', () => { expect(getByText('Personal account')).toBeInTheDocument(); }); + it('does not show user identifiers in the personal workspace trigger', async () => { + const { wrapper, props } = await createFixtures(f => { + f.withOrganizations(); + f.withUser({ + email_addresses: ['test@clerk.com'], + username: 'testuser', + }); + }); + + props.setProps({ hidePersonal: false }); + const { getByText, queryByText } = render(, { wrapper }); + expect(getByText('Personal account')).toBeInTheDocument(); + expect(queryByText('test@clerk.com')).not.toBeInTheDocument(); + expect(queryByText('testuser')).not.toBeInTheDocument(); + }); + + it('does not show web3 wallet address in the personal workspace trigger', async () => { + const { wrapper, props } = await createFixtures(f => { + f.withOrganizations(); + f.withUser({ + email_addresses: ['test@clerk.com'], + primary_web3_wallet_id: 'web3_wallet_123', + web3_wallets: [ + { + id: 'web3_wallet_123', + object: 'web3_wallet', + web3_wallet: '0x1234567890abcdef1234567890abcdef12345678', + verification: { status: 'verified', strategy: 'web3_metamask_signature', attempts: 1, expire_at: null }, + }, + ], + }); + }); + + props.setProps({ hidePersonal: false }); + const { getByText, queryByText } = render(, { wrapper }); + expect(getByText('Personal account')).toBeInTheDocument(); + expect(queryByText('0x1234567890abcdef1234567890abcdef12345678')).not.toBeInTheDocument(); + expect(queryByText('0x1234')).not.toBeInTheDocument(); + }); + it('shows "No organization selected" when user has no active organization and hidePersonal is true', async () => { const { wrapper, props } = await createFixtures(f => { f.withOrganizations();