Skip to content

Commit

Permalink
10207 required email changes to prod (#33567)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhasselle-oddball authored Dec 16, 2024
1 parent eb23afa commit 0e27439
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 206 deletions.
Original file line number Diff line number Diff line change
@@ -1,34 +1,15 @@
import {
emailSchema,
emailUI,
emailToSendNotificationsSchema,
emailToSendNotificationsUI,
phoneSchema,
phoneUI,
titleUI,
} from 'platform/forms-system/src/js/web-component-patterns';
import environment from 'platform/utilities/environment';
import {
getPhoneAndEmailPageEmailHint,
getPhoneAndEmailPageTitle,
} from '../helpers';

/** @type {PageSchema} */
const oldPageSchema = {
uiSchema: {
...titleUI(({ formData }) => getPhoneAndEmailPageTitle(formData)),
nonVeteranPhone: phoneUI('Phone number'),
nonVeteranEmailAddress: emailUI(),
},
schema: {
type: 'object',
properties: {
nonVeteranPhone: phoneSchema,
nonVeteranEmailAddress: emailSchema,
},
},
};

/** @type {PageSchema} */
const pageSchema = {
uiSchema: {
Expand All @@ -53,7 +34,4 @@ const pageSchema = {
},
};

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

export default (useNewPageSchema ? pageSchema : oldPageSchema);
export default pageSchema;
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,6 @@ import {
titleUI,
} 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';

/** @type {PageSchema} */
const oldPageSchema = {
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",
),
},
schema: {
type: 'object',
properties: {
pointOfContactName: {
type: 'string',
maxLength: 40,
},
pointOfContactPhone: phoneSchema,
},
},
};

/** @type {PageSchema} */
const pageSchema = {
Expand Down Expand Up @@ -68,7 +40,4 @@ const pageSchema = {
},
};

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

export default (useNewPageSchema ? pageSchema : oldPageSchema);
export default pageSchema;
24 changes: 1 addition & 23 deletions src/applications/simple-forms/20-10207/pages/phoneAndEmail.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
import {
emailSchema,
emailUI,
emailToSendNotificationsSchema,
emailToSendNotificationsUI,
phoneSchema,
phoneUI,
titleUI,
} from 'platform/forms-system/src/js/web-component-patterns';
import environment from 'platform/utilities/environment';

/** @type {PageSchema} */
const oldPageSchema = {
uiSchema: {
...titleUI('Your phone and email address'),
phone: phoneUI('Phone number'),
emailAddress: emailUI(),
},
schema: {
type: 'object',
properties: {
phone: phoneSchema,
emailAddress: emailSchema,
},
},
};

/** @type {PageSchema} */
const pageSchema = {
Expand All @@ -44,7 +25,4 @@ const pageSchema = {
},
};

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

export default (useNewPageSchema ? pageSchema : oldPageSchema);
export default pageSchema;
31 changes: 1 addition & 30 deletions src/applications/simple-forms/20-10207/pages/pointOfContact.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,8 @@ import {
titleUI,
} 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} */
const oldPageSchema = {
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'),
},
schema: {
type: 'object',
properties: {
pointOfContactName: {
type: 'string',
maxLength: 40,
},
pointOfContactPhone: phoneSchema,
},
},
};

