Skip to content

Commit 58a90f2

Browse files
committed
Rename TaskSelectOrganization to TaskChooseOrganization
1 parent 031e6ee commit 58a90f2

File tree

28 files changed

+140
-140
lines changed

28 files changed

+140
-140
lines changed

integration/tests/session-tasks-eject-flow.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ return (
5252
.addFile(
5353
'src/app/onboarding/select-organization/page.tsx',
5454
() => `
55-
import { TaskSelectOrganization } from '@clerk/nextjs';
55+
import { TaskChooseOrganization } from '@clerk/nextjs';
5656
5757
export default function Page() {
5858
return (
59-
<TaskSelectOrganization redirectUrlComplete='/'/>
59+
<TaskChooseOrganization redirectUrlComplete='/'/>
6060
);
6161
}`,
6262
)

packages/clerk-js/sandbox/app.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as l from '../../localizations';
21
import type { Clerk as ClerkType } from '../';
2+
import * as l from '../../localizations';
33

44
const AVAILABLE_LOCALES = Object.keys(l) as (keyof typeof l)[];
55

@@ -35,7 +35,7 @@ const AVAILABLE_COMPONENTS = [
3535
'pricingTable',
3636
'apiKeys',
3737
'oauthConsent',
38-
'taskSelectOrganization',
38+
'taskChooseOrganization',
3939
] as const;
4040

4141
const COMPONENT_PROPS_NAMESPACE = 'clerk-js-sandbox';
@@ -96,7 +96,7 @@ const componentControls: Record<(typeof AVAILABLE_COMPONENTS)[number], Component
9696
pricingTable: buildComponentControls('pricingTable'),
9797
apiKeys: buildComponentControls('apiKeys'),
9898
oauthConsent: buildComponentControls('oauthConsent'),
99-
taskSelectOrganization: buildComponentControls('taskSelectOrganization'),
99+
taskChooseOrganization: buildComponentControls('taskChooseOrganization'),
100100
};
101101

