diff --git a/src/components/Constants/LoadConstantsMock.ts b/src/components/Constants/LoadConstantsMock.ts index b7d76acb7..bb1b6f4b4 100644 --- a/src/components/Constants/LoadConstantsMock.ts +++ b/src/components/Constants/LoadConstantsMock.ts @@ -1,4 +1,12 @@ import { MockedResponse } from '@apollo/client/testing'; +import { + ActivityTypeEnum, + DisplayResultEnum, + PhaseEnum, + PledgeFrequencyEnum, + ResultEnum, + StatusEnum, +} from 'src/graphql/types.generated'; import { LoadConstantsDocument, LoadConstantsQuery, @@ -15,199 +23,198 @@ const LoadConstantsMock = (): MockedResponse => { }; }; -export const loadConstantsMockData = { +export const loadConstantsMockData: LoadConstantsQuery = { constant: { - __typename: 'Constant', status: [ { - id: 'NEVER_CONTACTED', + id: StatusEnum.NeverContacted, value: 'New Connection', }, { - id: 'ASK_IN_FUTURE', + id: StatusEnum.AskInFuture, value: 'Ask in Future', }, { - id: 'CULTIVATE_RELATIONSHIP', + id: StatusEnum.CultivateRelationship, value: 'Cultivate Relationship', }, { - id: 'CONTACT_FOR_APPOINTMENT', + id: StatusEnum.ContactForAppointment, value: 'Initiate for Appointment', }, { - id: 'APPOINTMENT_SCHEDULED', + id: StatusEnum.AppointmentScheduled, value: 'Appointment Scheduled', }, { - id: 'CALL_FOR_DECISION', + id: StatusEnum.CallForDecision, value: 'Follow Up for Decision', }, { - id: 'PARTNER_FINANCIAL', + id: StatusEnum.PartnerFinancial, value: 'Partner - Financial', }, { - id: 'PARTNER_SPECIAL', + id: StatusEnum.PartnerSpecial, value: 'Partner - Special', }, { - id: 'PARTNER_PRAY', + id: StatusEnum.PartnerPray, value: 'Partner - Pray', }, { - id: 'NOT_INTERESTED', + id: StatusEnum.NotInterested, value: 'Not Interested', }, { - id: 'UNRESPONSIVE', + id: StatusEnum.Unresponsive, value: 'Unresponsive', }, { - id: 'NEVER_ASK', + id: StatusEnum.NeverAsk, value: 'Never Ask', }, { - id: 'RESEARCH_ABANDONED', + id: StatusEnum.ResearchAbandoned, value: 'Research Abandoned', }, { - id: 'EXPIRED_REFERRAL', + id: StatusEnum.ExpiredReferral, value: 'Expired Connection', }, { - id: 'RESEARCH_CONTACT_INFO', + id: StatusEnum.ResearchContactInfo, value: 'Research Contact Info', }, ], activities: [ { - id: 'INITIATION_PHONE_CALL', + id: ActivityTypeEnum.InitiationPhoneCall, name: 'Phone call to initiate appointment', value: 'Initiation - Phone Call', }, { - id: 'INITIATION_EMAIL', + id: ActivityTypeEnum.InitiationEmail, name: 'Email to initiate', value: 'Initiation - Email', }, { - id: 'INITIATION_TEXT_MESSAGE', + id: ActivityTypeEnum.InitiationTextMessage, name: 'Text message to initiate', value: 'Initiation - Text Message', }, { - id: 'INITIATION_SOCIAL_MEDIA', + id: ActivityTypeEnum.InitiationSocialMedia, name: 'Social media message to initiate', value: 'Initiation - Social Media', }, { - id: 'INITIATION_LETTER', + id: ActivityTypeEnum.InitiationLetter, name: 'Letter to initiate', value: 'Initiation - Letter', }, { - id: 'INITIATION_SPECIAL_GIFT_APPEAL', + id: ActivityTypeEnum.InitiationSpecialGiftAppeal, name: 'Special gift appeal', value: 'Initiation - Special Gift Appeal', }, { - id: 'INITIATION_IN_PERSON', + id: ActivityTypeEnum.InitiationInPerson, name: 'Initiate in person', value: 'Initiation - In Person', }, { - id: 'APPOINTMENT_IN_PERSON', + id: ActivityTypeEnum.AppointmentInPerson, name: 'In person appointment', value: 'Appointment - In Person', }, { - id: 'APPOINTMENT_PHONE_CALL', + id: ActivityTypeEnum.AppointmentPhoneCall, name: 'phone appointment', value: 'Appointment - Phone Call', }, { - id: 'APPOINTMENT_VIDEO_CALL', + id: ActivityTypeEnum.AppointmentVideoCall, name: 'video appointment', value: 'Appointment - Video Call', }, { - id: 'FOLLOW_UP_PHONE_CALL', + id: ActivityTypeEnum.FollowUpPhoneCall, name: 'phone call to follow up', value: 'Follow Up - Phone Call', }, { - id: 'FOLLOW_UP_EMAIL', + id: ActivityTypeEnum.FollowUpEmail, name: 'email to follow up', value: 'Follow Up - Email', }, { - id: 'FOLLOW_UP_TEXT_MESSAGE', + id: ActivityTypeEnum.FollowUpTextMessage, name: 'text message to follow up', value: 'Follow Up - Text Message', }, { - id: 'FOLLOW_UP_SOCIAL_MEDIA', + id: ActivityTypeEnum.FollowUpSocialMedia, name: 'social media message to follow up', value: 'Follow Up - Social Media', }, { - id: 'FOLLOW_UP_IN_PERSON', + id: ActivityTypeEnum.FollowUpInPerson, name: 'follow up in person', value: 'Follow Up - In Person', }, { - id: 'PARTNER_CARE_PHONE_CALL', + id: ActivityTypeEnum.PartnerCarePhoneCall, name: 'call partner for cultivation', value: 'Partner Care - Phone Call', }, { - id: 'PARTNER_CARE_EMAIL', + id: ActivityTypeEnum.PartnerCareEmail, name: 'email partner for cultivation', value: 'Partner Care - Email', }, { - id: 'PARTNER_CARE_TEXT_MESSAGE', + id: ActivityTypeEnum.PartnerCareTextMessage, name: 'text message partner for cultivation', value: 'Partner Care - Text Message', }, { - id: 'PARTNER_CARE_SOCIAL_MEDIA', + id: ActivityTypeEnum.PartnerCareSocialMedia, name: 'social media message for cultivation', value: 'Partner Care - Social Media', }, { - id: 'PARTNER_CARE_IN_PERSON', + id: ActivityTypeEnum.PartnerCareInPerson, name: 'connect in person for cultivation', value: 'Partner Care - In Person', }, { - id: 'PARTNER_CARE_THANK', + id: ActivityTypeEnum.PartnerCareThank, name: 'send thank you note', value: 'Partner Care - Thank', }, { - id: 'PARTNER_CARE_DIGITAL_NEWSLETTER', + id: ActivityTypeEnum.PartnerCareDigitalNewsletter, name: 'send digital newsletter', value: 'Partner Care - Digital Newsletter', }, { - id: 'PARTNER_CARE_PHYSICAL_NEWSLETTER', + id: ActivityTypeEnum.PartnerCarePhysicalNewsletter, name: 'send physical newsletter', value: 'Partner Care - Physical Newsletter', }, { - id: 'PARTNER_CARE_PRAYER_REQUEST', + id: ActivityTypeEnum.PartnerCarePrayerRequest, name: 'ask for or receive prayer request', value: 'Partner Care - Prayer Request', }, { - id: 'PARTNER_CARE_UPDATE_INFORMATION', + id: ActivityTypeEnum.PartnerCareUpdateInformation, name: 'update partner information', value: 'Partner Care - Update Information', }, { - id: 'PARTNER_CARE_TO_DO', + id: ActivityTypeEnum.PartnerCareToDo, name: '', value: 'Partner Care - To Do', }, @@ -216,12 +223,12 @@ export const loadConstantsMockData = { phases: [ { contactStatuses: [ - 'NEVER_CONTACTED', - 'ASK_IN_FUTURE', - 'RESEARCH_CONTACT_INFO', - 'CULTIVATE_RELATIONSHIP', + StatusEnum.NeverContacted, + StatusEnum.AskInFuture, + StatusEnum.ResearchContactInfo, + StatusEnum.CultivateRelationship, ], - id: 'CONNECTION', + id: PhaseEnum.Connection, name: 'Connection', results: { resultOptions: [], @@ -230,317 +237,317 @@ export const loadConstantsMockData = { tasks: [], }, { - contactStatuses: ['CONTACT_FOR_APPOINTMENT'], - id: 'INITIATION', + contactStatuses: [StatusEnum.ContactForAppointment], + id: PhaseEnum.Initiation, name: 'Initiation', results: { resultOptions: [ { dbResult: [ { - result: 'ATTEMPTED', - task: 'INITIATION_PHONE_CALL', + result: ResultEnum.Attempted, + task: ActivityTypeEnum.InitiationPhoneCall, }, { - result: 'COMPLETED', - task: 'INITIATION_EMAIL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.InitiationEmail, }, { - result: 'COMPLETED', - task: 'INITIATION_TEXT_MESSAGE', + result: ResultEnum.Completed, + task: ActivityTypeEnum.InitiationTextMessage, }, { - result: 'COMPLETED', - task: 'INITIATION_SOCIAL_MEDIA', + result: ResultEnum.Completed, + task: ActivityTypeEnum.InitiationSocialMedia, }, { - result: 'COMPLETED', - task: 'INITIATION_LETTER', + result: ResultEnum.Completed, + task: ActivityTypeEnum.InitiationLetter, }, { - result: 'COMPLETED', - task: 'INITIATION_SPECIAL_GIFT_APPEAL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.InitiationSpecialGiftAppeal, }, { - result: 'COMPLETED', - task: 'INITIATION_IN_PERSON', + result: ResultEnum.Completed, + task: ActivityTypeEnum.InitiationInPerson, }, ], - name: 'INITIATION_RESULT_NO_RESPONSE', + name: DisplayResultEnum.InitiationResultNoResponse, suggestedContactStatus: null, suggestedNextActions: [ - 'INITIATION_PHONE_CALL', - 'INITIATION_EMAIL', - 'INITIATION_TEXT_MESSAGE', - 'INITIATION_SOCIAL_MEDIA', - 'INITIATION_LETTER', - 'INITIATION_SPECIAL_GIFT_APPEAL', - 'INITIATION_IN_PERSON', + ActivityTypeEnum.InitiationPhoneCall, + ActivityTypeEnum.InitiationEmail, + ActivityTypeEnum.InitiationTextMessage, + ActivityTypeEnum.InitiationSocialMedia, + ActivityTypeEnum.InitiationLetter, + ActivityTypeEnum.InitiationSpecialGiftAppeal, + ActivityTypeEnum.InitiationInPerson, ], }, { dbResult: [ { - result: 'COMPLETED', - task: 'INITIATION_PHONE_CALL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.InitiationPhoneCall, }, { - result: 'RECEIVED', - task: 'INITIATION_EMAIL', + result: ResultEnum.Received, + task: ActivityTypeEnum.InitiationEmail, }, { - result: 'RECEIVED', - task: 'INITIATION_TEXT_MESSAGE', + result: ResultEnum.Received, + task: ActivityTypeEnum.InitiationTextMessage, }, { - result: 'RECEIVED', - task: 'INITIATION_SOCIAL_MEDIA', + result: ResultEnum.Received, + task: ActivityTypeEnum.InitiationSocialMedia, }, { - result: 'RECEIVED', - task: 'INITIATION_LETTER', + result: ResultEnum.Received, + task: ActivityTypeEnum.InitiationLetter, }, { - result: 'RECEIVED', - task: 'INITIATION_SPECIAL_GIFT_APPEAL', + result: ResultEnum.Received, + task: ActivityTypeEnum.InitiationSpecialGiftAppeal, }, { - result: 'COMPLETED', - task: 'INITIATION_IN_PERSON', + result: ResultEnum.Completed, + task: ActivityTypeEnum.InitiationInPerson, }, ], - name: 'INITIATION_RESULT_CIRCLE_BACK', + name: DisplayResultEnum.InitiationResultCircleBack, suggestedContactStatus: null, suggestedNextActions: [ - 'INITIATION_PHONE_CALL', - 'INITIATION_EMAIL', - 'INITIATION_TEXT_MESSAGE', - 'INITIATION_SOCIAL_MEDIA', - 'INITIATION_LETTER', - 'INITIATION_SPECIAL_GIFT_APPEAL', - 'INITIATION_IN_PERSON', + ActivityTypeEnum.InitiationPhoneCall, + ActivityTypeEnum.InitiationEmail, + ActivityTypeEnum.InitiationTextMessage, + ActivityTypeEnum.InitiationSocialMedia, + ActivityTypeEnum.InitiationLetter, + ActivityTypeEnum.InitiationSpecialGiftAppeal, + ActivityTypeEnum.InitiationInPerson, ], }, { dbResult: [ { - result: 'COMPLETED', - task: 'INITIATION_PHONE_CALL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.InitiationPhoneCall, }, { - result: 'COMPLETED', - task: 'INITIATION_EMAIL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.InitiationEmail, }, { - result: 'COMPLETED', - task: 'INITIATION_TEXT_MESSAGE', + result: ResultEnum.Completed, + task: ActivityTypeEnum.InitiationTextMessage, }, { - result: 'COMPLETED', - task: 'INITIATION_SOCIAL_MEDIA', + result: ResultEnum.Completed, + task: ActivityTypeEnum.InitiationSocialMedia, }, { - result: 'COMPLETED', - task: 'INITIATION_LETTER', + result: ResultEnum.Completed, + task: ActivityTypeEnum.InitiationLetter, }, { - result: 'COMPLETED', - task: 'INITIATION_SPECIAL_GIFT_APPEAL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.InitiationSpecialGiftAppeal, }, { - result: 'COMPLETED', - task: 'INITIATION_IN_PERSON', + result: ResultEnum.Completed, + task: ActivityTypeEnum.InitiationInPerson, }, ], - name: 'INITIATION_RESULT_APPOINTMENT_SCHEDULED', - suggestedContactStatus: 'APPOINTMENT_SCHEDULED', + name: DisplayResultEnum.InitiationResultAppointmentScheduled, + suggestedContactStatus: StatusEnum.AppointmentScheduled, suggestedNextActions: [ - 'APPOINTMENT_IN_PERSON', - 'APPOINTMENT_PHONE_CALL', - 'APPOINTMENT_VIDEO_CALL', + ActivityTypeEnum.AppointmentInPerson, + ActivityTypeEnum.AppointmentPhoneCall, + ActivityTypeEnum.AppointmentVideoCall, ], }, { dbResult: [ { - result: 'COMPLETED', - task: 'INITIATION_PHONE_CALL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.InitiationPhoneCall, }, { - result: 'RECEIVED', - task: 'INITIATION_EMAIL', + result: ResultEnum.Received, + task: ActivityTypeEnum.InitiationEmail, }, { - result: 'RECEIVED', - task: 'INITIATION_TEXT_MESSAGE', + result: ResultEnum.Received, + task: ActivityTypeEnum.InitiationTextMessage, }, { - result: 'RECEIVED', - task: 'INITIATION_SOCIAL_MEDIA', + result: ResultEnum.Received, + task: ActivityTypeEnum.InitiationSocialMedia, }, { - result: 'RECEIVED', - task: 'INITIATION_LETTER', + result: ResultEnum.Received, + task: ActivityTypeEnum.InitiationLetter, }, { - result: 'RECEIVED', - task: 'INITIATION_SPECIAL_GIFT_APPEAL', + result: ResultEnum.Received, + task: ActivityTypeEnum.InitiationSpecialGiftAppeal, }, { - result: 'COMPLETED', - task: 'INITIATION_IN_PERSON', + result: ResultEnum.Completed, + task: ActivityTypeEnum.InitiationInPerson, }, ], - name: 'INITIATION_RESULT_NOT_INTERESTED', - suggestedContactStatus: 'NOT_INTERESTED', - suggestedNextActions: null, + name: DisplayResultEnum.InitiationResultNotInterested, + suggestedContactStatus: StatusEnum.NotInterested, + suggestedNextActions: [], }, ], tags: null, }, tasks: [ - 'INITIATION_PHONE_CALL', - 'INITIATION_EMAIL', - 'INITIATION_TEXT_MESSAGE', - 'INITIATION_SOCIAL_MEDIA', - 'INITIATION_LETTER', - 'INITIATION_SPECIAL_GIFT_APPEAL', - 'INITIATION_IN_PERSON', + ActivityTypeEnum.InitiationPhoneCall, + ActivityTypeEnum.InitiationEmail, + ActivityTypeEnum.InitiationTextMessage, + ActivityTypeEnum.InitiationSocialMedia, + ActivityTypeEnum.InitiationLetter, + ActivityTypeEnum.InitiationSpecialGiftAppeal, + ActivityTypeEnum.InitiationInPerson, ], }, { - contactStatuses: ['APPOINTMENT_SCHEDULED'], - id: 'APPOINTMENT', + contactStatuses: [StatusEnum.AppointmentScheduled], + id: PhaseEnum.Appointment, name: 'Appointment', results: { resultOptions: [ { dbResult: [ { - result: 'ATTEMPTED', - task: 'APPOINTMENT_IN_PERSON', + result: ResultEnum.Attempted, + task: ActivityTypeEnum.AppointmentInPerson, }, { - result: 'ATTEMPTED', - task: 'APPOINTMENT_VIDEO_CALL', + result: ResultEnum.Attempted, + task: ActivityTypeEnum.AppointmentVideoCall, }, { - result: 'ATTEMPTED', - task: 'APPOINTMENT_PHONE_CALL', + result: ResultEnum.Attempted, + task: ActivityTypeEnum.AppointmentPhoneCall, }, ], - name: 'APPOINTMENT_RESULT_CANCELLED', - suggestedContactStatus: 'CONTACT_FOR_APPOINTMENT', + name: DisplayResultEnum.AppointmentResultCancelled, + suggestedContactStatus: StatusEnum.ContactForAppointment, suggestedNextActions: [ - 'INITIATION_PHONE_CALL', - 'INITIATION_EMAIL', - 'INITIATION_TEXT_MESSAGE', - 'INITIATION_SOCIAL_MEDIA', - 'INITIATION_LETTER', - 'INITIATION_SPECIAL_GIFT_APPEAL', - 'INITIATION_IN_PERSON', + ActivityTypeEnum.InitiationPhoneCall, + ActivityTypeEnum.InitiationEmail, + ActivityTypeEnum.InitiationTextMessage, + ActivityTypeEnum.InitiationSocialMedia, + ActivityTypeEnum.InitiationLetter, + ActivityTypeEnum.InitiationSpecialGiftAppeal, + ActivityTypeEnum.InitiationInPerson, ], }, { dbResult: [ { - result: 'COMPLETED', - task: 'APPOINTMENT_IN_PERSON', + result: ResultEnum.Completed, + task: ActivityTypeEnum.AppointmentInPerson, }, { - result: 'COMPLETED', - task: 'APPOINTMENT_VIDEO_CALL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.AppointmentVideoCall, }, { - result: 'COMPLETED', - task: 'APPOINTMENT_PHONE_CALL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.AppointmentPhoneCall, }, ], - name: 'APPOINTMENT_RESULT_FOLLOW_UP', - suggestedContactStatus: 'CALL_FOR_DECISION', + name: DisplayResultEnum.AppointmentResultFollowUp, + suggestedContactStatus: StatusEnum.CallForDecision, suggestedNextActions: [ - 'FOLLOW_UP_PHONE_CALL', - 'FOLLOW_UP_EMAIL', - 'FOLLOW_UP_TEXT_MESSAGE', - 'FOLLOW_UP_SOCIAL_MEDIA', - 'FOLLOW_UP_IN_PERSON', + ActivityTypeEnum.FollowUpPhoneCall, + ActivityTypeEnum.FollowUpEmail, + ActivityTypeEnum.FollowUpTextMessage, + ActivityTypeEnum.FollowUpSocialMedia, + ActivityTypeEnum.FollowUpInPerson, ], }, { dbResult: [ { - result: 'COMPLETED', - task: 'APPOINTMENT_IN_PERSON', + result: ResultEnum.Completed, + task: ActivityTypeEnum.AppointmentInPerson, }, { - result: 'COMPLETED', - task: 'APPOINTMENT_VIDEO_CALL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.AppointmentVideoCall, }, { - result: 'COMPLETED', - task: 'APPOINTMENT_PHONE_CALL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.AppointmentPhoneCall, }, ], - name: 'FOLLOW_UP_RESULT_PARTNER_FINANCIAL', - suggestedContactStatus: 'PARTNER_FINANCIAL', - suggestedNextActions: ['PARTNER_CARE_THANK'], + name: DisplayResultEnum.FollowUpResultPartnerFinancial, + suggestedContactStatus: StatusEnum.PartnerFinancial, + suggestedNextActions: [ActivityTypeEnum.PartnerCareThank], }, { dbResult: [ { - result: 'COMPLETED', - task: 'APPOINTMENT_IN_PERSON', + result: ResultEnum.Completed, + task: ActivityTypeEnum.AppointmentInPerson, }, { - result: 'COMPLETED', - task: 'APPOINTMENT_VIDEO_CALL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.AppointmentVideoCall, }, { - result: 'COMPLETED', - task: 'APPOINTMENT_PHONE_CALL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.AppointmentPhoneCall, }, ], - name: 'FOLLOW_UP_RESULT_PARTNER_SPECIAL', - suggestedContactStatus: 'PARTNER_SPECIAL', - suggestedNextActions: ['PARTNER_CARE_THANK'], + name: DisplayResultEnum.FollowUpResultPartnerSpecial, + suggestedContactStatus: StatusEnum.PartnerSpecial, + suggestedNextActions: [ActivityTypeEnum.PartnerCareThank], }, { dbResult: [ { - result: 'COMPLETED', - task: 'APPOINTMENT_IN_PERSON', + result: ResultEnum.Completed, + task: ActivityTypeEnum.AppointmentInPerson, }, { - result: 'COMPLETED', - task: 'APPOINTMENT_VIDEO_CALL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.AppointmentVideoCall, }, { - result: 'COMPLETED', - task: 'APPOINTMENT_PHONE_CALL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.AppointmentPhoneCall, }, ], - name: 'FOLLOW_UP_RESULT_PARTNER_PRAY', - suggestedContactStatus: 'PARTNER_PRAY', - suggestedNextActions: ['PARTNER_CARE_THANK'], + name: DisplayResultEnum.FollowUpResultPartnerPray, + suggestedContactStatus: StatusEnum.PartnerPray, + suggestedNextActions: [ActivityTypeEnum.PartnerCareThank], }, { dbResult: [ { - result: 'COMPLETED', - task: 'APPOINTMENT_IN_PERSON', + result: ResultEnum.Completed, + task: ActivityTypeEnum.AppointmentInPerson, }, { - result: 'COMPLETED', - task: 'APPOINTMENT_VIDEO_CALL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.AppointmentVideoCall, }, { - result: 'COMPLETED', - task: 'APPOINTMENT_PHONE_CALL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.AppointmentPhoneCall, }, ], - name: 'FOLLOW_UP_RESULT_NOT_INTERESTED', - suggestedContactStatus: 'NOT_INTERESTED', - suggestedNextActions: null, + name: DisplayResultEnum.FollowUpResultNotInterested, + suggestedContactStatus: StatusEnum.NotInterested, + suggestedNextActions: [], }, ], tags: [ @@ -563,157 +570,157 @@ export const loadConstantsMockData = { ], }, tasks: [ - 'APPOINTMENT_IN_PERSON', - 'APPOINTMENT_PHONE_CALL', - 'APPOINTMENT_VIDEO_CALL', + ActivityTypeEnum.AppointmentInPerson, + ActivityTypeEnum.AppointmentPhoneCall, + ActivityTypeEnum.AppointmentVideoCall, ], }, { - contactStatuses: ['CALL_FOR_DECISION'], - id: 'FOLLOW_UP', + contactStatuses: [StatusEnum.CallForDecision], + id: PhaseEnum.FollowUp, name: 'Follow Up', results: { resultOptions: [ { dbResult: [ { - result: 'ATTEMPTED', - task: 'FOLLOW_UP_PHONE_CALL', + result: ResultEnum.Attempted, + task: ActivityTypeEnum.FollowUpPhoneCall, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_EMAIL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpEmail, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_TEXT_MESSAGE', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpTextMessage, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_SOCIAL_MEDIA', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpSocialMedia, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_IN_PERSON', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpInPerson, }, ], - name: 'INITIATION_RESULT_NO_RESPONSE', + name: DisplayResultEnum.InitiationResultNoResponse, suggestedContactStatus: null, suggestedNextActions: [ - 'FOLLOW_UP_PHONE_CALL', - 'FOLLOW_UP_EMAIL', - 'FOLLOW_UP_TEXT_MESSAGE', - 'FOLLOW_UP_SOCIAL_MEDIA', - 'FOLLOW_UP_IN_PERSON', + ActivityTypeEnum.FollowUpPhoneCall, + ActivityTypeEnum.FollowUpEmail, + ActivityTypeEnum.FollowUpTextMessage, + ActivityTypeEnum.FollowUpSocialMedia, + ActivityTypeEnum.FollowUpInPerson, ], }, { dbResult: [ { - result: 'COMPLETED', - task: 'FOLLOW_UP_PHONE_CALL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpPhoneCall, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_EMAIL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpEmail, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_TEXT_MESSAGE', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpTextMessage, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_SOCIAL_MEDIA', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpSocialMedia, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_IN_PERSON', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpInPerson, }, ], - name: 'FOLLOW_UP_RESULT_PARTNER_FINANCIAL', - suggestedContactStatus: 'PARTNER_FINANCIAL', - suggestedNextActions: ['PARTNER_CARE_THANK'], + name: DisplayResultEnum.FollowUpResultPartnerFinancial, + suggestedContactStatus: StatusEnum.PartnerFinancial, + suggestedNextActions: [ActivityTypeEnum.PartnerCareThank], }, { dbResult: [ { - result: 'COMPLETED', - task: 'FOLLOW_UP_PHONE_CALL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpPhoneCall, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_EMAIL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpEmail, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_TEXT_MESSAGE', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpTextMessage, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_SOCIAL_MEDIA', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpSocialMedia, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_IN_PERSON', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpInPerson, }, ], - name: 'FOLLOW_UP_RESULT_PARTNER_SPECIAL', - suggestedContactStatus: 'PARTNER_SPECIAL', - suggestedNextActions: ['PARTNER_CARE_THANK'], + name: DisplayResultEnum.FollowUpResultPartnerSpecial, + suggestedContactStatus: StatusEnum.PartnerSpecial, + suggestedNextActions: [ActivityTypeEnum.PartnerCareThank], }, { dbResult: [ { - result: 'COMPLETED', - task: 'FOLLOW_UP_PHONE_CALL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpPhoneCall, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_EMAIL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpEmail, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_TEXT_MESSAGE', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpTextMessage, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_SOCIAL_MEDIA', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpSocialMedia, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_IN_PERSON', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpInPerson, }, ], - name: 'FOLLOW_UP_RESULT_PARTNER_PRAY', - suggestedContactStatus: 'PARTNER_PRAY', - suggestedNextActions: ['PARTNER_CARE_THANK'], + name: DisplayResultEnum.FollowUpResultPartnerPray, + suggestedContactStatus: StatusEnum.PartnerPray, + suggestedNextActions: [ActivityTypeEnum.PartnerCareThank], }, { dbResult: [ { - result: 'COMPLETED', - task: 'FOLLOW_UP_PHONE_CALL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpPhoneCall, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_EMAIL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpEmail, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_TEXT_MESSAGE', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpTextMessage, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_SOCIAL_MEDIA', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpSocialMedia, }, { - result: 'COMPLETED', - task: 'FOLLOW_UP_IN_PERSON', + result: ResultEnum.Completed, + task: ActivityTypeEnum.FollowUpInPerson, }, ], - name: 'FOLLOW_UP_RESULT_NOT_INTERESTED', - suggestedContactStatus: 'NOT_INTERESTED', - suggestedNextActions: null, + name: DisplayResultEnum.FollowUpResultNotInterested, + suggestedContactStatus: StatusEnum.NotInterested, + suggestedNextActions: [], }, ], tags: [ @@ -740,112 +747,112 @@ export const loadConstantsMockData = { ], }, tasks: [ - 'FOLLOW_UP_PHONE_CALL', - 'FOLLOW_UP_EMAIL', - 'FOLLOW_UP_TEXT_MESSAGE', - 'FOLLOW_UP_SOCIAL_MEDIA', - 'FOLLOW_UP_IN_PERSON', + ActivityTypeEnum.FollowUpPhoneCall, + ActivityTypeEnum.FollowUpEmail, + ActivityTypeEnum.FollowUpTextMessage, + ActivityTypeEnum.FollowUpSocialMedia, + ActivityTypeEnum.FollowUpInPerson, ], }, { contactStatuses: [ - 'PARTNER_FINANCIAL', - 'PARTNER_SPECIAL', - 'PARTNER_PRAY', + StatusEnum.PartnerFinancial, + StatusEnum.PartnerSpecial, + StatusEnum.PartnerPray, ], - id: 'PARTNER_CARE', + id: PhaseEnum.PartnerCare, name: 'Partner Care', results: { resultOptions: [ { dbResult: [ { - result: 'COMPLETED', - task: 'PARTNER_CARE_PHONE_CALL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.PartnerCarePhoneCall, }, { - result: 'COMPLETED', - task: 'PARTNER_CARE_EMAIL', + result: ResultEnum.Completed, + task: ActivityTypeEnum.PartnerCareEmail, }, { - result: 'COMPLETED', - task: 'PARTNER_CARE_TEXT_MESSAGE', + result: ResultEnum.Completed, + task: ActivityTypeEnum.PartnerCareTextMessage, }, { - result: 'COMPLETED', - task: 'PARTNER_CARE_SOCIAL_MEDIA', + result: ResultEnum.Completed, + task: ActivityTypeEnum.PartnerCareSocialMedia, }, { - result: 'COMPLETED', - task: 'PARTNER_CARE_IN_PERSON', + result: ResultEnum.Completed, + task: ActivityTypeEnum.PartnerCareInPerson, }, { - result: 'COMPLETED', - task: 'PARTNER_CARE_THANK', + result: ResultEnum.Completed, + task: ActivityTypeEnum.PartnerCareThank, }, { - result: 'COMPLETED', - task: 'PARTNER_CARE_DIGITAL_NEWSLETTER', + result: ResultEnum.Completed, + task: ActivityTypeEnum.PartnerCareDigitalNewsletter, }, { - result: 'COMPLETED', - task: 'PARTNER_CARE_PHYSICAL_NEWSLETTER', + result: ResultEnum.Completed, + task: ActivityTypeEnum.PartnerCarePhysicalNewsletter, }, { - result: 'COMPLETED', - task: 'PARTNER_CARE_PRAYER_REQUEST', + result: ResultEnum.Completed, + task: ActivityTypeEnum.PartnerCarePrayerRequest, }, { - result: 'COMPLETED', - task: 'PARTNER_CARE_UPDATE_INFORMATION', + result: ResultEnum.Completed, + task: ActivityTypeEnum.PartnerCareUpdateInformation, }, { - result: 'COMPLETED', - task: 'PARTNER_CARE_TO_DO', + result: ResultEnum.Completed, + task: ActivityTypeEnum.PartnerCareToDo, }, ], - name: 'PARTNER_CARE_COMPLETED', + name: DisplayResultEnum.PartnerCareCompleted, suggestedContactStatus: null, suggestedNextActions: [ - 'PARTNER_CARE_PHONE_CALL', - 'PARTNER_CARE_EMAIL', - 'PARTNER_CARE_TEXT_MESSAGE', - 'PARTNER_CARE_SOCIAL_MEDIA', - 'PARTNER_CARE_IN_PERSON', - 'PARTNER_CARE_THANK', - 'PARTNER_CARE_DIGITAL_NEWSLETTER', - 'PARTNER_CARE_PHYSICAL_NEWSLETTER', - 'PARTNER_CARE_PRAYER_REQUEST', - 'PARTNER_CARE_UPDATE_INFORMATION', - 'PARTNER_CARE_TO_DO', + ActivityTypeEnum.PartnerCarePhoneCall, + ActivityTypeEnum.PartnerCareEmail, + ActivityTypeEnum.PartnerCareTextMessage, + ActivityTypeEnum.PartnerCareSocialMedia, + ActivityTypeEnum.PartnerCareInPerson, + ActivityTypeEnum.PartnerCareThank, + ActivityTypeEnum.PartnerCareDigitalNewsletter, + ActivityTypeEnum.PartnerCarePhysicalNewsletter, + ActivityTypeEnum.PartnerCarePrayerRequest, + ActivityTypeEnum.PartnerCareUpdateInformation, + ActivityTypeEnum.PartnerCareToDo, ], }, ], tags: null, }, tasks: [ - 'PARTNER_CARE_PHONE_CALL', - 'PARTNER_CARE_EMAIL', - 'PARTNER_CARE_TEXT_MESSAGE', - 'PARTNER_CARE_SOCIAL_MEDIA', - 'PARTNER_CARE_IN_PERSON', - 'PARTNER_CARE_THANK', - 'PARTNER_CARE_DIGITAL_NEWSLETTER', - 'PARTNER_CARE_PHYSICAL_NEWSLETTER', - 'PARTNER_CARE_PRAYER_REQUEST', - 'PARTNER_CARE_UPDATE_INFORMATION', - 'PARTNER_CARE_TO_DO', + ActivityTypeEnum.PartnerCarePhoneCall, + ActivityTypeEnum.PartnerCareEmail, + ActivityTypeEnum.PartnerCareTextMessage, + ActivityTypeEnum.PartnerCareSocialMedia, + ActivityTypeEnum.PartnerCareInPerson, + ActivityTypeEnum.PartnerCareThank, + ActivityTypeEnum.PartnerCareDigitalNewsletter, + ActivityTypeEnum.PartnerCarePhysicalNewsletter, + ActivityTypeEnum.PartnerCarePrayerRequest, + ActivityTypeEnum.PartnerCareUpdateInformation, + ActivityTypeEnum.PartnerCareToDo, ], }, { contactStatuses: [ - 'NOT_INTERESTED', - 'UNRESPONSIVE', - 'NEVER_ASK', - 'RESEARCH_ABANDONED', - 'EXPIRED_REFERRAL', + StatusEnum.NotInterested, + StatusEnum.Unresponsive, + StatusEnum.NeverAsk, + StatusEnum.ResearchAbandoned, + StatusEnum.ExpiredReferral, ], - id: 'ARCHIVE', + id: PhaseEnum.Archive, name: 'Archive', results: { resultOptions: [], @@ -894,17 +901,17 @@ export const loadConstantsMockData = { ], pledgeFrequency: [ { - id: 'QUARTERLY', + id: PledgeFrequencyEnum.Quarterly, key: '3.0', value: 'Quarterly', }, { - id: 'ANNUAL', + id: PledgeFrequencyEnum.Annual, key: '12.0', value: 'Annual', }, ], }, -} as LoadConstantsQuery; +}; export default LoadConstantsMock; diff --git a/src/components/Task/Modal/Form/Complete/TaskModalCompleteForm.tsx b/src/components/Task/Modal/Form/Complete/TaskModalCompleteForm.tsx index b7b58761d..39303d406 100644 --- a/src/components/Task/Modal/Form/Complete/TaskModalCompleteForm.tsx +++ b/src/components/Task/Modal/Form/Complete/TaskModalCompleteForm.tsx @@ -51,12 +51,12 @@ import { TagTypeEnum, TagsAutocomplete, } from '../Inputs/TagsAutocomplete/TagsAutocomplete'; -import { possibleNextActions } from '../PossibleNextActions'; import { useUpdateContactStatusMutation } from '../TaskModal.generated'; import { extractSuggestedTags, getDatabaseValueFromResult, } from '../TaskModalHelper'; +import { possibleNextActions } from '../possibleNextActions'; import { possiblePartnerStatus } from '../possiblePartnerStatus'; import { possibleResults } from '../possibleResults'; import { useCompleteTaskMutation } from './CompleteTask.generated'; diff --git a/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.test.tsx b/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.test.tsx index bd43e06a7..369008a1d 100644 --- a/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.test.tsx +++ b/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.test.tsx @@ -386,6 +386,42 @@ describe('TaskModalLogForm', () => { expect(getByRole('combobox', { name: 'Next Action' })).toBeInTheDocument(); }); + it('hides next action for results with no suggested next actions', async () => { + const { getByRole, findByRole, queryByRole } = render( + + + + + mocks={{ + LoadConstants, + }} + > + + + + + , + ); + + userEvent.click(getByRole('combobox', { name: 'Task Type' })); + userEvent.click(await findByRole('option', { name: 'Initiation' })); + + userEvent.click(getByRole('combobox', { name: 'Action' })); + userEvent.click(await findByRole('option', { name: 'In Person' })); + + userEvent.click(getByRole('combobox', { name: 'Result' })); + userEvent.click(await findByRole('option', { name: 'Not Interested' })); + + expect( + queryByRole('combobox', { name: 'Next Action' }), + ).not.toBeInTheDocument(); + }); + it('opens the next action modal', async () => { const mutationSpy = jest.fn(); const onClose = jest.fn(); diff --git a/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.tsx b/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.tsx index 59e916276..e919603dd 100644 --- a/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.tsx +++ b/src/components/Task/Modal/Form/LogForm/TaskModalLogForm.tsx @@ -56,7 +56,6 @@ import { TagsAutocomplete, } from '../Inputs/TagsAutocomplete/TagsAutocomplete'; import { TaskPhaseAutocomplete } from '../Inputs/TaskPhaseAutocomplete/TaskPhaseAutocomplete'; -import { possibleNextActions } from '../PossibleNextActions'; import { useCreateTasksMutation, useUpdateContactStatusMutation, @@ -67,6 +66,7 @@ import { handleTaskActionChange, handleTaskPhaseChange, } from '../TaskModalHelper'; +import { possibleNextActions } from '../possibleNextActions'; import { possiblePartnerStatus } from '../possiblePartnerStatus'; import { possibleResults } from '../possibleResults'; diff --git a/src/components/Task/Modal/Form/TaskModalForm.tsx b/src/components/Task/Modal/Form/TaskModalForm.tsx index 6400571ee..5e5fd4f1b 100644 --- a/src/components/Task/Modal/Form/TaskModalForm.tsx +++ b/src/components/Task/Modal/Form/TaskModalForm.tsx @@ -67,7 +67,6 @@ import { TagsAutocomplete, } from './Inputs/TagsAutocomplete/TagsAutocomplete'; import { TaskPhaseAutocomplete } from './Inputs/TaskPhaseAutocomplete/TaskPhaseAutocomplete'; -import { possibleNextActions } from './PossibleNextActions'; import { useCreateTasksMutation, useUpdateContactStatusMutation, @@ -80,6 +79,7 @@ import { handleTaskActionChange, handleTaskPhaseChange, } from './TaskModalHelper'; +import { possibleNextActions } from './possibleNextActions'; import { possiblePartnerStatus } from './possiblePartnerStatus'; import { possibleResults } from './possibleResults'; diff --git a/src/components/Task/Modal/Form/TaskModalHelper.ts b/src/components/Task/Modal/Form/TaskModalHelper.ts index ee2c5f069..7e27a8cd4 100644 --- a/src/components/Task/Modal/Form/TaskModalHelper.ts +++ b/src/components/Task/Modal/Form/TaskModalHelper.ts @@ -6,7 +6,7 @@ import { ResultEnum, } from 'src/graphql/types.generated'; import { Constants, SetPhaseId } from 'src/hooks/usePhaseData'; -import { possibleNextActions } from './PossibleNextActions'; +import { possibleNextActions } from './possibleNextActions'; export type SetFieldValue = ( field: string, diff --git a/src/components/Task/Modal/Form/PossibleNextActions.tsx b/src/components/Task/Modal/Form/possibleNextActions.ts similarity index 93% rename from src/components/Task/Modal/Form/PossibleNextActions.tsx rename to src/components/Task/Modal/Form/possibleNextActions.ts index bc38da98b..456910d60 100644 --- a/src/components/Task/Modal/Form/PossibleNextActions.tsx +++ b/src/components/Task/Modal/Form/possibleNextActions.ts @@ -20,7 +20,7 @@ export const possibleNextActions = ( ) : null; - return result?.suggestedNextActions + return result?.suggestedNextActions?.length ? [ActivityTypeEnum.None, ...result.suggestedNextActions] : []; };