/
form.js
237 lines (223 loc) · 7.82 KB
/
form.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
import { VA_FORM_IDS } from 'platform/forms/constants';
import { externalServices as services } from 'platform/monitoring/DowntimeNotification';
import preSubmitInfo from 'platform/forms/preSubmitInfo';
import FormFooter from 'platform/forms/components/FormFooter';
import migrations from '../migrations';
import prefillTransformer from './prefill-transformer';
import { transform } from './submit-transformer';
import submitForm from './submitForm';
import IntroductionPage from '../containers/IntroductionPage';
import ConfirmationPage from '../containers/ConfirmationPage';
import GetFormHelp from '../content/GetFormHelp';
import ReviewDescription from '../components/ReviewDescription';
import {
EditPhone,
EditEmail,
EditAddress,
} from '../components/EditContactInfo';
import AddIssue from '../components/AddIssue';
// Pages
import veteranInformation from '../pages/veteranInformation';
import contactInfo from '../pages/contactInformation';
import homeless from '../pages/homeless';
import contestableIssuesPage from '../pages/contestableIssues';
import addIssue from '../pages/addIssue';
import areaOfDisagreementFollowUp from '../pages/areaOfDisagreement';
import optIn from '../pages/optIn';
import issueSummary from '../pages/issueSummary';
import informalConference from '../pages/informalConference';
import informalConferenceRepV2 from '../pages/informalConferenceRepV2';
import informalConferenceTime from '../pages/informalConferenceTimeV2';
import {
errorMessages,
WIZARD_STATUS,
CONTESTABLE_ISSUES_PATH,
CONTACT_INFO_PATH,
ADD_ISSUE_PATH,
} from '../constants';
import { appStateSelector, mayHaveLegacyAppeals } from '../utils/helpers';
import { getIssueTitle } from '../content/areaOfDisagreement';
// import initialData from '../tests/schema/initialData';
import manifest from '../manifest.json';
const formConfig = {
rootUrl: manifest.rootUrl,
urlPrefix: '/',
submitUrl: 'higher_level_reviews',
submit: submitForm,
trackingPrefix: 'decision-reviews-va20-0996-',
downtime: {
requiredForPrefill: true,
dependencies: [
services.vaProfile,
services.bgs,
services.mvi,
services.appeals,
],
},
formId: VA_FORM_IDS.FORM_20_0996,
wizardStorageKey: WIZARD_STATUS,
saveInProgress: {
messages: {
inProgress:
'Your Higher-Level Review application (20-0996) is in progress.',
expired:
'Your saved Higher-Level Review application (20-0996) has expired. If you want to apply for Higher-Level Review, please start a new application.',
saved: 'Your Higher-Level Review application has been saved.',
},
// return restart destination url
restartFormCallback: () => '/', // introduction page
},
introduction: IntroductionPage,
confirmation: ConfirmationPage,
version: migrations.length,
migrations,
prefillTransformer,
prefillEnabled: true,
verifyRequiredPrefill: true,
transformForSubmit: transform,
// beforeLoad: props => { console.log('form config before load', props); },
// onFormLoaded: ({ formData, savedForms, returnUrl, formConfig, router }) => {
// console.log('form loaded', formData, savedForms, returnUrl, formConfig, router);
// },
savedFormMessages: {
notFound: errorMessages.savedFormNotFound,
noAuth: errorMessages.savedFormNoAuth,
},
title: 'Request a Higher-Level Review',
subTitle: 'VA Form 20-0996 (Higher-Level Review)',
defaultDefinitions: {},
preSubmitInfo,
chapters: {
infoPages: {
title: 'Veteran information',
reviewDescription: ReviewDescription,
pages: {
veteranInformation: {
title: 'Veteran information',
path: 'veteran-information',
uiSchema: veteranInformation.uiSchema,
schema: veteranInformation.schema,
// initialData,
},
homeless: {
title: 'Homelessness question',
path: 'homeless',
uiSchema: homeless.uiSchema,
schema: homeless.schema,
},
confirmContactInformation: {
title: 'Contact information',
path: CONTACT_INFO_PATH,
uiSchema: contactInfo.uiSchema,
schema: contactInfo.schema,
},
editMobilePhone: {
title: 'Edit mobile phone',
path: 'edit-mobile-phone',
CustomPage: EditPhone,
CustomPageReview: EditPhone,
depends: () => false, // accessed from contact info page
uiSchema: {},
schema: { type: 'object', properties: {} },
},
editEmailAddress: {
title: 'Edit email address',
path: 'edit-email-address',
CustomPage: EditEmail,
CustomPageReview: EditEmail,
depends: () => false, // accessed from contact info page
uiSchema: {},
schema: { type: 'object', properties: {} },
},
editMailingAddress: {
title: 'Edit mailing address',
path: 'edit-mailing-address',
CustomPage: EditAddress,
CustomPageReview: EditAddress,
depends: () => false, // accessed from contact info page
uiSchema: {},
schema: { type: 'object', properties: {} },
},
},
},
conditions: {
title: 'Issues eligible for review',
pages: {
// v2 - show contested + added issues
contestableIssues: {
title: ' ',
path: CONTESTABLE_ISSUES_PATH,
uiSchema: contestableIssuesPage.uiSchema,
schema: contestableIssuesPage.schema,
appStateSelector,
},
// v2 - add issue. Accessed from contestableIssues page only
addIssue: {
title: 'Add issues for review',
path: ADD_ISSUE_PATH,
depends: () => false,
// showPagePerItem: true,
// arrayPath: 'additionalIssues',
CustomPage: AddIssue,
uiSchema: addIssue.uiSchema,
schema: addIssue.schema,
},
areaOfDisagreementFollowUp: {
title: getIssueTitle,
path: 'area-of-disagreement/:index',
showPagePerItem: true,
arrayPath: 'areaOfDisagreement',
uiSchema: areaOfDisagreementFollowUp.uiSchema,
schema: areaOfDisagreementFollowUp.schema,
appStateSelector,
},
optIn: {
title: 'Opt in',
path: 'opt-in',
uiSchema: optIn.uiSchema,
schema: optIn.schema,
depends: formData => mayHaveLegacyAppeals(formData),
initialData: {
socOptIn: false,
},
},
issueSummary: {
title: 'Issue summary',
path: 'issue-summary',
uiSchema: issueSummary.uiSchema,
schema: issueSummary.schema,
},
},
},
informalConference: {
title: 'Request an informal conference',
pages: {
requestConference: {
path: 'informal-conference',
title: 'Request an informal conference',
uiSchema: informalConference.uiSchema,
schema: informalConference.schema,
},
representativeInfoV2: {
// changing path from v1, but this shouldn't matter since the
// migration code returns the Veteran to the contact info page
path: 'informal-conference/representative-info',
title: 'Representative’s information',
depends: formData => formData?.informalConference === 'rep',
uiSchema: informalConferenceRepV2.uiSchema,
schema: informalConferenceRepV2.schema,
},
conferenceTime: {
path: 'informal-conference/conference-availability',
title: 'Scheduling availability',
depends: formData => formData?.informalConference !== 'no',
uiSchema: informalConferenceTime.uiSchema,
schema: informalConferenceTime.schema,
},
},
},
},
footerContent: FormFooter,
getHelp: GetFormHelp,
};
export default formConfig;