102102
declare global {
@@ -337,10 +337,10 @@ void (async () => {
337337
},
338338
);
339339
},
340-
'/task-select-organization': () => {
341-
Clerk.mountTaskSelectOrganization(
340+
'/task-choose-organization': () => {
341+
Clerk.mountTaskChooseOrganization(
342342
app,
343-
componentControls.taskSelectOrganization.getProps() ?? {
343+
componentControls.taskChooseOrganization.getProps() ?? {
344344
redirectUrlComplete: '/user-profile',
345345
},
346346
);

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ import type {
3030
AuthenticateWithGoogleOneTapParams,
3131
AuthenticateWithMetamaskParams,
3232
AuthenticateWithOKXWalletParams,
33-
Clerk as ClerkInterface,
3433
ClerkAPIError,
3534
ClerkAuthenticateWithWeb3Params,
35+
Clerk as ClerkInterface,
3636
ClerkOptions,
3737
ClientJSONSnapshot,
3838
ClientResource,
@@ -76,7 +76,7 @@ import type {
7676
SignUpProps,
7777
SignUpRedirectOptions,
7878
SignUpResource,
79-
TaskSelectOrganizationProps,
79+
TaskChooseOrganizationProps,
8080
UnsubscribeCallback,
8181
UserButtonProps,
8282
UserProfileProps,
@@ -1163,31 +1163,31 @@ export class Clerk implements ClerkInterface {
11631163
void this.#componentControls.ensureMounted().then(controls => controls.unmountComponent({ node }));
11641164
};
11651165

1166-
public mountTaskSelectOrganization = (node: HTMLDivElement, props?: TaskSelectOrganizationProps) => {
1166+
public mountTaskChooseOrganization = (node: HTMLDivElement, props?: TaskChooseOrganizationProps) => {
11671167
this.assertComponentsReady(this.#componentControls);
11681168

11691169
if (disabledOrganizationsFeature(this, this.environment)) {
11701170
if (this.#instanceType === 'development') {
1171-
throw new ClerkRuntimeError(warnings.cannotRenderAnyOrganizationComponent('TaskSelectOrganization'), {
1171+
throw new ClerkRuntimeError(warnings.cannotRenderAnyOrganizationComponent('TaskChooseOrganization'), {
11721172
code: CANNOT_RENDER_ORGANIZATIONS_DISABLED_ERROR_CODE,
11731173
});
11741174
}
11751175
return;
11761176
}
11771177

1178-
void this.#componentControls.ensureMounted({ preloadHint: 'TaskSelectOrganization' }).then(controls =>
1178+
void this.#componentControls.ensureMounted({ preloadHint: 'TaskChooseOrganization' }).then(controls =>
11791179
controls.mountComponent({
1180-
name: 'TaskSelectOrganization',
1181-
appearanceKey: 'taskSelectOrganization',
1180+
name: 'TaskChooseOrganization',
1181+
appearanceKey: 'taskChooseOrganization',
11821182
node,
11831183
props,
11841184
}),
11851185
);
11861186

1187-
this.telemetry?.record(eventPrebuiltComponentMounted('TaskSelectOrganization', props));
1187+
this.telemetry?.record(eventPrebuiltComponentMounted('TaskChooseOrganization', props));
11881188
};
11891189

1190-
public unmountTaskSelectOrganization = (node: HTMLDivElement) => {
1190+
public unmountTaskChooseOrganization = (node: HTMLDivElement) => {
11911191
this.assertComponentsReady(this.#componentControls);
11921192
void this.#componentControls.ensureMounted().then(controls => controls.unmountComponent({ node }));
11931193
};

packages/clerk-js/src/core/warnings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const createMessageForDisabledOrganizations = (
1010
| 'OrganizationSwitcher'
1111
| 'OrganizationList'
1212
| 'CreateOrganization'
13-
| 'TaskSelectOrganization',
13+
| 'TaskChooseOrganization',
1414
) => {
1515
return formatWarning(
1616
`The <${componentName}/> cannot be rendered when the feature is turned off. Visit 'dashboard.clerk.com' to enable the feature. Since the feature is turned off, this is no-op.`,
@@ -29,7 +29,7 @@ const warnings = {
2929
cannotRenderSignUpComponentWhenTaskExists:
3030
'The <SignUp/> component cannot render when a user has a pending task, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the task instead.',
3131
cannotRenderComponentWhenTaskDoesNotExist:
32-
'<TaskSelectOrganization/> cannot render unless a session task is pending. Clerk is redirecting to the value set in `redirectUrlComplete` instead.',
32+
'<TaskChooseOrganization/> cannot render unless a session task is pending. Clerk is redirecting to the value set in `redirectUrlComplete` instead.',
3333
cannotRenderSignInComponentWhenSessionExists:
3434
'The <SignIn/> component cannot render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the `afterSignIn` URL instead.',
3535
cannotRenderSignInComponentWhenTaskExists:

packages/clerk-js/src/ui/components/SessionTasks/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import { INTERNAL_SESSION_TASK_ROUTE_BY_KEY } from '../../../core/sessionTasks';
1010
import { SignInContext, SignUpContext } from '../../../ui/contexts';
1111
import {
1212
SessionTasksContext,
13-
TaskSelectOrganizationContext,
13+
TaskChooseOrganizationContext,
1414
useSessionTasksContext,
1515
} from '../../contexts/components/SessionTasks';
1616
import { Route, Switch, useRouter } from '../../router';
17-
import { TaskSelectOrganization } from './tasks/TaskSelectOrganization';
17+
import { TaskChooseOrganization } from './tasks/TaskChooseOrganization';
1818

1919
const SessionTasksStart = () => {
2020
const clerk = useClerk();
@@ -45,11 +45,11 @@ function SessionTaskRoutes(): JSX.Element {
4545
return (
4646
<Switch>
4747
<Route path={INTERNAL_SESSION_TASK_ROUTE_BY_KEY['select-organization']}>
48-
<TaskSelectOrganizationContext.Provider
49-
value={{ componentName: 'TaskSelectOrganization', redirectUrlComplete: ctx.redirectUrlComplete }}
48+
<TaskChooseOrganizationContext.Provider
49+
value={{ componentName: 'TaskChooseOrganization', redirectUrlComplete: ctx.redirectUrlComplete }}
5050
>
51-
<TaskSelectOrganization />
52-
</TaskSelectOrganizationContext.Provider>
51+
<TaskChooseOrganization />
52+
</TaskChooseOrganizationContext.Provider>
5353
</Route>
5454
<Route index>
5555
<SessionTasksStart />
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ import { useOrganizationListInView } from '@/ui/hooks/useOrganizationListInView'
2525
import { Add } from '@/ui/icons';
2626
import { handleError } from '@/ui/utils/errorHandler';
2727

28-
type SelectOrganizationScreenProps = {
28+
type ChooseOrganizationScreenProps = {
2929
onCreateOrganizationClick: () => void;
3030
};
3131

32-
export const SelectOrganizationScreen = withCardStateProvider(
33-
({ onCreateOrganizationClick }: SelectOrganizationScreenProps) => {
32+
export const ChooseOrganizationScreen = withCardStateProvider(
33+
({ onCreateOrganizationClick }: ChooseOrganizationScreenProps) => {
3434
const { ref, userMemberships, userSuggestions, userInvitations } = useOrganizationListInView();
3535

3636
const isLoading = userMemberships?.isLoading || userInvitations?.isLoading || userSuggestions?.isLoading;
@@ -47,11 +47,11 @@ export const SelectOrganizationScreen = withCardStateProvider(
4747
showLogo
4848
sx={t => ({ padding: `${t.space.$none} ${t.space.$8}` })}
4949
>
50-
<Header.Title localizationKey={localizationKeys('taskSelectOrganization.selectOrganization.title')} />
51-
<Header.Subtitle localizationKey={localizationKeys('taskSelectOrganization.selectOrganization.subtitle')} />
50+
<Header.Title localizationKey={localizationKeys('taskChooseOrganization.chooseOrganization.title')} />
51+
<Header.Subtitle localizationKey={localizationKeys('taskChooseOrganization.chooseOrganization.subtitle')} />
5252
</Header.Root>
5353
<Col elementDescriptor={descriptors.main}>
54-
<OrganizationPreviewListItems elementDescriptor={descriptors.taskSelectOrganizationPreviewItems}>
54+
<OrganizationPreviewListItems elementDescriptor={descriptors.taskChooseOrganizationPreviewItems}>
5555
<Actions role='menu'>
5656
{(userMemberships.count || 0) > 0 &&
5757
userMemberships.data?.map(inv => {
@@ -117,11 +117,11 @@ const MembershipPreview = withCardStateProvider((props: { organization: Organiza
117117

118118
return (
119119
<OrganizationPreviewButton
120-
elementDescriptor={descriptors.taskSelectOrganizationPreviewButton}
120+
elementDescriptor={descriptors.taskChooseOrganizationPreviewButton}
121121
onClick={() => handleOrganizationClicked(props.organization)}
122122
>
123123
<OrganizationPreview
124-
elementId='taskSelectOrganization'
124+
elementId='taskChooseOrganization'
125125
mainIdentifierSx={sharedMainIdentifierSx}
126126
organization={props.organization}
127127
/>
@@ -163,13 +163,13 @@ const InvitationPreview = withCardStateProvider((props: UserOrganizationInvitati
163163
return (
164164
<OrganizationPreviewListItem
165165
organizationData={props.publicOrganizationData}
166-
elementId='taskSelectOrganization'
167-
elementDescriptor={descriptors.taskSelectOrganizationPreviewItem}
166+
elementId='taskChooseOrganization'
167+
elementDescriptor={descriptors.taskChooseOrganizationPreviewItem}
168168
>
169169
<OrganizationPreviewListItemButton
170170
isLoading={card.isLoading}
171171
onClick={handleAccept}
172-
localizationKey={localizationKeys('taskSelectOrganization.selectOrganization.action__invitationAccept')}
172+
localizationKey={localizationKeys('taskChooseOrganization.chooseOrganization.action__invitationAccept')}
173173
/>
174174
</OrganizationPreviewListItem>
175175
);
@@ -195,21 +195,21 @@ const SuggestionPreview = withCardStateProvider((props: OrganizationSuggestionRe
195195
return (
196196
<Text
197197
colorScheme='secondary'
198-
localizationKey={localizationKeys('taskSelectOrganization.selectOrganization.suggestionsAcceptedLabel')}
198+
localizationKey={localizationKeys('taskChooseOrganization.chooseOrganization.suggestionsAcceptedLabel')}
199199
/>
200200
);
201201
}
202202

203203
return (
204204
<OrganizationPreviewListItem
205205
organizationData={props.publicOrganizationData}
206-
elementId='taskSelectOrganization'
207-
elementDescriptor={descriptors.taskSelectOrganizationPreviewItem}
206+
elementId='taskChooseOrganization'
207+
elementDescriptor={descriptors.taskChooseOrganizationPreviewItem}
208208
>
209209
<OrganizationPreviewListItemButton
210210
onClick={handleAccept}
211211
isLoading={card.isLoading}
212-
localizationKey={localizationKeys('taskSelectOrganization.selectOrganization.action__suggestionsAccept')}
212+
localizationKey={localizationKeys('taskChooseOrganization.chooseOrganization.action__suggestionsAccept')}
213213
/>
214214
</OrganizationPreviewListItem>
215215
);
@@ -228,9 +228,9 @@ const CreateOrganizationButton = ({
228228

229229
return (
230230
<Action
231-
elementDescriptor={descriptors.taskSelectOrganizationCreateOrganizationActionButton}
231+
elementDescriptor={descriptors.taskChooseOrganizationCreateOrganizationActionButton}
232232
icon={Add}
233-
label={localizationKeys('taskSelectOrganization.selectOrganization.action__createOrganization')}
233+
label={localizationKeys('taskChooseOrganization.chooseOrganization.action__createOrganization')}
234234
onClick={onCreateOrganizationClick}
235235
sx={t => ({
236236
borderTopWidth: t.borderWidths.$normal,
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ export const CreateOrganizationScreen = withCardStateProvider((props: CreateOrga
7171
showLogo
7272
sx={t => ({ padding: `${t.space.$none} ${t.space.$8}` })}
7373
>
74-
<Header.Title localizationKey={localizationKeys('taskSelectOrganization.createOrganization.title')} />
75-
<Header.Subtitle localizationKey={localizationKeys('taskSelectOrganization.createOrganization.subtitle')} />
74+
<Header.Title localizationKey={localizationKeys('taskChooseOrganization.createOrganization.title')} />
75+
<Header.Subtitle localizationKey={localizationKeys('taskChooseOrganization.createOrganization.subtitle')} />
7676
</Header.Root>
7777
<FormContainer>
7878
<Form.Root
@@ -102,11 +102,11 @@ export const CreateOrganizationScreen = withCardStateProvider((props: CreateOrga
102102
<Form.SubmitButton
103103
block
104104
isDisabled={isSubmitButtonDisabled}
105-
localizationKey={localizationKeys('taskSelectOrganization.createOrganization.formButtonSubmit')}
105+
localizationKey={localizationKeys('taskChooseOrganization.createOrganization.formButtonSubmit')}
106106
/>
107107
{props.onCancel && (
108108
<Form.ResetButton
109-
localizationKey={localizationKeys('taskSelectOrganization.createOrganization.formButtonReset')}
109+
localizationKey={localizationKeys('taskChooseOrganization.createOrganization.formButtonReset')}
110110
onClick={props.onCancel}
111111
/>
112112
)}
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import userEvent from '@testing-library/user-event';
44
import { bindCreateFixtures, render, waitFor } from '@/testUtils';
55
import { createFakeUserOrganizationMembership } from '@/ui/components/OrganizationSwitcher/__tests__/utlis';
66

7-
import { TaskSelectOrganization } from '../';
7+
import { TaskChooseOrganization } from '..';
88

9-
const { createFixtures } = bindCreateFixtures('TaskSelectOrganization');
9+
const { createFixtures } = bindCreateFixtures('TaskChooseOrganization');
1010

11-
describe('TaskSelectOrganization', () => {
11+
describe('TaskChooseOrganization', () => {
1212
it('does not render component without existing session task', async () => {
1313
const { wrapper } = await createFixtures(f => {
1414
f.withOrganizations();
@@ -19,7 +19,7 @@ describe('TaskSelectOrganization', () => {
1919
});
2020
});
2121

22-
const { queryByText, queryByRole } = render(<TaskSelectOrganization />, { wrapper });
22+
const { queryByText, queryByRole } = render(<TaskChooseOrganization />, { wrapper });
2323

2424
await waitFor(() => {
2525
expect(queryByText('Setup your account')).not.toBeInTheDocument();
@@ -39,7 +39,7 @@ describe('TaskSelectOrganization', () => {
3939
});
4040
});
4141

42-
const { getByText, getByRole } = render(<TaskSelectOrganization />, { wrapper });
42+
const { getByText, getByRole } = render(<TaskChooseOrganization />, { wrapper });
4343

4444
await waitFor(() => {
4545
expect(getByText('Setup your account')).toBeInTheDocument();
@@ -59,7 +59,7 @@ describe('TaskSelectOrganization', () => {
5959
});
6060
});
6161

62-
const { getByRole, getByText } = render(<TaskSelectOrganization />, { wrapper });
62+
const { getByRole, getByText } = render(<TaskChooseOrganization />, { wrapper });
6363

6464
await waitFor(() => {
6565
expect(getByRole('textbox', { name: /name/i })).toBeInTheDocument();
@@ -98,7 +98,7 @@ describe('TaskSelectOrganization', () => {
9898
}),
9999
);
100100

101-
const { getByText, queryByRole } = render(<TaskSelectOrganization />, { wrapper });
101+
const { getByText, queryByRole } = render(<TaskChooseOrganization />, { wrapper });
102102

103103
await waitFor(() => {
104104
expect(getByText('Existing Org')).toBeInTheDocument();
@@ -138,7 +138,7 @@ describe('TaskSelectOrganization', () => {
138138
}),
139139
);
140140

141-
const { getByText, getByRole, queryByRole, queryByText } = render(<TaskSelectOrganization />, { wrapper });
141+
const { getByText, getByRole, queryByRole, queryByText } = render(<TaskChooseOrganization />, { wrapper });
142142

143143
await waitFor(() => {
144144
expect(getByText('Existing Org')).toBeInTheDocument();
@@ -177,7 +177,7 @@ describe('TaskSelectOrganization', () => {
177177
});
178178
});
179179

180-
const { getByText } = render(<TaskSelectOrganization />, { wrapper });
180+
const { getByText } = render(<TaskChooseOrganization />, { wrapper });
181181

182182
await waitFor(() => {
183183
expect(getByText(/user@test\.com/)).toBeInTheDocument();
@@ -196,7 +196,7 @@ describe('TaskSelectOrganization', () => {
196196
});
197197
});
198198

199-
const { getByRole } = render(<TaskSelectOrganization />, { wrapper });
199+
const { getByRole } = render(<TaskChooseOrganization />, { wrapper });
200200
const signOutButton = getByRole('link', { name: /sign out/i });
201201

202202
await userEvent.click(signOutButton);
@@ -215,7 +215,7 @@ describe('TaskSelectOrganization', () => {
215215
});
216216
});
217217

218-
const { getByText } = render(<TaskSelectOrganization />, { wrapper });
218+
const { getByText } = render(<TaskChooseOrganization />, { wrapper });
219219

220220
expect(getByText(/testuser/)).toBeInTheDocument();
221221
});

0 commit comments

Comments
 (0)