Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/shaky-papers-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@clerk/clerk-js': patch
'@clerk/types': patch
---

Rename task key from `select-organization` to `choose-organization`
6 changes: 3 additions & 3 deletions integration/tests/session-tasks-eject-flow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { ClerkProvider } from "@clerk/nextjs";

export function Provider({ children }: { children: any }) {
return (
<ClerkProvider taskUrls={{ 'select-organization': '/onboarding/select-organization' }}>
<ClerkProvider taskUrls={{ 'choose-organization': '/onboarding/choose-organization' }}>
{children}
</ClerkProvider>
)
Expand Down Expand Up @@ -50,7 +50,7 @@ return (
}`,
)
.addFile(
'src/app/onboarding/select-organization/page.tsx',
'src/app/onboarding/choose-organization/page.tsx',
() => `
import { TaskChooseOrganization } from '@clerk/nextjs';

Expand Down Expand Up @@ -96,7 +96,7 @@ return (
await u.po.expect.toBeSignedIn();

// Complete the organization selection task
await u.page.waitForAppUrl('/onboarding/select-organization');
await u.page.waitForAppUrl('/onboarding/choose-organization');
const fakeOrganization = Object.assign(u.services.organizations.createFakeOrganization(), {
slug: u.services.organizations.createFakeOrganization().slug + '-eject-flow',
});
Expand Down
26 changes: 13 additions & 13 deletions packages/clerk-js/src/core/__tests__/clerk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,17 +483,17 @@ describe('Clerk singleton', () => {
touch: jest.fn(() => Promise.resolve()),
getToken: jest.fn(),
lastActiveToken: { getRawString: () => 'mocked-token' },
tasks: [{ key: 'select-organization' }],
currentTask: { key: 'select-organization', __internal_getUrl: () => 'https://sut/tasks/select-organization' },
tasks: [{ key: 'choose-organization' }],
currentTask: { key: 'choose-organization', __internal_getUrl: () => 'https://sut/tasks/choose-organization' },
reload: jest.fn(() =>
Promise.resolve({
id: '1',
status: 'pending',
user: {},
tasks: [{ key: 'select-organization' }],
tasks: [{ key: 'choose-organization' }],
currentTask: {
key: 'select-organization',
__internal_getUrl: () => 'https://sut/tasks/select-organization',
key: 'choose-organization',
__internal_getUrl: () => 'https://sut/tasks/choose-organization',
},
}),
),
Expand Down Expand Up @@ -929,8 +929,8 @@ describe('Clerk singleton', () => {
id: '1',
status: 'pending',
user: {},
tasks: [{ key: 'select-organization' }],
currentTask: { key: 'select-organization', __internal_getUrl: () => 'https://sut/tasks/select-organization' },
tasks: [{ key: 'choose-organization' }],
currentTask: { key: 'choose-organization', __internal_getUrl: () => 'https://sut/tasks/choose-organization' },
lastActiveToken: { getRawString: () => 'mocked-token' },
};

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

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

Expand Down Expand Up @@ -2438,8 +2438,8 @@ describe('Clerk singleton', () => {
id: '1',
status: 'pending',
user: {},
tasks: [{ key: 'select-organization' }],
currentTask: { key: 'select-organization', __internal_getUrl: () => 'https://sut/tasks/select-organization' },
tasks: [{ key: 'choose-organization' }],
currentTask: { key: 'choose-organization', __internal_getUrl: () => 'https://sut/tasks/choose-organization' },
lastActiveToken: { getRawString: () => 'mocked-token' },
};

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

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

it('navigates to next task with custom routing from clerk options', async () => {
const sut = new Clerk(productionPublishableKey);
await sut.load({
...mockedLoadOptions,
taskUrls: {
'select-organization': '/onboarding/select-organization',
'choose-organization': '/onboarding/choose-organization',
},
});

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

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

Expand Down
2 changes: 1 addition & 1 deletion packages/clerk-js/src/core/sessionTasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
import { buildURL } from '../utils';

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

interface NavigateToTaskOptions {
Expand Down
2 changes: 1 addition & 1 deletion packages/clerk-js/src/ui/components/SessionTasks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function SessionTaskRoutes(): JSX.Element {

return (
<Switch>
<Route path={INTERNAL_SESSION_TASK_ROUTE_BY_KEY['select-organization']}>
<Route path={INTERNAL_SESSION_TASK_ROUTE_BY_KEY['choose-organization']}>
<TaskChooseOrganizationContext.Provider
value={{ componentName: 'TaskChooseOrganization', redirectUrlComplete: ctx.redirectUrlComplete }}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('TaskChooseOrganization', () => {
f.withUser({
email_addresses: ['[email protected]'],
create_organization_enabled: true,
tasks: [{ key: 'select-organization' }],
tasks: [{ key: 'choose-organization' }],
});
});

Expand All @@ -55,7 +55,7 @@ describe('TaskChooseOrganization', () => {
f.withUser({
email_addresses: ['[email protected]'],
create_organization_enabled: true,
tasks: [{ key: 'select-organization' }],
tasks: [{ key: 'choose-organization' }],
});
});

Expand All @@ -74,7 +74,7 @@ describe('TaskChooseOrganization', () => {
f.withUser({
email_addresses: ['[email protected]'],
create_organization_enabled: true,
tasks: [{ key: 'select-organization' }],
tasks: [{ key: 'choose-organization' }],
});
});

Expand Down Expand Up @@ -114,7 +114,7 @@ describe('TaskChooseOrganization', () => {
f.withUser({
email_addresses: ['[email protected]'],
create_organization_enabled: true,
tasks: [{ key: 'select-organization' }],
tasks: [{ key: 'choose-organization' }],
});
});

Expand Down Expand Up @@ -173,7 +173,7 @@ describe('TaskChooseOrganization', () => {
f.withUser({
email_addresses: ['[email protected]'],
create_organization_enabled: true,
tasks: [{ key: 'select-organization' }],
tasks: [{ key: 'choose-organization' }],
});
});

Expand All @@ -192,7 +192,7 @@ describe('TaskChooseOrganization', () => {
f.withUser({
email_addresses: ['[email protected]'],
create_organization_enabled: true,
tasks: [{ key: 'select-organization' }],
tasks: [{ key: 'choose-organization' }],
});
});

Expand All @@ -211,7 +211,7 @@ describe('TaskChooseOrganization', () => {
f.withUser({
username: 'testuser',
create_organization_enabled: true,
tasks: [{ key: 'select-organization' }],
tasks: [{ key: 'choose-organization' }],
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export interface SessionTask {
/**
* A unique identifier for the task
*/
key: 'select-organization';
key: 'choose-organization';
}

export type GetTokenOptions = {
Expand Down