{"version":3,"file":"useAllowedMfaMethods.mjs","sources":["../../../../../../../../web/src/adminPortal/utils/useAllowedMfaMethods.ts"],"sourcesContent":["import { B2BAllowedMFAMethods, B2BMFAProducts } from '@stytch/core/public';\nimport { useMemo } from 'react';\n\nimport { isTruthy } from '../../utils/isTruthy';\nimport { useAdminPortalOrgUIConfig } from '../StytchClientContext';\n\nconst configMfaMethodMap: Record<B2BMFAProducts, B2BAllowedMFAMethods> = {\n  smsOtp: 'sms_otp',\n  totp: 'totp',\n};\n\nexport const useAllowedMfaMethods = () => {\n  const orgUIConfig = useAdminPortalOrgUIConfig();\n\n  return useMemo(() => {\n    const mfaMethods = orgUIConfig?.allowedMfaAuthMethods ?? (Object.keys(configMfaMethodMap) as B2BMFAProducts[]);\n    return mfaMethods.map((method) => configMfaMethodMap[method]).filter(isTruthy);\n  }, [orgUIConfig?.allowedMfaAuthMethods]);\n};\n"],"names":["configMfaMethodMap","smsOtp","totp","useAllowedMfaMethods","orgUIConfig","useAdminPortalOrgUIConfig","useMemo","mfaMethods","allowedMfaAuthMethods","Object","keys","map","method","filter","isTruthy"],"mappings":";;;;;AAMA,MAAMA,kBAAAA,GAAmE;IACvEC,MAAAA,EAAQ,SAAA;IACRC,IAAAA,EAAM;AACR,CAAA;MAEaC,oBAAAA,GAAuB,IAAA;AAClC,IAAA,MAAMC,WAAAA,GAAcC,yBAAAA,EAAAA;AAEpB,IAAA,OAAOC,CAAAA,CAAQ,IAAA;AACb,QAAA,MAAMC,UAAAA,GAAaH,WAAAA,EAAaI,qBAAAA,IAA0BC,MAAAA,CAAOC,IAAI,CAACV,kBAAAA,CAAAA;QACtE,OAAOO,UAAAA,CAAWI,GAAG,CAAC,CAACC,MAAAA,GAAWZ,kBAAkB,CAACY,MAAAA,CAAO,CAAA,CAAEC,MAAM,CAACC,QAAAA,CAAAA;IACvE,CAAA,EAAG;QAACV,WAAAA,EAAaI;AAAsB,KAAA,CAAA;AACzC;;;;"}