Skip to content

feat(mosaic): redeem invitations in sign-up - #10944

Draft
austincalvelage wants to merge 20 commits into
austin/mosaic-sign-up-phone-channelfrom
austin/mosaic-sign-up-invitations
Draft

austincalvelage wants to merge 20 commits into
austin/mosaic-sign-up-phone-channelfrom
austin/mosaic-sign-up-invitations

Conversation

@austincalvelage

@austincalvelage austincalvelage commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Description

Redeems invitations in Mosaic sign-up. Stacked on #10930.

When someone opens an invitation link, sign-up redeems the ticket, shows the loading screen while it does, and goes to the step the sign-up still needs. That is usually the continue screen for a password, since the invitation already verified the email.

Review fixes

  • A sign-up counts as the invitation's only while its ticket is in the URL, as legacy SignUpStart checks with hasExistingSignUpWithTicket. An abandoned invitation sign-up no longer locks a later plain visit to the invited email. fix(mosaic): treat a sign-up as the invitation's only while its ticket is in the URL, covered by "starts a new sign-up when a later visit has no ticket in the URL".
  • An expired ticket shows its error on the start form, and the user can sign up normally from there. test(mosaic): show an expired invitation on the sign-up start form, covered by "shows an $kind invitation on the start form, then signs up normally", which runs for a rejected and an expired ticket.
  • The password update type and its changeset moved down to feat(shared): accept channel on create and password on update in SignUpFuture params #10955, so this PR no longer changes @clerk/shared.
  • useSignUpModel is back under the cognitive complexity limit. refactor(mosaic): keep the sign-up model under the complexity limit, a refactor with no new test.

1. The model reads the ticket and redeems it. The ticket comes from __clerk_ticket or __clerk_invitation_token, as legacy reads it. redeemTicket returns the next step, or the blocked notice when FAPI blocks the request, and the invited email for the form.

redeemTicket: async () => {
  const { error } = await signUp.ticket({ ticket: ticket ?? '', unsafeMetadata });
  if (error) {
    forgetTicket(); // a rejected ticket leaves a normal start form
    const blocked = blockedBy(error);
    if (!blocked) {
      throw error;
    }
    return { result: { type: 'blocked', details: blocked }, emailAddress: '' };
  }
  return { result: next(signUp), emailAddress: signUp.emailAddress ?? '' };
},

2. Sign-up redeems once, on start. A sign-up is the invitation's when the ticket is in the URL and FAPI verified its email with the ticket strategy. So a reload doesn't redeem again, a sign-up the user had already started doesn't block the invitation, and an old invitation sign-up doesn't take over a later visit without a ticket. A ref keyed by the ticket keeps StrictMode from redeeming it twice, and the screen is loading while it runs. A rejected ticket shows its error on the start form until the user submits it.

// sign-up.model.ts
const inTicketSignUp = Boolean(ticket) && signUp.verifications.emailAddress.strategy === 'ticket';

3. Going back to start never drops the invitation. While the invitation's sign-up is in progress, start locks the invited email and updates that sign-up instead of creating a new one. WhatsApp is hidden, as in legacy. With a ticket in the URL, start shows the form in restricted and waitlist mode, because FAPI lets a ticket through.

// sign-up-details.controller.ts
if (purpose === 'continue' || details.inTicketSignUp) {
  return details.update(submitted);
}

4. The invitation's sign-up finishes on the continue screen. It sends the password with the update, as #10881 already does for any sign-up. An invitation that FAPI completes on redemption keeps the loading screen up until sign-up leaves.

Finishing or starting over removes the ticket parameters from the URL. The fake FAPI redeems seeded tickets the way clerk_go does: the invited email starts verified, a ticket bypasses the sign-up mode gate, and an unknown or expired ticket returns ticket_invalid_code or ticket_expired_code.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

🤖 Generated with Claude Code

@vercel

vercel Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Nov 26, 2026 8:08am UTC
mosaic-docs Ready Ready Preview Nov 26, 2026 8:08am UTC
swingset Ready Ready Preview Nov 26, 2026 8:08am UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 91de416

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When 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

@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@pkg-pr-new

