diff --git a/lib/build/index2.js b/lib/build/index2.js index 9d1c4e84e..4903fe1fd 100644 --- a/lib/build/index2.js +++ b/lib/build/index2.js @@ -525,7 +525,8 @@ var RecipeRouter = /** @class */ (function () { } // We may get here if the app is using an older BE that doesn't support MFA var enabledRecipeCount = Object.keys(dynamicLoginMethods).filter(function (key) { - return dynamicLoginMethods[key].enabled; + var _a; + return ((_a = dynamicLoginMethods[key]) === null || _a === void 0 ? void 0 : _a.enabled) === true; }).length; var _loop_2 = function (rid, includes) { if ( diff --git a/lib/build/multifactorauthprebuiltui.js b/lib/build/multifactorauthprebuiltui.js index f58ca515b..5df6c54ca 100644 --- a/lib/build/multifactorauthprebuiltui.js +++ b/lib/build/multifactorauthprebuiltui.js @@ -84,71 +84,65 @@ var ThemeBase = function (_a) { }); }; -var FactorChooserFooter = uiEntry.withOverride( - "MultiFactorAuthFactorChooserFooter", - function MultiFactorAuthFactorChooserFooter(_a) { - var logout = _a.logout; - var t = translationContext.useTranslation(); - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "row factorChooserFooter" }, - { - children: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", onClick: logout }, - { - children: [ - jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { - color: "rgb(var(--palette-textPrimary))", - }), - t("MULTI_FACTOR_AUTH_LOGOUT"), - ], - } - ) - ), - } - ) - ); - } -); +var FactorChooserFooter = uiEntry.withOverride("MFAFactorChooserFooter", function MFAChooserFooter(_a) { + var logout = _a.logout; + var t = translationContext.useTranslation(); + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row factorChooserFooter" }, + { + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", onClick: logout }, + { + children: [ + jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { + color: "rgb(var(--palette-textPrimary))", + }), + t("MULTI_FACTOR_AUTH_LOGOUT"), + ], + } + ) + ), + } + ) + ); +}); -var FactorChooserHeader = uiEntry.withOverride( - "MultiFactorAuthFactorChooserHeader", - function MultiFactorAuthFactorChooserHeader(props) { - var t = translationContext.useTranslation(); - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "row factorChooserHeader" }, - { - children: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerTitle withBackButton" }, - { - children: [ - props.showBackButton - ? jsxRuntime.jsx(backButton.BackButton, { onClick: props.onBackButtonClicked }) - : jsxRuntime.jsx("span", { - "data-supertokens": "backButtonPlaceholder backButtonCommon", - }), - t("MULTI_FACTOR_CHOOSER_HEADER_TITLE"), - jsxRuntime.jsx("span", { - "data-supertokens": "backButtonPlaceholder backButtonCommon", - }), - ], - } - ) - ), - } - ) - ); - } -); +var FactorChooserHeader = uiEntry.withOverride("MFAFactorChooserHeader", function MFAFactorChooserHeader(props) { + var t = translationContext.useTranslation(); + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row factorChooserHeader" }, + { + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerTitle withBackButton" }, + { + children: [ + props.showBackButton + ? jsxRuntime.jsx(backButton.BackButton, { onClick: props.onBackButtonClicked }) + : jsxRuntime.jsx("span", { + "data-supertokens": "backButtonPlaceholder backButtonCommon", + }), + t("MULTI_FACTOR_CHOOSER_HEADER_TITLE"), + jsxRuntime.jsx("span", { + "data-supertokens": "backButtonPlaceholder backButtonCommon", + }), + ], + } + ) + ), + } + ) + ); +}); -var FactorOption = uiEntry.withOverride("MultiFactorAuthFactorOption", function MultiFactorAuthFactorOption(_a) { +var FactorOption = uiEntry.withOverride("MFAFactorOption", function MFAFactorOption(_a) { var onClick = _a.onClick, id = _a.id, name = _a.name, @@ -198,7 +192,7 @@ var FactorOption = uiEntry.withOverride("MultiFactorAuthFactorOption", function ); }); -var FactorList = uiEntry.withOverride("MultiFactorAuthFactorList", function MultiFactorAuthFactorList(_a) { +var FactorList = uiEntry.withOverride("MFAFactorList", function MFAFactorList(_a) { var availableFactors = _a.availableFactors, navigateToFactor = _a.navigateToFactor; return jsxRuntime.jsx( diff --git a/lib/build/recipe/multifactorauth/types.d.ts b/lib/build/recipe/multifactorauth/types.d.ts index e861b76c0..c1a225140 100644 --- a/lib/build/recipe/multifactorauth/types.d.ts +++ b/lib/build/recipe/multifactorauth/types.d.ts @@ -1,3 +1,7 @@ +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 { @@ -10,7 +14,10 @@ import type { OverrideableBuilder } from "supertokens-js-override"; import type { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth"; import type { MFAFactorInfo } from "supertokens-web-js/recipe/multifactorauth/types"; export declare type ComponentOverrideMap = { - FactorChooser_Override?: ComponentOverride; + MFAFactorChooserFooter_Override?: ComponentOverride; + MFAFactorChooserHeader_Override?: ComponentOverride; + MFAFactorList_Override?: ComponentOverride; + MFAFactorOption_Override?: ComponentOverride; }; export declare type UserInput = { firstFactors?: string[]; diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserFooter.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserFooter.tsx index 10473fbe1..f70658036 100644 --- a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserFooter.tsx +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserFooter.tsx @@ -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 ( diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.tsx index 00b62158b..d45d3a355 100644 --- a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.tsx +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.tsx @@ -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 ( diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorList.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorList.tsx index cbce96903..d0f5ed569 100644 --- a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorList.tsx +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorList.tsx @@ -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, }: { diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorOption.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorOption.tsx index a0eb374d0..9df6edda1 100644 --- a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorOption.tsx +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorOption.tsx @@ -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, @@ -42,9 +42,6 @@ export const FactorOption = withOverride(
{t(name)}

{t(description)}

- {/* - - */} ); } diff --git a/lib/ts/recipe/multifactorauth/types.ts b/lib/ts/recipe/multifactorauth/types.ts index a47873af0..c819c9258 100644 --- a/lib/ts/recipe/multifactorauth/types.ts +++ b/lib/ts/recipe/multifactorauth/types.ts @@ -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 { @@ -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; // TODO + MFAFactorChooserFooter_Override?: ComponentOverride; + MFAFactorChooserHeader_Override?: ComponentOverride; + MFAFactorList_Override?: ComponentOverride; + MFAFactorOption_Override?: ComponentOverride; }; // Config is what does in the constructor of the recipe. diff --git a/lib/ts/recipe/recipeRouter/index.tsx b/lib/ts/recipe/recipeRouter/index.tsx index 14d2c063a..a29c3fee5 100644 --- a/lib/ts/recipe/recipeRouter/index.tsx +++ b/lib/ts/recipe/recipeRouter/index.tsx @@ -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) {