Skip to content

Commit

Permalink
required emails 10207 followup (#33490)
Browse files Browse the repository at this point in the history
* required emails 10207 followup
  • Loading branch information
rhasselle-oddball authored Dec 13, 2024
1 parent d30a5d7 commit 494a42e
Show file tree
Hide file tree
Showing 8 changed files with 211 additions and 176 deletions.
5 changes: 4 additions & 1 deletion src/applications/simple-forms/20-10207/containers/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
DowntimeNotification,
externalServices,
} from '@department-of-veterans-affairs/platform-monitoring/DowntimeNotification';
import environment from 'platform/utilities/environment';
import formConfig from '../config/form';
import { WIP } from '../../shared/components/WIP';
import { workInProgressContent } from '../config/constants';
Expand Down Expand Up @@ -49,7 +50,9 @@ App.propTypes = {

const mapStateToProps = state => ({
isLoading: state?.featureToggles?.loading,
showForm: toggleValues(state)[FEATURE_FLAG_NAMES.form2010207] || false,
showForm:
toggleValues(state)[FEATURE_FLAG_NAMES.form2010207] ||
environment.isLocalhost(),
});

export default connect(mapStateToProps)(App);
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import {
} from '../helpers';

/** @type {PageSchema} */
// eslint-disable-next-line import/no-mutable-exports
let pageSchema = {
const oldPageSchema = {
uiSchema: {
...titleUI(({ formData }) => getPhoneAndEmailPageTitle(formData)),
nonVeteranPhone: phoneUI('Phone number'),
Expand All @@ -30,30 +29,31 @@ let pageSchema = {
},
};

// test on dev before making this change
if (environment.isDev() || environment.isLocalhost()) {
pageSchema = {
uiSchema: {
...titleUI(({ formData }) => getPhoneAndEmailPageTitle(formData)),
nonVeteranPhone: phoneUI('Phone number'),
nonVeteranEmailAddress: emailToSendNotificationsUI({
// no living situation risk = has housing = has email
required: formData => formData.livingSituation?.NONE,
updateUiSchema: formData => ({
'ui:options': {
hint: getPhoneAndEmailPageEmailHint(formData),
},
}),
/** @type {PageSchema} */
const pageSchema = {
uiSchema: {
...titleUI(({ formData }) => getPhoneAndEmailPageTitle(formData)),
nonVeteranPhone: phoneUI('Phone number'),
nonVeteranEmailAddress: emailToSendNotificationsUI({
// no living situation risk = has housing = has email
required: formData => formData.livingSituation?.NONE,
updateUiSchema: formData => ({
'ui:options': {
hint: getPhoneAndEmailPageEmailHint(formData),
},
}),
}),
},
schema: {
type: 'object',
properties: {
nonVeteranPhone: phoneSchema,
nonVeteranEmailAddress: emailToSendNotificationsSchema,
},
schema: {
type: 'object',
properties: {
nonVeteranPhone: phoneSchema,
nonVeteranEmailAddress: emailToSendNotificationsSchema,
},
},
};
}
},
};

// test on dev before making this change
const useNewPageSchema = environment.isDev() || environment.isLocalhost();

export default pageSchema;
export default (useNewPageSchema ? pageSchema : oldPageSchema);
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import VaTextInputField from 'platform/forms-system/src/js/web-component-fields/
import environment from 'platform/utilities/environment';

/** @type {PageSchema} */
// eslint-disable-next-line import/no-mutable-exports
let pageSchema = {
const oldPageSchema = {
uiSchema: {
...titleUI(
"Claimant's point of contact",
Expand All @@ -36,39 +35,40 @@ let pageSchema = {
},
};

// test on dev before making this change
if (environment.isDev() || environment.isLocalhost()) {
pageSchema = {
uiSchema: {
...titleUI(
'Claimant’s point of contact',
'To help us process this request, it helps us to be able to get in touch with the claimant. Please provide the name and telephone number of someone who can help us locate the claimant.',
),
pointOfContactName: {
'ui:title': 'Name of claimant’s point of contact',
'ui:webComponentField': VaTextInputField,
},
pointOfContactPhone: phoneUI(
'Telephone number of claimant’s point of contact',
),
pointOfContactEmail: emailToSendNotificationsUI({
hint:
'We’ll use this email to send the claimant’s point of contact notifications about your form submission',
required: formData => !formData.nonVeteranEmailAddress,
}),
/** @type {PageSchema} */
const pageSchema = {
uiSchema: {
...titleUI(
'Claimant’s point of contact',
'To help us process this request, it helps us to be able to get in touch with the claimant. Please provide the name and telephone number of someone who can help us locate the claimant.',
),
pointOfContactName: {
'ui:title': 'Name of claimant’s point of contact',
'ui:webComponentField': VaTextInputField,
},
schema: {
type: 'object',
properties: {
pointOfContactName: {
type: 'string',
maxLength: 40,
},
pointOfContactPhone: phoneSchema,
pointOfContactEmail: emailToSendNotificationsSchema,
pointOfContactPhone: phoneUI(
'Telephone number of claimant’s point of contact',
),
pointOfContactEmail: emailToSendNotificationsUI({
hint:
'We’ll use this email to send the claimant’s point of contact notifications about your form submission',
required: formData => !formData.nonVeteranEmailAddress,
}),
},
schema: {
type: 'object',
properties: {
pointOfContactName: {
type: 'string',
maxLength: 40,
},
pointOfContactPhone: phoneSchema,
pointOfContactEmail: emailToSendNotificationsSchema,
},
};
}
},
};

// test on dev before making this change
const useNewPageSchema = environment.isDev() || environment.isLocalhost();

export default pageSchema;
export default (useNewPageSchema ? pageSchema : oldPageSchema);
44 changes: 22 additions & 22 deletions src/applications/simple-forms/20-10207/pages/phoneAndEmail.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import {
import environment from 'platform/utilities/environment';

/** @type {PageSchema} */
// eslint-disable-next-line import/no-mutable-exports
let pageSchema = {
const oldPageSchema = {
uiSchema: {
...titleUI('Your phone and email address'),
phone: phoneUI('Phone number'),
Expand All @@ -26,25 +25,26 @@ let pageSchema = {
},
};

// test on dev before making this change
if (environment.isDev() || environment.isLocalhost()) {
pageSchema = {
uiSchema: {
...titleUI('Your phone and email address'),
phone: phoneUI('Phone number'),
emailAddress: emailToSendNotificationsUI({
// no living situation risk = has housing = has email
required: formData => formData.livingSituation?.NONE,
}),
},
schema: {
type: 'object',
properties: {
phone: phoneSchema,
emailAddress: emailToSendNotificationsSchema,
},
/** @type {PageSchema} */
const pageSchema = {
uiSchema: {
...titleUI('Your phone and email address'),
phone: phoneUI('Phone number'),
emailAddress: emailToSendNotificationsUI({
// no living situation risk = has housing = has email
required: formData => formData.livingSituation?.NONE,
}),
},
schema: {
type: 'object',
properties: {
phone: phoneSchema,
emailAddress: emailToSendNotificationsSchema,
},
};
}
},
};

// test on dev before making this change
const useNewPageSchema = environment.isDev() || environment.isLocalhost();

export default pageSchema;
export default (useNewPageSchema ? pageSchema : oldPageSchema);
69 changes: 37 additions & 32 deletions src/applications/simple-forms/20-10207/pages/pointOfContact.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import {
} from 'platform/forms-system/src/js/web-component-patterns';
import VaTextInputField from 'platform/forms-system/src/js/web-component-fields/VaTextInputField';
import environment from 'platform/utilities/environment';
import { PREPARER_TYPES } from '../config/constants';

/** @type {PageSchema} */
// eslint-disable-next-line import/no-mutable-exports
let pageSchema = {
const oldPageSchema = {
uiSchema: {
...titleUI(
'Your point of contact',
Expand All @@ -34,37 +34,42 @@ let pageSchema = {
},
};

// test on dev before making this change
if (environment.isDev() || environment.isLocalhost()) {
pageSchema = {
uiSchema: {
...titleUI(
'Your point of contact',
'To help us process your request, it helps us to be able to get in touch with you. Please provide the name and telephone number of someone who can help us locate you.',
),
pointOfContactName: {
'ui:title': 'Name of your point of contact',
'ui:webComponentField': VaTextInputField,
},
pointOfContactPhone: phoneUI('Telephone number of your point of contact'),
pointOfContactEmail: emailToSendNotificationsUI({
hint:
'We’ll use this email to send your point of contact notifications about your form submission',
required: formData => !formData.emailAddress,
}),
/** @type {PageSchema} */
const pageSchema = {
uiSchema: {
...titleUI(
'Your point of contact',
'To help us process your request, it helps us to be able to get in touch with you. Please provide the name and telephone number of someone who can help us locate you.',
),
pointOfContactName: {
'ui:title': 'Name of your point of contact',
'ui:webComponentField': VaTextInputField,
},
schema: {
type: 'object',
properties: {
pointOfContactName: {
type: 'string',
maxLength: 40,
},
pointOfContactPhone: phoneSchema,
pointOfContactEmail: emailToSendNotificationsSchema,
pointOfContactPhone: phoneUI('Telephone number of your point of contact'),
pointOfContactEmail: emailToSendNotificationsUI({
hint:
'We’ll use this email to send your point of contact notifications about your form submission',
required: formData =>
(formData.preparerType === PREPARER_TYPES.VETERAN &&
!formData.veteranEmailAddress) ||
(formData.preparerType === PREPARER_TYPES.NON_VETERAN &&
!formData.nonVeteranEmailAddress),
}),
},
schema: {
type: 'object',
properties: {
pointOfContactName: {
type: 'string',
maxLength: 40,
},
pointOfContactPhone: phoneSchema,
pointOfContactEmail: emailToSendNotificationsSchema,
},
};
}
},
};

// test on dev before making this change
const useNewPageSchema = environment.isDev() || environment.isLocalhost();

export default pageSchema;
export default (useNewPageSchema ? pageSchema : oldPageSchema);
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import {
} from '../helpers';

/** @type {PageSchema} */
// eslint-disable-next-line import/no-mutable-exports
let pageSchema = {
const oldPageSchema = {
uiSchema: {
...titleUI(({ formData }) => getPhoneAndEmailPageTitle(formData)),
veteranPhone: phoneUI('Phone number'),
Expand All @@ -30,30 +29,31 @@ let pageSchema = {
},
};

// test on dev before making this change
if (environment.isDev() || environment.isLocalhost()) {
pageSchema = {
uiSchema: {
...titleUI(({ formData }) => getPhoneAndEmailPageTitle(formData)),
veteranPhone: phoneUI('Phone number'),
veteranEmailAddress: emailToSendNotificationsUI({
// no living situation risk = has housing = has email
required: formData => formData.livingSituation?.NONE,
updateUiSchema: formData => ({
'ui:options': {
hint: getPhoneAndEmailPageEmailHint(formData),
},
}),
/** @type {PageSchema} */
const pageSchema = {
uiSchema: {
...titleUI(({ formData }) => getPhoneAndEmailPageTitle(formData)),
veteranPhone: phoneUI('Phone number'),
veteranEmailAddress: emailToSendNotificationsUI({
// no living situation risk = has housing = has email
required: formData => formData.livingSituation?.NONE,
updateUiSchema: formData => ({
'ui:options': {
hint: getPhoneAndEmailPageEmailHint(formData),
},
}),
}),
},
schema: {
type: 'object',
properties: {
veteranPhone: phoneSchema,
veteranEmailAddress: emailToSendNotificationsSchema,
},
schema: {
type: 'object',
properties: {
veteranPhone: phoneSchema,
veteranEmailAddress: emailToSendNotificationsSchema,
},
},
};
}
},
};

// test on dev before making this change
const useNewPageSchema = environment.isDev() || environment.isLocalhost();

export default pageSchema;
export default (useNewPageSchema ? pageSchema : oldPageSchema);
Loading

0 comments on commit 494a42e

Please sign in to comment.