From 4cca613ed514e47cbf2796aa361b7e32031095d8 Mon Sep 17 00:00:00 2001 From: "charly.garcia" Date: Tue, 21 Nov 2023 13:47:08 -0300 Subject: [PATCH] feat: add senior profiling --- apps/eo_web/src/configs/env.ts | 4 +- apps/eo_web/src/router/Router.tsx | 2 + apps/eo_web/src/screens/Senior/Profiling.tsx | 53 ++++++++++++++++++++ 3 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 apps/eo_web/src/screens/Senior/Profiling.tsx diff --git a/apps/eo_web/src/configs/env.ts b/apps/eo_web/src/configs/env.ts index 3ac56c5a..61df1f89 100644 --- a/apps/eo_web/src/configs/env.ts +++ b/apps/eo_web/src/configs/env.ts @@ -26,9 +26,9 @@ export const SENIOR_INTRO_QUESTION_PATIENT_ID = export const SENIOR_INTRO_QUESTION_CAREGIVER_ID = window.data.getEnv("SENIOR_INTRO_QUESTION_CAREGIVER_ID") || 233233204641040; export const SENIOR_PROFILE_PATIENT_ID = - window.data.getEnv("SENIOR_PROFILE_PATIENT_ID") || 232564063321650; + window.data.getEnv("SENIOR_PROFILE_PATIENT_ID") || 233205444527149; export const SENIOR_PROFILE_CAREGIVER_ID = - window.data.getEnv("SENIOR_PROFILE_CAREGIVER_ID") || 232564208467662; + window.data.getEnv("SENIOR_PROFILE_CAREGIVER_ID") || 233205444527149; export const API_ELIXIR = window.data.getEnv("API_URL") || "http://localhost:4200"; diff --git a/apps/eo_web/src/router/Router.tsx b/apps/eo_web/src/router/Router.tsx index 0121521d..148af99b 100644 --- a/apps/eo_web/src/router/Router.tsx +++ b/apps/eo_web/src/router/Router.tsx @@ -20,6 +20,7 @@ import { ProfilingThankYou } from "~/screens/ProfilingThankYou"; import { RecoveryPassword } from "~/screens/RecoveryPassword"; import { Register } from "~/screens/Register"; import { RegisterComplete } from "~/screens/RegisterComplete"; +import { Profiling as SeniorProfiling } from "~/screens/Senior/Profiling"; import { UnavailableZipCode } from "~/screens/UnavailableZipCode"; import { UserRolSelector } from "~/screens/UserRolSelector"; import { ZipCodeValidation } from "~/screens/ZipCodeValidation"; @@ -108,6 +109,7 @@ export const Router = () => { /> {/* SENIOR */} + } path={ROUTES.seniorForm} /> ); }; diff --git a/apps/eo_web/src/screens/Senior/Profiling.tsx b/apps/eo_web/src/screens/Senior/Profiling.tsx new file mode 100644 index 00000000..75f1c0b2 --- /dev/null +++ b/apps/eo_web/src/screens/Senior/Profiling.tsx @@ -0,0 +1,53 @@ +import { useNavigate } from "react-router-dom"; + +import { SENIOR_PROFILE_PATIENT_ID } from "~/configs/env"; +import { jotformScript } from "~/helpers/jotform_script"; +import { useMount } from "~/hooks/useMount"; +import { LayoutDefault } from "~/layouts"; +import { ROUTES } from "~/router"; +import { useProfilingStore } from "~/stores/useProfilingStore"; + + + + + +export const Profiling = () => { + const { type } = useProfilingStore((state) => state); + const navigate = useNavigate(); + + const seniorFormId = + type === "Patient" ? SENIOR_PROFILE_PATIENT_ID : SENIOR_PROFILE_PATIENT_ID; + + if (!type) { + navigate(ROUTES.userRolSelector); + } + + useMount(() => { + setTimeout(() => { + jotformScript(seniorFormId); + }, 400); + }); + + return ( + +
+ {/* uncomment for real flow */} + +
+
+ ); +};