/** @type {PageSchema} */
const pageSchema = {
uiSchema: {
Expand Down Expand Up @@ -69,7 +43,4 @@ const pageSchema = {
},
};

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

export default (useNewPageSchema ? pageSchema : oldPageSchema);
export default pageSchema;
Original file line number Diff line number Diff line change
@@ -1,34 +1,15 @@
import {
emailSchema,
emailUI,
emailToSendNotificationsSchema,
emailToSendNotificationsUI,
phoneSchema,
phoneUI,
titleUI,
} from 'platform/forms-system/src/js/web-component-patterns';
import environment from 'platform/utilities/environment';
import {
getPhoneAndEmailPageTitle,
getPhoneAndEmailPageEmailHint,
} from '../helpers';

/** @type {PageSchema} */
const oldPageSchema = {
uiSchema: {
...titleUI(({ formData }) => getPhoneAndEmailPageTitle(formData)),
veteranPhone: phoneUI('Phone number'),
veteranEmailAddress: emailUI(),
},
schema: {
type: 'object',
properties: {
veteranPhone: phoneSchema,
veteranEmailAddress: emailSchema,
},
},
};

/** @type {PageSchema} */
const pageSchema = {
uiSchema: {
Expand All @@ -53,7 +34,4 @@ const pageSchema = {
},
};

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

export default (useNewPageSchema ? pageSchema : oldPageSchema);
export default pageSchema;
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,6 @@ import {
titleUI,
} 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';

/** @type {PageSchema} */
const oldPageSchema = {
uiSchema: {
...titleUI(
"Veteran's point of contact",
'To help us process this request, it helps us to be able to get in touch with the Veteran. Please provide the name and telephone number of someone who can help us locate the Veteran.',
),
pointOfContactName: {
'ui:title': "Name of Veteran's point of contact",
'ui:webComponentField': VaTextInputField,
},
pointOfContactPhone: phoneUI(
"Telephone number of Veteran's point of contact",
),
},
schema: {
type: 'object',
properties: {
pointOfContactName: {
type: 'string',
maxLength: 40,
},
pointOfContactPhone: phoneSchema,
},
},
};

/** @type {PageSchema} */
const pageSchema = {
Expand Down Expand Up @@ -68,7 +40,4 @@ const pageSchema = {
},
};

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

export default (useNewPageSchema ? pageSchema : oldPageSchema);
export default pageSchema;
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import environment from 'platform/utilities/environment';
import {
testNumberOfErrorsOnSubmit,
testNumberOfErrorsOnSubmitForWebComponents,
Expand All @@ -16,12 +15,7 @@ const pageTitle = "Claimant's point of contact";

const data = {};

let expectedNumberOfWebComponentFields = 2;

// test on dev before making this change
if (environment.isDev() || environment.isLocalhost()) {
expectedNumberOfWebComponentFields = 3;
}
const expectedNumberOfWebComponentFields = 3;

testNumberOfWebComponentFields(
formConfig,
Expand All @@ -32,12 +26,7 @@ testNumberOfWebComponentFields(
data,
);

let expectedNumberOfWebComponentErrors = 0;

// test on dev before making this change
if (environment.isDev() || environment.isLocalhost()) {
expectedNumberOfWebComponentErrors = 1;
}
const expectedNumberOfWebComponentErrors = 1;

testNumberOfErrorsOnSubmitForWebComponents(
formConfig,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import environment from 'platform/utilities/environment';
import {
testNumberOfErrorsOnSubmit,
testNumberOfErrorsOnSubmitForWebComponents,
Expand All @@ -16,12 +15,7 @@ const pageTitle = 'Your point of contact';

let data = {};

let expectedNumberOfWebComponentFields = 2;

// test on dev before making this change
if (environment.isDev() || environment.isLocalhost()) {
expectedNumberOfWebComponentFields = 3;
}
const expectedNumberOfWebComponentFields = 3;

testNumberOfWebComponentFields(
formConfig,
Expand All @@ -35,11 +29,6 @@ testNumberOfWebComponentFields(
// veteran with email - point of contact should not be required
let expectedNumberOfWebComponentErrors = 0;

// test on dev before making this change
if (environment.isDev() || environment.isLocalhost()) {
expectedNumberOfWebComponentErrors = 0;
}

data = {
preparerType: 'veteran',
veteranEmailAddress: '[email protected]',
Expand All @@ -55,12 +44,7 @@ testNumberOfErrorsOnSubmitForWebComponents(
);

// veteran without email - point of contact should be required
expectedNumberOfWebComponentErrors = 0;

// test on dev before making this change
if (environment.isDev() || environment.isLocalhost()) {
expectedNumberOfWebComponentErrors = 1;
}
expectedNumberOfWebComponentErrors = 1;

data = {
preparerType: 'veteran',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import environment from 'platform/utilities/environment';
import {
testNumberOfErrorsOnSubmit,
testNumberOfErrorsOnSubmitForWebComponents,
Expand All @@ -16,12 +15,7 @@ const pageTitle = "Veteran's point of contact";

const data = {};

let expectedNumberOfWebComponentFields = 2;

// test on dev before making this change
if (environment.isDev() || environment.isLocalhost()) {
expectedNumberOfWebComponentFields = 3;
}
const expectedNumberOfWebComponentFields = 3;

testNumberOfWebComponentFields(
formConfig,
Expand All @@ -32,12 +26,8 @@ testNumberOfWebComponentFields(
data,
);

let expectedNumberOfWebComponentErrors = 0;
const expectedNumberOfWebComponentErrors = 1;

// test on dev before making this change
if (environment.isDev() || environment.isLocalhost()) {
expectedNumberOfWebComponentErrors = 1;
}
testNumberOfErrorsOnSubmitForWebComponents(
formConfig,
schema,
Expand Down

0 comments on commit 0e27439

Please sign in to comment.