File size: 529 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import config from '@automattic/calypso-config';

type ShouldUseMagicCodeProps = {
	/**
	 * Whether the login is for a Jetpack site.
	 */
	isJetpack?: boolean;
};

/**
 * Returns true if the login should use magic code.
 * @param {ShouldUseMagicCodeProps} options
 * @returns {boolean}
 */
export function shouldUseMagicCode( { isJetpack }: ShouldUseMagicCodeProps ): boolean {
	const isMagicCodeEnabled = config.isEnabled( 'login/use-magic-code' );

	if ( isJetpack && isMagicCodeEnabled ) {
		return true;
	}

	return false;
}