Skip to content

Commit

Permalink
Merge pull request #94 from Light-it-labs/develop
Browse files Browse the repository at this point in the history
[RELEASE] 22 February πŸš€πŸš€
  • Loading branch information
cgarcia-lightit authored Feb 22, 2024
2 parents b8c2b26 + fe72e3e commit e84161a
Show file tree
Hide file tree
Showing 19 changed files with 358 additions and 172 deletions.
121 changes: 0 additions & 121 deletions apps/eo_web/dist/assets/main-26785659.js

This file was deleted.

121 changes: 121 additions & 0 deletions apps/eo_web/dist/assets/main-ef04d2d4.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions apps/eo_web/dist/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
"src": "../../packages/ui/src/assets/avatar.svg"
},
"src/main.css": {
"file": "assets/main-ddf6ac53.css",
"file": "assets/main-f1ea2402.css",
"src": "src/main.css"
},
"src/main.tsx": {
"assets": [
"assets/UploadFile-694e44b5.svg"
],
"css": [
"assets/main-ddf6ac53.css"
"assets/main-f1ea2402.css"
],
"file": "assets/main-26785659.js",
"file": "assets/main-ef04d2d4.js",
"isEntry": true,
"src": "src/main.tsx"
}
Expand Down
6 changes: 6 additions & 0 deletions apps/eo_web/src/api/useApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ export const useApi = () => {
{ email },
);

const surveyStatus = async (email: string, phase: string) =>
await apiElixir.get<{ active: boolean }>(
`/v2/survey/${email}/availability/${phase}`,
);

const postCancerFormSubmission = async (data: object) =>
await apiLaravel.post<LaravelSuccessBase<ProfileCreationResult>>(
"/api/v2/cancer/profile",
Expand Down Expand Up @@ -173,5 +178,6 @@ export const useApi = () => {
postAthleteSurveyFormSubmission,
postSeniorFormSubmission,
postSeniorSurveyFormSubmission,
surveyStatus,
};
};
10 changes: 10 additions & 0 deletions apps/eo_web/src/components/Loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const Loading = () => {
return (
<div
className="right-[calc(50%-20px)] top-1/2 h-12 w-12 animate-spin rounded-full border-4 border-gray-200 border-t-gray-1000"
style={{
position: "absolute",
}}
/>
);
};
30 changes: 30 additions & 0 deletions apps/eo_web/src/components/SurveyResponded.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Button, Typography, icons } from "@eo/ui";

import { WEB_APP_URL } from "~/configs/env";

