Repository navigation
feat(mosaic): wire up sign-up with step routing - #10881
austincalvelage wants to merge 73 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
🦋 Changeset detectedLatest commit: 319a9c3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 24 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-biometrics
@clerk/expo-google-signin
@clerk/expo-native-components
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/mosaic
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
…orts missing The continue screen now asks for the fields FAPI lists in missing_fields instead of re-deriving them from the instance settings. A missing email, phone or username that FAPI lists as optional is one choice, so the form asks for one of them. The fake FAPI lists every optional identifier as missing when none was given, as FAPI does.
…t progressive sign-up
…e continue screen cannot ask for When FAPI lists a missing requirement the continue form has no field for, such as a required OAuth provider, the step is unknown, so the user sees Start over instead of a form that can't finish. The fake FAPI lists required social providers as missing, as FAPI does.
…ebuilding it from settings
… continue test The switch round trip is covered by the progressive test. Here it typed the email twice on CI, so the test only checks that one field and the switch show.
…d is filled The form skips the browser's validation popup, so nothing stopped a sign-up from submitting with a required field empty. Continue now stays disabled until each required field and, when shown, legal consent are filled, as the other Mosaic forms do with canSubmit.
…n a code screen Clerk's sign-up signals are shared across Clerk instances. A test that ended while its code screen was still sending wrote that sign-up back into the signals after the next test reset them, so the next form prefilled the old email or username and typing doubled it on CI.
…opens with a code already out The countdown only started when the code screen sent the code itself, so a reload, a reopened verify route or a code sent by the form left Resend available at once. It now starts on arrival either way, as the legacy code card does.
SignUpFuture.update() now accepts a password, so a sign-up created without one can finish from the continue screen instead of asking again.
The after sign-up URL reads redirect_url and the redirect query params, and the sign-in and waitlist links carry redirect_url on.
The sign-up wrapper reads the choose-organization task model and passes it to the task screen, instead of the sign-up model calling the task's wrapper hook and the screen running the model again. The controller holds the finished screen until the task has loaded.
… finishing In single-session mode a signed-in visit leaves for the after sign-up URL, or the session's task URL, without showing the form, as the legacy withRedirectToAfterSignUp does. In multi-session mode the form stays, so the user can add an account. Once a sign-up this component ran has created its session, it renders nothing instead of holding the last screen busy while it stays mounted.
…tion The model reads the email verification's supportedStrategies instead of the instance settings, and the models guide names supportedStrategies as the answer to read before anything is sent.
Mark entry actions and transfer as planned, and describe the signed_in step, the end state after finishing, redirect_url, and how the wrapper passes the organization task.
The start-over notice reads its copy from `message` and `pending` since the AuthStartOver block moved to blocks/auth, so sign-up passes both and shows a failed Start over in the alert with the button kept available.
SignUpVerifyScreen requires isPending, so the example did not compile when copied.
…in story The sign-up step edits emailAddress, but submitSignUp still checked and sent identifier, so a changed email never reached validation or the code screen.
Remounting alone resumed the sign-up in progress, so Reset returned to the code screen instead of the start.
… test - Remove the start-over failure test. It stubbed clerk.client.resetSignUp, and signUp.reset() makes no request, so FAPI cannot produce that failure. - Fold "links to sign-in from the form" into the redirect_url sign-in link test. - Rename the reopened verify route test to what it asserts: no second code.
The fake FAPI asks a new sign-up for enterprise SSO when its email domain belongs to an enterprise connection, as clerk_go does. Sign-up has no enterprise screen yet, so the feature test covers the Start over it shows.
Description
Wires up the Mosaic
<SignUp />component, building on Alex's flow guide (packages/mosaic/docs/internals/sign-in-sign-up-flow.md). Each sign-up screen is its own component, and it mounts when its route is active. Routing is virtual for now, and should be easy to move to path routing once #10860 lands.SignUptakes someone from the first form to a signed-in session: details, email or phone code, then on to the app. It is not exported from the package entry yet.Stacked on #10957. The PRs it built on, #10867, #10868 and #10883, have merged. Below it are
channelonSignUpFuture.create()(#10955), which the WhatsApp PR above uses, then theAuthStartOverblock (#10956) and the alternative-channel fix (#10957). #10955 is a@clerk/sharedtype change, since clerk-js already sendschannel.Clerk guards the route if the sign-up isn't ready for that screen
1. The route you're on is the screen you get, unless the model's step says otherwise.
2. The code screen sends its code when it mounts if one hasn't been sent yet, and starts the resend countdown either way. Edit stays disabled until that first code is out.
The verify screen runs its own controller, so the wrapper builds it and passes it to the view as a slot:
3. The form lives above the screens, so start and continue share it, and your password is still there when you come back from the code screen.
4. Clerk wipes the sign-up once the code is accepted, which would flash the first form before the app navigates. So while finishing, we keep rendering the model we left from, like the switcher's
frozenModel.The machine holds that model while the live step is
leaving, or ataskwhose data hasn't loaded. The wrapper runs the organization task's model once, passes it to the task screen and tells the controller when it has loaded, so the task replaces the code screen in the same card with no skeleton in between. If the app set its own URL for that task intaskUrls, sign-up goes there. Once the hold ends with the session signed in, a<SignUp />that stays mounted renders nothing.5. The continue screen asks for what FAPI says is still missing, instead of rebuilding that list from the instance settings.
A missing email, phone or username that's also in
optional_fieldsmeans any one will do, so the form shows one field with the email/phone switch. A password typed there goes out with theupdate.6. If FAPI needs something the continue screen can't ask for, like a required OAuth provider, you get Start over instead of a form you can't finish.
7. Continue stays disabled until every required field is filled.
Formskips the browser's validation popup, so the form checks it itself, like the other Mosaic forms.8. A signed-in visitor doesn't see the form in single-session mode. The model reports a
signed_instep. The controller keeps the step it saw at mount, so only a visit that arrives signed in leaves, and finishing a sign-up doesn't count as one.9.
redirect_urlin the query decides where sign-up lands, and the sign-in and waitlist links keep it.The model is grouped by screen
The model reads Clerk in one place and returns
flow,app,navigation,detailsandverification.email/verification.phone. Each screen folder takes its group whole, so one screen is one folder to read.features.mdnow describes this as the shape for a flow with several screens.Changes outside sign-up
SignUpFutureUpdateParamsgainspassword?, matching the create params. clerk-js already sends every update param, so this is a@clerk/sharedtype change with a patch changeset.isTaskChooseOrganizationReady(model), andTaskChooseOrganizationContenttakes the model, so sign-up runs the task model once.Known gaps
SignUpPropsare not supported yet, because they add public API. Onlyredirect_urlfrom the query is read.redirect_urlonly, not the rest of the query.transferstep.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change