@@ -5,7 +5,8 @@ import { RecipeRouter } from "../recipeRouter";
55import SessionAuth from "../session/sessionAuth" ;
66
77import { useRecipeComponentOverrideContext } from "./componentOverrideContext" ;
8- import ContinueWithPasskeyFeature from "./components/features/continueWithPasskey" ;
8+ import SignInWithPasskeyFeature from "./components/features/signIn" ;
9+ import { defaultTranslationsWebauthn } from "./components/themes/translations" ;
910import WebauthnRecipe from "./recipe" ;
1011
1112import type { GenericComponentOverrideMap } from "../../components/componentOverride/componentOverrideContext" ;
@@ -19,9 +20,7 @@ import type {
1920
2021export class WebauthnPreBuiltUI extends RecipeRouter {
2122 static instance ?: WebauthnPreBuiltUI ;
22- languageTranslations = {
23- en : { } ,
24- } ;
23+ languageTranslations = defaultTranslationsWebauthn ;
2524
2625 constructor ( public readonly recipeInstance : WebauthnRecipe ) {
2726 super ( ) ;
@@ -42,7 +41,7 @@ export class WebauthnPreBuiltUI extends RecipeRouter {
4241 return WebauthnPreBuiltUI . getInstanceOrInitAndGetInstance ( ) . getFeatures ( useComponentOverrides ) ;
4342 }
4443 static getFeatureComponent (
45- componentName : "sign-up" | " sign-in ",
44+ componentName : "webauthn- sign-up " ,
4645 props : FeatureBaseProps < { userContext ?: UserContext } > ,
4746 useComponentOverrides : ( ) => GenericComponentOverrideMap < any > = useRecipeComponentOverrideContext
4847 ) : JSX . Element {
@@ -63,35 +62,31 @@ export class WebauthnPreBuiltUI extends RecipeRouter {
6362 } ;
6463
6564 getFeatureComponent = (
66- // eslint-disable-next-line @typescript-eslint/no-unused-vars
67- componentName : "sign-up" | "sign-in" ,
65+ componentName : "webauthn-sign-up" ,
6866 props : FeatureBaseProps < { userContext ?: UserContext } > ,
6967 _ : ( ) => GenericComponentOverrideMap < any > = useRecipeComponentOverrideContext
7068 ) : JSX . Element => {
71- if ( componentName === "sign-up" ) {
69+ if ( componentName === "webauthn- sign-up" ) {
7270 return (
7371 < UserContextWrapper userContext = { props . userContext } >
7472 < SessionAuth requireAuth = { false } doRedirection = { false } >
7573 < div > </ div >
7674 </ SessionAuth >
7775 </ UserContextWrapper >
7876 ) ;
79- } else if ( componentName === "sign-in" ) {
80- // TODO: Define this once sign-in is ready.
81- return < div > </ div > ;
8277 }
8378 throw new Error ( "Should never come here." ) ;
8479 } ;
8580
8681 getAuthComponents ( ) : AuthComponent [ ] {
87- const res : AuthComponent [ ] = [
82+ return [
8883 {
8984 type : "SIGN_UP" as const ,
9085 factorIds : [ FactorIds . WEBAUTHN ] ,
9186 displayOrder : 4 ,
87+ /* TODO: Update the following to be sign up instead of sign in */
9288 component : ( props : PartialAuthComponentProps ) => (
93- < ContinueWithPasskeyFeature
94- continueFor = "SIGN_UP"
89+ < SignInWithPasskeyFeature
9590 key = "webauthn-sign-up"
9691 { ...props }
9792 recipe = { this . recipeInstance }
@@ -100,9 +95,21 @@ export class WebauthnPreBuiltUI extends RecipeRouter {
10095 />
10196 ) ,
10297 } ,
98+ {
99+ type : "SIGN_IN" as const ,
100+ factorIds : [ FactorIds . WEBAUTHN ] ,
101+ displayOrder : 4 ,
102+ component : ( props : PartialAuthComponentProps ) => (
103+ < SignInWithPasskeyFeature
104+ key = "webauthn-sign-in"
105+ { ...props }
106+ recipe = { this . recipeInstance }
107+ factorIds = { [ FactorIds . WEBAUTHN ] }
108+ useComponentOverrides = { useRecipeComponentOverrideContext }
109+ />
110+ ) ,
111+ } ,
103112 ] ;
104-
105- return res ;
106113 }
107114
108115 // For tests
0 commit comments