<commit_before>import * as React from 'react'
import { AuthenticationForm } from './authentication-form'
import { assertNever } from '../../lib/fatal-error'
import { TwoFactorAuthentication } from '../lib/two-factor-authentication'
import { EnterpriseServerEntry } from '../lib/enterprise-server-entry'
import { Dispatcher, SignInStep, Step, AuthenticationMethods } from '../../lib/dispatcher'

interface ISignInProps {
  readonly currentStep: SignInStep
  readonly dispatcher: Dispatcher

  /** An array of additional buttons to render after the "Sign In" button. */
  readonly children?: ReadonlyArray<JSX.Element>
}

/** The sign in flow for GitHub. */
export class SignIn extends React.Component<ISignInProps, void> {

  private onEndpointEntered = (url: string) => {
    this.props.dispatcher.setSignInEndpoint(url)
  }

  private onCredentialsEntered = (username: string, password: string) => {
    this.props.dispatcher.setSignInCredentials(username, password)
  }

  private onBrowserSignInRequested = () => {
    this.props.dispatcher.requestBrowserAuthentication()
  }

  private onOTPEntered = (otp: string) => {
    this.props.dispatcher.setSignInOTP(otp)
  }

  public render() {
    const step = this.props.currentStep
    if (step.kind === Step.EndpointEntry) {
      return <EnterpriseServerEntry
        loading={step.loading}
        error={step.error}
        onSubmit={this.onEndpointEntered}
        additionalButtons={this.props.children}
      />
    } else if (step.kind === Step.Authentication) {
      const supportsBasicAuth = step.authMethods.has(AuthenticationMethods.BasicAuth)
      return <AuthenticationForm
        loading={step.loading}
        error={step.error}
        supportsBasicAuth={supportsBasicAuth}
        endpoint={step.endpoint}
        additionalButtons={this.props.children}
        onBrowserSignInRequested={this.onBrowserSignInRequested}
        onSubmit={this.onCredentialsEntered}/>
    } else if (step.kind === Step.TwoFactorAuthentication) {
      return <TwoFactorAuthentication
        loading={step.loading}
        error={step.error}
        onOTPEntered={this.onOTPEntered}/>
    } else {
      return assertNever(step, `Unknown sign-in step: ${step}`)
    }
  }
}
<commit_msg>Don't render anything for success step (for now)<commit_after>import * as React from 'react'
import { AuthenticationForm } from './authentication-form'
import { assertNever } from '../../lib/fatal-error'
import { TwoFactorAuthentication } from '../lib/two-factor-authentication'
import { EnterpriseServerEntry } from '../lib/enterprise-server-entry'
import { Dispatcher, SignInStep, Step, AuthenticationMethods } from '../../lib/dispatcher'

interface ISignInProps {
  readonly currentStep: SignInStep
  readonly dispatcher: Dispatcher

  /** An array of additional buttons to render after the "Sign In" button. */
  readonly children?: ReadonlyArray<JSX.Element>
}

/** The sign in flow for GitHub. */
export class SignIn extends React.Component<ISignInProps, void> {

  private onEndpointEntered = (url: string) => {
    this.props.dispatcher.setSignInEndpoint(url)
  }

  private onCredentialsEntered = (username: string, password: string) => {
    this.props.dispatcher.setSignInCredentials(username, password)
  }

  private onBrowserSignInRequested = () => {
    this.props.dispatcher.requestBrowserAuthentication()
  }

  private onOTPEntered = (otp: string) => {
    this.props.dispatcher.setSignInOTP(otp)
  }

  public render() {
    const step = this.props.currentStep
    if (step.kind === Step.EndpointEntry) {
      return <EnterpriseServerEntry
        loading={step.loading}
        error={step.error}
        onSubmit={this.onEndpointEntered}
        additionalButtons={this.props.children}
      />
    } else if (step.kind === Step.Authentication) {
      const supportsBasicAuth = step.authMethods.has(AuthenticationMethods.BasicAuth)
      return <AuthenticationForm
        loading={step.loading}
        error={step.error}
        supportsBasicAuth={supportsBasicAuth}
        endpoint={step.endpoint}
        additionalButtons={this.props.children}
        onBrowserSignInRequested={this.onBrowserSignInRequested}
        onSubmit={this.onCredentialsEntered}/>
    } else if (step.kind === Step.TwoFactorAuthentication) {
      return <TwoFactorAuthentication
        loading={step.loading}
        error={step.error}
        onOTPEntered={this.onOTPEntered}/>
    } else if (step.kind === Step.Success) {
      return null
    } else {
      return assertNever(step, `Unknown sign-in step: ${step}`)
    }
  }
}

{'fraction_non_alphanumeric': 0.11625874125874126, 'fraction_numerical': 0.0, 'mean_word_length': 3.5724275724275723, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '632761', 'n_tokens_mistral': 1295, 'n_tokens_neox': 1288, 'n_words': 273}