Skip to content

Commit d9f77f7

Browse files
Add support for reusing auth style components in webauthn full pages
1 parent 5065b04 commit d9f77f7

File tree

2 files changed

+44
-6
lines changed

2 files changed

+44
-6
lines changed

lib/ts/recipe/webauthn/components/themes/signUp/index.tsx

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
* under the License.
1414
*/
1515

16+
import { SuperTokensBranding } from "../../../../../components/SuperTokensBranding";
1617
import SuperTokens from "../../../../../superTokens";
18+
import { AuthPageFooter, AuthPageHeader } from "../../../../../ui";
1719
import UserContextWrapper from "../../../../../usercontext/userContextWrapper";
20+
import GeneralError from "../../../../emailpassword/components/library/generalError";
1821
import { ThemeBase } from "../themeBase";
1922

2023
import { SignUpForm } from "./signUpForm";
@@ -26,10 +29,45 @@ function SignUpTheme(props: SignUpThemeProps): JSX.Element {
2629

2730
const activeStyle = props.config.signUpFeature.style;
2831

32+
// TODO: Define a way to reset the factor list.
33+
const handleResetFactorList = () => {
34+
return null;
35+
};
36+
37+
const stInstance = SuperTokens.getInstanceOrThrow();
38+
39+
const privacyPolicyLink = stInstance.privacyPolicyLink;
40+
const termsOfServiceLink = stInstance.termsOfServiceLink;
41+
2942
return (
3043
<UserContextWrapper userContext={props.userContext}>
3144
<ThemeBase userStyles={[rootStyle, props.config.recipeRootStyle, activeStyle]}>
32-
<SignUpForm {...props} />
45+
<div
46+
data-supertokens={`container authPage ${
47+
props.factorIds.length > 1 ? "multiFactor" : "singleFactor"
48+
}`}>
49+
<div data-supertokens="row">
50+
<AuthPageHeader
51+
factorIds={props.factorIds}
52+
isSignUp={true}
53+
onSignInUpSwitcherClick={undefined}
54+
hasSeparateSignUpView={true}
55+
resetFactorList={handleResetFactorList}
56+
showBackButton={true}
57+
oauth2ClientInfo={undefined}
58+
/>
59+
{props.error !== undefined && <GeneralError error={props.error} />}
60+
<SignUpForm {...props} />
61+
<AuthPageFooter
62+
factorIds={props.factorIds}
63+
isSignUp={true}
64+
hasSeparateSignUpView={true}
65+
privacyPolicyLink={privacyPolicyLink}
66+
termsOfServiceLink={termsOfServiceLink}
67+
/>
68+
</div>
69+
<SuperTokensBranding />
70+
</div>
3371
</ThemeBase>
3472
</UserContextWrapper>
3573
);

stories/allrecipes.stories.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ export const SignUpPasskey: Story = {
115115
},
116116
play: async ({ canvasElement }) => {
117117
// Assigns canvas to the component root element
118-
// const canvas = within(canvasElement);
119-
// const switcher = await canvas.findByText("CONTINUE WITH PASSKEY");
120-
// await new Promise((res) => setTimeout(res, 100));
121-
// canvasElement;
122-
// await userEvent.click(switcher, { delay: 200 });
118+
const canvas = within(canvasElement);
119+
const switcher = await canvas.findByText("CONTINUE WITH PASSKEY");
120+
await new Promise((res) => setTimeout(res, 100));
121+
canvasElement;
122+
await userEvent.click(switcher, { delay: 200 });
123123
},
124124
};
125125

0 commit comments

Comments
 (0)