export const SurveyResponded = () => (
<div className="mx-6 flex flex-col-reverse justify-between lg:ml-8 lg:flex-row xl:mx-0 xl:ml-[155px] xl:mt-[144px] xl:w-[979px] xl:items-center">
<section className="mt-4 flex flex-col gap-[35px] lg:mt-0">
<Typography
variant="large"
className="!text-[48px] font-extrabold !leading-[120%]"
>
Survey already <br />
responded!
</Typography>
<Typography className="text-[20px] text-gray-800" font="regular">
Thank you for answering our survey! <br />
Your insights are greatly appreciated and will help us improve.
</Typography>
<div>
<a href={WEB_APP_URL} className="float-left block">
<Button variant="black">
<span className="hidden lg:block">Go Back Home</span>
<span className="lg:hidden">Go Back</span>
</Button>
</a>
</div>
</section>
<icons.SurveyIcon className="mt-0 lg:mt-6" />
</div>
);
4 changes: 2 additions & 2 deletions apps/eo_web/src/configs/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export const CANCER_INTRO_QUESTION_PATIENT_ID =
export const CANCER_INTRO_QUESTION_CAREGIVER_ID =
window.data.getEnv("CANCER_INTRO_QUESTION_CAREGIVER_ID") || 233244799896174;
export const CANCER_PROFILE_PATIENT_ID =
window.data.getEnv("CANCER_PROFILE_PATIENT_ID") || 232564063321650;
window.data.getEnv("CANCER_PROFILE_PATIENT_ID") || 240392836044658;
export const CANCER_PROFILE_CAREGIVER_ID =
window.data.getEnv("CANCER_PROFILE_CAREGIVER_ID") || 232564208467662;
window.data.getEnv("CANCER_PROFILE_CAREGIVER_ID") || 240392823236657;
export const CANCER_PATIENT_SURVEY_ID =
window.data.getEnv("CANCER_PATIENT_SURVEY_ID") || 232885421299668;
export const CANCER_CAREGIVER_SURVEY_ID =
Expand Down
13 changes: 4 additions & 9 deletions apps/eo_web/src/copy/copy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,21 @@ export const CarrouselItems = [
step: "STEP 1",
title: "Profile & subscribe",
content:
"In about 5 minutes, you can create your eo account and provide the information our clinical team needs to create your initial plan.",
"In 5-10 minutes, you can share the key information our clinical team needs to create your initial plan.",
icon: icons.ProfileIconWhite,
},
{
step: "STEP 2",
title: "Get your care plan",
content:
"In under 24 hours, you’ll receive an email with a link to your personalized, clinician-approved care plan and your recommended products.",
"In under 24 hours, you’ll receive an email with a link to your personalized, clinician-approved care plan.",
icon: icons.HandHeartWhite,
},
{
step: "STEP 3",
title: "Get your products",
content:
"Review your plan and schedule a time to pick-up your products at a dispensary near you. We’ll order your products for you. You just pick-up and pay.",
"Review your plan and schedule a time to pick-up your products at dispensary near you. We’ll order your products for you. You just pick-up and pay.",
icon: icons.PillsWhite,
},
{
Expand Down Expand Up @@ -195,12 +195,7 @@ export const faqs: Copy[] = [
title:
"Do I order the products that are included in my care plan or do you do it for me?",
content:
"After you’ve approved your recommended products, we’ll order your THC products for you and let you know when they’re ready for pick-up. You can order any non-THC products (e.g. CBD, CBN or CBG products) directly from our recommended retail partners for home delivery.",
},
{
title: "Do I need a medical card to use eo?",
content:
"No. You can use eo without a medical card. We’ll ask you about your medical card status when you’re sharing your profile information.",
"After you’ve approved your recommended products, we’ll order your THC products for you and let you know when they’re ready for pick-up. You can order any non-THC products (e.g. CBD, CBN or CBG products) direct from our recommended retail partners for home delivery.",
},
{
title: "What should I bring with me when I pick-up my products?",
Expand Down
10 changes: 10 additions & 0 deletions apps/eo_web/src/helpers/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const scapeParamFromQuery = (
key: string,
urlParam?: URLSearchParams,
): string | null => {
if (!urlParam) {
urlParam = new URLSearchParams(window.location.search);
}
const val = urlParam.get(key);
return val ? val.replace(" ", "+") : null;
};
15 changes: 13 additions & 2 deletions apps/eo_web/src/layouts/LayoutDefault.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
import { type ReactNode } from "react";

import { tw } from "@eo/shared";

import { Header } from "~/components/Header";

export const LayoutDefault = ({ children }: { children: ReactNode }) => {

export const LayoutDefault = ({
children,
className,
}: {
children: ReactNode;
className?: string;
}) => {
return (
<section className="flex h-screen w-screen flex-col bg-ice-silver">
<section
className={tw("flex h-screen w-screen flex-col bg-ice-silver", className)}
>
<div className="flex h-full w-full flex-col overflow-auto">
<Header />
{children}
Expand Down
19 changes: 11 additions & 8 deletions apps/eo_web/src/screens/Cancer/CancerSurveyThankYou.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@ import { toast } from "react-toastify";
import { Typography } from "@eo/ui";

import { useApi } from "~/api/useApi";
import { useMount } from "~/hooks/useMount";
import { LayoutDefault } from "~/layouts";
import { AllDonePanel } from "~/components/AllDonePanel";
import { HowEOWorks } from "~/components/HowEOWorks";
import { FAQs } from "~/components/FAQs";
import { HowEOWorks } from "~/components/HowEOWorks";
import { useMount } from "~/hooks/useMount";
import { LayoutDefault } from "~/layouts";
import { FooterFull } from "~/layouts/FooterFull";
import { useProfilingStore } from "~/stores/useProfilingStore";
import { useSurveyStore } from "~/stores/useSurveyStore";


export const CancerSurveyThankYou = () => {
const [searchParams] = useSearchParams();

const usePayment = useProfilingStore((s) => s.usePayment);
const { email, phase } = useSurveyStore();
const { usePayment } = useProfilingStore();

const submission_id = searchParams.get("submission_id") ?? "";

Expand All @@ -44,23 +46,24 @@ export const CancerSurveyThankYou = () => {
},
});

useMount(() => mutate({ submission_id }));
useMount(() => mutate({ email, phase, submission_id }));

return (
<LayoutDefault>
<AllDonePanel>
<Typography
variant="base"
font="regular"
className="text-center text-[22px] font-normal leading-[36px] max-w-xl"
className="max-w-xl text-center text-[22px] font-normal leading-[36px]"
>
We received your feedback! <br />
<br />
Thank you! <br />
<br />
Have questions? We’re here. Email [email protected], call <a href="tel:+1-877-707-0706">877-707-0706</a>, or {" "}
Have questions? We’re here. Email [email protected], call{" "}
<a href="tel:+1-877-707-0706">877-707-0706</a>, or{" "}
<a
className="cursor-pointer underline font-new-hero text-[22px]"
className="cursor-pointer font-new-hero text-[22px] underline"
href="https://eo-care-telemed.as.me/schedule.php"
target="_blank"
>
Expand Down
40 changes: 34 additions & 6 deletions apps/eo_web/src/screens/Cancer/SurveyForm.tsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,67 @@
import { useQuery } from "@tanstack/react-query";
import { useSearchParams } from "react-router-dom";

import { useApi } from "~/api/useApi";
import { JotformFrame } from "~/components/JotformFrame";
import { Loading } from "~/components/Loading";
import { SurveyResponded } from "~/components/SurveyResponded";
import {
CANCER_CAREGIVER_SURVEY_ID,
CANCER_PATIENT_SURVEY_ID,
} from "~/configs/env";
import { scapeParamFromQuery } from "~/helpers";
import { useMount } from "~/hooks/useMount";
import { LayoutDefault } from "~/layouts";
import { useProfilingStore } from "~/stores/useProfilingStore";
import { useSurveyStore } from "~/stores/useSurveyStore";


export const SurveyForm = () => {
const [searchParams] = useSearchParams();
const setUsePayment = useProfilingStore((s) => s.setUsePayment);
const { setUsePayment } = useProfilingStore();
const { setPhase, setEmail } = useSurveyStore();
const { surveyStatus } = useApi();

const isPilot = (searchParams.get("pilot") ?? "") === "true";
const email = searchParams.get("email") ?? "";
const email = scapeParamFromQuery("email", searchParams);
const profiled = searchParams.get("profiled") ?? "patient";
const symptoms = searchParams.get("symptoms") ?? "";
const phase = searchParams.get("phase") ?? "";

setUsePayment(!isPilot);
if (!email) {
window.location.href = "https://eo.care";
}

useMount(() => {
setPhase(phase);
setEmail(email as string);
setUsePayment(!isPilot);
});

const { data, isLoading, isSuccess } = useQuery({
queryFn: () => (email && phase ? surveyStatus(email, phase) : null),
queryKey: ["surveyStatus"],
});

const formId =
profiled === "patient"
? CANCER_PATIENT_SURVEY_ID
: CANCER_CAREGIVER_SURVEY_ID;

const params = new URLSearchParams({
email,
email: email as string,
symptoms,
});

return (
<LayoutDefault>
<LayoutDefault className="bg-gradient lg:bg-ice-silver lg:bg-none">
<div className="mb-10 flex h-screen flex-col">
<JotformFrame formId={formId} searchParam={params} />
{isLoading && <Loading />}
{!isLoading && isSuccess && data?.data.active ? (
<JotformFrame formId={formId} searchParam={params} />
) : (
isSuccess && data?.data && !data?.data?.active && <SurveyResponded />
)}
</div>
</LayoutDefault>
);
Expand Down
45 changes: 37 additions & 8 deletions apps/eo_web/src/screens/Senior/SeniorSurveyForm.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,45 @@
import { useQuery } from "@tanstack/react-query";
import { useSearchParams } from "react-router-dom";

import { useApi } from "~/api/useApi";
import { JotformFrame } from "~/components/JotformFrame";
import { Loading } from "~/components/Loading";
import { SurveyResponded } from "~/components/SurveyResponded";
import {
SENIOR_CAREGIVER_SURVEY_ID,
SENIOR_PATIENT_SURVEY_ID,
} from "~/configs/env";
import { scapeParamFromQuery } from "~/helpers";
import { useMount } from "~/hooks/useMount";
import { LayoutDefault } from "~/layouts";
import { useSurveyStore } from "~/stores/useSurveyStore";


export const SeniorSurveyForm = () => {
const [params] = useSearchParams();
const email = params.get("email") || "";
const symptoms = params.get("symptoms") || "";
const profiled = params.get("profiled") ?? "patient";
const { surveyStatus } = useApi();
const { setPhase, setEmail } = useSurveyStore();
const [searchParams] = useSearchParams();
const email = scapeParamFromQuery("email", searchParams);
const symptoms = searchParams.get("symptoms") || "";
const profiled = searchParams.get("profiled") ?? "patient";
const phase = searchParams.get("phase") ?? "";

const searchParam = new URLSearchParams({
email,
if (!email) {
window.location.href = "https://eo.care";
}

useMount(() => {
setPhase(phase);
setEmail(email as string);
});

const { data, isLoading, isSuccess } = useQuery({
queryFn: () => (email && phase ? surveyStatus(email, phase) : null),
queryKey: ["surveyStatus"],
});

const params = new URLSearchParams({
email: email as string,
symptoms,
});

Expand All @@ -25,9 +49,14 @@ export const SeniorSurveyForm = () => {
: SENIOR_CAREGIVER_SURVEY_ID;

return (
<LayoutDefault>
<LayoutDefault className="bg-gradient lg:bg-ice-silver lg:bg-none">
<div className="mb-10 flex h-screen flex-col">
<JotformFrame formId={formId} searchParam={searchParam} />
{isLoading && <Loading />}
{!isLoading && isSuccess && data?.data.active ? (
<JotformFrame formId={formId} searchParam={params} />
) : (
isSuccess && data?.data && !data?.data?.active && <SurveyResponded />
)}
</div>
</LayoutDefault>
);
Expand Down
Loading

0 comments on commit e84161a

Please sign in to comment.