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:
1 parent
077942166c
commit
0535f6f167
14 files changed
+377
-225
No files matched your search
@@ -73,10 +73,6 @@ import {
|
||||
CREATE_FLOW_COPIED_QUERY,
|
||||
CREATE_FLOW_COPIED_VALUE,
|
||||
} from "../../../lib/create/invitePaths";
|
||||
import {
|
||||
clearPendingKeepRuleLogin,
|
||||
hasPendingKeepRuleLogin,
|
||||
} from "../../../lib/create/pendingKeepRuleLogin";
|
||||
import { runCompletedStepExit } from "./utils/runCompletedStepExit";
|
||||
import messages from "../../../messages/en/index";
|
||||
import {
|
||||
@@ -144,8 +140,8 @@ function CreateFlowSessionShell({ children }: { children: ReactNode }) {
|
||||
const sessionResolved = sessionUser !== undefined;
|
||||
// Mirror in-progress draft to localStorage for ALL visitors once we know who
|
||||
// they are. Refresh-survival is the same UX for guest and signed-in users.
|
||||
// Save & Exit: guests open the save-progress login modal; signed-in users
|
||||
// PUT the server draft (`useCreateFlowExit`).
|
||||
// Save and exit is only for signed-in users (progress is already saved).
|
||||
// Guests keep Exit; Save your progress stays the optional community-save step.
|
||||
const enableLocalDraftMirroring = sessionResolved;
|
||||
|
||||
return (
|
||||
@@ -364,24 +360,7 @@ function CreateFlowLayoutContent({
|
||||
|
||||
if (!sessionResolved) return;
|
||||
|
||||
// Completed is post-publish. Guests still need Save & Exit → keep-this-rule
|
||||
// login (the document is live but unclaimed). Signed-in users just leave.
|
||||
if (currentStep === "completed") {
|
||||
if (sessionUser === null) {
|
||||
openLogin({
|
||||
variant: "keepRule",
|
||||
nextPath: CREATE_ROUTES.completed,
|
||||
backdropVariant: "blurredYellow",
|
||||
onDismiss: () => {
|
||||
runCompletedStepExit({
|
||||
clearState,
|
||||
clearAnonymousCreateFlowStorage,
|
||||
router,
|
||||
});
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
runCompletedStepExit({
|
||||
clearState,
|
||||
clearAnonymousCreateFlowStorage,
|
||||
@@ -580,26 +559,6 @@ function CreateFlowLayoutContent({
|
||||
setCompletedCopiedReady(Boolean(last?.copiedFromTitle));
|
||||
}, [currentStep]);
|
||||
|
||||
useEffect(() => {
|
||||
if (currentStep !== "completed") return;
|
||||
if (!sessionResolved) return;
|
||||
if (sessionUser !== null) {
|
||||
clearPendingKeepRuleLogin();
|
||||
return;
|
||||
}
|
||||
if (!hasPendingKeepRuleLogin()) return;
|
||||
const timeoutId = window.setTimeout(() => {
|
||||
if (!hasPendingKeepRuleLogin()) return;
|
||||
clearPendingKeepRuleLogin();
|
||||
openLogin({
|
||||
variant: "keepRule",
|
||||
nextPath: CREATE_ROUTES.completed,
|
||||
backdropVariant: "blurredYellow",
|
||||
});
|
||||
}, 0);
|
||||
return () => window.clearTimeout(timeoutId);
|
||||
}, [currentStep, sessionResolved, sessionUser, openLogin]);
|
||||
|
||||
const handleCommunitySaveMagicLinkSubmit = useCallback(async (
|
||||
formEl?: HTMLFormElement | null,
|
||||
) => {
|
||||
@@ -705,7 +664,7 @@ function CreateFlowLayoutContent({
|
||||
const mainResponsiveLayout = `${mainMaxMdCross} ${mainMaxMdJustify} md:flex-row md:justify-center`;
|
||||
const saveDraftOnExit =
|
||||
shouldOfferCreateFlowSaveAndExit(currentStep, sessionUser) ||
|
||||
isCreateTemplatesPickerRoute;
|
||||
(isCreateTemplatesPickerRoute && Boolean(sessionUser));
|
||||
|
||||
const proportionBarProgress = getProportionBarProgressForCreateFlowStep(
|
||||
currentStep,
|
||||
@@ -1275,6 +1234,18 @@ function CreateFlowLayoutContent({
|
||||
disabled={isPublishing || !sessionResolved}
|
||||
className={CREATE_FLOW_FOOTER_BUTTON_CLASS}
|
||||
onClick={() => {
|
||||
if (!sessionResolved) return;
|
||||
if (sessionUser === null) {
|
||||
openLogin({
|
||||
variant: "invite",
|
||||
nextPath:
|
||||
createFlowStepPathWithSyncDraft(
|
||||
"confirm-stakeholders",
|
||||
),
|
||||
backdropVariant: "blurredYellow",
|
||||
});
|
||||
return;
|
||||
}
|
||||
void handleFinalize({ skipInvites: false });
|
||||
}}
|
||||
>
|
||||
@@ -1293,8 +1264,7 @@ function CreateFlowLayoutContent({
|
||||
isPublishing ||
|
||||
(isEditRuleStep && !sessionResolved) ||
|
||||
(currentStep === "final-review" &&
|
||||
(!sessionResolved ||
|
||||
isFinalReviewContinueBlocked(state)))
|
||||
isFinalReviewContinueBlocked(state))
|
||||
}
|
||||
className={CREATE_FLOW_FOOTER_BUTTON_CLASS}
|
||||
onClick={() => {
|
||||
@@ -1304,18 +1274,6 @@ function CreateFlowLayoutContent({
|
||||
}
|
||||
if (currentStep === "final-review") {
|
||||
if (isFinalReviewContinueBlocked(state)) return;
|
||||
if (!sessionResolved) return;
|
||||
if (sessionUser === null) {
|
||||
openLogin({
|
||||
variant: "invite",
|
||||
nextPath:
|
||||
createFlowStepPathWithSyncDraft(
|
||||
"confirm-stakeholders",
|
||||
),
|
||||
backdropVariant: "blurredYellow",
|
||||
});
|
||||
return;
|
||||
}
|
||||
goToNextStep();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user