Let anyone finish a Rule without an account or email.

Continue on final review and Finish without inviting no longer open a login wall. The header stays Exit until Save your progress is done, and Send invitations is the only invite-path login.
This commit is contained in:
adilallo committed 2026-11-23 14:48:01 -07:00
1 parent 077942166c
commit 0535f6f167
14 files changed
+377 -225

No files matched your search

+7 -6
View File
@@ -189,23 +189,24 @@ export function getStepIndex(step: CreateFlowStep | null | undefined): number {
return FLOW_STEP_ORDER.indexOf(step);
}
/** First wizard step that offers Save and exit (after the community is ready to keep). */
/** First wizard step that offers Save and exit once progress can actually be saved. */
const SAVE_EXIT_FROM_STEP_INDEX = getStepIndex("community-save");
/**
* Top-nav Save and exit (vs Exit). Guests and signed-in users share this from
* `community-save` onward and on `edit-rule`. On completed, guests still
* get Save and exit (claim/login); signed-in users get Exit (already owned).
* Top-nav Save and exit (vs Exit). The header stays Exit until Save your
* progress is done — a signed-in session. Guests (and session-in-flight)
* keep Exit, including on completed and edit-rule.
*
* @param sessionUser `null` is a guest. `undefined` (session in flight) is
* not a guest — completed stays Exit until the session resolves.
* treated like a guest so the label does not flash Save and exit.
*/
export function shouldOfferCreateFlowSaveAndExit(
currentStep: CreateFlowStep | null | undefined,
sessionUser?: { id: string } | null,
): boolean {
if (currentStep == null) return false;
if (currentStep === "completed") return sessionUser === null;
if (!sessionUser) return false;
if (currentStep === "completed") return false;
if (currentStep === "edit-rule") return true;
return getStepIndex(currentStep) >= SAVE_EXIT_FROM_STEP_INDEX;
}