Skip to content

Commit

Permalink
Merge pull request #303 from usagov/stage
Browse files Browse the repository at this point in the history
Sprint 67 release to MAIN
  • Loading branch information
rayestrada authored Sep 6, 2024
2 parents 8ff09c0 + 2b1a6e1 commit 173003a
Show file tree
Hide file tree
Showing 18 changed files with 376 additions and 180 deletions.
116 changes: 59 additions & 57 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,54 @@ version: 2.1
orbs:
gh: circleci/[email protected]
jobs:
update-nvrf:
docker:
- image: cimg/base:stable
environment:
URL: https://www.eac.gov/sites/default/files/eac_assets/1/6/Federal_Voter_Registration_ENG.pdf
NVRF_FILE_NAME: Federal_Voter_Registration_ENG.pdf
NEW_BRANCH_NAME: upload-nvrf-pdf
steps:
#Install gh
- gh/install
- run:
name: Git Clone and Config
command: |
GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone -b "update-nvrf-pdf" "$CIRCLE_REPOSITORY_URL"
cd vote-gov-nvrf-app
git config user.email "circleci@df52e93b2563.(none)"
git config user.name "Pipeline Commit"
- run:
name: Fetch NVRF from eac.gov
command: |
curl -o Federal_Voter_Registration_ENG.pdf $URL
#Save pdf as an artifact
- store_artifacts:
path: Federal_Voter_Registration_ENG.pdf
destination: /pdf-files
# Create a variable to store the PDF artifact
- run:
name: Replace current NVRF
command: |
cd vote-gov-nvrf-app
artifacts=$(curl -X GET "https://circleci.com/api/v2/project/github/usagov/vote-gov-nvrf-app/$CIRCLE_BUILD_NUM/artifacts" \
-H "Accept: application/json" \
-u "$NVRF_PDF_WRITE:")
echo "read -r -d '' STORED_ARTIFACTS \<< 'EOF_ARTIFACTS'" >> $BASH_ENV
echo "$artifacts" >> $BASH_ENV
echo "EOF_ARTIFACTS" >> $BASH_ENV
cd public/files
rm $NVRF_FILE_NAME
echo $STORED_ARTIFACTS > $NVRF_FILE_NAME
- run:
name: Create Pull Request
shell: /bin/bash
command: |
cd vote-gov-nvrf-app
echo $NVRF_PDF_WRITE | tee /tmp/key.txt
gh auth login --with-token < /tmp/key.txt
gh pr create --title "Update NVRF PDF" --body "Upload the new NVRF PDF from eac.gov. This is an automated job from CircleCI" || true
# turning off job until review of pdf can be done
# update-nvrf:
# docker:
# - image: cimg/base:stable
# environment:
# URL: https://www.eac.gov/sites/default/files/eac_assets/1/6/Federal_Voter_Registration_ENG.pdf
# NVRF_FILE_NAME: Federal_Voter_Registration_ENG.pdf
# NEW_BRANCH_NAME: upload-nvrf-pdf
# steps:
# #Install gh
# - gh/install
# - run:
# name: Git Clone and Config
# command: |
# GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone -b "update-nvrf-pdf" "$CIRCLE_REPOSITORY_URL"
# cd vote-gov-nvrf-app
# git config user.email "circleci@df52e93b2563.(none)"
# git config user.name "Pipeline Commit"
# - run:
# name: Fetch NVRF from eac.gov
# command: |
# curl -o Federal_Voter_Registration_ENG.pdf $URL
# #Save pdf as an artifact
# - store_artifacts:
# path: Federal_Voter_Registration_ENG.pdf
# destination: /pdf-files
# # Create a variable to store the PDF artifact
# - run:
# name: Replace current NVRF
# command: |
# cd vote-gov-nvrf-app
# artifacts=$(curl -X GET "https://circleci.com/api/v2/project/github/usagov/vote-gov-nvrf-app/$CIRCLE_BUILD_NUM/artifacts" \
# -H "Accept: application/json" \
# -u "$NVRF_PDF_WRITE:")
# echo "read -r -d '' STORED_ARTIFACTS \<< 'EOF_ARTIFACTS'" >> $BASH_ENV
# echo "$artifacts" >> $BASH_ENV
# echo "EOF_ARTIFACTS" >> $BASH_ENV
# cd public/files
# rm $NVRF_FILE_NAME
# echo $STORED_ARTIFACTS > $NVRF_FILE_NAME
# - run:
# name: Create Pull Request
# shell: /bin/bash
# command: |
# cd vote-gov-nvrf-app
# echo $NVRF_PDF_WRITE | tee /tmp/key.txt
# gh auth login --with-token < /tmp/key.txt
# gh pr create --title "Update NVRF PDF" --body "Upload the new NVRF PDF from eac.gov. This is an automated job from CircleCI" || true
cypress-testing:
docker:
- image: cypress/included:cypress-13.3.0-node-20.6.1-chrome-116.0.5845.187-1-ff-117.0-edge-116.0.1938.76-1
Expand All @@ -70,13 +71,14 @@ workflows:
main-workflow:
jobs:
- cypress-testing
update-nvrf-workflow:
jobs:
- update-nvrf
triggers:
- schedule:
cron: '0 0 * * 5'
filters:
branches:
only:
- stage
# turning off job until review of pdf can be done
# update-nvrf-workflow:
# jobs:
# - update-nvrf
# triggers:
# - schedule:
# cron: '0 0 * * 5'
# filters:
# branches:
# only:
# - stage
Binary file added data/es/Federal_Voter_Registration_es.pdf
Binary file not shown.
6 changes: 2 additions & 4 deletions data/es/navigation.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"back": {
"vote": "Go back to Vote.gov",
"select_state": "Go back to select your state",
"state_reg_options": "Go back to state registration options",
"eligibility_req": "Back to state eligibility requirements",
"reg_options": "Back to registration options",
Expand All @@ -11,13 +9,13 @@
"edit_info": "Edit registration information"
},
"next": {
"next": "Next",
"start": "Continue to the digital form filler on vote.gov",
"reg_options": "Continue to view registration options",
"address_location": "Continue to address and location",
"identification": "Continue to identification",
"political_party": "Continue to political party",
"confirm_info": "Continue to review your information"
"confirm_info": "Continue to review your information",
"delivery": "Confirm and continue"
},
"step_label_1": "Personal information",
"step_label_2": "Address and location",
Expand Down
15 changes: 0 additions & 15 deletions data/es/strings.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,18 @@
{
"notRequired": "Not required for your state",
"newWindow": "Go to your state's PDF form in a new tab",
"newTab": "Print your mail-in form in a new tab",
"nameChange": "I have legally changed my name since I last registered in this state.",
"dob": "Date of Birth",
"month": "Month",
"day": "Day",
"year": "Year",
"stateName": "Go to the PDF form on @state_name's website",
"checkReg": "Check your registration",
"checkRegWY": "Find your local office to check your registration",
"learnMore": "Learn more about your voting options",
"backBtn": "Back to Vote.gov",
"backIcon": "back arrow icon",
"forwardIcon": "forward arrow icon",
"stateOnlineName": "Register on @state_name's website",
"confirm": "Confirm and continue",
"selectState": "Select your state or territory",
"selectStateAriaLabel": "State selection dropdown menu",
"lastUpdated": "@state_name information last updated ",
"privacyPolicy": "Privacy policy",
"extlink": "External link opens new window",
"emailLabel": "Voter Contact",
"emailHint": "For example: [email protected]",
"select": "- Select -",
"download": "Download your mail-in form",
"downloadText": "If form does not open in a new tab you can download using the option below.",
"mailDeadlineLabel": "Mail-in registration deadline:",
"inPersonBtn": "Learn more on @state_name's election website",
"inPersonBtnWY": "Find in-person registration locations",
"idSelectionAriaLabel": "Choose identification type"
}
6 changes: 2 additions & 4 deletions data/navigation.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"back": {
"vote": "Go back to Vote.gov",
"select_state": "Go back to select your state",
"state_reg_options": "Go back to state registration options",
"eligibility_req": "Back to state eligibility requirements",
"reg_options": "Back to registration options",
Expand All @@ -11,13 +9,13 @@
"edit_info": "Edit registration information"
},
"next": {
"next": "Next",
"start": "Continue to the digital form filler on vote.gov",
"reg_options": "Continue to view registration options",
"address_location": "Continue to address and location",
"identification": "Continue to identification",
"political_party": "Continue to political party",
"confirm_info": "Continue to review your information"
"confirm_info": "Continue to review your information",
"delivery": "Confirm and continue"
},
"step_label_1": "Personal information",
"step_label_2": "Address and location",
Expand Down
15 changes: 0 additions & 15 deletions data/strings.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,18 @@
{
"notRequired": "Not required for your state",
"newWindow": "Go to your state's PDF form in a new tab",
"newTab": "Print your mail-in form in a new tab",
"nameChange": "I have legally changed my name since I last registered in this state.",
"dob": "Date of Birth",
"month": "Month",
"day": "Day",
"year": "Year",
"stateName": "Go to the PDF form on @state_name's website",
"checkReg": "Check your registration",
"checkRegWY": "Find your local office to check your registration",
"learnMore": "Learn more about your voting options",
"backBtn": "Back to Vote.gov",
"backIcon": "back arrow icon",
"forwardIcon": "forward arrow icon",
"stateOnlineName": "Register on @state_name's website",
"confirm": "Confirm and continue",
"selectState": "Select your state or territory",
"selectStateAriaLabel": "State selection dropdown menu",
"lastUpdated": "@state_name information last updated ",
"privacyPolicy": "Privacy policy",
"extlink": "External link opens new window",
"emailLabel": "Voter Contact",
"emailHint": "For example: [email protected]",
"select": "- Select -",
"download": "Download your mail-in form",
"downloadText": "If form does not open in a new tab you can download using the option below.",
"mailDeadlineLabel": "Mail-in registration deadline:",
"inPersonBtn": "Learn more on @state_name's election website",
"inPersonBtnWY": "Find in-person registration locations",
"idSelectionAriaLabel": "Choose identification type"
}
21 changes: 20 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<!-- Data layer -->
<script id="taxonomy-data">
dataLayer = [{
"Page_Language" : "English",
"State_or_Territory": "",
}];
</script>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push(
{'gtm.start': new Date().getTime(),event:'gtm.js'}
);var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-5BKF7S7X');</script>
<!-- End Google Tag Manager -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="HandheldFriendly" content="True">
Expand All @@ -11,6 +26,10 @@
<link rel="stylesheet" href="theme/assets/styles/nvrf.css">
</head>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5BKF7S7X"
sandbox height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

