{"version":3,"file":"useAllowedAuthMethods.mjs","sources":["../../../../../../../../web/src/adminPortal/utils/useAllowedAuthMethods.ts"],"sourcesContent":["import { B2BAllowedAuthMethods } from '@stytch/core/public';\nimport { useMemo } from 'react';\n\nimport { isTruthy } from '../../utils/isTruthy';\nimport { AdminPortalB2BProducts } from '../AdminPortalB2BProducts';\nimport { useAdminPortalOrgUIConfig } from '../StytchClientContext';\n\nexport const configAuthMethodMap: Record<AdminPortalB2BProducts, B2BAllowedAuthMethods> = {\n  emailMagicLinks: 'magic_link',\n  emailOtp: 'email_otp',\n  sso: 'sso',\n  password: 'password',\n  oauthGoogle: 'google_oauth',\n  oauthMicrosoft: 'microsoft_oauth',\n  oauthHubspot: 'hubspot_oauth',\n  oauthSlack: 'slack_oauth',\n  oauthGithub: 'github_oauth',\n};\n\nexport const useAllowedAuthMethods = () => {\n  const orgUIConfig = useAdminPortalOrgUIConfig();\n\n  return useMemo(() => {\n    const authMethods =\n      orgUIConfig?.allowedAuthMethods ?? (Object.keys(configAuthMethodMap) as AdminPortalB2BProducts[]);\n    return authMethods.map((method) => configAuthMethodMap[method]).filter(isTruthy);\n  }, [orgUIConfig?.allowedAuthMethods]);\n};\n"],"names":["configAuthMethodMap","emailMagicLinks","emailOtp","sso","password","oauthGoogle","oauthMicrosoft","oauthHubspot","oauthSlack","oauthGithub","useAllowedAuthMethods","orgUIConfig","useAdminPortalOrgUIConfig","useMemo","authMethods","allowedAuthMethods","Object","keys","map","method","filter","isTruthy"],"mappings":";;;;;MAOaA,mBAAAA,GAA6E;IACxFC,eAAAA,EAAiB,YAAA;IACjBC,QAAAA,EAAU,WAAA;IACVC,GAAAA,EAAK,KAAA;IACLC,QAAAA,EAAU,UAAA;IACVC,WAAAA,EAAa,cAAA;IACbC,cAAAA,EAAgB,iBAAA;IAChBC,YAAAA,EAAc,eAAA;IACdC,UAAAA,EAAY,aAAA;IACZC,WAAAA,EAAa;AACf;MAEaC,qBAAAA,GAAwB,IAAA;AACnC,IAAA,MAAMC,WAAAA,GAAcC,yBAAAA,EAAAA;AAEpB,IAAA,OAAOC,CAAAA,CAAQ,IAAA;AACb,QAAA,MAAMC,WAAAA,GACJH,WAAAA,EAAaI,kBAAAA,IAAuBC,MAAAA,CAAOC,IAAI,CAACjB,mBAAAA,CAAAA;QAClD,OAAOc,WAAAA,CAAYI,GAAG,CAAC,CAACC,MAAAA,GAAWnB,mBAAmB,CAACmB,MAAAA,CAAO,CAAA,CAAEC,MAAM,CAACC,QAAAA,CAAAA;IACzE,CAAA,EAAG;QAACV,WAAAA,EAAaI;AAAmB,KAAA,CAAA;AACtC;;;;"}