Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/wet-mangos-stop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@clerk/localizations': minor
'@clerk/clerk-js': minor
'@clerk/shared': minor
'@clerk/ui': minor
---

Add support for rendering the Banned badge in the organization members list.
3 changes: 3 additions & 0 deletions packages/clerk-js/src/core/resources/PublicUserData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class PublicUserData implements IPublicUserData {
identifier!: string;
userId?: string;
username?: string;
banned?: boolean;

constructor(data: PublicUserDataJSON | PublicUserDataJSONSnapshot) {
this.fromJSON(data);
Expand All @@ -26,6 +27,7 @@ export class PublicUserData implements IPublicUserData {
this.identifier = data.identifier || '';
this.userId = data.user_id;
this.username = data.username;
this.banned = data.banned ?? undefined;
}

return this;
Expand All @@ -40,6 +42,7 @@ export class PublicUserData implements IPublicUserData {
identifier: this.identifier,
user_id: this.userId,
username: this.username,
banned: this.banned,
};
}
}
1 change: 1 addition & 0 deletions packages/localizations/src/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export const enUS: LocalizationResource = {
badge__upcomingPlan: 'Upcoming',
badge__userDevice: 'User device',
badge__you: 'You',
badge__banned: 'Banned',
billing: {
addPaymentMethod__label: 'Add payment method',
alwaysFree: 'Always free',
Expand Down
1 change: 1 addition & 0 deletions packages/shared/src/types/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ export interface PublicUserDataJSON {
identifier: string;
user_id?: string;
username?: string;
banned?: boolean;
}

export interface SessionWithActivitiesJSON extends Omit<SessionJSON, 'user'> {
Expand Down
1 change: 1 addition & 0 deletions packages/shared/src/types/localization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export type __internal_LocalizationResource = {
badge__unverified: LocalizationValue;
badge__requiresAction: LocalizationValue;
badge__you: LocalizationValue;
badge__banned: LocalizationValue;
badge__freeTrial: LocalizationValue;
badge__currentPlan: LocalizationValue;
badge__upcomingPlan: LocalizationValue;
Expand Down
1 change: 1 addition & 0 deletions packages/shared/src/types/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ export interface PublicUserData {
identifier: string;
userId?: string;
username?: string;
banned?: boolean;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,16 @@ const MemberRow = (props: {
user={membership.publicUserData}
subtitle={membership.publicUserData?.identifier}
subtitleProps={{ variant: 'caption' }}
badge={isCurrentUser && <Badge localizationKey={localizationKeys('badge__you')} />}
badge={
isCurrentUser ? (
<Badge localizationKey={localizationKeys('badge__you')} />
) : membership.publicUserData?.banned ? (
<Badge
colorScheme='danger'
localizationKey={localizationKeys('badge__banned')}
/>
) : undefined
}
/>
</Td>
<Td>
Expand Down
Loading