@@ -26,14 +26,15 @@ import { useUserContext } from "../../../../../usercontext";
2626import { useRethrowInRender } from "../../../../../utils" ;
2727import Session from "../../../../session/recipe" ;
2828import useSessionContext from "../../../../session/useSessionContext" ;
29+ import { WEBAUTHN_IS_SIGN_UP_STATE_KEY } from "../../../constants" ;
2930import { ContinueWithPasskeyTheme } from "../../themes/continueWithPasskey" ;
3031import SignUpTheme from "../../themes/signUp" ;
3132import { defaultTranslationsWebauthn } from "../../themes/translations" ;
3233
3334import type { UserContext , PartialAuthComponentProps } from "../../../../../types" ;
3435import type { AuthSuccessContext } from "../../../../authRecipe/types" ;
3536import type Recipe from "../../../recipe" ;
36- import type { ComponentOverrideMap } from "../../../types" ;
37+ import type { ComponentOverrideMap , ContinueFor } from "../../../types" ;
3738import type { SignUpThemeProps } from "../../../types" ;
3839import type { User } from "supertokens-web-js/types" ;
3940
@@ -43,7 +44,8 @@ export function useChildProps(
4344 onAuthSuccess : ( successContext : AuthSuccessContext ) => Promise < void > ,
4445 error : string | undefined ,
4546 onError : ( err : string ) => void ,
46- userContext : UserContext
47+ userContext : UserContext ,
48+ clearError : ( ) => void
4749) : SignUpThemeProps {
4850 const session = useSessionContext ( ) ;
4951 const recipeImplementation = recipe . webJSRecipe ;
@@ -74,6 +76,7 @@ export function useChildProps(
7476 } ,
7577 error,
7678 onError,
79+ clearError,
7780 onFetchError : async ( /* err: Response*/ ) => {
7881 // TODO: Do we need to do something else?
7982 onError ( "SOMETHING_WENT_WRONG_ERROR" ) ;
@@ -103,7 +106,8 @@ const SignUpFeatureInner: React.FC<
103106 props . onAuthSuccess ,
104107 props . error ,
105108 props . onError ,
106- userContext
109+ userContext ,
110+ props . clearError
107111 ) ! ;
108112
109113 return (
@@ -152,14 +156,22 @@ export const SignUpWithPasskeyFeature: React.FC<
152156> = ( props ) => {
153157 const recipeComponentOverrides = props . useComponentOverrides ( ) ;
154158
159+ const handleContinueClick = React . useCallback (
160+ ( continueFor : ContinueFor ) => {
161+ props . setFactorList ( props . factorIds ) ;
162+ props . userContext [ WEBAUTHN_IS_SIGN_UP_STATE_KEY ] = continueFor === "SIGN_UP" ;
163+ } ,
164+ [ props ]
165+ ) ;
166+
155167 return (
156168 < AuthComponentWrapper recipeComponentOverrides = { recipeComponentOverrides } >
157169 < FeatureWrapper
158170 useShadowDom = { SuperTokens . getInstanceOrThrow ( ) . useShadowDom }
159171 defaultStore = { defaultTranslationsWebauthn } >
160172 < ContinueWithPasskeyTheme
161173 { ...props }
162- continueWithPasskeyClicked = { ( ) => props . setFactorList ( props . factorIds ) }
174+ continueWithPasskeyClicked = { handleContinueClick }
163175 config = { props . recipe . config }
164176 continueFor = "SIGN_UP"
165177 />
0 commit comments