Repository navigation
feat(mosaic): send sign-up phone codes over WhatsApp - #10930
Draft
austincalvelage wants to merge 16 commits into
Draft
austincalvelage wants to merge 16 commits into
austincalvelage wants to merge 16 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: b051363 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types 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 |
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
|
austincalvelage
force-pushed
the
austin/mosaic-sign-up-phone-channel
branch
from
November 20, 2026 17:26
920ef05 to
2db057f
Compare
austincalvelage
force-pushed
the
austin/mosaic-sign-up-phone-channel
branch
from
November 20, 2026 19:21
2db057f to
7f1d941
Compare
@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: |
austincalvelage
force-pushed
the
austin/mosaic-sign-up-phone-channel
branch
from
November 20, 2026 20:17
7f1d941 to
9e8e980
Compare
austincalvelage
force-pushed
the
austin/mosaic-sign-up-phone-channel
branch
from
November 20, 2026 20:41
9e8e980 to
798166f
Compare
austincalvelage
force-pushed
the
austin/mosaic-sign-up-phone-channel
branch
from
November 20, 2026 20:50
798166f to
d7d887b
Compare
austincalvelage
force-pushed
the
austin/mosaic-sign-up-phone-channel
branch
from
November 20, 2026 21:29
d7d887b to
a568e3a
Compare
austincalvelage
force-pushed
the
austin/mosaic-sign-up-phone-channel
branch
from
November 23, 2026 19:54
531cd8d to
5af4db5
Compare
austincalvelage
force-pushed
the
austin/mosaic-sign-up-phone-channel
branch
from
November 23, 2026 20:12
5af4db5 to
109921f
Compare
austincalvelage
force-pushed
the
austin/mosaic-sign-up-phone-channel
branch
from
November 23, 2026 22:16
109921f to
0817bba
Compare
austincalvelage
force-pushed
the
austin/mosaic-sign-up-phone-channel
branch
from
November 23, 2026 22:27
0817bba to
e2e44bb
Compare
When the instance enables WhatsApp for phone numbers, the start screen offers it. Picking it asks for the phone number only, creates the sign-up and sends the code over WhatsApp. The code screen names the channel, resends over it, and can switch to SMS. A phone sign-up also uses the channel the instance prefers for the number's country.
A phone error from FAPI now shows on the WhatsApp phone screen, since AuthAlternativeChannel reads the phone field's feedback. A failed WhatsApp send shows FAPI's message. The continue screen offers no WhatsApp buttons. Editing from the code screen and Start over return to the main form. The WhatsApp create sends prefilled values the screen does not show. The country's preferred channel applies only to the first send after the start form, not to resends or a phone entered on the continue screen.
FAPI allows the WhatsApp channel when the instance can send WhatsApp messages, not when the phone attribute lists it, and rejects it with whatsapp_channel_not_enabled otherwise. It can also send by SMS when the WhatsApp quota is used up, and always reports the channel a phone code went out on. The fake now does the same.
… sign-up Continue on the WhatsApp phone screen stays disabled until the phone number is filled. The code screen locks while switching to SMS, starts the resend countdown after a failed send, and clears the typed code on resend and on the switch to SMS.
FAPI creates a sign-up with `strategy: 'phone_code'` and a channel in one transaction, so a code it cannot send creates nothing. The fake now does the same, and the tests check that a WhatsApp sign-up takes one request and that a failed send leaves no sign-up behind.
A WhatsApp sign-up created the sign-up, then sent the code in a second request. When the send failed, the sign-up stayed behind and each retry created another. Create now sends `strategy: 'phone_code'` with the picked or preferred channel, as legacy `SignUpStart` does, so FAPI creates the sign-up and sends the code together. The SMS default still sends no strategy and lets the code screen send the code.
The full form and the WhatsApp phone screen share one form, so a rejected phone number on one stayed under the phone field after switching to the other. Picking a channel and Use another method now clear the phone number's error.
…om WhatsApp Resend clears the channel the code screen picked, so it relies on the model sending over the channel the sign-up last used. The test pins that a resend after switching to SMS stays on SMS.
The fake FAPI dropped the sign-up when the create request could not send the WhatsApp code. clerk_go 8bb8f66dde inserts the sign-up and attaches it to the client before it prepares the code (api/fapi/v1/sign_up/service.go:394-407), prepares it in a later transaction (:529, channel check in pkg/usersettings/clerk/strategies/phone_code.go:352-361), and returns the error with the client (http.go:73-77, wrapper.go:49). clerk-js applies meta.client from an error response (Client.ts getClientResourceFromPayload). The fake now keeps the unverified sign-up with the phone number and sends the client in the error. The test that expected no sign-up now checks that the user stays on the WhatsApp screen with the error and a retry sends the code. A new test goes back to the form and signs up over SMS with the stray sign-up present.
- Fold the one-request create checks into the WhatsApp sign-up test. - Fold the rejected phone number checks into the test that goes back to the form after it. - Drop the unavailable-channel test, which the failed-send retry test repeats before it retries. - Drop the SMS switch test, which the SMS resend and lock tests cover. - Drop the back-to-form test, which two other tests do on the way.
The routing PR no longer uses vi, and these tests fake the resend timer.
This branch was successfully deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Sends Mosaic sign-up phone codes over WhatsApp. Stacked on #10928.
When an instance turns on WhatsApp for phone numbers, the start screen offers it as a button. Picking it asks for the phone number only, creates the sign-up and sends the code over WhatsApp in the same request. The code screen names the channel, resends over it, and offers "Send code via SMS" instead of going back.
This needs
channelonSignUpFutureCreateParamsfrom #10955. clerk-js already sends it, so that PR is a@clerk/sharedtype change. TheAuthAlternativeChannelfix this screen relies on is in #10957.Review fixes
strategy: 'phone_code'with the channel, as legacySignUpStartdoes, so FAPI creates the sign-up and sends the code in one request. The secondsendPhoneCoderequest is gone.fix(mosaic): send the sign-up phone channel in the create request, covered by "sends the phone code over WhatsApp when the user picks it, then signs them up".fix(mosaic): keep phone errors on the sign-up screen that got them, covered by "shows a rejected phone number on the WhatsApp phone screen and leaves it behind on the form" and "leaves the form's phone error behind when picking WhatsApp".test(mosaic): resend the sign-up phone code by SMS after switching from WhatsApp, covered by "resends the phone code by SMS after switching to SMS from the WhatsApp code screen".test(mosaic): keep the sign-up a failed WhatsApp send leaves behind, covered by "keeps the WhatsApp screen and its error after a failed send, then sends the code on retry" and "signs up over SMS from the form after a failed WhatsApp send left a sign-up".AuthAlternativeChannelchange moved to fix(mosaic): gate the alternative channel Continue and show its phone field errors #10957, with a sign-in test.1. The details model lists the alternative channels and can create over one.
createtakes an optional channel and sends it withstrategy: 'phone_code', so the code goes out with the create request.2. Picking a channel swaps
startfor the alternative phone screen. The details controller keeps the chosen channel, so the same form asks for the phone number only, and Continue stays disabled until it's filled. Back, Edit from the code screen and Start over all return to the full form. The channel buttons show onstartonly, as in legacy. A phone error from one screen is cleared when you switch to the other.3. The verify screen reads the channel from the sign-up. The verification model reports the channel the code went out on, so a reload still names WhatsApp, and the SMS screen shows when FAPI falls back to SMS because the WhatsApp quota is used up. Resend uses that channel, and the code machine gets a
SEND_SMSevent for the switch to SMS. The screen locks while switching, clears the typed code on resend and on the switch, and starts the resend countdown even when a send fails.4. The first code after the start form uses the channel the instance prefers for the number's country, through
getPreferredPhoneCodeChannelByCountry, as legacy does. It goes out with the create request. Resends and a phone entered oncontinuedon't use it. With no preferred channel, create sends no strategy and the code screen sends the SMS code.5. Errors on the WhatsApp path show where the user looks. A rejected phone number shows under the field, through the
AuthAlternativeChannelfix in #10957. A failed WhatsApp send, such aswhatsapp_channel_not_enabled, shows FAPI's message instead of the generic one.The fake FAPI now checks WhatsApp the way FAPI does: it allows the channel when the instance can send WhatsApp, not when the phone attribute lists it, and it can fall back to SMS. A create with
strategy: 'phone_code'prepares the phone in the same request. When the send fails, the sign-up stays on the client with the unverified phone number and the error carries the client, as in clerk_go.Known gaps
whatsapp_channel_not_enabledmessage, still shows after Use another method, as legacy's card error does.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
🤖 Generated with Claude Code