Skip to content

Commit

Permalink
fix: remove contact preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinBuyck committed Nov 19, 2024
1 parent 7284e97 commit 17a2225
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 108 deletions.
1 change: 0 additions & 1 deletion shared-helpers/__tests__/testHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ export const application: Application = {
createdAt: new Date(),
updatedAt: new Date(),
},
contactPreferences: [],
preferredUnitTypes: [],
householdMember: [
{
Expand Down
1 change: 0 additions & 1 deletion shared-helpers/src/utilities/blankApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export const blankApplication = {
additionalPhone: false,
additionalPhoneNumber: "",
additionalPhoneNumberType: "",
contactPreferences: [],
householdSize: 0,
housingStatus: "",
sendMailToMailingAddress: false,
Expand Down
15 changes: 0 additions & 15 deletions shared-helpers/src/utilities/formKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,6 @@ export const countyKeys = [
"Sonoma",
]

export const contactPreferencesKeys = [
{
id: "email",
},
{
id: "phone",
},
{
id: "letter",
},
{
id: "text",
},
]

export const adaFeatureKeys = ["mobility", "vision", "hearing"]

export const relationshipKeys = ["", ...Object.values(HouseholdMemberRelationship)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,6 @@ const DetailsPrimaryApplicant = () => {
>
{application.additionalPhoneNumber || t("t.n/a")}
</FieldValue>

<FieldValue label={t("application.details.preferredContact")} testId="preferredContact">
{(() => {
if (!application.contactPreferences.length) return t("t.n/a")

return application.contactPreferences.map((item) => (
<span key={item}>
{t(`t.${item}`)}
<br />
</span>
))
})()}
</FieldValue>
</Grid.Row>

<SectionWithGrid.HeadingRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ import {
FormAddress,
} from "@bloom-housing/ui-components"
import { Grid } from "@bloom-housing/ui-seeds"
import {
phoneNumberKeys,
contactPreferencesKeys,
stateKeys,
emailRegex,
} from "@bloom-housing/shared-helpers"
import { phoneNumberKeys, stateKeys, emailRegex } from "@bloom-housing/shared-helpers"
import SectionWithGrid from "../../../shared/SectionWithGrid"

const FormPrimaryApplicant = () => {
Expand All @@ -24,11 +19,6 @@ const FormPrimaryApplicant = () => {
// eslint-disable-next-line @typescript-eslint/unbound-method
const { register, watch, errors, control, setValue, clearErrors } = formMethods

const contactPreferencesOptions = contactPreferencesKeys?.map((item) => ({
id: item.id,
label: t(`t.${item.id}`),
}))

const mailingAddressValue: boolean = watch("application.sendMailToMailingAddress")
const phoneValue: string = watch("phoneNumber")
const additionalPhoneValue: string = watch("application.additionalPhoneNumber")
Expand Down Expand Up @@ -164,16 +154,6 @@ const FormPrimaryApplicant = () => {
disabled={!additionalPhoneValue?.length}
/>
</Grid.Cell>

<Grid.Cell>
<FieldGroup
name="application.contactPreferences"
fields={contactPreferencesOptions}
type="checkbox"
register={register}
groupLabel={t("application.contact.preferredContactType")}
/>
</Grid.Cell>
</Grid.Row>

<FormAddress
Expand Down
1 change: 0 additions & 1 deletion sites/partners/src/lib/applications/FormTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export type ApplicationTypes = {
language?: LanguagesEnum
additionalPhoneNumber?: string
additionalPhoneNumberType?: string
contactPreferences?: string[]
acceptedTerms?: YesNoEnum
incomePeriod?: IncomePeriodEnum
incomeVouchers?: string[]
Expand Down
4 changes: 0 additions & 4 deletions sites/partners/src/lib/applications/formatApplicationData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ export const mapFormToApi = ({
additionalPhoneNumberType: additionalPhoneNumberTypeData,
applicationsMailingAddress: mailingAddressData,
additionalPhoneNumber,
contactPreferences,
incomeVouchers,
} = data.application

Expand Down Expand Up @@ -243,7 +242,6 @@ export const mapFormToApi = ({
additionalPhone,
additionalPhoneNumber,
additionalPhoneNumberType,
contactPreferences,
sendMailToMailingAddress,
applicationsMailingAddress,
alternateContact,
Expand Down Expand Up @@ -375,7 +373,6 @@ export const mapApiToForm = (applicationData: ApplicationUpdate, listing: Listin
const application: ApplicationTypes = (() => {
const {
language,
contactPreferences,
sendMailToMailingAddress,
applicationsMailingAddress,
incomePeriod,
Expand Down Expand Up @@ -414,7 +411,6 @@ export const mapApiToForm = (applicationData: ApplicationUpdate, listing: Listin
additionalPhoneNumber,
additionalPhoneNumberType,
preferences,
contactPreferences,
sendMailToMailingAddress,
applicationsMailingAddress,
preferredUnit,
Expand Down
3 changes: 0 additions & 3 deletions sites/public/cypress/mockData/applicationData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const idDefaults = {
updatedAt: new Date(),
}

export const contactPreferencesCheckboxesOrder = ["email", "phone", "letter", "text"]
export const alternateContactTypeRadioOrder = [
"familyMember",
"friend",
Expand Down Expand Up @@ -100,7 +99,6 @@ export const ElmVillageApplication: Application = {
additionalPhone: true,
additionalPhoneNumber: "(555) 555-5555",
additionalPhoneNumberType: "home",
contactPreferences: ["email"],
householdSize: 2,
housingStatus: "",
sendMailToMailingAddress: true,
Expand Down Expand Up @@ -327,7 +325,6 @@ export const minimalDataApplication: Application = {
additionalPhone: false,
additionalPhoneNumber: "",
additionalPhoneNumberType: "",
contactPreferences: ["letter"],
householdSize: 1,
housingStatus: "",
sendMailToMailingAddress: false,
Expand Down
10 changes: 0 additions & 10 deletions sites/public/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import {
applicationStepOrder,
contactPreferencesCheckboxesOrder,
alternateContactTypeRadioOrder,
howDidYouHearCheckboxesOrder,
} from "./../mockData/applicationData"
Expand Down Expand Up @@ -140,11 +139,6 @@ Cypress.Commands.add("step2PrimaryApplicantAddresses", (application) => {
)
}

application.contactPreferences.forEach((contactPreference) => {
const contactPreferenceIndex = contactPreferencesCheckboxesOrder.indexOf(contactPreference)
cy.getByTestId("app-primary-contact-preference").eq(contactPreferenceIndex).check()
})

cy.goNext()
cy.checkErrorAlert("not.exist")
cy.checkErrorMessages("not.exist")
Expand Down Expand Up @@ -474,10 +468,6 @@ Cypress.Commands.add("step18Summary", (application, verify) => {
fieldValue: `${application.applicant.applicantAddress.city}, ${application.applicant.applicantAddress.state} ${application.applicant.applicantAddress.zipCode}`,
},

{
id: "app-summary-contact-preference-type",
fieldValue: application.contactPreferences[0],
},
{
id: "app-summary-preferred-units",
fieldValue: application.preferredUnitTypes
Expand Down
11 changes: 0 additions & 11 deletions sites/public/src/components/shared/FormSummaryDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,17 +265,6 @@ const FormSummaryDetails = ({
<MultiLineAddress address={reformatAddress(application.applicationsMailingAddress)} />
</FieldValue>
)}

{application.contactPreferences && (
<FieldValue
testId={"app-summary-contact-preference-type"}
id="applicantPreferredContactType"
label={t("application.contact.preferredContactType")}
className={styles["summary-value"]}
>
{application.contactPreferences?.map((item) => t(`t.${item}`)).join(", ")}
</FieldValue>
)}
</Card.Section>
{application.alternateContact.type && application.alternateContact.type !== "noContact" && (
<>
Expand Down
28 changes: 0 additions & 28 deletions sites/public/src/pages/applications/contact/address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Alert } from "@bloom-housing/ui-seeds"
import { Field, FieldGroup, Form, PhoneField, Select, t } from "@bloom-housing/ui-components"
import { CardSection } from "@bloom-housing/ui-seeds/src/blocks/Card"
import {
contactPreferencesKeys,
phoneNumberKeys,
stateKeys,
blankApplication,
Expand Down Expand Up @@ -101,13 +100,6 @@ const ApplicationAddress = () => {
const sendMailToMailingAddress = watch("sendMailToMailingAddress")
const clientLoaded = OnClientSide()

const contactPreferencesOptions = contactPreferencesKeys?.map((item) => ({
id: item.id,
label: t(`t.${item.id}`),
defaultChecked: application?.contactPreferences?.includes(item.id) || false,
disabled: disableContactFormOption(item.id, noPhone, application.applicant.noEmail),
}))

useEffect(() => {
pushGtmEvent<PageView>({
event: "pageView",
Expand Down Expand Up @@ -470,26 +462,6 @@ const ApplicationAddress = () => {
</fieldset>
</CardSection>
)}

<CardSection divider={"inset"}>
<fieldset>
<legend
className={`text__caps-spaced ${errors?.contactPreferences ? "text-alert" : ""}`}
>
{t("application.contact.contactPreference")}
</legend>
<FieldGroup
name="contactPreferences"
fields={contactPreferencesOptions}
type="checkbox"
validation={{ required: true }}
error={errors?.contactPreferences}
errorMessage={t("errors.selectAtLeastOne")}
register={register}
dataTestId={"app-primary-contact-preference"}
/>
</fieldset>
</CardSection>
</div>
<CardSection>
{verifyAddress && (
Expand Down

0 comments on commit 17a2225

Please sign in to comment.