({
loginHint,
onSignup,
onProviderClick,
onForgotPassword,
onPasswordLogin,
targetId,
isLoginFlow,
initialLoginFlow,
onBack,
providers,
disableRegistration,
disablePassword,
isLoading,
isSocialAuthLoading,
isReady,
trigger,
signUpTitle = 'Sign up for daily.dev',
logInTitle = 'Log in to daily.dev',
signUpDescription,
logInDescription,
signupProviders,
socialSignupOnly,
loginButton,
simplified,
onAuthOpenLogged,
emailLogin,
hasTopBarBack,
loginEmail,
isStartups,
onLogInChange,
socialError,
}: AuthDefaultProps)
| 63 | } |
| 64 | |
| 65 | const AuthDefault = ({ |
| 66 | loginHint, |
| 67 | onSignup, |
| 68 | onProviderClick, |
| 69 | onForgotPassword, |
| 70 | onPasswordLogin, |
| 71 | targetId, |
| 72 | isLoginFlow, |
| 73 | initialLoginFlow, |
| 74 | onBack, |
| 75 | providers, |
| 76 | disableRegistration, |
| 77 | disablePassword, |
| 78 | isLoading, |
| 79 | isSocialAuthLoading, |
| 80 | isReady, |
| 81 | trigger, |
| 82 | signUpTitle = 'Sign up for daily.dev', |
| 83 | logInTitle = 'Log in to daily.dev', |
| 84 | signUpDescription, |
| 85 | logInDescription, |
| 86 | signupProviders, |
| 87 | socialSignupOnly, |
| 88 | loginButton, |
| 89 | simplified, |
| 90 | onAuthOpenLogged, |
| 91 | emailLogin, |
| 92 | hasTopBarBack, |
| 93 | loginEmail, |
| 94 | isStartups, |
| 95 | onLogInChange, |
| 96 | socialError, |
| 97 | }: AuthDefaultProps): ReactElement => { |
| 98 | const { logEvent } = useLogContext(); |
| 99 | const [shouldLogin, setShouldLogin] = useState(isLoginFlow); |
| 100 | const fallbackLoginHint = useState<string | null>(null); |
| 101 | const resolvedLoginHint = loginHint ?? fallbackLoginHint; |
| 102 | const fallbackEmailLogin = useState(false); |
| 103 | const [isEmailLogin, setIsEmailLogin] = emailLogin ?? fallbackEmailLogin; |
| 104 | const socialLoginListRef = useRef<HTMLDivElement>(null); |
| 105 | const [clickedProvider, setClickedProvider] = useState<string>(); |
| 106 | |
| 107 | const focusFirstSocialLink = () => { |
| 108 | if (!socialLoginListRef.current) { |
| 109 | return; |
| 110 | } |
| 111 | const firstChild = socialLoginListRef.current.children[0]; |
| 112 | if (!(firstChild instanceof HTMLElement)) { |
| 113 | return; |
| 114 | } |
| 115 | firstChild.focus(); |
| 116 | }; |
| 117 | |
| 118 | useEffect(() => { |
| 119 | logEvent({ |
| 120 | event_name: shouldLogin |
| 121 | ? AuthEventNames.OpenLogin |
| 122 | : AuthEventNames.OpenSignup, |
nothing calls this directly
no test coverage detected