<dialog id="loginDialog" data-enabled="true" style="width: 480px; border: 0; border-radius: 0.5rem; padding: 1.5rem;">
<form class="usa-form" style="max-width: none;">
Expand Down Expand Up @@ -39,7 +58,7 @@ <h2>Sign in</h2>
<section class="usa-section grid-container">

<!-- Embedded REACT app -->
<div class="nvrf-app-container" data-privacyPath="https://vote.gov/" data-returnPath='https://vote.gov/register/alabama' data-stateId="al" id="root"></div>
<div class="nvrf-app-container" data-returnPath='https://vote.gov/register/alabama' data-stateId="al" id="root"></div>
<script type="module" src="/src/main.jsx"></script>

</section>
Expand Down
2 changes: 1 addition & 1 deletion nvrf/assets/cards.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"uuid":"0ac52b5d-4381-4b4e-830e-38319f3a3757","lang":"en","heading":"I am already registered in @state_name and need to change my information.","body":"\u003Cp\u003EReport a change to registration information, such as name, address, or political party.\u003C\/p\u003E","button_label":"Change registration information","image_url":""},{"uuid":"3abd804c-2787-44f9-a06b-ad6d63ca797f","lang":"en","heading":"I am registering in @state_name for the first time.","body":"\u003Cp\u003ERegister for the first time in this state. We recommend having your driver\u2019s license or non-driver identification number available.\u003C\/p\u003E","button_label":"Begin new registration","image_url":""}]
[{"uuid":"0ac52b5d-4381-4b4e-830e-38319f3a3757","lang":"en","heading":"I am already registered in @state_name and need to change my information.","body":"\u003Cp\u003EReport a change to registration information, such as name, address, or political party.\u003C\/p\u003E","button_label":"Change registration information","image_url":""},{"uuid":"5922e06c-ac2f-475d-ab10-abfdeb65de43","lang":"en","heading":"","body":"\u003Cp\u003EOMB Control No. 3265-0015\u003C\/p\u003E\u003Cp\u003E\u003Ca href=\u0022\/form-filler-privacy-policy\u0022\u003EPrivacy policy\u003C\/a\u003E\u003C\/p\u003E","button_label":"","image_url":""},{"uuid":"3abd804c-2787-44f9-a06b-ad6d63ca797f","lang":"en","heading":"I am registering in @state_name for the first time.","body":"\u003Cp\u003ERegister for the first time in this state. We recommend having your driver\u2019s license or non-driver identification number available.\u003C\/p\u003E","button_label":"Begin new registration","image_url":""}]
31 changes: 22 additions & 9 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import PathSelection from 'Views/PathSelection.jsx';
import MultiStepForm from 'Views/MultiStepForm.jsx';
import {fetchData, fetchStaticData, sanitizeDOM} from 'Utils/JsonHelper.jsx';
import { HelmetProvider } from "react-helmet-async";
import {getFieldValue} from "Utils/fieldParser.jsx";
import loadPdf from './Utils/pdfLoader';


