Skip to content

Commit

Permalink
Merge branch 'feat/mfa/recipe-setup' into feat/mfa/otp
Browse files Browse the repository at this point in the history
  • Loading branch information
porcellus committed Nov 21, 2023
2 parents 21dee6b + 7891b73 commit da4ac03
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 82 deletions.
3 changes: 2 additions & 1 deletion lib/build/index2.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

122 changes: 58 additions & 64 deletions lib/build/multifactorauthprebuiltui.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion lib/build/recipe/multifactorauth/types.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import { withOverride } from "../../../../../components/componentOverride/withOv
import { useTranslation } from "../../../../../translation/translationContext";

export const FactorChooserFooter = withOverride(
"MultiFactorAuthFactorChooserFooter",
function MultiFactorAuthFactorChooserFooter({ logout }: { logout: (() => void) | undefined }): JSX.Element {
"MFAFactorChooserFooter",
function MFAChooserFooter({ logout }: { logout: (() => void) | undefined }): JSX.Element {
const t = useTranslation();

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ import { useTranslation } from "../../../../../translation/translationContext";
import BackButton from "../../../../emailpassword/components/library/backButton";

export const FactorChooserHeader = withOverride(
"MultiFactorAuthFactorChooserHeader",
function MultiFactorAuthFactorChooserHeader(props: {
showBackButton: boolean;
onBackButtonClicked: () => void;
}): JSX.Element {
"MFAFactorChooserHeader",
function MFAFactorChooserHeader(props: { showBackButton: boolean; onBackButtonClicked: () => void }): JSX.Element {
const t = useTranslation();

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import type { SecondaryFactorRedirectionInfo } from "../../../types";
import type { MFAFactorInfo } from "supertokens-web-js/recipe/multifactorauth/types";

export const FactorList = withOverride(
"MultiFactorAuthFactorList",
function MultiFactorAuthFactorList({
"MFAFactorList",
function MFAFactorList({
availableFactors,
navigateToFactor,
}: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import { useTranslation } from "../../../../../translation/translationContext";
import type { FC } from "react";

export const FactorOption = withOverride(
"MultiFactorAuthFactorOption",
function MultiFactorAuthFactorOption({
"MFAFactorOption",
function MFAFactorOption({
onClick,
id,
name,
Expand All @@ -42,9 +42,6 @@ export const FactorOption = withOverride(
<h6 data-supertokens="factorName">{t(name)}</h6>
<p data-supertokens="factorDescription">{t(description)}</p>
</div>
{/* <span data-supertokens="factorArrow">
<ArrowRightIcon color="rgb(var(--palette-textPrimary))" />
</span> */}
</a>
);
}
Expand Down
9 changes: 8 additions & 1 deletion lib/ts/recipe/multifactorauth/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
* under the License.
*/

import type { FactorChooserFooter } from "./components/themes/factorChooser/factorChooserFooter";
import type { FactorChooserHeader } from "./components/themes/factorChooser/factorChooserHeader";
import type { FactorList } from "./components/themes/factorChooser/factorList";
import type { FactorOption } from "./components/themes/factorChooser/factorOption";
import type { ComponentOverride } from "../../components/componentOverride/componentOverride";
import type { FeatureBaseConfig } from "../../types";
import type {
Expand All @@ -26,7 +30,10 @@ import type { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth"
import type { MFAFactorInfo } from "supertokens-web-js/recipe/multifactorauth/types";

export type ComponentOverrideMap = {
FactorChooser_Override?: ComponentOverride<any>; // TODO
MFAFactorChooserFooter_Override?: ComponentOverride<typeof FactorChooserFooter>;
MFAFactorChooserHeader_Override?: ComponentOverride<typeof FactorChooserHeader>;
MFAFactorList_Override?: ComponentOverride<typeof FactorList>;
MFAFactorOption_Override?: ComponentOverride<typeof FactorOption>;
};

// Config is what does in the constructor of the recipe.
Expand Down
2 changes: 1 addition & 1 deletion lib/ts/recipe/recipeRouter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export abstract class RecipeRouter {

// We may get here if the app is using an older BE that doesn't support MFA
const enabledRecipeCount = Object.keys(dynamicLoginMethods).filter(
(key) => (dynamicLoginMethods as any)[key].enabled
(key) => (dynamicLoginMethods as any)[key]?.enabled === true
).length;
// We first try to find an exact match
for (const { rid, includes } of priorityOrder) {
Expand Down

0 comments on commit da4ac03

Please sign in to comment.