-
Notifications
You must be signed in to change notification settings - Fork 320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(clerk-js,types): Navigate to session tasks #5187
Draft
LauraBeatris
wants to merge
17
commits into
main
Choose a base branch
from
laura/tasks-sign-sign-up-routes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+437
−29
Draft
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
6622e0a
Add `tasks` on `Session` resource
LauraBeatris 7d2d43d
Add changeset
LauraBeatris d4f072e
Update redirect guard to explict check for `active`
LauraBeatris e307f3a
Display pending task routes
LauraBeatris 0d0a717
Update handling for array of tasks
LauraBeatris f44a7ec
Fix session task key
LauraBeatris 43beb76
Implement unit tests for Task component
LauraBeatris 46fe2b8
Add unit tests for `useTaskRoute`
LauraBeatris 9234c79
Add option for a custom tasks URL to cover custom flow
LauraBeatris d38dbbc
Refactor redirect guards for tasks
LauraBeatris 1dc30d5
Does not trigger `redirectUrl` logic
LauraBeatris 36e0c91
Trigger navigation on client-piggybacking
LauraBeatris f1e64f1
Set tasks URL on the sign-in/sign-up context
LauraBeatris 9a5415d
Introduce separate redirect guards for tasks
LauraBeatris 1233d3b
Add unit test for redirection to task
LauraBeatris e15d124
Introduce skeleton for integration tests
LauraBeatris 61dff33
Introduce new base skeleton for URL resolution
LauraBeatris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@clerk/clerk-js': patch | ||
'@clerk/types': patch | ||
--- | ||
|
||
Navigate to session tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { appConfigs } from '../presets'; | ||
import { testAgainstRunningApps } from '../testUtils'; | ||
|
||
// TODO ORGS-566 - Write integration tests for after-auth flow | ||
testAgainstRunningApps({ withEnv: [appConfigs.envs.withEmailCodes] })('after-auth flows @generic @nextjs', () => { | ||
describe('after sign-in', () => { | ||
// /sign-in -> /sign-in/select-organization | ||
it.todo('navigates to tasks'); | ||
|
||
// /sign-in -> /sign-in/select-organization -> /app (after-sign-in URL) | ||
it.todo('navigates to after-sign-in URL when tasks get resolved'); | ||
|
||
// with session status pending -> accesses /sign-in -> redirects to /sign-in/select-organization | ||
it.todo('on single-session mode, sign-in redirects back to tasks when accessed with a pending session'); | ||
}); | ||
|
||
describe('after sign-up', () => { | ||
// /sign-up -> /sign-up/select-organization | ||
it.todo('navigates to tasks'); | ||
|
||
// /sign-up -> /sign-up/select-organization -> /app/welcome (after-sign-up URL) | ||
it.todo('navigates to after-sign-up URL when tasks get resolved'); | ||
|
||
// with session status pending -> accesses /sign-up -> redirects to /sign-up/select-organization | ||
it.todo('on single-session mode, sign-up redirects back to tasks when accessed with a pending session'); | ||
}); | ||
|
||
describe('when user is using the app and session transitions to active to pending', () => { | ||
// /my-dashboard/recipes -> /sign-in/select-organization | ||
it.todo('on session transition to pending with tasks, redirects to tasks'); | ||
|
||
// /my-dashboard/recipes -> /sign-in/select-organization -> /my-dashboard/recipes | ||
it.todo('navigates to middle app origin when tasks get resolved'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { SessionTask } from '@clerk/types'; | ||
|
||
export const sessionTaskRoutePaths = ['select-organization'] as const; | ||
|
||
type SessionTaskRoutePath = (typeof sessionTaskRoutePaths)[number]; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const sessionTaskKeyToRoutePaths: Record<SessionTask['key'], SessionTaskRoutePath> = { | ||
org: 'select-organization', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a placeholder for me to come back later which is helpful to visualize the redirection behavior introduced in this PR
The reason integration tests aren't being implemented is that FAPI changes for that are under development and it could break CI