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

Adds initial mhv-supply-reordering application #33224

Merged
merged 33 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e7f37be
Adds initial mhv-supply-reorder form app
radavis Nov 15, 2024
e1ef873
Adds mocks
radavis Nov 15, 2024
2fc3d8d
Additions
radavis Nov 15, 2024
6f0f61d
Adds alerts
radavis Nov 18, 2024
1640844
Save point
radavis Nov 18, 2024
a320df0
Moves breadcrumbs to IntroductionPage
radavis Nov 19, 2024
3192cb4
Sets useTopBackLink: true in formConfig (large continue button)
radavis Nov 19, 2024
7c05b66
Show subtitle on IntroductionPage, only
radavis Nov 19, 2024
8327774
Sets 'Finish this order later' content for save link
radavis Nov 19, 2024
256a65d
Removes margin from paragraph in informative va-alert
radavis Nov 19, 2024
9ecef23
Sets Select supplies as first page
radavis Nov 19, 2024
e67788c
Sets supply count, 'No supplies selected/found' text
radavis Nov 19, 2024
217d6ec
Adds formatDate helper
radavis Nov 21, 2024
b94d005
Updates
radavis Nov 22, 2024
7c96130
Save point
radavis Nov 25, 2024
bc02c77
Merge branch 'main' into order-supplies
radavis Nov 25, 2024
e626448
Merge branch 'main' into order-supplies
radavis Nov 25, 2024
af807be
Checkboxes!
radavis Nov 25, 2024
f62ece4
Adds product description
radavis Nov 25, 2024
ae5e379
Updates readme
radavis Nov 25, 2024
46080d3
Removes unused code
radavis Nov 25, 2024
9a0848c
Readd user.json
radavis Nov 25, 2024
5a6bab3
Updates
radavis Nov 26, 2024
26bafcd
Fixes supply phrase
radavis Nov 26, 2024
f4b9e2e
No e2e specs, yet
radavis Nov 26, 2024
eb480c3
Removes commented code, adds unit specs
radavis Nov 26, 2024
03e8cc3
Adds selector specs
radavis Nov 26, 2024
cb3b951
Updates
radavis Nov 26, 2024
4a08315
Use require instead of import for mocks
radavis Nov 26, 2024
d2afa71
Merge branch 'main' into order-supplies
radavis Nov 26, 2024
2073076
Updates readme
radavis Nov 27, 2024
716cb3f
Merge branch 'main' into order-supplies
radavis Nov 27, 2024
8896ca5
Merge branch 'main' into order-supplies
radavis Dec 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions src/applications/mhv-supply-reordering/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# mhv-supply-reordering

## Background Info

