Skip to content

Commit 2e4b99d

Browse files
committed
Update useTotalEnabledAuthMethods.ts
1 parent 45437aa commit 2e4b99d

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

packages/clerk-js/src/ui/hooks/useTotalEnabledAuthMethods.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,15 @@ import type { Attribute } from '@clerk/shared/types';
33
import { useEnvironment } from '../contexts/EnvironmentContext';
44
import { useEnabledThirdPartyProviders } from './useEnabledThirdPartyProviders';
55

6-
/**
7-
* Calculates the total count of all enabled authentication methods.
8-
* This includes:
9-
* - First factor identifiers (email_address, username, phone_number)
10-
* - OAuth strategies
11-
* - Web3 strategies
12-
* - Alternative phone code channels
13-
*
14-
* Note: When both email and username are enabled, they count as 2 separate methods
15-
* even though the UI may show them as one combined field.
16-
*/
176
export const useTotalEnabledAuthMethods = (): { totalCount: number } => {
187
const { userSettings } = useEnvironment();
198
const { authenticatableOauthStrategies, web3Strategies, alternativePhoneCodeChannels } =
209
useEnabledThirdPartyProviders();
2110

22-
// Count enabled first factor identifiers
23-
// Use the raw array (not grouped) to get accurate counts
24-
// Filter out 'passkey' as it's not counted as a separate method in the UI
2511
const firstFactorCount = userSettings.enabledFirstFactorIdentifiers.filter(
2612
(attr: Attribute) => attr !== 'passkey',
2713
).length;
2814

29-
// Count third-party authentication methods
3015
const oauthCount = authenticatableOauthStrategies.length;
3116
const web3Count = web3Strategies.length;
3217
const alternativePhoneCodeCount = alternativePhoneCodeChannels.length;

0 commit comments

Comments
 (0)