Skip to content

Commit 696f8e1

Browse files
authored
chore(clerk-js): Rename task key from select-organization to choose-organization (#6482)
1 parent 1ad16da commit 696f8e1

File tree

7 files changed

+32
-26
lines changed

7 files changed

+32
-26
lines changed

.changeset/shaky-papers-push.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
'@clerk/types': patch
4+
---
5+
6+
Rename task key from `select-organization` to `choose-organization`

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { ClerkProvider } from "@clerk/nextjs";
2020
2121
export function Provider({ children }: { children: any }) {
2222
return (
23-
<ClerkProvider taskUrls={{ 'select-organization': '/onboarding/select-organization' }}>
23+
<ClerkProvider taskUrls={{ 'choose-organization': '/onboarding/choose-organization' }}>
2424
{children}
2525
</ClerkProvider>
2626
)
@@ -50,7 +50,7 @@ return (
5050
}`,
5151
)
5252
.addFile(
53-
'src/app/onboarding/select-organization/page.tsx',
53+
'src/app/onboarding/choose-organization/page.tsx',
5454
() => `
5555
import { TaskChooseOrganization } from '@clerk/nextjs';
5656
@@ -96,7 +96,7 @@ return (
9696
await u.po.expect.toBeSignedIn();
9797

9898
// Complete the organization selection task
99-
await u.page.waitForAppUrl('/onboarding/select-organization');
99+
await u.page.waitForAppUrl('/onboarding/choose-organization');
100100
const fakeOrganization = Object.assign(u.services.organizations.createFakeOrganization(), {
101101
slug: u.services.organizations.createFakeOrganization().slug + '-eject-flow',
102102
});

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -483,17 +483,17 @@ describe('Clerk singleton', () => {
483483
touch: jest.fn(() => Promise.resolve()),
484484
getToken: jest.fn(),
485485
lastActiveToken: { getRawString: () => 'mocked-token' },
486-
tasks: [{ key: 'select-organization' }],
487-
currentTask: { key: 'select-organization', __internal_getUrl: () => 'https://sut/tasks/select-organization' },
486+
tasks: [{ key: 'choose-organization' }],
487+
currentTask: { key: 'choose-organization', __internal_getUrl: () => 'https://sut/tasks/choose-organization' },
488488
reload: jest.fn(() =>
489489
Promise.resolve({
490490
id: '1',
491491
status: 'pending',
492492
user: {},
493-
tasks: [{ key: 'select-organization' }],
493+
tasks: [{ key: 'choose-organization' }],
494494
currentTask: {
495-
key: 'select-organization',
496-
__internal_getUrl: () => 'https://sut/tasks/select-organization',
495+
key: 'choose-organization',
496+
__internal_getUrl: () => 'https://sut/tasks/choose-organization',
497497
},
498498
}),
499499
),
@@ -929,8 +929,8 @@ describe('Clerk singleton', () => {
929929
id: '1',
930930
status: 'pending',
931931
user: {},
932-
tasks: [{ key: 'select-organization' }],
933-
currentTask: { key: 'select-organization', __internal_getUrl: () => 'https://sut/tasks/select-organization' },
932+
tasks: [{ key: 'choose-organization' }],
933+
currentTask: { key: 'choose-organization', __internal_getUrl: () => 'https://sut/tasks/choose-organization' },
934934
lastActiveToken: { getRawString: () => 'mocked-token' },
935935
};
936936

@@ -970,7 +970,7 @@ describe('Clerk singleton', () => {
970970
await sut.handleRedirectCallback();
971971

972972
await waitFor(() => {
973-
expect(mockNavigate.mock.calls[0][0]).toBe('/sign-in#/tasks/select-organization');
973+
expect(mockNavigate.mock.calls[0][0]).toBe('/sign-in#/tasks/choose-organization');
974974
});
975975
});
976976

@@ -2438,8 +2438,8 @@ describe('Clerk singleton', () => {
24382438
id: '1',
24392439
status: 'pending',
24402440
user: {},
2441-
tasks: [{ key: 'select-organization' }],
2442-
currentTask: { key: 'select-organization', __internal_getUrl: () => 'https://sut/tasks/select-organization' },
2441+
tasks: [{ key: 'choose-organization' }],
2442+
currentTask: { key: 'choose-organization', __internal_getUrl: () => 'https://sut/tasks/choose-organization' },
24432443
lastActiveToken: { getRawString: () => 'mocked-token' },
24442444
};
24452445

@@ -2473,22 +2473,22 @@ describe('Clerk singleton', () => {
24732473
await sut.setActive({ session: mockResource as any as PendingSessionResource });
24742474
await sut.__internal_navigateToTaskIfAvailable();
24752475

2476-
expect(mockNavigate.mock.calls[0][0]).toBe('/sign-in#/tasks/select-organization');
2476+
expect(mockNavigate.mock.calls[0][0]).toBe('/sign-in#/tasks/choose-organization');
24772477
});
24782478

24792479
it('navigates to next task with custom routing from clerk options', async () => {
24802480
const sut = new Clerk(productionPublishableKey);
24812481
await sut.load({
24822482
...mockedLoadOptions,
24832483
taskUrls: {
2484-
'select-organization': '/onboarding/select-organization',
2484+
'choose-organization': '/onboarding/choose-organization',
24852485
},
24862486
});
24872487

24882488
await sut.setActive({ session: mockResource as any as PendingSessionResource });
24892489
await sut.__internal_navigateToTaskIfAvailable();
24902490

2491-
expect(mockNavigate.mock.calls[0][0]).toBe('/onboarding/select-organization');
2491+
expect(mockNavigate.mock.calls[0][0]).toBe('/onboarding/choose-organization');
24922492
});
24932493
});
24942494

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type {
88
import { buildURL } from '../utils';
99

1010
export const INTERNAL_SESSION_TASK_ROUTE_BY_KEY: Record<SessionTask['key'], string> = {
11-
'select-organization': 'select-organization',
11+
'choose-organization': 'choose-organization',
1212
} as const;
1313

1414
interface NavigateToTaskOptions {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function SessionTaskRoutes(): JSX.Element {
4444

4545
return (
4646
<Switch>
47-
<Route path={INTERNAL_SESSION_TASK_ROUTE_BY_KEY['select-organization']}>
47+
<Route path={INTERNAL_SESSION_TASK_ROUTE_BY_KEY['choose-organization']}>
4848
<TaskChooseOrganizationContext.Provider
4949
value={{ componentName: 'TaskChooseOrganization', redirectUrlComplete: ctx.redirectUrlComplete }}
5050
>

packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('TaskChooseOrganization', () => {
3535
f.withUser({
3636
email_addresses: ['[email protected]'],
3737
create_organization_enabled: true,
38-
tasks: [{ key: 'select-organization' }],
38+
tasks: [{ key: 'choose-organization' }],
3939
});
4040
});
4141

@@ -55,7 +55,7 @@ describe('TaskChooseOrganization', () => {
5555
f.withUser({
5656
email_addresses: ['[email protected]'],
5757
create_organization_enabled: true,
58-
tasks: [{ key: 'select-organization' }],
58+
tasks: [{ key: 'choose-organization' }],
5959
});
6060
});
6161

@@ -74,7 +74,7 @@ describe('TaskChooseOrganization', () => {
7474
f.withUser({
7575
email_addresses: ['[email protected]'],
7676
create_organization_enabled: true,
77-
tasks: [{ key: 'select-organization' }],
77+
tasks: [{ key: 'choose-organization' }],
7878
});
7979
});
8080

@@ -114,7 +114,7 @@ describe('TaskChooseOrganization', () => {
114114
f.withUser({
115115
email_addresses: ['[email protected]'],
116116
create_organization_enabled: true,
117-
tasks: [{ key: 'select-organization' }],
117+
tasks: [{ key: 'choose-organization' }],
118118
});
119119
});
120120

@@ -173,7 +173,7 @@ describe('TaskChooseOrganization', () => {
173173
f.withUser({
174174
email_addresses: ['[email protected]'],
175175
create_organization_enabled: true,
176-
tasks: [{ key: 'select-organization' }],
176+
tasks: [{ key: 'choose-organization' }],
177177
});
178178
});
179179

@@ -192,7 +192,7 @@ describe('TaskChooseOrganization', () => {
192192
f.withUser({
193193
email_addresses: ['[email protected]'],
194194
create_organization_enabled: true,
195-
tasks: [{ key: 'select-organization' }],
195+
tasks: [{ key: 'choose-organization' }],
196196
});
197197
});
198198

@@ -211,7 +211,7 @@ describe('TaskChooseOrganization', () => {
211211
f.withUser({
212212
username: 'testuser',
213213
create_organization_enabled: true,
214-
tasks: [{ key: 'select-organization' }],
214+
tasks: [{ key: 'choose-organization' }],
215215
});
216216
});
217217

packages/types/src/session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ export interface SessionTask {
333333
/**
334334
* A unique identifier for the task
335335
*/
336-
key: 'select-organization';
336+
key: 'choose-organization';
337337
}
338338

339339
export type GetTokenOptions = {

0 commit comments

Comments
 (0)