Skip to content

Commit 43ea069

Browse files
authored
chore(clerk-js): Rename org session task key to select-organization (#6372)
1 parent c61855c commit 43ea069

File tree

5 files changed

+20
-11
lines changed

5 files changed

+20
-11
lines changed

.changeset/wicked-meals-travel.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 `org` session task key to `select-organization`

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

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -485,15 +485,18 @@ describe('Clerk singleton', () => {
485485
touch: jest.fn(() => Promise.resolve()),
486486
getToken: jest.fn(),
487487
lastActiveToken: { getRawString: () => 'mocked-token' },
488-
tasks: [{ key: 'org' }],
489-
currentTask: { key: 'org', __internal_getUrl: () => 'https://sut/tasks/add-organization' },
488+
tasks: [{ key: 'select-organization' }],
489+
currentTask: { key: 'select-organization', __internal_getUrl: () => 'https://sut/tasks/select-organization' },
490490
reload: jest.fn(() =>
491491
Promise.resolve({
492492
id: '1',
493493
status: 'pending',
494494
user: {},
495-
tasks: [{ key: 'org' }],
496-
currentTask: { key: 'org', __internal_getUrl: () => 'https://sut/tasks/add-organization' },
495+
tasks: [{ key: 'select-organization' }],
496+
currentTask: {
497+
key: 'select-organization',
498+
__internal_getUrl: () => 'https://sut/tasks/select-organization',
499+
},
497500
}),
498501
),
499502
};
@@ -2337,8 +2340,8 @@ describe('Clerk singleton', () => {
23372340
id: '1',
23382341
status: 'pending',
23392342
user: {},
2340-
tasks: [{ key: 'org' }],
2341-
currentTask: { key: 'org', __internal_getUrl: () => 'https://sut/tasks/add-organization' },
2343+
tasks: [{ key: 'select-organization' }],
2344+
currentTask: { key: 'select-organization', __internal_getUrl: () => 'https://sut/tasks/select-organization' },
23422345
lastActiveToken: { getRawString: () => 'mocked-token' },
23432346
};
23442347

@@ -2367,15 +2370,15 @@ describe('Clerk singleton', () => {
23672370
await sut.setActive({ session: mockResource as any as PendingSessionResource });
23682371
await sut.__internal_navigateToTaskIfAvailable();
23692372

2370-
expect(mockNavigate.mock.calls[0][0]).toBe('/sign-in#/tasks/add-organization');
2373+
expect(mockNavigate.mock.calls[0][0]).toBe('/sign-in#/tasks/select-organization');
23712374
});
23722375

23732376
it('navigates to next task with custom routing from clerk options', async () => {
23742377
const sut = new Clerk(productionPublishableKey);
23752378
await sut.load({
23762379
...mockedLoadOptions,
23772380
taskUrls: {
2378-
org: '/onboarding/select-organization',
2381+
'select-organization': '/onboarding/select-organization',
23792382
},
23802383
});
23812384

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-
org: 'add-organization',
11+
'select-organization': 'select-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
@@ -38,7 +38,7 @@ const SessionTasksStart = () => {
3838
function SessionTaskRoutes(): JSX.Element {
3939
return (
4040
<Switch>
41-
<Route path={INTERNAL_SESSION_TASK_ROUTE_BY_KEY['org']}>
41+
<Route path={INTERNAL_SESSION_TASK_ROUTE_BY_KEY['select-organization']}>
4242
<ForceOrganizationSelectionTask />
4343
</Route>
4444
<Route index>

packages/types/src/session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ export interface SessionTask {
334334
/**
335335
* The unique identifier for the type of task that needs to be completed
336336
*/
337-
key: 'org';
337+
key: 'select-organization';
338338
}
339339

340340
export type GetTokenOptions = {

0 commit comments

Comments
 (0)