Skip to content
Draft
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
6 changes: 6 additions & 0 deletions packages/clerk-js/src/core/resources/EnterpriseConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export class EnterpriseConnection extends BaseResource implements EnterpriseConn
id!: string;
name!: string;
active!: boolean;
provider!: string;
logoPublicUrl: string | null = null;
domains: string[] = [];
organizationId: string | null = null;
syncUserAttributes!: boolean;
Expand All @@ -105,6 +107,8 @@ export class EnterpriseConnection extends BaseResource implements EnterpriseConn
this.id = data.id;
this.name = data.name;
this.active = data.active;
this.provider = data.provider;
this.logoPublicUrl = data.logo_public_url ?? null;
this.domains = data.domains ?? [];
this.organizationId = data.organization_id ?? null;
this.syncUserAttributes = data.sync_user_attributes;
Expand All @@ -126,6 +130,8 @@ export class EnterpriseConnection extends BaseResource implements EnterpriseConn
id: this.id,
name: this.name,
active: this.active,
provider: this.provider,
logo_public_url: this.logoPublicUrl,
domains: this.domains,
organization_id: this.organizationId,
sync_user_attributes: this.syncUserAttributes,
Expand Down
4 changes: 4 additions & 0 deletions packages/shared/src/types/enterpriseConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export interface EnterpriseConnectionJSON extends ClerkResourceJSON {
object: 'enterprise_connection';
name: string;
active: boolean;
provider: string;
logo_public_url?: string | null;
domains?: string[];
organization_id?: string | null;
sync_user_attributes: boolean;
Expand All @@ -23,6 +25,8 @@ export interface EnterpriseConnectionResource extends ClerkResource {
id: string;
name: string;
active: boolean;
provider: string;
logoPublicUrl: string | null;
domains: string[];
organizationId: string | null;
syncUserAttributes: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ const EnterpriseConnectMenuButton = (props: { connection: EnterpriseConnectionRe
});
};

const providerIconUrl = connection.oauthConfig?.logoPublicUrl?.trim() ?? '';
const providerIconId = connection.provider.replace(/(oauth_|saml_)/, '').trim() as OAuthProvider;
const providerIconUrl = connection.logoPublicUrl?.trim() || '';

return (
<ProfileSection.ActionMenuItem
Expand All @@ -75,15 +76,14 @@ const EnterpriseConnectMenuButton = (props: { connection: EnterpriseConnectionRe
})}
leftIcon={
<ProviderIcon
// TODO - Use `provider` and `logo_public_url` once FAPI `EnterpriseConnection` resource gets updated
id={GENERIC_ENTERPRISE_PROVIDER_ICON_ID}
id={providerIconId}
iconUrl={providerIconUrl || undefined}
name={connection.name}
isLoading={card.loadingMetadata === loadingKey}
isDisabled={card.isLoading}
alt={`Connect ${connection.name} account`}
elementDescriptor={descriptors.providerIcon}
elementId={descriptors.providerIcon.setId(GENERIC_ENTERPRISE_PROVIDER_ICON_ID)}
elementId={descriptors.providerIcon.setId(providerIconId)}
/>
}
/>
Expand Down
Loading