Develop
This commit is contained in:
parent
a049e5e8c9
commit
c0d0533235
@ -20,11 +20,11 @@ export interface PayloadUpdate {
|
|||||||
|
|
||||||
profile?: Partial<ICreateAuthorizeUser>;
|
profile?: Partial<ICreateAuthorizeUser>;
|
||||||
partner?: Partial<Exclude<ICreateAuthorizeUser, "relationship_status">>;
|
partner?: Partial<Exclude<ICreateAuthorizeUser, "relationship_status">>;
|
||||||
answers?: Partial<IAnswersSession>;
|
answers?: Partial<IAnswersSessionPalmistry | IAnswersSessionChats>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IAnswersSession {
|
export interface IAnswersSessionPalmistry {
|
||||||
what_aspects: 'love_relationships' | 'health_vitality' | 'career_destiny', // Type: string, optional - 'love_relationships' | 'health_vitality' | 'career_destiny';
|
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';
|
relationship_status: 'single' | 'in_relationship', // Type: string, optional - 'single' | 'in_relationship';
|
||||||
element_resonates: 'water' | 'fire' | 'air' | 'earth', // Type: string, optional - 'water' | 'fire' | 'air' | 'earth';
|
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;
|
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 {
|
export interface ResponseCreate {
|
||||||
status: "success" | string,
|
status: "success" | string,
|
||||||
sessionId: string
|
sessionId: string
|
||||||
|
|||||||
@ -20,6 +20,10 @@ export function createMethod<P, R>(createRequest: (payload: P) => Request) {
|
|||||||
source = ESourceAuthorization["aura.palmistry.new"];
|
source = ESourceAuthorization["aura.palmistry.new"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (location.pathname.includes("/chats")) {
|
||||||
|
source = ESourceAuthorization["aura.chats"];
|
||||||
|
}
|
||||||
|
|
||||||
const sessionId = localStorage.getItem(`${source}_sessionId`);
|
const sessionId = localStorage.getItem(`${source}_sessionId`);
|
||||||
|
|
||||||
if (sessionId?.length) {
|
if (sessionId?.length) {
|
||||||
|
|||||||
@ -2,6 +2,9 @@ import { useDispatch } from "react-redux";
|
|||||||
import { IAnswer } from "../../data";
|
import { IAnswer } from "../../data";
|
||||||
import styles from "./styles.module.scss";
|
import styles from "./styles.module.scss";
|
||||||
import { actions } from "@/store";
|
import { actions } from "@/store";
|
||||||
|
import { useSession } from "@/hooks/session/useSession";
|
||||||
|
import { ESourceAuthorization } from "@/api/resources/User";
|
||||||
|
import routes from "@/routes";
|
||||||
|
|
||||||
interface IAnswerProps {
|
interface IAnswerProps {
|
||||||
answer: IAnswer;
|
answer: IAnswer;
|
||||||
@ -10,6 +13,14 @@ interface IAnswerProps {
|
|||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const notUpdateSessionRoutes = [
|
||||||
|
routes.client.chatsQuizSatisfiedWithLife(),
|
||||||
|
routes.client.chatsQuizProneToOverthinking(),
|
||||||
|
routes.client.chatsQuizHeadOrHeart(),
|
||||||
|
routes.client.chatsQuizDecisionGuidance(),
|
||||||
|
routes.client.chatsQuizReadingExperience(),
|
||||||
|
];
|
||||||
|
|
||||||
function Answer({
|
function Answer({
|
||||||
answer,
|
answer,
|
||||||
classNameContainer = "",
|
classNameContainer = "",
|
||||||
@ -17,8 +28,19 @@ function Answer({
|
|||||||
onClick,
|
onClick,
|
||||||
}: IAnswerProps) {
|
}: IAnswerProps) {
|
||||||
const dispatch = useDispatch();
|
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(
|
dispatch(
|
||||||
actions.chats.updateAnswers({
|
actions.chats.updateAnswers({
|
||||||
[answer.questionId]: answer.value,
|
[answer.questionId]: answer.value,
|
||||||
|
|||||||
@ -8,15 +8,26 @@ import { useState } from "react";
|
|||||||
import Button from "@/components/ChatsPath/ui/Button";
|
import Button from "@/components/ChatsPath/ui/Button";
|
||||||
import ZodiacWheel from "@/components/ChatsPath/components/ZodiacWheel";
|
import ZodiacWheel from "@/components/ChatsPath/components/ZodiacWheel";
|
||||||
import { useUpdateStep } from "@/components/ChatsPath/hooks/useUpdateStep";
|
import { useUpdateStep } from "@/components/ChatsPath/hooks/useUpdateStep";
|
||||||
|
import { useSession } from "@/hooks/session/useSession";
|
||||||
|
import { ESourceAuthorization } from "@/api/resources/User";
|
||||||
|
|
||||||
function Date() {
|
function Date() {
|
||||||
|
const { updateSession } = useSession();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
useUpdateStep(4);
|
useUpdateStep(4);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const birthdate = useSelector(selectors.selectBirthdate);
|
const birthdate = useSelector(selectors.selectBirthdate);
|
||||||
const [isDisabled, setIsDisabled] = useState(true);
|
const [isDisabled, setIsDisabled] = useState(true);
|
||||||
|
|
||||||
const handleNext = () => {
|
const handleNext = async () => {
|
||||||
|
await updateSession(
|
||||||
|
{
|
||||||
|
profile: {
|
||||||
|
birthdate: `${birthdate} 00:00`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ESourceAuthorization["aura.chats"]
|
||||||
|
);
|
||||||
navigate(routes.client.chatsQuizParentStatus());
|
navigate(routes.client.chatsQuizParentStatus());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -10,13 +10,27 @@ import AnswerDescription, {
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { selectors } from "@/store";
|
import { selectors } from "@/store";
|
||||||
import Button from "@/components/ChatsPath/ui/Button";
|
import Button from "@/components/ChatsPath/ui/Button";
|
||||||
|
import { useSession } from "@/hooks/session/useSession";
|
||||||
|
import { ESourceAuthorization } from "@/api/resources/User";
|
||||||
|
|
||||||
function DecisionGuidance() {
|
function DecisionGuidance() {
|
||||||
|
const { updateSession } = useSession();
|
||||||
useUpdateStep(18);
|
useUpdateStep(18);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const answer = useSelector(selectors.selectAnswers)?.decisionGuidance;
|
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());
|
navigate(routes.client.chatsQuizResonateLove());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -7,14 +7,25 @@ import MultiplyAnswers from "@/components/ChatsPath/components/MultiplyAnswers";
|
|||||||
import Button from "@/components/ChatsPath/ui/Button";
|
import Button from "@/components/ChatsPath/ui/Button";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { selectors } from "@/store";
|
import { selectors } from "@/store";
|
||||||
|
import { useSession } from "@/hooks/session/useSession";
|
||||||
|
import { ESourceAuthorization } from "@/api/resources/User";
|
||||||
|
|
||||||
function GuidanceArea() {
|
function GuidanceArea() {
|
||||||
|
const { updateSession } = useSession();
|
||||||
useUpdateStep(27);
|
useUpdateStep(27);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const answer = useSelector(selectors.selectAnswers)?.guidanceArea;
|
const answer = useSelector(selectors.selectAnswers)?.guidanceArea;
|
||||||
|
|
||||||
const handleNext = () => {
|
const handleNext = async () => {
|
||||||
if (!answer?.length) return;
|
if (!answer?.length) return;
|
||||||
|
await updateSession(
|
||||||
|
{
|
||||||
|
answers: {
|
||||||
|
guidanceArea: answer,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ESourceAuthorization["aura.chats"]
|
||||||
|
);
|
||||||
navigate(routes.client.chatsQuizPsychicComfortable());
|
navigate(routes.client.chatsQuizPsychicComfortable());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -10,13 +10,27 @@ import AnswerDescription, {
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { selectors } from "@/store";
|
import { selectors } from "@/store";
|
||||||
import Button from "@/components/ChatsPath/ui/Button";
|
import Button from "@/components/ChatsPath/ui/Button";
|
||||||
|
import { useSession } from "@/hooks/session/useSession";
|
||||||
|
import { ESourceAuthorization } from "@/api/resources/User";
|
||||||
|
|
||||||
function HeadOrHeart() {
|
function HeadOrHeart() {
|
||||||
|
const { updateSession } = useSession();
|
||||||
useUpdateStep(15);
|
useUpdateStep(15);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const answer = useSelector(selectors.selectAnswers)?.headOrHeart;
|
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());
|
navigate(routes.client.chatsQuizHowConfident());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -10,16 +10,15 @@ import AnswerDescription, {
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { selectors } from "@/store";
|
import { selectors } from "@/store";
|
||||||
import Button from "@/components/ChatsPath/ui/Button";
|
import Button from "@/components/ChatsPath/ui/Button";
|
||||||
|
import { useSession } from "@/hooks/session/useSession";
|
||||||
|
import { ESourceAuthorization } from "@/api/resources/User";
|
||||||
|
|
||||||
function ProneToOverthinking() {
|
function ProneToOverthinking() {
|
||||||
|
const { updateSession } = useSession();
|
||||||
useUpdateStep(12);
|
useUpdateStep(12);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const answer = useSelector(selectors.selectAnswers)?.proneToOverthinking;
|
const answer = useSelector(selectors.selectAnswers)?.proneToOverthinking;
|
||||||
|
|
||||||
const handleNext = () => {
|
|
||||||
navigate(routes.client.chatsQuizWorriesImpact());
|
|
||||||
};
|
|
||||||
|
|
||||||
const answers: IAnswer[] = [
|
const answers: IAnswer[] = [
|
||||||
{
|
{
|
||||||
id: 1,
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<h2 className={`chats-answers-title`}>Are you prone to overthinking?</h2>
|
<h2 className={`chats-answers-title`}>Are you prone to overthinking?</h2>
|
||||||
|
|||||||
@ -8,14 +8,25 @@ import Button from "@/components/ChatsPath/ui/Button";
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { selectors } from "@/store";
|
import { selectors } from "@/store";
|
||||||
import Tip from "@/components/ChatsPath/components/Tip";
|
import Tip from "@/components/ChatsPath/components/Tip";
|
||||||
|
import { ESourceAuthorization } from "@/api/resources/User";
|
||||||
|
import { useSession } from "@/hooks/session/useSession";
|
||||||
|
|
||||||
function PsychicComfortable() {
|
function PsychicComfortable() {
|
||||||
|
const { updateSession } = useSession();
|
||||||
useUpdateStep(28);
|
useUpdateStep(28);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const answer = useSelector(selectors.selectAnswers)?.psychicComfortable;
|
const answer = useSelector(selectors.selectAnswers)?.psychicComfortable;
|
||||||
|
|
||||||
const handleNext = () => {
|
const handleNext = async () => {
|
||||||
if (!answer?.length) return;
|
if (!answer?.length) return;
|
||||||
|
await updateSession(
|
||||||
|
{
|
||||||
|
answers: {
|
||||||
|
psychicComfortable: answer,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ESourceAuthorization["aura.chats"]
|
||||||
|
);
|
||||||
navigate(routes.client.chatsQuizUserName());
|
navigate(routes.client.chatsQuizUserName());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -10,13 +10,27 @@ import AnswerDescription, {
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { selectors } from "@/store";
|
import { selectors } from "@/store";
|
||||||
import Button from "@/components/ChatsPath/ui/Button";
|
import Button from "@/components/ChatsPath/ui/Button";
|
||||||
|
import { ESourceAuthorization } from "@/api/resources/User";
|
||||||
|
import { useSession } from "@/hooks/session/useSession";
|
||||||
|
|
||||||
function ReadingExperience() {
|
function ReadingExperience() {
|
||||||
|
const { updateSession } = useSession();
|
||||||
useUpdateStep(23);
|
useUpdateStep(23);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const answer = useSelector(selectors.selectAnswers)?.readingExperience;
|
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());
|
navigate(routes.client.chatsQuizInterestedHowLong());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -6,13 +6,24 @@ import { useDispatch } from "react-redux";
|
|||||||
import { actions } from "@/store";
|
import { actions } from "@/store";
|
||||||
import YesNoButtons from "@/components/ChatsPath/components/YesNoButtons";
|
import YesNoButtons from "@/components/ChatsPath/components/YesNoButtons";
|
||||||
import { images } from "@/components/ChatsPath/data";
|
import { images } from "@/components/ChatsPath/data";
|
||||||
|
import { ESourceAuthorization } from "@/api/resources/User";
|
||||||
|
import { useSession } from "@/hooks/session/useSession";
|
||||||
|
|
||||||
function ResonateFuture() {
|
function ResonateFuture() {
|
||||||
|
const { updateSession } = useSession();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
useUpdateStep(21);
|
useUpdateStep(21);
|
||||||
const navigate = useNavigate();
|
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 }));
|
dispatch(actions.chats.updateAnswers({ resonateFuture: answer }));
|
||||||
navigate(routes.client.chatsPreferencesIntro());
|
navigate(routes.client.chatsPreferencesIntro());
|
||||||
};
|
};
|
||||||
|
|||||||
@ -6,13 +6,24 @@ import { useDispatch } from "react-redux";
|
|||||||
import { actions } from "@/store";
|
import { actions } from "@/store";
|
||||||
import YesNoButtons from "@/components/ChatsPath/components/YesNoButtons";
|
import YesNoButtons from "@/components/ChatsPath/components/YesNoButtons";
|
||||||
import { images } from "@/components/ChatsPath/data";
|
import { images } from "@/components/ChatsPath/data";
|
||||||
|
import { useSession } from "@/hooks/session/useSession";
|
||||||
|
import { ESourceAuthorization } from "@/api/resources/User";
|
||||||
|
|
||||||
function ResonateLife() {
|
function ResonateLife() {
|
||||||
|
const { updateSession } = useSession();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
useUpdateStep(20);
|
useUpdateStep(20);
|
||||||
const navigate = useNavigate();
|
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 }));
|
dispatch(actions.chats.updateAnswers({ resonateLife: answer }));
|
||||||
navigate(routes.client.chatsQuizResonateFuture());
|
navigate(routes.client.chatsQuizResonateFuture());
|
||||||
};
|
};
|
||||||
|
|||||||
@ -6,13 +6,24 @@ import { useDispatch } from "react-redux";
|
|||||||
import { actions } from "@/store";
|
import { actions } from "@/store";
|
||||||
import YesNoButtons from "@/components/ChatsPath/components/YesNoButtons";
|
import YesNoButtons from "@/components/ChatsPath/components/YesNoButtons";
|
||||||
import { images } from "@/components/ChatsPath/data";
|
import { images } from "@/components/ChatsPath/data";
|
||||||
|
import { useSession } from "@/hooks/session/useSession";
|
||||||
|
import { ESourceAuthorization } from "@/api/resources/User";
|
||||||
|
|
||||||
function ResonateLove() {
|
function ResonateLove() {
|
||||||
|
const { updateSession } = useSession();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
useUpdateStep(19);
|
useUpdateStep(19);
|
||||||
const navigate = useNavigate();
|
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 }));
|
dispatch(actions.chats.updateAnswers({ resonateLove: answer }));
|
||||||
navigate(routes.client.chatsQuizResonateLife());
|
navigate(routes.client.chatsQuizResonateLife());
|
||||||
};
|
};
|
||||||
|
|||||||
@ -10,16 +10,15 @@ import AnswerDescription, {
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { selectors } from "@/store";
|
import { selectors } from "@/store";
|
||||||
import Button from "@/components/ChatsPath/ui/Button";
|
import Button from "@/components/ChatsPath/ui/Button";
|
||||||
|
import { useSession } from "@/hooks/session/useSession";
|
||||||
|
import { ESourceAuthorization } from "@/api/resources/User";
|
||||||
|
|
||||||
function SatisfiedWithLife() {
|
function SatisfiedWithLife() {
|
||||||
|
const { updateSession } = useSession();
|
||||||
useUpdateStep(6);
|
useUpdateStep(6);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const answer = useSelector(selectors.selectAnswers)?.satisfiedWithLife;
|
const answer = useSelector(selectors.selectAnswers)?.satisfiedWithLife;
|
||||||
|
|
||||||
const handleNext = () => {
|
|
||||||
navigate(routes.client.chatsQuizWhatEmotion());
|
|
||||||
};
|
|
||||||
|
|
||||||
const answers: IAnswer[] = [
|
const answers: IAnswer[] = [
|
||||||
{
|
{
|
||||||
id: 1,
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<h2 className={`chats-answers-title ${styles.title}`}>
|
<h2 className={`chats-answers-title ${styles.title}`}>
|
||||||
|
|||||||
@ -8,8 +8,11 @@ import { actions, selectors } from "@/store";
|
|||||||
import Tip from "@/components/ChatsPath/components/Tip";
|
import Tip from "@/components/ChatsPath/components/Tip";
|
||||||
import NameInput from "@/components/pages/ABDesign/v1/pages/EmailEnterPage/NameInput";
|
import NameInput from "@/components/pages/ABDesign/v1/pages/EmailEnterPage/NameInput";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import { ESourceAuthorization } from "@/api/resources/User";
|
||||||
|
import { useSession } from "@/hooks/session/useSession";
|
||||||
|
|
||||||
function UserName() {
|
function UserName() {
|
||||||
|
const { updateSession } = useSession();
|
||||||
useUpdateStep(29);
|
useUpdateStep(29);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@ -17,8 +20,16 @@ function UserName() {
|
|||||||
const [name, setName] = useState("");
|
const [name, setName] = useState("");
|
||||||
const [isValidName, setIsValidName] = useState(false);
|
const [isValidName, setIsValidName] = useState(false);
|
||||||
|
|
||||||
const handleNext = () => {
|
const handleNext = async () => {
|
||||||
if (!answer?.length) return;
|
if (!answer?.length) return;
|
||||||
|
await updateSession(
|
||||||
|
{
|
||||||
|
profile: {
|
||||||
|
name,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ESourceAuthorization["aura.chats"]
|
||||||
|
);
|
||||||
navigate(routes.client.chatsQuizProcessing());
|
navigate(routes.client.chatsQuizProcessing());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -12,12 +12,27 @@ import Address from "../../components/Address";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import routes from "@/routes";
|
import routes from "@/routes";
|
||||||
import { useRef } from "react";
|
import { useRef } from "react";
|
||||||
|
import { useSession } from "@/hooks/session/useSession";
|
||||||
|
import { EGender, ESourceAuthorization } from "@/api/resources/User";
|
||||||
|
|
||||||
function Welcome() {
|
function Welcome() {
|
||||||
|
const { createSession, updateSession } = useSession();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const genderScrollRef = useRef<HTMLDivElement>(null);
|
const genderScrollRef = useRef<HTMLDivElement>(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());
|
navigate(routes.client.chatsQuizPsychicReading());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import FireSVG from "../../images/SVG/Fire";
|
|||||||
import AirSVG from "../../images/SVG/Air";
|
import AirSVG from "../../images/SVG/Air";
|
||||||
import EarthSVG from "../../images/SVG/Earth";
|
import EarthSVG from "../../images/SVG/Earth";
|
||||||
import { ELottieKeys, useLottie } from "@/hooks/lottie/useLottie";
|
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 { useSession } from "@/hooks/session/useSession";
|
||||||
import { ESourceAuthorization } from "@/api/resources/User";
|
import { ESourceAuthorization } from "@/api/resources/User";
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ function ElementResonates() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const answers: {
|
const answers: {
|
||||||
id: IAnswersSession["element_resonates"];
|
id: IAnswersSessionPalmistry["element_resonates"];
|
||||||
title: string;
|
title: string;
|
||||||
Icon: JSX.Element;
|
Icon: JSX.Element;
|
||||||
}[] = useMemo(
|
}[] = useMemo(
|
||||||
@ -59,7 +59,7 @@ function ElementResonates() {
|
|||||||
[translate]
|
[translate]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleClick = async (id: IAnswersSession["element_resonates"]) => {
|
const handleClick = async (id: IAnswersSessionPalmistry["element_resonates"]) => {
|
||||||
dispatch(actions.palmistryV1Answers.update({ elementResonates: id }));
|
dispatch(actions.palmistryV1Answers.update({ elementResonates: id }));
|
||||||
await updateSession({
|
await updateSession({
|
||||||
answers: {
|
answers: {
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import { ELocalesPlacement } from "@/locales";
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import TabSVG from "../../images/SVG/Tab";
|
import TabSVG from "../../images/SVG/Tab";
|
||||||
import { usePreloadImages } from "@/hooks/preload/images";
|
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 { useSession } from "@/hooks/session/useSession";
|
||||||
import { ESourceAuthorization } from "@/api/resources/User";
|
import { ESourceAuthorization } from "@/api/resources/User";
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ function FavoriteColor() {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const answers: {
|
const answers: {
|
||||||
id: IAnswersSession["favorite_color"];
|
id: IAnswersSessionPalmistry["favorite_color"];
|
||||||
title: string;
|
title: string;
|
||||||
color?: string;
|
color?: string;
|
||||||
}[] = useMemo(
|
}[] = useMemo(
|
||||||
@ -70,7 +70,7 @@ function FavoriteColor() {
|
|||||||
[translate]
|
[translate]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleClick = async (id: IAnswersSession["favorite_color"]) => {
|
const handleClick = async (id: IAnswersSessionPalmistry["favorite_color"]) => {
|
||||||
dispatch(actions.palmistryV1Answers.update({ favoriteColor: id }));
|
dispatch(actions.palmistryV1Answers.update({ favoriteColor: id }));
|
||||||
await updateSession({
|
await updateSession({
|
||||||
answers: {
|
answers: {
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import { ELocalesPlacement } from "@/locales";
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { usePreloadImages } from "@/hooks/preload/images";
|
import { usePreloadImages } from "@/hooks/preload/images";
|
||||||
import { useSession } from "@/hooks/session/useSession";
|
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 { ESourceAuthorization } from "@/api/resources/User";
|
||||||
|
|
||||||
function HeadOrHeart() {
|
function HeadOrHeart() {
|
||||||
@ -34,7 +34,7 @@ function HeadOrHeart() {
|
|||||||
"/v1/palmistry/partners.png",
|
"/v1/palmistry/partners.png",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const answers: { id: IAnswersSession["head_or_heart"]; title: string }[] =
|
const answers: { id: IAnswersSessionPalmistry["head_or_heart"]; title: string }[] =
|
||||||
useMemo(
|
useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
@ -53,7 +53,7 @@ function HeadOrHeart() {
|
|||||||
[translate]
|
[translate]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleClick = async (id: IAnswersSession["head_or_heart"]) => {
|
const handleClick = async (id: IAnswersSessionPalmistry["head_or_heart"]) => {
|
||||||
dispatch(actions.palmistryV1Answers.update({ headOrHeart: id }));
|
dispatch(actions.palmistryV1Answers.update({ headOrHeart: id }));
|
||||||
await updateSession(
|
await updateSession(
|
||||||
{
|
{
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import { ELocalesPlacement } from "@/locales";
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { ELottieKeys, useLottie } from "@/hooks/lottie/useLottie";
|
import { ELottieKeys, useLottie } from "@/hooks/lottie/useLottie";
|
||||||
import { useSession } from "@/hooks/session/useSession";
|
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 { ESourceAuthorization } from "@/api/resources/User";
|
||||||
|
|
||||||
function RelationshipStatus() {
|
function RelationshipStatus() {
|
||||||
@ -28,7 +28,7 @@ function RelationshipStatus() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const answers: {
|
const answers: {
|
||||||
id: IAnswersSession["relationship_status"];
|
id: IAnswersSessionPalmistry["relationship_status"];
|
||||||
title: string;
|
title: string;
|
||||||
}[] = useMemo(
|
}[] = useMemo(
|
||||||
() => [
|
() => [
|
||||||
@ -44,7 +44,7 @@ function RelationshipStatus() {
|
|||||||
[translate]
|
[translate]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleClick = async (id: IAnswersSession["relationship_status"]) => {
|
const handleClick = async (id: IAnswersSessionPalmistry["relationship_status"]) => {
|
||||||
dispatch(actions.palmistryV1Answers.update({ relationshipStatus: id }));
|
dispatch(actions.palmistryV1Answers.update({ relationshipStatus: id }));
|
||||||
await updateSession({
|
await updateSession({
|
||||||
answers: {
|
answers: {
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import { useTranslations } from "@/hooks/translations";
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { ELottieKeys, useLottie } from "@/hooks/lottie/useLottie";
|
import { ELottieKeys, useLottie } from "@/hooks/lottie/useLottie";
|
||||||
import { useSession } from "@/hooks/session/useSession";
|
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 { ESourceAuthorization } from "@/api/resources/User";
|
||||||
|
|
||||||
function WhatAspects() {
|
function WhatAspects() {
|
||||||
@ -25,7 +25,7 @@ function WhatAspects() {
|
|||||||
preloadKey: ELottieKeys.scalesHeartPalmistry,
|
preloadKey: ELottieKeys.scalesHeartPalmistry,
|
||||||
});
|
});
|
||||||
|
|
||||||
const aspects: { id: IAnswersSession["what_aspects"]; title: string }[] =
|
const aspects: { id: IAnswersSessionPalmistry["what_aspects"]; title: string }[] =
|
||||||
useMemo(
|
useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
@ -44,7 +44,7 @@ function WhatAspects() {
|
|||||||
[translate]
|
[translate]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleClick = async (id: IAnswersSession["what_aspects"]) => {
|
const handleClick = async (id: IAnswersSessionPalmistry["what_aspects"]) => {
|
||||||
dispatch(actions.palmistryV1Answers.update({ whatAspects: id }));
|
dispatch(actions.palmistryV1Answers.update({ whatAspects: id }));
|
||||||
await updateSession(
|
await updateSession(
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import useSteps, {
|
|||||||
ColorYouLikeChoice,
|
ColorYouLikeChoice,
|
||||||
} from "../../../hooks/palmistry/use-steps";
|
} from "../../../hooks/palmistry/use-steps";
|
||||||
import { useSession } from "@/hooks/session/useSession";
|
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 { ESourceAuthorization } from "@/api/resources/User";
|
||||||
import { useTranslations } from "@/hooks/translations";
|
import { useTranslations } from "@/hooks/translations";
|
||||||
import { ELocalesPlacement } from "@/locales";
|
import { ELocalesPlacement } from "@/locales";
|
||||||
@ -19,7 +19,7 @@ export default function StepColorYouLike() {
|
|||||||
{
|
{
|
||||||
answers: {
|
answers: {
|
||||||
favorite_color:
|
favorite_color:
|
||||||
choice.toLowerCase() as IAnswersSession["favorite_color"],
|
choice.toLowerCase() as IAnswersSessionPalmistry["favorite_color"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ESourceAuthorization["aura.palmistry"]
|
ESourceAuthorization["aura.palmistry"]
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import Button from "../button/button";
|
import Button from "../button/button";
|
||||||
import useSteps, { DecisionsChoice } from "../../../hooks/palmistry/use-steps";
|
import useSteps, { DecisionsChoice } from "../../../hooks/palmistry/use-steps";
|
||||||
import { useSession } from "@/hooks/session/useSession";
|
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 { ESourceAuthorization } from "@/api/resources/User";
|
||||||
import { ELocalesPlacement } from "@/locales";
|
import { ELocalesPlacement } from "@/locales";
|
||||||
import { useTranslations } from "@/hooks/translations";
|
import { useTranslations } from "@/hooks/translations";
|
||||||
@ -17,7 +17,7 @@ export default function StepDecisions() {
|
|||||||
{
|
{
|
||||||
answers: {
|
answers: {
|
||||||
head_or_heart:
|
head_or_heart:
|
||||||
choice.toLowerCase() as IAnswersSession["head_or_heart"],
|
choice.toLowerCase() as IAnswersSessionPalmistry["head_or_heart"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ESourceAuthorization["aura.palmistry"]
|
ESourceAuthorization["aura.palmistry"]
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import useSteps, {
|
|||||||
ResonatedElementChoice,
|
ResonatedElementChoice,
|
||||||
} from "../../../hooks/palmistry/use-steps";
|
} from "../../../hooks/palmistry/use-steps";
|
||||||
import { useSession } from "@/hooks/session/useSession";
|
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 { ESourceAuthorization } from "@/api/resources/User";
|
||||||
import { useTranslations } from "@/hooks/translations";
|
import { useTranslations } from "@/hooks/translations";
|
||||||
import { ELocalesPlacement } from "@/locales";
|
import { ELocalesPlacement } from "@/locales";
|
||||||
@ -19,7 +19,7 @@ export default function StepResonatedElement() {
|
|||||||
{
|
{
|
||||||
answers: {
|
answers: {
|
||||||
element_resonates:
|
element_resonates:
|
||||||
choice.toLowerCase() as IAnswersSession["element_resonates"],
|
choice.toLowerCase() as IAnswersSessionPalmistry["element_resonates"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ESourceAuthorization["aura.palmistry"]
|
ESourceAuthorization["aura.palmistry"]
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
import Button from "../button/button";
|
import Button from "../button/button";
|
||||||
import useSteps, { WishChoice } from "../../../hooks/palmistry/use-steps";
|
import useSteps, { WishChoice } from "../../../hooks/palmistry/use-steps";
|
||||||
import { useSession } from "@/hooks/session/useSession";
|
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 { ESourceAuthorization } from "@/api/resources/User";
|
||||||
import { useTranslations } from "@/hooks/translations";
|
import { useTranslations } from "@/hooks/translations";
|
||||||
import { ELocalesPlacement } from "@/locales";
|
import { ELocalesPlacement } from "@/locales";
|
||||||
|
|
||||||
const choiceForSession: {
|
const choiceForSession: {
|
||||||
[key in WishChoice]: IAnswersSession["what_aspects"];
|
[key in WishChoice]: IAnswersSessionPalmistry["what_aspects"];
|
||||||
} = {
|
} = {
|
||||||
[WishChoice.Love]: "love_relationships",
|
[WishChoice.Love]: "love_relationships",
|
||||||
[WishChoice.Health]: "health_vitality",
|
[WishChoice.Health]: "health_vitality",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user