Skip to content

Commit

Permalink
[CU-86dumd161] add new flows (#225)
Browse files Browse the repository at this point in the history
* feat: implement new flows

* feat: add related copies text for the newest flows

* fix: fix missing footer link for the newest flow

* fix: add missing M
  • Loading branch information
cgarcia-lightit authored Sep 18, 2024
1 parent 13cc704 commit 5140d4d
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 16 deletions.
6 changes: 6 additions & 0 deletions apps/eo_web/src/components/FAQs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ const flowsWithCOrgFaqs: FlowType[] = [
Flows.unite_for_her,
Flows.mass_retirees,
Flows.stupid_cancer,

// The flows related to resources_center_1/2
Flows.cancer_buddy,
Flows.friend_family,
Flows.northwell_systems,
Flows.realm_of_caring,
];

const flowsWithInovaFaqs: FlowType[] = [Flows.inova, Flows.uva];
Expand Down
13 changes: 11 additions & 2 deletions apps/eo_web/src/layouts/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React from "react";

import { tw } from "@eo/shared";
import { Typography, icons } from "@eo/ui";
import { icons, Typography } from "@eo/ui";

import { Flows, type FlowType } from "~/stores/useProfilingStore";


interface FooterProps {
flow: FlowType;
}
Expand Down Expand Up @@ -134,6 +133,12 @@ const stupid_cancer = [
},
...basicData,
];

const cancer_buddy = [...basicData];
const realm_of_caring = [...basicData];
const friend_family = [...basicData];
const northwell_systems = [...basicData];

const allData = {
c_org,
cancer_pilot,
Expand All @@ -149,6 +154,10 @@ const allData = {
unite_for_her,
mass_retirees,
stupid_cancer,
cancer_buddy,
realm_of_caring,
friend_family,
northwell_systems,
};

export function Footer({ flow }: FooterProps) {
Expand Down
38 changes: 25 additions & 13 deletions apps/eo_web/src/screens/AccountCreation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,33 @@ import {
type FlowType,
} from "~/stores/useProfilingStore";

export const ReferralOptions = {
export const ReferralOptions: Record<string, FlowType> = {
"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 Health": Flows.uva,
"Inova Schar Cancer Institute": Flows.inova,
"Mass Retirees": Flows.mass_retirees,
"Northwell Systems": Flows.northwell_systems,
"Friend / Family": Flows.friend_family,
"Cancer Buddy": Flows.cancer_buddy,
"Realm of Caring": Flows.realm_of_caring,
} 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 keys: ReferralOptionsType[] = Object.keys(ReferralOptions);
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
}

const encodedReferredBy = searchParams.get("referred_by") ?? undefined;
return encodedReferredBy ? decodeURIComponent(encodedReferredBy) : undefined;
};

export const signUpSchema = z.object({
// Profiling
Expand Down Expand Up @@ -104,8 +108,8 @@ export const AccountCreation = () => {
setReferredBy,
} = useProfilingStore((state) => state);

const referredBy = getReferredBy(useParams)
const referredFlow = referredBy ? getFlowFromReferral(referredBy) : undefined
const referredBy = getReferredBy(useParams);
const referredFlow = referredBy ? getFlowFromReferral(referredBy) : undefined;

const [validatingForm, setValidatingForm] = useState(false);
const { mutate: createPreProfile } = usePreProfile().preProfileMutation;
Expand Down Expand Up @@ -188,6 +192,14 @@ export const AccountCreation = () => {
return "13";
case Flows.c_org:
return "14";
case Flows.cancer_buddy:
return "15";
case Flows.realm_of_caring:
return "16";
case Flows.friend_family:
return "17";
case Flows.northwell_systems:
return "18";
}
};

Expand Down Expand Up @@ -294,7 +306,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
Expand All @@ -316,7 +328,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{" "}
Expand Down
8 changes: 7 additions & 1 deletion apps/eo_web/src/screens/Cancer/CancerSurveyThankYou.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { HowEOWorks } from "~/components/HowEOWorks";
import { LayoutDefault } from "~/layouts";
import { Footer } from "~/layouts/Footer";
import { FooterFull } from "~/layouts/FooterFull";
import { type Channel, Flows, type FlowType } from "~/stores/useProfilingStore";
import { Flows, type Channel, type FlowType } from "~/stores/useProfilingStore";
import { useSurveyStore } from "~/stores/useSurveyStore";

const flowsWithSmallFooter: FlowType[] = [
Expand All @@ -20,6 +20,12 @@ const flowsWithSmallFooter: FlowType[] = [
Flows.employer_center,
Flows.inova,
Flows.uva,

// The flows related to resources_center_1/2
Flows.cancer_buddy,
Flows.friend_family,
Flows.northwell_systems,
Flows.realm_of_caring,
];

export const CancerSurveyThankYou = () => {
Expand Down
6 changes: 6 additions & 0 deletions apps/eo_web/src/screens/ProfilingThankYou.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ const flowsWithSmallFooter: FlowType[] = [
Flows.uva,
Flows.imerman,
Flows.unite_for_her,

// The flows related to resources_center_1/2
Flows.cancer_buddy,
Flows.friend_family,
Flows.northwell_systems,
Flows.realm_of_caring,
];

export const ProfilingThankYou = () => {
Expand Down
6 changes: 6 additions & 0 deletions apps/eo_web/src/stores/useProfilingStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export const Flows = {
unite_for_her: "unite_for_her",
mass_retirees: "mass_retirees",
stupid_cancer: "stupid_cancer",
// these are not real flows, because these came from resource_center_1 or resource_center_2
// but we save these values in the same place that flows
cancer_buddy: "cancer_buddy",
realm_of_caring: "realm_of_caring",
friend_family: "friend_family",
northwell_systems: "northwell_systems",
} as const;

export type FlowType = keyof typeof Flows;
Expand Down

0 comments on commit 5140d4d

Please sign in to comment.