From c0d0533235aa4107fddc8da9a611f2e7d7e0a129 Mon Sep 17 00:00:00 2001 From: Daniil Chemerkin Date: Fri, 22 Nov 2024 16:31:24 +0000 Subject: [PATCH] Develop --- src/api/resources/Session.ts | 35 +++++++++++++++++-- src/api/utils.ts | 4 +++ .../ChatsPath/components/Answer/index.tsx | 24 ++++++++++++- .../ChatsPath/pages/Answers/Date/index.tsx | 13 ++++++- .../pages/Answers/DecisionGuidance/index.tsx | 16 ++++++++- .../pages/Answers/GuidanceArea/index.tsx | 13 ++++++- .../pages/Answers/HeadOrHeart/index.tsx | 16 ++++++++- .../Answers/ProneToOverthinking/index.tsx | 22 +++++++++--- .../Answers/PsychicComfortable/index.tsx | 13 ++++++- .../pages/Answers/ReadingExperience/index.tsx | 16 ++++++++- .../pages/Answers/ResonateFuture/index.tsx | 13 ++++++- .../pages/Answers/ResonateLife/index.tsx | 13 ++++++- .../pages/Answers/ResonateLove/index.tsx | 13 ++++++- .../pages/Answers/SatisfiedWithLife/index.tsx | 22 +++++++++--- .../pages/Answers/UserName/index.tsx | 13 ++++++- .../ChatsPath/pages/Welcome/index.tsx | 17 ++++++++- .../pages/ElementResonates/index.tsx | 6 ++-- .../PalmistryV1/pages/FavoriteColor/index.tsx | 6 ++-- .../PalmistryV1/pages/HeadOrHeart/index.tsx | 6 ++-- .../pages/RelationshipStatus/index.tsx | 6 ++-- .../PalmistryV1/pages/WhatAspects/index.tsx | 6 ++-- .../step-color-you-like.tsx | 4 +-- .../step-decisions/step-decisions.tsx | 4 +-- .../step-resonated-element.tsx | 4 +-- .../palmistry/step-wish/step-wish.tsx | 4 +-- 25 files changed, 264 insertions(+), 45 deletions(-) diff --git a/src/api/resources/Session.ts b/src/api/resources/Session.ts index 851c5fb..4a2d479 100644 --- a/src/api/resources/Session.ts +++ b/src/api/resources/Session.ts @@ -20,11 +20,11 @@ export interface PayloadUpdate { profile?: Partial; partner?: Partial>; - answers?: Partial; + answers?: Partial; } } -export interface IAnswersSession { +export interface IAnswersSessionPalmistry { what_aspects: 'love_relationships' | 'health_vitality' | 'career_destiny', // Type: string, optional - 'love_relationships' | 'health_vitality' | 'career_destiny'; relationship_status: 'single' | 'in_relationship', // Type: string, optional - 'single' | 'in_relationship'; element_resonates: 'water' | 'fire' | 'air' | 'earth', // Type: string, optional - 'water' | 'fire' | 'air' | 'earth'; @@ -37,6 +37,37 @@ export interface IAnswersSession { activities_independently: 1 | 2 | 3 | 4 | 5 // Type: number, optional - 1 | 2 | 3 | 4 | 5; } +export interface IAnswersSessionChats { + psychicReading: string; + goal: string; + relationshipStatus: string; + satisfiedWithLife: string; + parentStatus: string; + whatEmotion: string; + whatYouWant: string; + missingInLife: string; + yourGoal: string; + somethingWorrying: string; + proneToOverthinking: string; + worriesImpact: string; + sensitiveToCriticism: string; + headOrHeart: string; + howConfident: string; + needGuidance: string; + decisionGuidance: string; + resonateLove: string; + resonateLife: string; + resonateFuture: string; + believeInSpirituality: string; + readingExperience: string; + interestedHowLong: string; + mainReason: string; + whatToExpect: string; + guidanceArea: string[]; + psychicComfortable: string[]; + userName: string; +} + export interface ResponseCreate { status: "success" | string, sessionId: string diff --git a/src/api/utils.ts b/src/api/utils.ts index 77335f2..fe4fe5d 100644 --- a/src/api/utils.ts +++ b/src/api/utils.ts @@ -20,6 +20,10 @@ export function createMethod(createRequest: (payload: P) => Request) { source = ESourceAuthorization["aura.palmistry.new"]; } + if (location.pathname.includes("/chats")) { + source = ESourceAuthorization["aura.chats"]; + } + const sessionId = localStorage.getItem(`${source}_sessionId`); if (sessionId?.length) { diff --git a/src/components/ChatsPath/components/Answer/index.tsx b/src/components/ChatsPath/components/Answer/index.tsx index 5dd50c1..d5c8ae8 100644 --- a/src/components/ChatsPath/components/Answer/index.tsx +++ b/src/components/ChatsPath/components/Answer/index.tsx @@ -2,6 +2,9 @@ import { useDispatch } from "react-redux"; import { IAnswer } from "../../data"; import styles from "./styles.module.scss"; import { actions } from "@/store"; +import { useSession } from "@/hooks/session/useSession"; +import { ESourceAuthorization } from "@/api/resources/User"; +import routes from "@/routes"; interface IAnswerProps { answer: IAnswer; @@ -10,6 +13,14 @@ interface IAnswerProps { onClick?: () => void; } +const notUpdateSessionRoutes = [ + routes.client.chatsQuizSatisfiedWithLife(), + routes.client.chatsQuizProneToOverthinking(), + routes.client.chatsQuizHeadOrHeart(), + routes.client.chatsQuizDecisionGuidance(), + routes.client.chatsQuizReadingExperience(), +]; + function Answer({ answer, classNameContainer = "", @@ -17,8 +28,19 @@ function Answer({ onClick, }: IAnswerProps) { const dispatch = useDispatch(); + const { updateSession } = useSession(); - const handleClick = () => { + const handleClick = async () => { + if (!notUpdateSessionRoutes.includes(window.location.pathname)) { + await updateSession( + { + answers: { + [answer.questionId]: answer.name, + }, + }, + ESourceAuthorization["aura.chats"] + ); + } dispatch( actions.chats.updateAnswers({ [answer.questionId]: answer.value, diff --git a/src/components/ChatsPath/pages/Answers/Date/index.tsx b/src/components/ChatsPath/pages/Answers/Date/index.tsx index 286e405..9f0e755 100644 --- a/src/components/ChatsPath/pages/Answers/Date/index.tsx +++ b/src/components/ChatsPath/pages/Answers/Date/index.tsx @@ -8,15 +8,26 @@ import { useState } from "react"; import Button from "@/components/ChatsPath/ui/Button"; import ZodiacWheel from "@/components/ChatsPath/components/ZodiacWheel"; import { useUpdateStep } from "@/components/ChatsPath/hooks/useUpdateStep"; +import { useSession } from "@/hooks/session/useSession"; +import { ESourceAuthorization } from "@/api/resources/User"; function Date() { + const { updateSession } = useSession(); const dispatch = useDispatch(); useUpdateStep(4); const navigate = useNavigate(); const birthdate = useSelector(selectors.selectBirthdate); const [isDisabled, setIsDisabled] = useState(true); - const handleNext = () => { + const handleNext = async () => { + await updateSession( + { + profile: { + birthdate: `${birthdate} 00:00`, + }, + }, + ESourceAuthorization["aura.chats"] + ); navigate(routes.client.chatsQuizParentStatus()); }; diff --git a/src/components/ChatsPath/pages/Answers/DecisionGuidance/index.tsx b/src/components/ChatsPath/pages/Answers/DecisionGuidance/index.tsx index d4690f0..daea9cc 100644 --- a/src/components/ChatsPath/pages/Answers/DecisionGuidance/index.tsx +++ b/src/components/ChatsPath/pages/Answers/DecisionGuidance/index.tsx @@ -10,13 +10,27 @@ import AnswerDescription, { import { useSelector } from "react-redux"; import { selectors } from "@/store"; import Button from "@/components/ChatsPath/ui/Button"; +import { useSession } from "@/hooks/session/useSession"; +import { ESourceAuthorization } from "@/api/resources/User"; function DecisionGuidance() { + const { updateSession } = useSession(); useUpdateStep(18); const navigate = useNavigate(); const answer = useSelector(selectors.selectAnswers)?.decisionGuidance; - const handleNext = () => { + const handleNext = async () => { + const _answer = answers.find((item) => item.value === answer); + if (_answer) { + await updateSession( + { + answers: { + decisionGuidance: _answer.name as string, + }, + }, + ESourceAuthorization["aura.chats"] + ); + } navigate(routes.client.chatsQuizResonateLove()); }; diff --git a/src/components/ChatsPath/pages/Answers/GuidanceArea/index.tsx b/src/components/ChatsPath/pages/Answers/GuidanceArea/index.tsx index 3cbf64e..1150cea 100644 --- a/src/components/ChatsPath/pages/Answers/GuidanceArea/index.tsx +++ b/src/components/ChatsPath/pages/Answers/GuidanceArea/index.tsx @@ -7,14 +7,25 @@ import MultiplyAnswers from "@/components/ChatsPath/components/MultiplyAnswers"; import Button from "@/components/ChatsPath/ui/Button"; import { useSelector } from "react-redux"; import { selectors } from "@/store"; +import { useSession } from "@/hooks/session/useSession"; +import { ESourceAuthorization } from "@/api/resources/User"; function GuidanceArea() { + const { updateSession } = useSession(); useUpdateStep(27); const navigate = useNavigate(); const answer = useSelector(selectors.selectAnswers)?.guidanceArea; - const handleNext = () => { + const handleNext = async () => { if (!answer?.length) return; + await updateSession( + { + answers: { + guidanceArea: answer, + }, + }, + ESourceAuthorization["aura.chats"] + ); navigate(routes.client.chatsQuizPsychicComfortable()); }; diff --git a/src/components/ChatsPath/pages/Answers/HeadOrHeart/index.tsx b/src/components/ChatsPath/pages/Answers/HeadOrHeart/index.tsx index 29497d4..25486b9 100644 --- a/src/components/ChatsPath/pages/Answers/HeadOrHeart/index.tsx +++ b/src/components/ChatsPath/pages/Answers/HeadOrHeart/index.tsx @@ -10,13 +10,27 @@ import AnswerDescription, { import { useSelector } from "react-redux"; import { selectors } from "@/store"; import Button from "@/components/ChatsPath/ui/Button"; +import { useSession } from "@/hooks/session/useSession"; +import { ESourceAuthorization } from "@/api/resources/User"; function HeadOrHeart() { + const { updateSession } = useSession(); useUpdateStep(15); const navigate = useNavigate(); const answer = useSelector(selectors.selectAnswers)?.headOrHeart; - const handleNext = () => { + const handleNext = async () => { + const _answer = answers.find((item) => item.value === answer); + if (_answer) { + await updateSession( + { + answers: { + headOrHeart: _answer.name as string, + }, + }, + ESourceAuthorization["aura.chats"] + ); + } navigate(routes.client.chatsQuizHowConfident()); }; diff --git a/src/components/ChatsPath/pages/Answers/ProneToOverthinking/index.tsx b/src/components/ChatsPath/pages/Answers/ProneToOverthinking/index.tsx index c1ac5b0..7cba7b8 100644 --- a/src/components/ChatsPath/pages/Answers/ProneToOverthinking/index.tsx +++ b/src/components/ChatsPath/pages/Answers/ProneToOverthinking/index.tsx @@ -10,16 +10,15 @@ import AnswerDescription, { import { useSelector } from "react-redux"; import { selectors } from "@/store"; import Button from "@/components/ChatsPath/ui/Button"; +import { useSession } from "@/hooks/session/useSession"; +import { ESourceAuthorization } from "@/api/resources/User"; function ProneToOverthinking() { + const { updateSession } = useSession(); useUpdateStep(12); const navigate = useNavigate(); const answer = useSelector(selectors.selectAnswers)?.proneToOverthinking; - const handleNext = () => { - navigate(routes.client.chatsQuizWorriesImpact()); - }; - const answers: IAnswer[] = [ { id: 1, @@ -59,6 +58,21 @@ function ProneToOverthinking() { }, }; + const handleNext = async () => { + const _answer = answers.find((item) => item.value === answer); + if (_answer) { + await updateSession( + { + answers: { + proneToOverthinking: _answer.name as string, + }, + }, + ESourceAuthorization["aura.chats"] + ); + } + navigate(routes.client.chatsQuizWorriesImpact()); + }; + return ( <>

Are you prone to overthinking?

diff --git a/src/components/ChatsPath/pages/Answers/PsychicComfortable/index.tsx b/src/components/ChatsPath/pages/Answers/PsychicComfortable/index.tsx index 9d94642..14a95c9 100644 --- a/src/components/ChatsPath/pages/Answers/PsychicComfortable/index.tsx +++ b/src/components/ChatsPath/pages/Answers/PsychicComfortable/index.tsx @@ -8,14 +8,25 @@ import Button from "@/components/ChatsPath/ui/Button"; import { useSelector } from "react-redux"; import { selectors } from "@/store"; import Tip from "@/components/ChatsPath/components/Tip"; +import { ESourceAuthorization } from "@/api/resources/User"; +import { useSession } from "@/hooks/session/useSession"; function PsychicComfortable() { + const { updateSession } = useSession(); useUpdateStep(28); const navigate = useNavigate(); const answer = useSelector(selectors.selectAnswers)?.psychicComfortable; - const handleNext = () => { + const handleNext = async () => { if (!answer?.length) return; + await updateSession( + { + answers: { + psychicComfortable: answer, + }, + }, + ESourceAuthorization["aura.chats"] + ); navigate(routes.client.chatsQuizUserName()); }; diff --git a/src/components/ChatsPath/pages/Answers/ReadingExperience/index.tsx b/src/components/ChatsPath/pages/Answers/ReadingExperience/index.tsx index ab4aa72..d455284 100644 --- a/src/components/ChatsPath/pages/Answers/ReadingExperience/index.tsx +++ b/src/components/ChatsPath/pages/Answers/ReadingExperience/index.tsx @@ -10,13 +10,27 @@ import AnswerDescription, { import { useSelector } from "react-redux"; import { selectors } from "@/store"; import Button from "@/components/ChatsPath/ui/Button"; +import { ESourceAuthorization } from "@/api/resources/User"; +import { useSession } from "@/hooks/session/useSession"; function ReadingExperience() { + const { updateSession } = useSession(); useUpdateStep(23); const navigate = useNavigate(); const answer = useSelector(selectors.selectAnswers)?.readingExperience; - const handleNext = () => { + const handleNext = async () => { + const _answer = answers.find((item) => item.value === answer); + if (_answer) { + await updateSession( + { + answers: { + readingExperience: _answer.name as string, + }, + }, + ESourceAuthorization["aura.chats"] + ); + } navigate(routes.client.chatsQuizInterestedHowLong()); }; diff --git a/src/components/ChatsPath/pages/Answers/ResonateFuture/index.tsx b/src/components/ChatsPath/pages/Answers/ResonateFuture/index.tsx index 4009e74..17afe9a 100644 --- a/src/components/ChatsPath/pages/Answers/ResonateFuture/index.tsx +++ b/src/components/ChatsPath/pages/Answers/ResonateFuture/index.tsx @@ -6,13 +6,24 @@ import { useDispatch } from "react-redux"; import { actions } from "@/store"; import YesNoButtons from "@/components/ChatsPath/components/YesNoButtons"; import { images } from "@/components/ChatsPath/data"; +import { ESourceAuthorization } from "@/api/resources/User"; +import { useSession } from "@/hooks/session/useSession"; function ResonateFuture() { + const { updateSession } = useSession(); const dispatch = useDispatch(); useUpdateStep(21); const navigate = useNavigate(); - const handleNext = (answer: "yes" | "no") => { + const handleNext = async (answer: "yes" | "no") => { + await updateSession( + { + answers: { + resonateFuture: answer, + }, + }, + ESourceAuthorization["aura.chats"] + ); dispatch(actions.chats.updateAnswers({ resonateFuture: answer })); navigate(routes.client.chatsPreferencesIntro()); }; diff --git a/src/components/ChatsPath/pages/Answers/ResonateLife/index.tsx b/src/components/ChatsPath/pages/Answers/ResonateLife/index.tsx index b112618..e727507 100644 --- a/src/components/ChatsPath/pages/Answers/ResonateLife/index.tsx +++ b/src/components/ChatsPath/pages/Answers/ResonateLife/index.tsx @@ -6,13 +6,24 @@ import { useDispatch } from "react-redux"; import { actions } from "@/store"; import YesNoButtons from "@/components/ChatsPath/components/YesNoButtons"; import { images } from "@/components/ChatsPath/data"; +import { useSession } from "@/hooks/session/useSession"; +import { ESourceAuthorization } from "@/api/resources/User"; function ResonateLife() { + const { updateSession } = useSession(); const dispatch = useDispatch(); useUpdateStep(20); const navigate = useNavigate(); - const handleNext = (answer: "yes" | "no") => { + const handleNext = async (answer: "yes" | "no") => { + await updateSession( + { + answers: { + resonateLife: answer, + }, + }, + ESourceAuthorization["aura.chats"] + ); dispatch(actions.chats.updateAnswers({ resonateLife: answer })); navigate(routes.client.chatsQuizResonateFuture()); }; diff --git a/src/components/ChatsPath/pages/Answers/ResonateLove/index.tsx b/src/components/ChatsPath/pages/Answers/ResonateLove/index.tsx index 4853aea..d8f98ed 100644 --- a/src/components/ChatsPath/pages/Answers/ResonateLove/index.tsx +++ b/src/components/ChatsPath/pages/Answers/ResonateLove/index.tsx @@ -6,13 +6,24 @@ import { useDispatch } from "react-redux"; import { actions } from "@/store"; import YesNoButtons from "@/components/ChatsPath/components/YesNoButtons"; import { images } from "@/components/ChatsPath/data"; +import { useSession } from "@/hooks/session/useSession"; +import { ESourceAuthorization } from "@/api/resources/User"; function ResonateLove() { + const { updateSession } = useSession(); const dispatch = useDispatch(); useUpdateStep(19); const navigate = useNavigate(); - const handleNext = (answer: "yes" | "no") => { + const handleNext = async (answer: "yes" | "no") => { + await updateSession( + { + answers: { + resonateLove: answer, + }, + }, + ESourceAuthorization["aura.chats"] + ); dispatch(actions.chats.updateAnswers({ resonateLove: answer })); navigate(routes.client.chatsQuizResonateLife()); }; diff --git a/src/components/ChatsPath/pages/Answers/SatisfiedWithLife/index.tsx b/src/components/ChatsPath/pages/Answers/SatisfiedWithLife/index.tsx index 96c810f..306e37e 100644 --- a/src/components/ChatsPath/pages/Answers/SatisfiedWithLife/index.tsx +++ b/src/components/ChatsPath/pages/Answers/SatisfiedWithLife/index.tsx @@ -10,16 +10,15 @@ import AnswerDescription, { import { useSelector } from "react-redux"; import { selectors } from "@/store"; import Button from "@/components/ChatsPath/ui/Button"; +import { useSession } from "@/hooks/session/useSession"; +import { ESourceAuthorization } from "@/api/resources/User"; function SatisfiedWithLife() { + const { updateSession } = useSession(); useUpdateStep(6); const navigate = useNavigate(); const answer = useSelector(selectors.selectAnswers)?.satisfiedWithLife; - const handleNext = () => { - navigate(routes.client.chatsQuizWhatEmotion()); - }; - const answers: IAnswer[] = [ { id: 1, @@ -59,6 +58,21 @@ function SatisfiedWithLife() { }, }; + const handleNext = async () => { + const _answer = answers.find((item) => item.value === answer); + if (_answer) { + await updateSession( + { + answers: { + satisfiedWithLife: _answer.name as string, + }, + }, + ESourceAuthorization["aura.chats"] + ); + } + navigate(routes.client.chatsQuizWhatEmotion()); + }; + return ( <>

diff --git a/src/components/ChatsPath/pages/Answers/UserName/index.tsx b/src/components/ChatsPath/pages/Answers/UserName/index.tsx index d70e196..2ee4592 100644 --- a/src/components/ChatsPath/pages/Answers/UserName/index.tsx +++ b/src/components/ChatsPath/pages/Answers/UserName/index.tsx @@ -8,8 +8,11 @@ import { actions, selectors } from "@/store"; import Tip from "@/components/ChatsPath/components/Tip"; import NameInput from "@/components/pages/ABDesign/v1/pages/EmailEnterPage/NameInput"; import { useState } from "react"; +import { ESourceAuthorization } from "@/api/resources/User"; +import { useSession } from "@/hooks/session/useSession"; function UserName() { + const { updateSession } = useSession(); useUpdateStep(29); const navigate = useNavigate(); const dispatch = useDispatch(); @@ -17,8 +20,16 @@ function UserName() { const [name, setName] = useState(""); const [isValidName, setIsValidName] = useState(false); - const handleNext = () => { + const handleNext = async () => { if (!answer?.length) return; + await updateSession( + { + profile: { + name, + }, + }, + ESourceAuthorization["aura.chats"] + ); navigate(routes.client.chatsQuizProcessing()); }; diff --git a/src/components/ChatsPath/pages/Welcome/index.tsx b/src/components/ChatsPath/pages/Welcome/index.tsx index 22dd731..47de160 100644 --- a/src/components/ChatsPath/pages/Welcome/index.tsx +++ b/src/components/ChatsPath/pages/Welcome/index.tsx @@ -12,12 +12,27 @@ import Address from "../../components/Address"; import { useNavigate } from "react-router-dom"; import routes from "@/routes"; import { useRef } from "react"; +import { useSession } from "@/hooks/session/useSession"; +import { EGender, ESourceAuthorization } from "@/api/resources/User"; function Welcome() { + const { createSession, updateSession } = useSession(); const navigate = useNavigate(); const genderScrollRef = useRef(null); - const handleNext = () => { + const handleNext = async (gender: string) => { + const session = await createSession(ESourceAuthorization["aura.chats"]); + if (session?.sessionId?.length) { + await updateSession( + { + profile: { + gender: EGender[gender as keyof typeof EGender], + }, + }, + ESourceAuthorization["aura.chats"], + session.sessionId + ); + } navigate(routes.client.chatsQuizPsychicReading()); }; diff --git a/src/components/PalmistryV1/pages/ElementResonates/index.tsx b/src/components/PalmistryV1/pages/ElementResonates/index.tsx index fd274ff..f8fadb8 100644 --- a/src/components/PalmistryV1/pages/ElementResonates/index.tsx +++ b/src/components/PalmistryV1/pages/ElementResonates/index.tsx @@ -15,7 +15,7 @@ import FireSVG from "../../images/SVG/Fire"; import AirSVG from "../../images/SVG/Air"; import EarthSVG from "../../images/SVG/Earth"; import { ELottieKeys, useLottie } from "@/hooks/lottie/useLottie"; -import { IAnswersSession } from "@/api/resources/Session"; +import { IAnswersSessionPalmistry } from "@/api/resources/Session"; import { useSession } from "@/hooks/session/useSession"; import { ESourceAuthorization } from "@/api/resources/User"; @@ -30,7 +30,7 @@ function ElementResonates() { }); const answers: { - id: IAnswersSession["element_resonates"]; + id: IAnswersSessionPalmistry["element_resonates"]; title: string; Icon: JSX.Element; }[] = useMemo( @@ -59,7 +59,7 @@ function ElementResonates() { [translate] ); - const handleClick = async (id: IAnswersSession["element_resonates"]) => { + const handleClick = async (id: IAnswersSessionPalmistry["element_resonates"]) => { dispatch(actions.palmistryV1Answers.update({ elementResonates: id })); await updateSession({ answers: { diff --git a/src/components/PalmistryV1/pages/FavoriteColor/index.tsx b/src/components/PalmistryV1/pages/FavoriteColor/index.tsx index faad875..79c0f61 100644 --- a/src/components/PalmistryV1/pages/FavoriteColor/index.tsx +++ b/src/components/PalmistryV1/pages/FavoriteColor/index.tsx @@ -12,7 +12,7 @@ import { ELocalesPlacement } from "@/locales"; import { useMemo } from "react"; import TabSVG from "../../images/SVG/Tab"; import { usePreloadImages } from "@/hooks/preload/images"; -import { IAnswersSession } from "@/api/resources/Session"; +import { IAnswersSessionPalmistry } from "@/api/resources/Session"; import { useSession } from "@/hooks/session/useSession"; import { ESourceAuthorization } from "@/api/resources/User"; @@ -32,7 +32,7 @@ function FavoriteColor() { ]); const answers: { - id: IAnswersSession["favorite_color"]; + id: IAnswersSessionPalmistry["favorite_color"]; title: string; color?: string; }[] = useMemo( @@ -70,7 +70,7 @@ function FavoriteColor() { [translate] ); - const handleClick = async (id: IAnswersSession["favorite_color"]) => { + const handleClick = async (id: IAnswersSessionPalmistry["favorite_color"]) => { dispatch(actions.palmistryV1Answers.update({ favoriteColor: id })); await updateSession({ answers: { diff --git a/src/components/PalmistryV1/pages/HeadOrHeart/index.tsx b/src/components/PalmistryV1/pages/HeadOrHeart/index.tsx index 0bc92e0..a180bad 100644 --- a/src/components/PalmistryV1/pages/HeadOrHeart/index.tsx +++ b/src/components/PalmistryV1/pages/HeadOrHeart/index.tsx @@ -12,7 +12,7 @@ import { ELocalesPlacement } from "@/locales"; import { useMemo } from "react"; import { usePreloadImages } from "@/hooks/preload/images"; import { useSession } from "@/hooks/session/useSession"; -import { IAnswersSession } from "@/api/resources/Session"; +import { IAnswersSessionPalmistry } from "@/api/resources/Session"; import { ESourceAuthorization } from "@/api/resources/User"; function HeadOrHeart() { @@ -34,7 +34,7 @@ function HeadOrHeart() { "/v1/palmistry/partners.png", ]); - const answers: { id: IAnswersSession["head_or_heart"]; title: string }[] = + const answers: { id: IAnswersSessionPalmistry["head_or_heart"]; title: string }[] = useMemo( () => [ { @@ -53,7 +53,7 @@ function HeadOrHeart() { [translate] ); - const handleClick = async (id: IAnswersSession["head_or_heart"]) => { + const handleClick = async (id: IAnswersSessionPalmistry["head_or_heart"]) => { dispatch(actions.palmistryV1Answers.update({ headOrHeart: id })); await updateSession( { diff --git a/src/components/PalmistryV1/pages/RelationshipStatus/index.tsx b/src/components/PalmistryV1/pages/RelationshipStatus/index.tsx index a987309..5a7a0cc 100644 --- a/src/components/PalmistryV1/pages/RelationshipStatus/index.tsx +++ b/src/components/PalmistryV1/pages/RelationshipStatus/index.tsx @@ -12,7 +12,7 @@ import { ELocalesPlacement } from "@/locales"; import { useMemo } from "react"; import { ELottieKeys, useLottie } from "@/hooks/lottie/useLottie"; import { useSession } from "@/hooks/session/useSession"; -import { IAnswersSession } from "@/api/resources/Session"; +import { IAnswersSessionPalmistry } from "@/api/resources/Session"; import { ESourceAuthorization } from "@/api/resources/User"; function RelationshipStatus() { @@ -28,7 +28,7 @@ function RelationshipStatus() { }); const answers: { - id: IAnswersSession["relationship_status"]; + id: IAnswersSessionPalmistry["relationship_status"]; title: string; }[] = useMemo( () => [ @@ -44,7 +44,7 @@ function RelationshipStatus() { [translate] ); - const handleClick = async (id: IAnswersSession["relationship_status"]) => { + const handleClick = async (id: IAnswersSessionPalmistry["relationship_status"]) => { dispatch(actions.palmistryV1Answers.update({ relationshipStatus: id })); await updateSession({ answers: { diff --git a/src/components/PalmistryV1/pages/WhatAspects/index.tsx b/src/components/PalmistryV1/pages/WhatAspects/index.tsx index c510d43..2161c9d 100644 --- a/src/components/PalmistryV1/pages/WhatAspects/index.tsx +++ b/src/components/PalmistryV1/pages/WhatAspects/index.tsx @@ -12,7 +12,7 @@ import { useTranslations } from "@/hooks/translations"; import { useMemo } from "react"; import { ELottieKeys, useLottie } from "@/hooks/lottie/useLottie"; import { useSession } from "@/hooks/session/useSession"; -import { IAnswersSession } from "@/api/resources/Session"; +import { IAnswersSessionPalmistry } from "@/api/resources/Session"; import { ESourceAuthorization } from "@/api/resources/User"; function WhatAspects() { @@ -25,7 +25,7 @@ function WhatAspects() { preloadKey: ELottieKeys.scalesHeartPalmistry, }); - const aspects: { id: IAnswersSession["what_aspects"]; title: string }[] = + const aspects: { id: IAnswersSessionPalmistry["what_aspects"]; title: string }[] = useMemo( () => [ { @@ -44,7 +44,7 @@ function WhatAspects() { [translate] ); - const handleClick = async (id: IAnswersSession["what_aspects"]) => { + const handleClick = async (id: IAnswersSessionPalmistry["what_aspects"]) => { dispatch(actions.palmistryV1Answers.update({ whatAspects: id })); await updateSession( { diff --git a/src/components/palmistry/step-color-you-like/step-color-you-like.tsx b/src/components/palmistry/step-color-you-like/step-color-you-like.tsx index b999488..d8c250c 100644 --- a/src/components/palmistry/step-color-you-like/step-color-you-like.tsx +++ b/src/components/palmistry/step-color-you-like/step-color-you-like.tsx @@ -4,7 +4,7 @@ import useSteps, { ColorYouLikeChoice, } from "../../../hooks/palmistry/use-steps"; import { useSession } from "@/hooks/session/useSession"; -import { IAnswersSession } from "@/api/resources/Session"; +import { IAnswersSessionPalmistry } from "@/api/resources/Session"; import { ESourceAuthorization } from "@/api/resources/User"; import { useTranslations } from "@/hooks/translations"; import { ELocalesPlacement } from "@/locales"; @@ -19,7 +19,7 @@ export default function StepColorYouLike() { { answers: { favorite_color: - choice.toLowerCase() as IAnswersSession["favorite_color"], + choice.toLowerCase() as IAnswersSessionPalmistry["favorite_color"], }, }, ESourceAuthorization["aura.palmistry"] diff --git a/src/components/palmistry/step-decisions/step-decisions.tsx b/src/components/palmistry/step-decisions/step-decisions.tsx index 118b3f1..f660d70 100644 --- a/src/components/palmistry/step-decisions/step-decisions.tsx +++ b/src/components/palmistry/step-decisions/step-decisions.tsx @@ -1,7 +1,7 @@ import Button from "../button/button"; import useSteps, { DecisionsChoice } from "../../../hooks/palmistry/use-steps"; import { useSession } from "@/hooks/session/useSession"; -import { IAnswersSession } from "@/api/resources/Session"; +import { IAnswersSessionPalmistry } from "@/api/resources/Session"; import { ESourceAuthorization } from "@/api/resources/User"; import { ELocalesPlacement } from "@/locales"; import { useTranslations } from "@/hooks/translations"; @@ -17,7 +17,7 @@ export default function StepDecisions() { { answers: { head_or_heart: - choice.toLowerCase() as IAnswersSession["head_or_heart"], + choice.toLowerCase() as IAnswersSessionPalmistry["head_or_heart"], }, }, ESourceAuthorization["aura.palmistry"] diff --git a/src/components/palmistry/step-resonated-element/step-resonated-element.tsx b/src/components/palmistry/step-resonated-element/step-resonated-element.tsx index 9a93f92..ff514f1 100644 --- a/src/components/palmistry/step-resonated-element/step-resonated-element.tsx +++ b/src/components/palmistry/step-resonated-element/step-resonated-element.tsx @@ -3,7 +3,7 @@ import useSteps, { ResonatedElementChoice, } from "../../../hooks/palmistry/use-steps"; import { useSession } from "@/hooks/session/useSession"; -import { IAnswersSession } from "@/api/resources/Session"; +import { IAnswersSessionPalmistry } from "@/api/resources/Session"; import { ESourceAuthorization } from "@/api/resources/User"; import { useTranslations } from "@/hooks/translations"; import { ELocalesPlacement } from "@/locales"; @@ -19,7 +19,7 @@ export default function StepResonatedElement() { { answers: { element_resonates: - choice.toLowerCase() as IAnswersSession["element_resonates"], + choice.toLowerCase() as IAnswersSessionPalmistry["element_resonates"], }, }, ESourceAuthorization["aura.palmistry"] diff --git a/src/components/palmistry/step-wish/step-wish.tsx b/src/components/palmistry/step-wish/step-wish.tsx index 62a5095..431bb76 100644 --- a/src/components/palmistry/step-wish/step-wish.tsx +++ b/src/components/palmistry/step-wish/step-wish.tsx @@ -1,13 +1,13 @@ import Button from "../button/button"; import useSteps, { WishChoice } from "../../../hooks/palmistry/use-steps"; import { useSession } from "@/hooks/session/useSession"; -import { IAnswersSession } from "@/api/resources/Session"; +import { IAnswersSessionPalmistry } from "@/api/resources/Session"; import { ESourceAuthorization } from "@/api/resources/User"; import { useTranslations } from "@/hooks/translations"; import { ELocalesPlacement } from "@/locales"; const choiceForSession: { - [key in WishChoice]: IAnswersSession["what_aspects"]; + [key in WishChoice]: IAnswersSessionPalmistry["what_aspects"]; } = { [WishChoice.Love]: "love_relationships", [WishChoice.Health]: "health_vitality",