About: This app provides an interface to re-order Hearing Aid and Sleep Apnea accessories
Slack Channel: [#va-cto-supply-reordering](https://dsva.slack.com/archives/C05DFSM57FW/p1689711688225089)

## App

Form app generated with `yarn app:new`. Changes to the following files were reverted, since `VA_FORM_IDS.FORM_VA_2346A` already exists.
Copy link
Contributor

Choose a reason for hiding this comment

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

correction: yarn app:new --> yarn new:app


- `src/platform/forms/constants.js`
- `src/platform/forms/tests/forms.unit.spec.js`

## Quick start to get running locally

Before you get started check [this page](https://depo-platform-documentation.scrollhelp.site/developer-docs/setting-up-your-local-frontend-environment) first to make sure you are setup to use the correct version of Node and Yarn.

- clone vets-website repo `git clone [email protected]:department-of-veterans-affairs/vets-website.git`
- run `yarn install`
- turn on local mocks `yarn mock-api --responses src/applications/mhv-supply-reordering/mocks/index.js`
- start app `yarn watch --env entry=mhv-supply-reordering`
- Run this in your browser console to simulate being logged in `localStorage.setItem('hasSession', true);`
- visit the app: `http://localhost:3001/my-health/order-supplies`

Note: The application fetches supply data from `/v0/in_progress_forms/mdot`. This endpoint is mocked in the local development environment.

## Running tests

Unit tests can be run using this command: `yarn test:unit --app-folder mhv-supply-reordering`. To get detailed errors, run this command with `--log-level=error`. To get coverage reports run this command `yarn test:unit --app-folder mhv-supply-reordering --coverage --coverage-html`. View the report at `/coverage/index.html`

Cypress tests can be run with the GUI using this command: `yarn cy:open`. From there you can filter by `mhv-supply-reordering` to run end to end tests for this app.

Run Cypress from command line:

- Run all `yarn cy:run --spec "src/applications/mhv-supply-reordering/**/**/*"`
- Specify browser `-b electron`

## VA Forms - Web Component Fields and Patterns

[[docs](https://depo-platform-documentation.scrollhelp.site/developer-docs/va-forms-library-web-component-fields-and-patterns)]

[[examples](https://staging.va.gov/mock-form-patterns/introduction)]

A web-component-field is a design system web component for use in forms. These can be found at `src/platform/forms-system/src/js/web-component-fields`.

A web-component-pattern is a group of web-component-fields that can span one or more pages (e.g. - a multi-page form). These can be found at `src/platform/forms-system/src/js/web-component-patterns`.

## Form Flow
Copy link
Contributor

Choose a reason for hiding this comment

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

I love this thorough README and the docs references!


- IntroductionPage
- SelectSupplies
- ContactInformation (optionally: EditEmail, EditAddress)
- ReviewPage
- ConfirmationPage

## API Responses

[[mocker-api](https://github.com/jaywcjlove/mocker-api/tree/v2.9.0?tab=readme-ov-file#usage)]

[[vets-api OpenAPI documentation](https://department-of-veterans-affairs.github.io/va-digital-services-platform-docs/api-reference/#/in_progress_forms)]

`GET /v0/in_progress_forms/MDOT` returns the following... (note the lack of a `data` property)

```json
{
"formData": {
"fullName": {},
"permanentAddress": {},
"temporaryAddress": {},
"ssnLastFour": "",
"gender": "",
"vetEmail": "",
"dateOfBirth": "",
"eligibility": {},
"supplies": []
},
"metadata": {
"version": 0,
"prefill": true,
"returnUrl": ""
}
}
```

When requesting `GET /v0/in_progress_forms/MDOT`, the MDOT client in vets-api will make a request to the system of record for veteran details and supplies available to the veteran. See `V0::InProgressFormsController.camelized_prefill_for_user` and `FormProfiles::MDOT#prefill`. On the front-end, test against the possible responses for `MDOT::Client.new(user).get_supplies` which are mapped to `mdot.exceptions` values in `vets-api/config/locales/exceptions.en.yml` and then passed along in the response. Also, see `vets-api/spec/support/vcr_cassettes/mdot/get_supplies*.yml`.

## Dynamic Forms

[[using update and replace schema funcs](https://depo-platform-documentation.scrollhelp.site/developer-docs/va-forms-library-how-to-use-updateschema-and-repla)]

see `src/applications/disability-benefits/all-claims/pages/toxicExposure/toxicExposureConditions.js` for an example.

## Device Types

How do we access other device types? (e.g. - assistive devices, nebulizers)... It sounds like these are included in the request for supplies.

(I believe) The `productGroup` property of a supply can be one of the following values: `['accessories', 'batteries', 'apnea']`.

## Thoughts & Improvements

Should there be a `GET /v0/mdot/supplies` endpoint that returns available supplies? Current implementation of fetching supplies from `/v0/in_progres_forms/MDOT` feels strange.

Need to understand the relationship between backend forms and frontend forms.

Just build the frontend.
13 changes: 13 additions & 0 deletions src/applications/mhv-supply-reordering/actions/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {
GET_MDOT_IN_PROGRESS_FORM_STARTED,
GET_MDOT_IN_PROGRESS_FORM_SUCCEEDED,
GET_MDOT_IN_PROGRESS_FORM_FAILED,
getMdotInProgressForm,
} from './mdotInProgressForm';

export {
GET_MDOT_IN_PROGRESS_FORM_STARTED,
GET_MDOT_IN_PROGRESS_FORM_SUCCEEDED,
GET_MDOT_IN_PROGRESS_FORM_FAILED,
getMdotInProgressForm,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { apiRequest } from 'platform/utilities/api';

export const GET_MDOT_IN_PROGRESS_FORM_STARTED =
'GET_MDOT_IN_PROGRESS_FORM_STARTED';
export const GET_MDOT_IN_PROGRESS_FORM_SUCCEEDED =
'GET_MDOT_IN_PROGRESS_FORM_SUCCEEDED';
export const GET_MDOT_IN_PROGRESS_FORM_FAILED =
'GET_MDOT_IN_PROGRESS_FORM_FAILED';

const getMdotInProgressFormStarted = () => ({
type: GET_MDOT_IN_PROGRESS_FORM_STARTED,
});

const getMdotInProgressFormSucceeded = payload => ({
type: GET_MDOT_IN_PROGRESS_FORM_SUCCEEDED,
payload,
});

const getMdotInProgressFormFailed = payload => ({
type: GET_MDOT_IN_PROGRESS_FORM_FAILED,
payload,
});

const MDOT_IN_PROGRESS_FORM_PATH = '/in_progress_forms/MDOT';

export const getMdotInProgressForm = () => async dispatch => {
await dispatch(getMdotInProgressFormStarted());
return apiRequest(MDOT_IN_PROGRESS_FORM_PATH)
.then(payload => {
return dispatch(getMdotInProgressFormSucceeded(payload));
})
.catch(err => {
return dispatch(getMdotInProgressFormFailed(err));
});
};
15 changes: 15 additions & 0 deletions src/applications/mhv-supply-reordering/app-entry.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import '@department-of-veterans-affairs/platform-polyfills';
import './sass/mhv-supply-reordering.scss';

import { startAppFromIndex } from '@department-of-veterans-affairs/platform-startup/exports';

import routes from './routes';
import reducer from './reducers';
import manifest from './manifest.json';

startAppFromIndex({
entryName: manifest.entryName,
url: manifest.rootUrl,
reducer,
routes,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react';
import { VaBreadcrumbs } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
import manifest from '../manifest.json';

const breadcrumbList = [
{
href: '/',
label: 'VA.gov Home',
},
{
href: '/my-health',
label: 'Health care',
},
{
href: manifest.rootUrl,
label: manifest.appName,
},
];

const Breadcrumbs = () => <VaBreadcrumbs breadcrumbList={breadcrumbList} />;

export default Breadcrumbs;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';
import { DLC_EMAIL } from '../constants';

const DlcEmailLink = () => <a href={`mailto:${DLC_EMAIL}`}>{DLC_EMAIL}</a>;

export default DlcEmailLink;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

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

really like these clean little components

import { CONTACTS } from '@department-of-veterans-affairs/component-library/contacts';
import { DLC_TELEPHONE } from '../constants';

const DlcTelephoneLink = () => (
<>
<va-telephone contact={DLC_TELEPHONE} /> (
<va-telephone contact={CONTACTS['711']} tty />)
</>
);

export default DlcTelephoneLink;
Loading
Loading