const currentStateId = document.getElementById('root').getAttribute('data-stateId');
const returnPath = document.getElementById('root').getAttribute('data-returnPath');
const privacyPath = document.getElementById('root').getAttribute('data-privacyPath');

function App() {
const [states, setStates] = useState('');
Expand All @@ -18,6 +18,16 @@ function App() {
const [fieldContent, setFieldContent] = useState('')
const [stringContent, setStringContent] = useState('')

const [pdfDoc, setPdfDoc] = useState(null);
const [form, setForm] = useState(null);

useEffect(() => {
loadPdf().then(({ pdfDoc, form }) => {
setPdfDoc(pdfDoc);
setForm(form);
});
}, []);

useEffect(() => {
fetchData("states.json", setStates);
fetchData("pages.json", setContent);
Expand Down Expand Up @@ -87,7 +97,9 @@ function App() {
};

// Only render the markup if the data is loaded.
if (states && content && navContent && fieldContent && stringContent) {
if (states && cards && content && navContent && fieldContent && stringContent) {
// Get NVRF footer card
const cardFooter = cards.find(item => item.uuid === "5922e06c-ac2f-475d-ab10-abfdeb65de43");

const statesList = []
for (let i = 0; i < states.length; i++) {
Expand Down Expand Up @@ -146,17 +158,18 @@ function App() {
registrationPath={registrationPath}
getFormStep={getFormStep}
stringContent={stringContent}
pdfDoc={pdfDoc}
form={form}
/>}

{step >= 1 &&
<div className="text-base margin-top-5 maxw-tablet margin-x-auto">
<p>{getFieldValue(content, "2c597df4-53b6-4ef5-8301-7817b04e1099", "omb_number")}
<br/>
<p>
{lastUpdatedText.replace("@state_name", stateData.name)}
<span dangerouslySetInnerHTML= {{__html: lastUpdatedSanitized}}/>
</p>
{privacyPath && (
<p><a href={privacyPath} target="_blank">{stringContent.privacyPolicy}</a></p>
<span dangerouslySetInnerHTML={{__html: lastUpdatedSanitized}}/>
</p>
{cardFooter && (
<div dangerouslySetInnerHTML={{__html: sanitizeDOM(cardFooter.body)}}></div>
)}
</div>
}
Expand Down
Loading

0 comments on commit 173003a

Please sign in to comment.