From 4c848361fa49841c2a7a46e5da7455abf33e7c59 Mon Sep 17 00:00:00 2001 From: sgoycoechea-lightit <131689591+sgoycoechea-lightit@users.noreply.github.com> Date: Wed, 24 Jul 2024 13:40:03 -0300 Subject: [PATCH 1/5] feat: add referred by question (#207) --- apps/eo_web/src/api/useApi.ts | 1 + apps/eo_web/src/screens/AccountCreation.tsx | 38 +++++++++++++++++-- apps/eo_web/src/screens/Checkout.tsx | 3 +- .../src/screens/ProfilingIntroQuestions.tsx | 3 +- apps/eo_web/src/stores/useProfilingStore.ts | 6 +++ cspell.json | 2 + 6 files changed, 48 insertions(+), 5 deletions(-) diff --git a/apps/eo_web/src/api/useApi.ts b/apps/eo_web/src/api/useApi.ts index c16ab423..ad7d4d33 100644 --- a/apps/eo_web/src/api/useApi.ts +++ b/apps/eo_web/src/api/useApi.ts @@ -80,6 +80,7 @@ interface CreatePreProfileParams { email: string; phone_number: string; origin: string; + referred_by: string; } export const useApi = () => { diff --git a/apps/eo_web/src/screens/AccountCreation.tsx b/apps/eo_web/src/screens/AccountCreation.tsx index e33ecf75..026d76c3 100644 --- a/apps/eo_web/src/screens/AccountCreation.tsx +++ b/apps/eo_web/src/screens/AccountCreation.tsx @@ -20,6 +20,30 @@ import { type FlowType, } from "~/stores/useProfilingStore"; +export const ReferralOptions = { + "Twist Out Cancer": Flows.twist_out_cancer, + "Unite for Her": Flows.unite_for_her, + "Imerman Angels": Flows.imerman, + "Stupid Cancer": Flows.stupid_cancer, + "Cancer Support Community": Flows.cancer_support_community, + "UVA": Flows.uva, + "Inova": Flows.inova, +} as const; + +export type ReferralOptionsType = keyof typeof ReferralOptions; + +const getFlowFromReferral = (value: string) => { + const keys = Object.keys(ReferralOptions) as ReferralOptionsType[] + const key = keys.find(key => key === value) + return key ? ReferralOptions[key] : undefined +} + +const getReferredBy = (searchParams: URLSearchParams) => { + const encodedReferredBy = searchParams.get("referred_by") ?? undefined + return encodedReferredBy ? decodeURIComponent(encodedReferredBy) : undefined +} + + export const signUpSchema = z.object({ // Profiling firstName: z.string().min(1, { message: "First name is required" }), @@ -66,6 +90,7 @@ export type SignUpFormSchema = z.infer; export const AccountCreation = () => { const navigate = useNavigate(); + const [useParams] = useSearchParams(); const { account, @@ -75,8 +100,12 @@ export const AccountCreation = () => { setState, setExperience, flow, + setReferredBy, } = useProfilingStore((state) => state); + const referredBy = getReferredBy(useParams) + const referredFlow = referredBy ? getFlowFromReferral(referredBy) : undefined + const [validatingForm, setValidatingForm] = useState(false); const { mutate: createPreProfile } = usePreProfile().preProfileMutation; const { @@ -109,7 +138,8 @@ export const AccountCreation = () => { last_name: data.lastName, email: data.email, phone_number: data.phoneNumber.replace(/\D/g, ""), - origin: getIndex(flow), + origin: referredFlow ? getIndex(referredFlow) : getIndex(flow), + referred_by: referredBy ?? "", }); switch (channel) { case "cancer": @@ -166,6 +196,7 @@ export const AccountCreation = () => { const submissionId = useParams.get("submission_id"); const state = useParams.get("state"); const experience = useParams.get("experience") ?? ""; + const referredBy = getReferredBy(useParams) ?? ""; if (!submissionId) { toast.error( @@ -178,6 +209,7 @@ export const AccountCreation = () => { setState(state); setIntroQuestionSubmissionId(submissionId); setExperience(experience); + setReferredBy(referredBy); } }); @@ -260,7 +292,7 @@ export const AccountCreation = () => { className={tw( "font-nunito text-[11px] font-light ", errors.agreeReceiveNotifications?.message && - "text-red-500", + "text-red-500", )} > I agree to receive emails and text messages related to my @@ -282,7 +314,7 @@ export const AccountCreation = () => { className={tw( "font-nunito text-[11px] font-light !leading-4", errors.agreeTermsAndConditions?.message && - "text-red-500", + "text-red-500", )} > I have read and agree to the{" "} diff --git a/apps/eo_web/src/screens/Checkout.tsx b/apps/eo_web/src/screens/Checkout.tsx index 4b55fcb7..c4060447 100644 --- a/apps/eo_web/src/screens/Checkout.tsx +++ b/apps/eo_web/src/screens/Checkout.tsx @@ -18,7 +18,7 @@ export const Checkout = () => { const { usePayment } = useProfilingStore(); const [searchParams] = useSearchParams(); - const { account, introQuestionSubmissionId, channel, flow, origin } = + const { account, introQuestionSubmissionId, channel, flow, origin, referredBy } = useProfilingStore(); const formParams = new URLSearchParams({ @@ -80,6 +80,7 @@ export const Checkout = () => { agree_terms_and_conditions: account.agreeTermsAndConditions, channel, flow, + referredBy, }), ); diff --git a/apps/eo_web/src/screens/ProfilingIntroQuestions.tsx b/apps/eo_web/src/screens/ProfilingIntroQuestions.tsx index af85aa4e..b33fac96 100644 --- a/apps/eo_web/src/screens/ProfilingIntroQuestions.tsx +++ b/apps/eo_web/src/screens/ProfilingIntroQuestions.tsx @@ -13,9 +13,10 @@ import { useProfilingStore } from "~/stores/useProfilingStore"; export const ProfilingIntroQuestions = () => { const navigate = useNavigate(); - const { channel, type, origin } = useProfilingStore((state) => state); + const { channel, type, origin, flow } = useProfilingStore((state) => state); const searchParams = new URLSearchParams({ origin, + flow }); let introQuestionsId: string | number | null = null; diff --git a/apps/eo_web/src/stores/useProfilingStore.ts b/apps/eo_web/src/stores/useProfilingStore.ts index d416cdfe..f64e38c5 100644 --- a/apps/eo_web/src/stores/useProfilingStore.ts +++ b/apps/eo_web/src/stores/useProfilingStore.ts @@ -49,6 +49,7 @@ export interface ProfilingStore { experience: string; account: Account; flow: FlowType; + referredBy: string; setAccountData: (account: Account) => void; setChannel: (channel: Channel) => void; setType: (type: Type) => void; @@ -60,6 +61,7 @@ export interface ProfilingStore { setOrigin: (origin: string) => void; setExperience: (experience: string) => void; setFlow: (flow: FlowType) => void; + setReferredBy: (referredBy: string) => void; } const defaultState = { @@ -81,6 +83,7 @@ const defaultState = { }, usePayment: true, flow: Flows.marketing_site, + referredBy: "", }; export const useProfilingStore = create()( @@ -119,6 +122,9 @@ export const useProfilingStore = create()( setFlow: (flow: FlowType) => { set({ flow }); }, + setReferredBy: (referredBy: string) => { + set({ referredBy }); + }, ...defaultState, }), { diff --git a/cspell.json b/cspell.json index 8e02c5d0..3b881d16 100644 --- a/cspell.json +++ b/cspell.json @@ -31,11 +31,13 @@ "iconify", "imerman", "inova", + "intoxi", "jotform", "LARAVEL", "manypkg", "medtech", "middlewares", + "nonworkday", "NEXTAUTH", "pnpm", "rgba", From 56c0445750d14b1e084be0605f80fd89b92efb47 Mon Sep 17 00:00:00 2001 From: sgoycoechea-lightit <131689591+sgoycoechea-lightit@users.noreply.github.com> Date: Wed, 24 Jul 2024 14:54:42 -0300 Subject: [PATCH 2/5] fix: paremeter name (#208) --- apps/eo_web/src/screens/Checkout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/eo_web/src/screens/Checkout.tsx b/apps/eo_web/src/screens/Checkout.tsx index c4060447..8cbc5401 100644 --- a/apps/eo_web/src/screens/Checkout.tsx +++ b/apps/eo_web/src/screens/Checkout.tsx @@ -80,7 +80,7 @@ export const Checkout = () => { agree_terms_and_conditions: account.agreeTermsAndConditions, channel, flow, - referredBy, + referred_by: referredBy, }), ); From 2d73376cde4c88fb20bed8cda33aeb319fe7bac8 Mon Sep 17 00:00:00 2001 From: sgoycoechea-lightit <131689591+sgoycoechea-lightit@users.noreply.github.com> Date: Wed, 24 Jul 2024 15:24:24 -0300 Subject: [PATCH 3/5] fix: origin not changed for referral (#209) --- apps/eo_web/src/screens/AccountCreation.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/eo_web/src/screens/AccountCreation.tsx b/apps/eo_web/src/screens/AccountCreation.tsx index 026d76c3..5ab13892 100644 --- a/apps/eo_web/src/screens/AccountCreation.tsx +++ b/apps/eo_web/src/screens/AccountCreation.tsx @@ -100,6 +100,7 @@ export const AccountCreation = () => { setState, setExperience, flow, + setFlow, setReferredBy, } = useProfilingStore((state) => state); @@ -138,7 +139,7 @@ export const AccountCreation = () => { last_name: data.lastName, email: data.email, phone_number: data.phoneNumber.replace(/\D/g, ""), - origin: referredFlow ? getIndex(referredFlow) : getIndex(flow), + origin: getIndex(flow), referred_by: referredBy ?? "", }); switch (channel) { @@ -210,6 +211,7 @@ export const AccountCreation = () => { setIntroQuestionSubmissionId(submissionId); setExperience(experience); setReferredBy(referredBy); + if (referredFlow) setFlow(referredFlow); } }); From b896e149b750fa07e62379cfbb676affd7fb6263 Mon Sep 17 00:00:00 2001 From: Matias Fernandez <132606537+Mat0ias@users.noreply.github.com> Date: Thu, 25 Jul 2024 15:43:15 -0300 Subject: [PATCH 4/5] feat: delete unnecessary athletes stuff (#210) --- apps/eo_web/.env.example | 2 - apps/eo_web/src/App.tsx | 2 - apps/eo_web/src/api/useApi.ts | 8 +- apps/eo_web/src/configs/env.ts | 5 -- apps/eo_web/src/router/Router.tsx | 9 --- apps/eo_web/src/router/routes.tsx | 4 - .../src/screens/Athlete/AthleteSurveyForm.tsx | 42 ----------- .../screens/Athlete/AthleteSurveyThankYou.tsx | 75 ------------------- 8 files changed, 1 insertion(+), 146 deletions(-) delete mode 100644 apps/eo_web/src/screens/Athlete/AthleteSurveyForm.tsx delete mode 100644 apps/eo_web/src/screens/Athlete/AthleteSurveyThankYou.tsx diff --git a/apps/eo_web/.env.example b/apps/eo_web/.env.example index abf048b9..df530e61 100644 --- a/apps/eo_web/.env.example +++ b/apps/eo_web/.env.example @@ -7,7 +7,5 @@ ZUKO_SLUG_ID_PROCESS_START= CANCER_PROFILE_PATIENT_ID= CANCER_PROFILE_CAREGIVER_ID= CANCER_SURVEY_FORM= -ATHLETE_PROFILE_FORM= -ATHLETE_SURVEY_FORM= API_URL= API_LARAVEL= diff --git a/apps/eo_web/src/App.tsx b/apps/eo_web/src/App.tsx index be970bbd..f72ffaba 100644 --- a/apps/eo_web/src/App.tsx +++ b/apps/eo_web/src/App.tsx @@ -29,8 +29,6 @@ interface EnvironmentsConfigs { CANCER_PROFILE_CAREGIVER_ID: string; CANCER_PATIENT_SURVEY_ID: string; CANCER_CAREGIVER_SURVEY_ID: string; - ATHLETE_PROFILE_FORM: string; - ATHLETE_SURVEY_FORM: string; SENIOR_INTRO_QUESTION_PATIENT_ID: string; SENIOR_INTRO_QUESTION_CAREGIVER_ID: string; SENIOR_PROFILE_PATIENT_ID: string; diff --git a/apps/eo_web/src/api/useApi.ts b/apps/eo_web/src/api/useApi.ts index ad7d4d33..9ee83f51 100644 --- a/apps/eo_web/src/api/useApi.ts +++ b/apps/eo_web/src/api/useApi.ts @@ -1,4 +1,3 @@ -import { apiElixir, apiLaravel } from "~/api/axios"; import { type AvoidPresentation, type Maladies, @@ -7,6 +6,7 @@ import { type ThcProductPreferences, type WorseSymptomsMoment, } from "~/api/PrePlanTypes"; +import { apiElixir, apiLaravel } from "~/api/axios"; import { useProfileStore, type Profile } from "~/stores/useProfileStore"; import { type FlowType } from "~/stores/useProfilingStore"; @@ -155,11 +155,6 @@ export const useApi = () => { data, ); - const postAthleteSurveyFormSubmission = async (data: object) => - await apiLaravel.post< - LaravelSuccessBase | LaravelErrorValidation - >("/api/athletes/survey", data); - const postSeniorFormSubmission = async (data: object) => await apiLaravel.post< LaravelSuccessBase | LaravelErrorValidation @@ -191,7 +186,6 @@ export const useApi = () => { eligibleEmail, postCancerFormSubmission, postCancerSurveyFormSubmission, - postAthleteSurveyFormSubmission, postSeniorFormSubmission, postSeniorSurveyFormSubmission, surveyStatus, diff --git a/apps/eo_web/src/configs/env.ts b/apps/eo_web/src/configs/env.ts index 1627854f..e20cce0f 100644 --- a/apps/eo_web/src/configs/env.ts +++ b/apps/eo_web/src/configs/env.ts @@ -18,11 +18,6 @@ export const CANCER_PATIENT_SURVEY_ID = export const CANCER_CAREGIVER_SURVEY_ID = window.data.getEnv("CANCER_CAREGIVER_SURVEY_ID") || 233415093176152; -export const ATHLETE_PROFILE_FORM = - window.data.getEnv("ATHLETE_PROFILE_FORM") || 233115151709146; -export const ATHLETE_SURVEY_FORM = - window.data.getEnv("ATHLETE_SURVEY_FORM") || 233164188186664; - export const SENIOR_INTRO_QUESTION_PATIENT_ID = window.data.getEnv("SENIOR_INTRO_QUESTION_PATIENT_ID") || 233233204641040; export const SENIOR_INTRO_QUESTION_CAREGIVER_ID = diff --git a/apps/eo_web/src/router/Router.tsx b/apps/eo_web/src/router/Router.tsx index 97fa5175..926149e0 100644 --- a/apps/eo_web/src/router/Router.tsx +++ b/apps/eo_web/src/router/Router.tsx @@ -3,8 +3,6 @@ import { Route, Routes } from "react-router-dom"; import { ROUTES } from "~/router/routes"; import { AccountCreation } from "~/screens/AccountCreation"; -import { AthleteSurveyForm } from "~/screens/Athlete/AthleteSurveyForm"; -import { AthleteSurveyThankYou } from "~/screens/Athlete/AthleteSurveyThankYou"; import { CancerSurveyThankYou } from "~/screens/Cancer/CancerSurveyThankYou"; import { Profiling } from "~/screens/Cancer/Profiling"; import { SurveyForm } from "~/screens/Cancer/SurveyForm"; @@ -113,13 +111,6 @@ export const Router = () => { path={ROUTES.cancerSurveyThankYou} /> - {/* ATHLETES */} - } path={ROUTES.athleteSurvey} /> - } - path={ROUTES.athleteSurveyThankYou} - /> - {/* SENIOR */} } path={ROUTES.seniorForm} /> } path={ROUTES.seniorSurvey} /> diff --git a/apps/eo_web/src/router/routes.tsx b/apps/eo_web/src/router/routes.tsx index b1791a57..49dca0ef 100644 --- a/apps/eo_web/src/router/routes.tsx +++ b/apps/eo_web/src/router/routes.tsx @@ -30,10 +30,6 @@ export const ROUTES = { cancerSurvey: "/cancer/survey", cancerSurveyThankYou: "/cancer/survey-thank-you", - // Athletes PATH - athleteSurvey: "/athletes/survey", - athleteSurveyThankYou: "athletes/survey-thank-you", - // Senior PATH seniorForm: "/senior/profiling", seniorSurvey: "/senior/survey", diff --git a/apps/eo_web/src/screens/Athlete/AthleteSurveyForm.tsx b/apps/eo_web/src/screens/Athlete/AthleteSurveyForm.tsx deleted file mode 100644 index a4238fee..00000000 --- a/apps/eo_web/src/screens/Athlete/AthleteSurveyForm.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import { useEffect } from "react"; -import { useSearchParams } from "react-router-dom"; - -import { ATHLETE_SURVEY_FORM } from "~/configs/env"; -import { jotformScript } from "~/helpers/jotform_script"; -import { LayoutDefault } from "~/layouts"; - - - - - -export const AthleteSurveyForm = () => { - const [searchParams] = useSearchParams(); - - const email = searchParams.get("email") || ""; - const symptoms = searchParams.get("symptoms") || ""; - - useEffect(() => { - jotformScript(ATHLETE_SURVEY_FORM); - }, []); - return ( - -
- -
-
- ); -}; diff --git a/apps/eo_web/src/screens/Athlete/AthleteSurveyThankYou.tsx b/apps/eo_web/src/screens/Athlete/AthleteSurveyThankYou.tsx deleted file mode 100644 index 57772b0c..00000000 --- a/apps/eo_web/src/screens/Athlete/AthleteSurveyThankYou.tsx +++ /dev/null @@ -1,75 +0,0 @@ -import { useMutation } from "@tanstack/react-query"; -import axios from "axios"; -import { useNavigate, useSearchParams } from "react-router-dom"; -import { toast } from "react-toastify"; - -import { Typography } from "@eo/ui"; - -import { useApi } from "~/api/useApi"; -import { AllDonePanel } from "~/components/AllDonePanel"; -import { FAQs } from "~/components/FAQs"; -import { HowEOWorks } from "~/components/HowEOWorks"; -import { useMount } from "~/hooks/useMount"; -import { LayoutDefault } from "~/layouts"; -import { FooterFull } from "~/layouts/FooterFull"; - - -export const AthleteSurveyThankYou = () => { - const [searchParams] = useSearchParams(); - - const submission_id = searchParams.get("submission_id") || ""; - - const navigate = useNavigate(); - - if (!submission_id) { - navigate("/"); - } - - const { postAthleteSurveyFormSubmission } = useApi(); - - const { mutate } = useMutation({ - mutationFn: postAthleteSurveyFormSubmission, - mutationKey: ["postAthleteSurveyFormSubmission", submission_id], - onError: (result) => { - if (axios.isAxiosError(result)) { - if (result.response?.status !== 200) { - toast.error("Something went wrong"); - } - } else { - toast.error("Something went wrong"); - } - }, - }); - - useMount(() => mutate({ submission_id })); - - return ( - - - - We received your feedback!
-
- Thank you!
-
- Have questions? We’re here. Email support@eo.care, call{" "} - 888-823-6143, or{" "} - - schedule a chat - {" "} - with a member of our team. -
-
- - - -
- ); -}; From 13cc704135e56449de3d446cdb4eb92bf61148ff Mon Sep 17 00:00:00 2001 From: sgoycoechea-lightit <131689591+sgoycoechea-lightit@users.noreply.github.com> Date: Fri, 26 Jul 2024 13:06:43 -0300 Subject: [PATCH 5/5] feat: update referred by copies (#211) --- apps/eo_web/src/screens/AccountCreation.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/eo_web/src/screens/AccountCreation.tsx b/apps/eo_web/src/screens/AccountCreation.tsx index 5ab13892..85edb70b 100644 --- a/apps/eo_web/src/screens/AccountCreation.tsx +++ b/apps/eo_web/src/screens/AccountCreation.tsx @@ -26,8 +26,8 @@ export const ReferralOptions = { "Imerman Angels": Flows.imerman, "Stupid Cancer": Flows.stupid_cancer, "Cancer Support Community": Flows.cancer_support_community, - "UVA": Flows.uva, - "Inova": Flows.inova, + "UVA Health": Flows.uva, + "Inova Schar Cancer Institute": Flows.inova, } as const; export type ReferralOptionsType = keyof typeof ReferralOptions;