Let guests keep a published rule via Save & Exit and a post-finalize sign-in prompt.
Email is optional so they can continue without saving; skip from Save & Exit leaves the flow instead of returning to completed. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
||||
import Login from "../components/modals/Login";
|
||||
import LoginForm from "../components/modals/Login/LoginForm";
|
||||
|
||||
export type AuthModalLoginVariant = "default" | "saveProgress";
|
||||
export type AuthModalLoginVariant = "default" | "saveProgress" | "keepRule";
|
||||
|
||||
export type AuthModalBackdropVariant = "solid" | "blurredYellow";
|
||||
|
||||
@@ -20,6 +20,11 @@ export type OpenLoginOptions = {
|
||||
/** Passed to `requestMagicLink` as `next` (internal path). */
|
||||
nextPath?: string;
|
||||
backdropVariant?: AuthModalBackdropVariant;
|
||||
/**
|
||||
* `keepRule` only: **Continue without saving**. Default is close the overlay.
|
||||
* Guest completed Save & Exit passes leave-the-flow.
|
||||
*/
|
||||
onDismiss?: () => void;
|
||||
};
|
||||
|
||||
type AuthModalContextValue = {
|
||||
@@ -49,6 +54,14 @@ export function AuthModalProvider({ children }: { children: ReactNode }) {
|
||||
);
|
||||
|
||||
const backdropVariant = opts.backdropVariant ?? "blurredYellow";
|
||||
const keepRuleDismiss =
|
||||
opts.variant === "keepRule"
|
||||
? () => {
|
||||
const extra = opts.onDismiss;
|
||||
closeLogin();
|
||||
extra?.();
|
||||
}
|
||||
: undefined;
|
||||
|
||||
return (
|
||||
<AuthModalContext.Provider value={value}>
|
||||
@@ -63,6 +76,7 @@ export function AuthModalProvider({ children }: { children: ReactNode }) {
|
||||
<LoginForm
|
||||
variant={opts.variant ?? "default"}
|
||||
magicLinkNextPath={opts.nextPath}
|
||||
onDismiss={keepRuleDismiss}
|
||||
/>
|
||||
</Login>
|
||||
</AuthModalContext.Provider>
|
||||
|
||||
Reference in New Issue
Block a user