<commit_before>import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
import { H4 } from '@govuk-react/heading'
import UnorderedList from '@govuk-react/unordered-list'
import ListItem from '@govuk-react/list-item'
import InsetText from '@govuk-react/inset-text'
import { SPACING } from '@govuk-react/constants'
import ErrorSummary from '@govuk-react/error-summary'
import Details from '@govuk-react/details'

import { SummaryList } from '../../../../../client/components'
import TaskForm from '../../../../../client/components/Task/Form'
import urls from '../../../../../lib/urls'
import MatchDuplicate from './MatchDuplicate'

const StyledRoot = styled('div')`
  h2:not(:first-child) {
    margin-top: ${SPACING.SCALE_6};
  }
`

// TODO: Reset all styles to defaults for HTML within react-slot.
const StyledList = styled(UnorderedList)`
  list-style-type: initial;
  margin-bottom: ${SPACING.SCALE_6};
`

function MatchConfirmation({
  dnbCompanyIsMatched,
  company,
  dnbCompany,
  csrfToken,
}) {
  if (dnbCompanyIsMatched) {
    return (
      <MatchDuplicate
        company={company}
        dnbCompany={dnbCompany}
        csrfToken={csrfToken}
      />
    )
  }

  return (
    <StyledRoot>
      <TaskForm
        id="match-confirmation-form"
        submissionTaskName="Match confirmation"
        analyticsFormName="match-confirmation-form"
        redirectTo={(company) => urls.companies.detail(company.id)}
        flashMessage={() => [
          'Business details verified.',
          'Thanks for helping to improve the quality of records on Data Hub!',
        ]}
        transformPayload={() => ({
          company,
          dnbCompany,
          csrfToken,
        })}
        submitButtonLabel="Verify"
        actionLinks={[
          { href: urls.companies.match.index(company.id), children: 'Back' },
        ]}
      >
        {({ submissionError }) => (
          <>
            {submissionError && (
              <ErrorSummary
                heading="There was an error matching this company"
                description={submissionError.message}
                errors={[]}
              />
            )}

            <H4 as="h2">Data Hub business details (un-verified)</H4>
            <InsetText>
              <SummaryList
                rows={[
                  { label: 'Company name', value: company.name },
                  {
                    label: 'Located at',
                    value: company.address.join(', '),
                  },<commit_msg>Remove unnecessary error summary from form<commit_after>import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
import { H4 } from '@govuk-react/heading'
import UnorderedList from '@govuk-react/unordered-list'
import ListItem from '@govuk-react/list-item'
import InsetText from '@govuk-react/inset-text'
import { SPACING } from '@govuk-react/constants'
import Details from '@govuk-react/details'

import { SummaryList } from '../../../../../client/components'
import TaskForm from '../../../../../client/components/Task/Form'
import urls from '../../../../../lib/urls'
import MatchDuplicate from './MatchDuplicate'

const StyledRoot = styled('div')`
  h2:not(:first-child) {
    margin-top: ${SPACING.SCALE_6};
  }
`

// TODO: Reset all styles to defaults for HTML within react-slot.
const StyledList = styled(UnorderedList)`
  list-style-type: initial;
  margin-bottom: ${SPACING.SCALE_6};
`

function MatchConfirmation({
  dnbCompanyIsMatched,
  company,
  dnbCompany,
  csrfToken,
}) {
  if (dnbCompanyIsMatched) {
    return (
      <MatchDuplicate
        company={company}
        dnbCompany={dnbCompany}
        csrfToken={csrfToken}
      />
    )
  }

  return (
    <StyledRoot>
      <TaskForm
        id="match-confirmation-form"
        submissionTaskName="Match confirmation"
        analyticsFormName="match-confirmation-form"
        redirectTo={(company) => urls.companies.detail(company.id)}
        flashMessage={() => [
          'Business details verified.',
          'Thanks for helping to improve the quality of records on Data Hub!',
        ]}
        transformPayload={() => ({
          company,
          dnbCompany,
          csrfToken,
        })}
        submitButtonLabel="Verify"
        actionLinks={[
          { href: urls.companies.match.index(company.id), children: 'Back' },
        ]}
      >
        {() => (
          <>
            <H4 as="h2">Data Hub business details (un-verified)</H4>
            <InsetText>
              <SummaryList
                rows={[
                  { label: 'Company name', value: company.name },
                  {
                    label: 'Located at',
                    value: company.address.join(', '),
                  },
{'fraction_non_alphanumeric': 0.13615512927439533, 'fraction_numerical': 0.0029190992493744786, 'mean_word_length': 2.191616766467066, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 26, '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': '4740590', 'n_tokens_mistral': 1388, 'n_tokens_neox': 1368, 'n_words': 305}