Skip to content

Commit a76363d

Browse files
committed
Rename property and fix navigation to IdP
1 parent 76f2d4b commit a76363d

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

packages/clerk-js/src/core/resources/EnterpriseAccount.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class EnterpriseAccountConnection extends BaseResource implements Enterpr
9595
protocol!: EnterpriseAccountResource['protocol'];
9696
provider!: EnterpriseAccountResource['provider'];
9797
syncUserAttributes!: boolean;
98-
allowAccountLinking!: boolean;
98+
allowOrganizationAccountLinking!: boolean;
9999
createdAt!: Date;
100100
updatedAt!: Date;
101101
enterpriseConnectionId: string | null = '';
@@ -117,7 +117,7 @@ export class EnterpriseAccountConnection extends BaseResource implements Enterpr
117117
this.allowSubdomains = data.allow_subdomains;
118118
this.allowIdpInitiated = data.allow_idp_initiated;
119119
this.disableAdditionalIdentifications = data.disable_additional_identifications;
120-
this.allowAccountLinking = data.allow_account_linking;
120+
this.allowOrganizationAccountLinking = data.allow_organization_account_linking;
121121
this.createdAt = unixEpochToDate(data.created_at);
122122
this.updatedAt = unixEpochToDate(data.updated_at);
123123
this.enterpriseConnectionId = data.enterprise_connection_id;
@@ -140,7 +140,7 @@ export class EnterpriseAccountConnection extends BaseResource implements Enterpr
140140
allow_subdomains: this.allowSubdomains,
141141
allow_idp_initiated: this.allowIdpInitiated,
142142
disable_additional_identifications: this.disableAdditionalIdentifications,
143-
allow_account_linking: this.allowAccountLinking,
143+
allow_organization_account_linking: this.allowOrganizationAccountLinking,
144144
enterprise_connection_id: this.enterpriseConnectionId,
145145
created_at: this.createdAt.getTime(),
146146
updated_at: this.updatedAt.getTime(),

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ describe('User', () => {
8686
object: 'enterprise_account_connection',
8787
name: 'Acme Corp SSO',
8888
active: true,
89-
allow_account_linking: true,
89+
allow_organization_account_linking: true,
9090
domain: 'acme.com',
9191
protocol: 'saml',
9292
provider: 'saml_okta',
@@ -121,7 +121,7 @@ describe('User', () => {
121121

122122
expect(connections).toHaveLength(1);
123123
expect(connections[0].name).toBe('Acme Corp SSO');
124-
expect(connections[0].allowAccountLinking).toBe(true);
124+
expect(connections[0].allowOrganizationAccountLinking).toBe(true);
125125
});
126126

127127
it('creates a web3 wallet', async () => {

packages/shared/src/types/enterpriseAccount.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export interface EnterpriseAccountConnectionResource extends ClerkResource {
3636
protocol: EnterpriseProtocol;
3737
provider: EnterpriseProvider;
3838
syncUserAttributes: boolean;
39-
allowAccountLinking: boolean;
39+
allowOrganizationAccountLinking: boolean;
4040
enterpriseConnectionId: string | null;
4141
__internal_toSnapshot: () => EnterpriseAccountConnectionJSONSnapshot;
4242
}

packages/shared/src/types/json.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ export interface EnterpriseAccountConnectionJSON extends ClerkResourceJSON {
272272
protocol: EnterpriseProtocol;
273273
provider: EnterpriseProvider;
274274
sync_user_attributes: boolean;
275-
allow_account_linking: boolean;
275+
allow_organization_account_linking: boolean;
276276
created_at: number;
277277
updated_at: number;
278278
enterprise_connection_id: string | null;

packages/ui/src/components/UserProfile/EnterpriseAccountsSection.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { appendModalState } from '@clerk/shared/internal/clerk-js/queryStateParams';
2+
import { windowNavigate } from '@clerk/shared/internal/clerk-js/windowNavigate';
23
import { useReverification, useUser } from '@clerk/shared/react';
34
import type {
45
EnterpriseAccountConnectionResource,
@@ -12,22 +13,19 @@ import { useCardState, withCardStateProvider } from '@/ui/elements/contexts';
1213
import { ProfileSection } from '@/ui/elements/Section';
1314
import { ThreeDotsMenu } from '@/ui/elements/ThreeDotsMenu';
1415
import { handleError } from '@/ui/utils/errorHandler';
15-
import { sleep } from '@/ui/utils/sleep';
1616

1717
import { ProviderIcon } from '../../common';
1818
import { useUserProfileContext } from '../../contexts';
1919
import { Badge, Box, descriptors, Flex, localizationKeys, Text } from '../../customizables';
2020
import { Action } from '../../elements/Action';
2121
import { useActionContext } from '../../elements/Action/ActionRoot';
22-
import { useRouter } from '../../router';
2322
import type { PropsOfComponent } from '../../styledSystem';
2423
import { RemoveEnterpriseAccountForm } from './RemoveResourceForm';
2524

2625
const EnterpriseConnectMenuButton = (props: { connection: EnterpriseAccountConnectionResource }) => {
2726
const { connection } = props;
2827
const card = useCardState();
2928
const { user } = useUser();
30-
const { navigate } = useRouter();
3129
const { componentName, mode } = useUserProfileContext();
3230
const isModal = mode === 'modal';
3331
const loadingKey = `enterprise_${connection.id}`;
@@ -47,11 +45,13 @@ const EnterpriseConnectMenuButton = (props: { connection: EnterpriseAccountConne
4745
}
4846

4947
card.setLoading(loadingKey);
48+
5049
return createExternalAccount()
5150
.then(res => {
5251
if (res?.verification?.externalVerificationRedirectURL) {
53-
void sleep(2000).then(() => card.setIdle(loadingKey));
54-
void navigate(res.verification.externalVerificationRedirectURL.href);
52+
windowNavigate(res.verification.externalVerificationRedirectURL);
53+
} else {
54+
card.setIdle(loadingKey);
5555
}
5656
})
5757
.catch(err => {
@@ -142,7 +142,7 @@ export const EnterpriseAccountsSection = withCardStateProvider(() => {
142142

143143
useEffect(() => {
144144
user?.getEnterpriseConnections?.().then(connections => {
145-
setEnterpriseConnections(connections.filter(c => c.allowAccountLinking));
145+
setEnterpriseConnections(connections.filter(c => c.allowOrganizationAccountLinking));
146146
});
147147
}, [user]);
148148

0 commit comments

Comments
 (0)