Skip to content

Commit

Permalink
feature: add origin to redirec back, to able diferents domains redire…
Browse files Browse the repository at this point in the history
…ctions. (#39)
  • Loading branch information
cgarcia-lightit authored Nov 28, 2023
1 parent bc5cd1a commit 24be9f8
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 35 deletions.
1 change: 0 additions & 1 deletion apps/eo_web/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ VITE_APP_URL="http://localhost:5173"
PROFILE_ONE_ID=
PROFILE_TWO_ID=
ZUKO_SLUG_ID_PROCESS_START=
CANCER_USER_DATA=
CANCER_PROFILE_PATIENT_ID=
CANCER_PROFILE_CAREGIVER_ID=
CANCER_SURVEY_FORM=
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/eo_web/dist/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"css": [
"assets/main-20667dcd.css"
],
"file": "assets/main-bcbb9d97.js",
"file": "assets/main-03507f56.js",
"isEntry": true,
"src": "src/main.tsx"
}
Expand Down
1 change: 0 additions & 1 deletion apps/eo_web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ interface EnvironmentsConfigs {
CANCER_INTRO_QUESTION_CAREGIVER_ID: string;
CANCER_PROFILE_PATIENT_ID: string;
CANCER_PROFILE_CAREGIVER_ID: string;
CANCER_USER_DATA: string;
CANCER_SURVEY_FORM: string;
ATHLETE_PROFILE_FORM: string;
ATHLETE_SURVEY_FORM: string;
Expand Down
2 changes: 1 addition & 1 deletion apps/eo_web/src/configs/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const ATHLETE_SURVEY_FORM =
export const SENIOR_INTRO_QUESTION_PATIENT_ID =
window.data.getEnv("SENIOR_INTRO_QUESTION_PATIENT_ID") || 233233204641040;
export const SENIOR_INTRO_QUESTION_CAREGIVER_ID =
window.data.getEnv("SENIOR_INTRO_QUESTION_CAREGIVER_ID") || 233233204641040;
window.data.getEnv("SENIOR_INTRO_QUESTION_CAREGIVER_ID") || 233244799896174;
export const SENIOR_PROFILE_PATIENT_ID =
window.data.getEnv("SENIOR_PROFILE_PATIENT_ID") || 233205444527149;
export const SENIOR_PROFILE_CAREGIVER_ID =
Expand Down
1 change: 0 additions & 1 deletion apps/eo_web/src/router/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import { ProfilingOne } from "~/screens/profiling/ProfilingOne";
import { ProfilingOneRedirect } from "~/screens/profiling/ProfilingOneRedirect";
import { ProfilingTwo } from "~/screens/profiling/ProfilingTwo";
import { ProfilingTwoRedirect } from "~/screens/profiling/ProfilingTwoRedirect";

import { ProtectedRoute } from "./ProtectedRoute";


Expand Down
3 changes: 2 additions & 1 deletion apps/eo_web/src/screens/Cancer/Profiling.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ import { useProfilingStore } from "~/stores/useProfilingStore";


export const Profiling = () => {
const { type, symptoms, state, usePayment } = useProfilingStore(
const { type, symptoms, state, usePayment, origin } = useProfilingStore(
(state) => state,
);

const searchParam = new URLSearchParams({
states: state ?? "",
symptoms: symptoms.join(","),
payment: usePayment ? "yes" : "no",
origin,
});

const navigate = useNavigate();
Expand Down
7 changes: 5 additions & 2 deletions apps/eo_web/src/screens/ProfilingIntroQuestions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import { useProfilingStore } from "~/stores/useProfilingStore";

export const ProfilingIntroQuestions = () => {
const navigate = useNavigate();
const { channel, type } = useProfilingStore((state) => state);
const { channel, type, origin } = useProfilingStore((state) => state);
const searchParams = new URLSearchParams({
origin,
});

let introQuestionsId: string | number | null = null;

Expand Down Expand Up @@ -53,7 +56,7 @@ export const ProfilingIntroQuestions = () => {
allow="geolocation; microphone; camera"
allowTransparency
allowFullScreen={true}
src={`https://form.jotform.com/${introQuestionsId}`}
src={`https://form.jotform.com/${introQuestionsId}?${searchParams.toString()}`}
className="h-full w-full"
style={{
minWidth: "100%",
Expand Down
3 changes: 2 additions & 1 deletion apps/eo_web/src/screens/Senior/Profiling.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import { useProfilingStore } from "~/stores/useProfilingStore";


export const Profiling = () => {
const { type, symptoms, state, usePayment } = useProfilingStore(
const { type, symptoms, state, usePayment, origin } = useProfilingStore(
(state) => state,
);
const searchParam = new URLSearchParams({
states: state ?? "",
symptoms: symptoms.join(","),
payment: usePayment ? "yes" : "no",
origin,
});
const navigate = useNavigate();

Expand Down
3 changes: 3 additions & 0 deletions apps/eo_web/src/screens/UserRolSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ export const UserRolSelector = () => {
setSymptoms,
setUsePayment,
resetProfilingStore,
setOrigin,
} = useProfilingStore((state) => state);
const redirectForm = (type: Type) => {
const channel = searchParams.get("channel") as Channel;
const symptoms = searchParams.get("symptoms") ?? "";
const origin = searchParams.get("origin") ?? "http://localhost:5173";

setOrigin(origin);
setSymptoms(symptoms.split(","));
setChannel(channel);
setType(type);
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 @@ -26,6 +26,7 @@ export interface ProfilingStore {
state: string | null;
introQuestionSubmissionId?: string | null;
usePayment: boolean;
origin: string;
account: Account;
setAccountData: (account: Account) => void;
setChannel: (channel: Channel) => void;
Expand All @@ -35,6 +36,7 @@ export interface ProfilingStore {
setState: (state: string | null) => void;
setUsePayment: (usePayment: boolean) => void;
resetProfilingStore: () => void;
setOrigin: (origin: string) => void;
}

const defaultState = {
Expand All @@ -43,6 +45,7 @@ const defaultState = {
introQuestionSubmissionId: null,
symptoms: [],
state: null,
origin: "",
account: {
email: "",
password: "",
Expand Down Expand Up @@ -82,6 +85,9 @@ export const useProfilingStore = create<ProfilingStore>()(
resetProfilingStore: () => {
set({ ...get(), ...defaultState });
},
setOrigin: (origin: string) => {
set({ origin });
},
...defaultState,
}),
{
Expand Down

0 comments on commit 24be9f8

Please sign in to comment.