src/applications/simple-forms/40-0247/containers/ConfirmationPage.jsx
import React from 'react';
import PropTypes from 'prop-types';
import { connect, useSelector } from 'react-redux';
import { ConfirmationPageView } from '../../shared/components/ConfirmationPageView';
const content = {
headlineText:
'You’ve submitted your Presidential Memorial Certificate request',
nextStepsText:
'After we receive your request, we’ll verify if the Veteran or Reservist is eligible. Then we’ll mail you the certificates you requested.',
};
export const ConfirmationPage = () => {
const form = useSelector(state => state.form || {});
const { submission } = form;
const submitDate = submission.timestamp;
const confirmationNumber = submission.response?.confirmationNumber;
return (
<ConfirmationPageView
formType="submission"
submitterHeader="Who submitted this form"
submitterName={form.data.applicantFullName}
submitDate={submitDate}
confirmationNumber={confirmationNumber}
content={content}
/>
);
};
ConfirmationPage.propTypes = {
form: PropTypes.shape({
data: PropTypes.shape({
fullName: {
first: PropTypes.string.isRequired,
middle: PropTypes.string,
last: PropTypes.string.isRequired,
suffix: PropTypes.string,
},
}),
formId: PropTypes.string,
submission: PropTypes.shape({
response: PropTypes.shape({
attributes: PropTypes.shape({
confirmationNumber: PropTypes.string.isRequired,
}).isRequired,
}).isRequired,
timestamp: PropTypes.string.isRequired,
}),
}),
name: PropTypes.string,
};
function mapStateToProps(state) {
return {
form: state.form,
};
}
export default connect(mapStateToProps)(ConfirmationPage);