pkg-pr-new Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@10944

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@10944

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@10944

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@10944

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@10944

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@10944

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@10944

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@10944

@clerk/expo-biometrics

npm i https://pkg.pr.new/@clerk/expo-biometrics@10944

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@10944

@clerk/expo-native-components

npm i https://pkg.pr.new/@clerk/expo-native-components@10944

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@10944

@clerk/express

npm i https://pkg.pr.new/@clerk/express@10944

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@10944

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@10944

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@10944

@clerk/mosaic

npm i https://pkg.pr.new/@clerk/mosaic@10944

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@10944

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@10944

@clerk/react

npm i https://pkg.pr.new/@clerk/react@10944

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@10944

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@10944

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@10944

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@10944

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@10944

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@10944

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@10944

commit: 91de416

@austincalvelage
austincalvelage force-pushed the austin/mosaic-sign-up-invitations branch from 8f5cd12 to a36f82f Compare November 21, 2026 01:15
@austincalvelage
austincalvelage force-pushed the austin/mosaic-sign-up-invitations branch from a36f82f to d487ad9 Compare November 21, 2026 04:02
@austincalvelage
austincalvelage force-pushed the austin/mosaic-sign-up-invitations branch from d487ad9 to bd8e06a Compare November 23, 2026 17:09
@austincalvelage
austincalvelage removed this pull request from stack #10873 November 23, 2026 17:12
@austincalvelage
austincalvelage force-pushed the austin/mosaic-sign-up-invitations branch from 2c3f167 to ec7bc61 Compare November 23, 2026 17:19
Sign-up redeems a ticket from __clerk_ticket or __clerk_invitation_token once, showing the loading screen, then goes to the step the sign-up needs, usually continue for the password. A rejected ticket shows its error on the start form, which then works as a normal sign-up. While the invitation's sign-up is in progress, the start form locks the invited email and updates that sign-up instead of creating a new one.
…icted mode

A sign-up is the invitation's when FAPI verified its email with the ticket strategy, so an earlier sign-up on the client no longer blocks redemption or poses as the invitation. With a ticket in the URL, start shows the form in restricted and waitlist mode. Submitting the start form clears a rejected invitation's error, and Start over removes the ticket parameters.
…t is in the URL

An abandoned invitation sign-up stayed on the client, so a later visit to the plain sign-up page locked the start form to the invited email and updated the old sign-up. Sign-up now also needs the ticket in the URL, as legacy `SignUpStart` does with `hasExistingSignUpWithTicket`.
The invitation checks pushed `useSignUpModel` past the cognitive complexity limit. The channels an invitation hides are picked once at the top.
Folds the rejected and expired invitation tests into one table.
…tion is blocked

Fails today. The blocked notice now comes from the result a request resolves with, and redeeming an invitation still rejects with the error, so the start form shows it inline.
…ion is blocked

`redeemTicket` resolves with the blocked result when FAPI answers `action_blocked`, as `create` and the Protect proof do, and the controller keeps it for the mount. Any other error still rejects and shows on the start form.
…finishes signing up

An invitation that leaves nothing to fill in completes on redemption. The
first test holds the session activation and fails today: the start form
shows, locked and busy, between the loading screen and the navigation. It
also pins that the invitation is redeemed once on this path.

The second test passes today. It pins what a failed activation shows: the
error on the start form, with the way to sign in.
…inishes signing up

An invitation that leaves nothing to fill in completes on redemption. The
loading screen showed only while the ticket action was pending, and that
action ends as soon as it hands the step to the finish machine. The finish
froze the model, which says start, so the start form showed, locked and
busy, until the session was active.

The ticket action now hands next the loading screen, and the finish
freezes it with the model. A failed activation ends the hold, so start
shows the error.
The invitation tests move out of the shared sign-up feature test with the helpers they alone use, and are grouped by what the invitee is doing in place of one "SignUp invitations" block.

This branch was successfully deployed

2 active deployments
Preview – swingset — 91de4162 Deployed Nov 26, 2026 by vercel[bot]
Preview – clerk-js-sandbox — 91de4162 Deployed Nov 26, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant