This commit is contained in:
Daniil Chemerkin 2024-07-29 23:23:29 +00:00
parent 3d1f33011e
commit 71a0b89530
7 changed files with 29 additions and 5 deletions

View File

@ -8,6 +8,7 @@ import { useNavigate } from "react-router-dom";
import routes from "@/routes";
import QuestionnaireGreenButton from "../../../../ui/GreenButton";
import { ELottieKeys, useLottie } from "@/hooks/lottie/useLottie";
import metricService from "@/services/metric/metricService";
interface IBirthdateCustomAnswerProps {
affiliation?: "self" | "partner";
@ -44,8 +45,23 @@ function BirthdateCustomAnswer({
setIsDisabled(_birthdate === "");
};
const getAge = () => {
const today = new Date();
const birthDate = new Date(birthdate);
let age = today?.getFullYear() - birthDate?.getFullYear();
const m = today?.getMonth() - birthDate?.getMonth();
if (m < 0 || (m === 0 && today?.getDate() < birthDate?.getDate())) {
age--;
}
return age;
};
const handleNext = () => {
if (affiliation === "self") {
const age = getAge();
metricService.userParams({
age,
});
dispatch(actions.questionnaire.update({ birthdate }));
navigate(routes.client.singleZodiacInfoV1());
}

View File

@ -16,7 +16,7 @@ function AboutUsPage() {
const [selectedAnswer, setSelectedAnswer] = useState<IAnswer | null>(null);
const clickAnswerTimeOutRef = useRef<NodeJS.Timeout>();
const [searchParams] = useSearchParams()
const aboutUsAnswersKey = searchParams.get('key') ?? "aboutUsAnswersNormal"
const aboutUsAnswersKey = searchParams.get('key') ?? "aboutUsAnswersA"
const handleClick = async (answer: IAnswer) => {
setSelectedAnswer(answer);

View File

@ -14,7 +14,9 @@ import { genders } from "../../data/genders";
import PrivacyPolicy from "../../components/PrivacyPolicy";
import Toast from "../../components/Toast";
import { DotLottieReact } from "@lottiefiles/dotlottie-react";
import { useMetricABFlags } from "@/services/metric/metricService";
import metricService, {
useMetricABFlags,
} from "@/services/metric/metricService";
import { usePreloadImages } from "@/hooks/preload/images";
interface IGenderPageProps {
@ -73,6 +75,10 @@ function GenderPage({ productKey }: IGenderPageProps): JSX.Element {
if (!selectedGender) return;
await new Promise((resolve) => setTimeout(resolve, 1000));
dispatch(actions.questionnaire.update({ gender: selectedGender.id }));
metricService.userParams({
gender: selectedGender.name,
});
if (productKey === EProductKeys["moons.pdf.aura"]) {
return navigate(routes.client.epeBirthdate());
}

View File

@ -87,7 +87,7 @@ function PaymentTable({
<span className={styles.discount}>
${Number(getText("full.price")) / 100}
</span>
{product.trialPrice !== 50 && <span>${product.price / 100}</span>}
{product.trialPrice !== 50 && <span>${getPrice(product)}</span>}
{product.trialPrice === 50 && <span>${getPrice(product)}</span>}
</div>
</div>

View File

@ -27,7 +27,7 @@ function AboutUsPage() {
</Title>
<div className={styles["answers-container"]}>
{aboutUsAnswers['aboutUsAnswersNormal'].map((answer, index) => (
{aboutUsAnswers["aboutUsAnswersA"].map((answer, index) => (
<Answer
classNameContainer={styles["answer-container"]}
key={index}

View File

@ -58,7 +58,7 @@ function PaymentTable({ product, buttonClick }: IPaymentTableProps) {
<p>Your cost per 2 weeks after trial</p>
<div>
<span className={styles.discount}>$65</span>
<span>${product.trialPrice / 100}</span>
<span>${getPrice(product)}</span>
</div>
</div>
</div>

View File

@ -32,6 +32,8 @@ interface IUserParams {
genderFrom: string;
email: string;
hasPersonalVideo: boolean;
gender: string;
age: number;
}
const environments = import.meta.env