Skip to content

Commit d951d19

Browse files
committed
Add changeset
1 parent 07abb56 commit d951d19

6 files changed

Lines changed: 26 additions & 33 deletions

File tree

.changeset/dull-plums-sleep.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@clerk/localizations': minor
3+
'@clerk/clerk-js': minor
4+
'@clerk/shared': minor
5+
'@clerk/ui': minor
6+
---
7+
8+
Display "Single Sign-on (SSO)" section in `OrganizationProfile` if self-serve SSO is enabled on the current active organization

packages/clerk-js/src/core/resources/__tests__/Organization.test.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,4 @@ describe('Organization', () => {
4141
},
4242
});
4343
});
44-
45-
it('defaults selfServeSSOEnabled to false when the field is omitted from FAPI', () => {
46-
const organization = new Organization({
47-
object: 'organization',
48-
id: 'test_id',
49-
name: 'test_name',
50-
public_metadata: {},
51-
slug: 'test_slug',
52-
image_url: '',
53-
created_at: 12345,
54-
updated_at: 5678,
55-
members_count: 1,
56-
pending_invitations_count: 0,
57-
admin_delete_enabled: true,
58-
max_allowed_memberships: 3,
59-
has_image: false,
60-
});
61-
62-
expect(organization.selfServeSSOEnabled).toBe(false);
63-
});
6444
});

packages/shared/src/types/organization.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ export interface OrganizationResource extends ClerkResource, BillingPayerMethods
4646
publicMetadata: OrganizationPublicMetadata;
4747
adminDeleteEnabled: boolean;
4848
maxAllowedMemberships: number;
49-
/**
50-
* Whether the organization opted-in to self-serve SSO. Defaults to `false`
51-
* when the instance does not have self-serve SSO enabled.
52-
*/
5349
selfServeSSOEnabled: boolean;
5450
createdAt: Date;
5551
updatedAt: Date;

packages/ui/src/components/ConfigureSSO/__tests__/ConfigureSSO.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('ConfigureSSO', () => {
3636
f.withOrganizations();
3737
f.withUser({
3838
email_addresses: ['test@clerk.com'],
39-
organization_memberships: [{ name: 'Org1', permissions: ['org:sys_enterprise_connections:manage'] }],
39+
organization_memberships: [{ name: 'Org1', permissions: ['org:sys_entconns:manage'] }],
4040
});
4141
});
4242

packages/ui/src/components/OrganizationProfile/OrganizationProfileRoutes.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ export const OrganizationProfileRoutes = () => {
154154
<Route path={isSelfServeSsoPageRoot ? undefined : 'organization-self-serve-sso'}>
155155
<Switch>
156156
<Route index>
157-
<OrganizationSelfServeSSOPage />
157+
<Suspense fallback={''}>
158+
<OrganizationSelfServeSSOPage />
159+
</Suspense>
158160
</Route>
159161
</Switch>
160162
</Route>

packages/ui/src/components/OrganizationProfile/__tests__/OrganizationProfile.test.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import type { CustomPage } from '@clerk/shared/types';
22
import { describe, expect, it } from 'vitest';
33

44
import { bindCreateFixtures } from '@/test/create-fixtures';
5-
import { render, screen, waitFor } from '@/test/utils';
5+
import { cleanup, render, screen, waitFor } from '@/test/utils';
66

77
import { OrganizationProfile } from '../';
8+
import { OrganizationSelfServeSSOPage } from '../OrganizationSelfServeSSOPage';
89

910
const { createFixtures } = bindCreateFixtures('OrganizationProfile');
1011

@@ -494,7 +495,7 @@ describe('OrganizationProfile', () => {
494495
});
495496

496497
render(<OrganizationProfile />, { wrapper });
497-
expect(await screen.findByText('Self-Serve SSO')).toBeDefined();
498+
expect(await screen.findByText('Single Sign-On (SSO)')).toBeDefined();
498499
});
499500

500501
it('does not include SSO when disabled at the instance level', async () => {
@@ -514,7 +515,7 @@ describe('OrganizationProfile', () => {
514515
});
515516

516517
const { queryByText } = render(<OrganizationProfile />, { wrapper });
517-
await waitFor(() => expect(queryByText('Self-Serve SSO')).toBeNull());
518+
await waitFor(() => expect(queryByText('Single Sign-On (SSO)')).toBeNull());
518519
});
519520

520521
it('does not include SSO when the org has not opted in, even if the instance has it enabled', async () => {
@@ -534,10 +535,10 @@ describe('OrganizationProfile', () => {
534535
});
535536

536537
const { queryByText } = render(<OrganizationProfile />, { wrapper });
537-
await waitFor(() => expect(queryByText('Self-Serve SSO')).toBeNull());
538+
await waitFor(() => expect(queryByText('Single Sign-On (SSO)')).toBeNull());
538539
});
539540

540-
it('includes SSO even when the user does not have the manage enterprise connections permission', async () => {
541+
it('includes SSO even when the user does not have the manage enterprise connections permission, but the page surfaces a warning', async () => {
541542
const { wrapper } = await createFixtures(f => {
542543
f.withEnterpriseSso({ selfServeSSO: true });
543544
f.withOrganizations();
@@ -553,9 +554,15 @@ describe('OrganizationProfile', () => {
553554
});
554555
});
555556

556-
// TODO -> Add assertions for page content warning
557557
render(<OrganizationProfile />, { wrapper });
558-
expect(await screen.findByText('Self-Serve SSO')).toBeDefined();
558+
expect(await screen.findByText('Single Sign-On (SSO)')).toBeDefined();
559+
560+
cleanup();
561+
render(<OrganizationSelfServeSSOPage />, { wrapper });
562+
expect(await screen.findByText(/you do not have permission to manage enterprise connections/i)).toBeDefined();
563+
expect(
564+
screen.queryByText(/contact your organization administrator in order to have permissions/i),
565+
).toBeInTheDocument();
559566
});
560567
});
561568

0 commit comments

Comments
 (0)