Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VATEAM-101161: Normalize Custom Step with pages and components #2454

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

derekhouck
Copy link
Contributor

@derekhouck derekhouck commented Feb 20, 2025

Are you removing or changing a registry.json entryName in this PR?

  • No, I'm not changing any entryNames (skip to Summary and delete the rest of this section)
  • Yes, I'm removing or changing an entryName

Summary

  • Updates the GraphQL query to fetch the proper fields for Custom Step Paragraph entities.
  • Normalizes fields for Custom Steps as well as their pages and the Text Input component.

Example output

      {
        "id": 172736,
        "type": "digital_form_custom_step",
        "chapterTitle": "My custom step",
        "pages": [
          {
            "bodyText": "My custom body text",
            "components": [
              {
                "hint": "This is optional hint text",
                "label": "My custom text input",
                "required": true,
                "type": "digital_form_text_input"
              }
            ],
            "pageTitle": "My custom page"
          },
          {
            "bodyText": "With additonal body text",
            "components": [
              {
                "hint": null,
                "label": "A text input with no hint text",
                "required": true,
                "type": "digital_form_text_input"
              },
              {
                "hint": "This text input is not required",
                "label": "An optional text input",
                "required": false,
                "type": "digital_form_text_input"
              }
            ],
            "pageTitle": "An additional page"
          }
        ]
      }

Related issue(s)

Testing done

  • New/updated unit tests for the new and updated GraphQL fragments and the Digital Form post processor
  • Pulled local Drupal data and confirmed the resulting output from content-build

What areas of the site does it impact?

Only affects the output of digital-forms.json.

Acceptance criteria

Quality Assurance & Testing

  • I fixed|updated|added unit tests and integration tests for each feature (if applicable).
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs
  • Linting warnings have been addressed
  • Documentation has been updated (link to documentation *if necessary)
  • Screenshot of the developed feature is added
  • Accessibility testing has been performed

Error Handling

  • Browser console contains no warnings or errors.
  • Events are being sent to the appropriate logging solution
  • Feature/bug has a monitor built into Datadog or Grafana (if applicable)

Authentication

  • Did you login to a local build and verify all authenticated routes work as expected with a test user

Requested Feedback

(OPTIONAL) What should the reviewers know in addition to the above. Is there anything specific you wish the reviewer to assist with. Do you have any concerns with this PR, why?

Copy link
Collaborator

@va-vfs-bot va-vfs-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESLint is disabled

vets-website uses ESLint to help enforce code quality. In most situations we would like ESLint to remain enabled.

What you can do

See if the code can be refactored to avoid disabling ESLint, or wait for a VSP review.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid overloading postProcessDigitalForm.js, I've moved all code relating to chapters to this page.

Comment on lines +3 to +22
const extractAdditionalFields = entity => {
const { entityId } = entity.type.entity;

switch (entityId) {
case 'digital_form_address':
return {
militaryAddressCheckbox: entity.fieldMilitaryAddressCheckbox,
};
case 'digital_form_list_loop':
return {
optional: entity.fieldOptional,
};
case 'digital_form_phone_and_email':
return {
includeEmail: entity.fieldIncludeEmail,
};
default:
return {};
}
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no changes to extractAdditionalFields

type,
};

switch (type) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This switch statement is ripe for a refactor, but it will make more sense to do that when I add custom List & Loops at a later date.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These methods were moved out of postProcessDigitalForm.js to give that file more focus. No changes were made to either method.

@derekhouck derekhouck requested a review from ryguyk February 20, 2025 22:11
@derekhouck derekhouck marked this pull request as ready for review February 20, 2025 22:11
@derekhouck derekhouck requested review from a team as code owners February 20, 2025 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Normalize custom step (with text input) in content-build
3 participants