Merge branch 'develop' into 'main'

AW-429-comp-v1-ios-ab

See merge request witapp/aura-webapp!705
This commit is contained in:
Daniil Chemerkin 2025-03-26 17:14:10 +00:00
commit c116b163f0
10 changed files with 39 additions and 116 deletions

View File

@ -5,7 +5,6 @@ import { useState } from "react";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { actions, selectors } from "@/store"; import { actions, selectors } from "@/store";
import Button from "../../components/Button"; import Button from "../../components/Button";
import metricService from "@/services/metric/metricService";
import routes, { compatibilityV2Prefix } from "@/routes"; import routes, { compatibilityV2Prefix } from "@/routes";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useTranslations } from "@/hooks/translations"; import { useTranslations } from "@/hooks/translations";
@ -27,23 +26,7 @@ function BirthdatePartner() {
setIsDisabled(_birthdate === ""); 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 = () => { const handleNext = () => {
const age = getAge();
metricService.userParams({
age,
});
// dispatch(actions.form.addDate(birthdate));
dispatch(actions.questionnaire.update({ partnerBirthdate: birthdate })); dispatch(actions.questionnaire.update({ partnerBirthdate: birthdate }));
navigate(routes.client.compatibilityV2PalmsInformationPartner()); navigate(routes.client.compatibilityV2PalmsInformationPartner());
updateSession( updateSession(

View File

@ -5,7 +5,6 @@ import { useState } from "react";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { actions, selectors } from "@/store"; import { actions, selectors } from "@/store";
import Button from "../../components/Button"; import Button from "../../components/Button";
import metricService from "@/services/metric/metricService";
import routes, { compatibilityV2Prefix } from "@/routes"; import routes, { compatibilityV2Prefix } from "@/routes";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useTranslations } from "@/hooks/translations"; import { useTranslations } from "@/hooks/translations";
@ -29,23 +28,7 @@ function DateEvent() {
setIsDisabled(_birthdate === ""); setIsDisabled(_birthdate === "");
}; };
const getAge = () => {
const today = new Date();
const date = new Date(dateEvent);
let age = today?.getFullYear() - date?.getFullYear();
const m = today?.getMonth() - date?.getMonth();
if (m < 0 || (m === 0 && today?.getDate() < date?.getDate())) {
age--;
}
return age;
};
const handleNext = () => { const handleNext = () => {
const age = getAge();
metricService.userParams({
age,
});
// dispatch(actions.form.addDate(birthdate));
dispatch(actions.compatibilityV2Answers.update({ dateEvent })); dispatch(actions.compatibilityV2Answers.update({ dateEvent }));
navigate(routes.client.compatibilityV2HeadOrHeart()); navigate(routes.client.compatibilityV2HeadOrHeart());
updateSession( updateSession(

View File

@ -5,7 +5,6 @@ import { useState } from "react";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { actions, selectors } from "@/store"; import { actions, selectors } from "@/store";
import Button from "../../components/Button"; import Button from "../../components/Button";
import metricService from "@/services/metric/metricService";
import routes, { compatibilityV3Prefix } from "@/routes"; import routes, { compatibilityV3Prefix } from "@/routes";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useTranslations } from "@/hooks/translations"; import { useTranslations } from "@/hooks/translations";
@ -27,23 +26,7 @@ function BirthdatePartner() {
setIsDisabled(_birthdate === ""); 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 = () => { const handleNext = () => {
const age = getAge();
metricService.userParams({
age,
});
// dispatch(actions.form.addDate(birthdate));
dispatch(actions.questionnaire.update({ partnerBirthdate: birthdate })); dispatch(actions.questionnaire.update({ partnerBirthdate: birthdate }));
navigate(routes.client.compatibilityV3PalmsInformationPartner()); navigate(routes.client.compatibilityV3PalmsInformationPartner());
updateSession( updateSession(

View File

@ -5,7 +5,6 @@ import { useState } from "react";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { actions, selectors } from "@/store"; import { actions, selectors } from "@/store";
import Button from "../../components/Button"; import Button from "../../components/Button";
import metricService from "@/services/metric/metricService";
import routes, { compatibilityV3Prefix } from "@/routes"; import routes, { compatibilityV3Prefix } from "@/routes";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useTranslations } from "@/hooks/translations"; import { useTranslations } from "@/hooks/translations";
@ -29,23 +28,7 @@ function DateEvent() {
setIsDisabled(_birthdate === ""); setIsDisabled(_birthdate === "");
}; };
const getAge = () => {
const today = new Date();
const date = new Date(dateEvent);
let age = today?.getFullYear() - date?.getFullYear();
const m = today?.getMonth() - date?.getMonth();
if (m < 0 || (m === 0 && today?.getDate() < date?.getDate())) {
age--;
}
return age;
};
const handleNext = () => { const handleNext = () => {
const age = getAge();
metricService.userParams({
age,
});
// dispatch(actions.form.addDate(birthdate));
dispatch(actions.compatibilityV3Answers.update({ dateEvent })); dispatch(actions.compatibilityV3Answers.update({ dateEvent }));
navigate(routes.client.compatibilityV3HeadOrHeart()); navigate(routes.client.compatibilityV3HeadOrHeart());
updateSession( updateSession(

View File

@ -5,7 +5,6 @@ import { useState } from "react";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { actions, selectors } from "@/store"; import { actions, selectors } from "@/store";
import Button from "../../components/Button"; import Button from "../../components/Button";
import metricService from "@/services/metric/metricService";
import routes from "@/routes"; import routes from "@/routes";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useTranslations } from "@/hooks/translations"; import { useTranslations } from "@/hooks/translations";
@ -27,23 +26,7 @@ function BirthdatePartner() {
setIsDisabled(_birthdate === ""); 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 = () => { const handleNext = () => {
const age = getAge();
metricService.userParams({
age,
});
// dispatch(actions.form.addDate(birthdate));
dispatch(actions.questionnaire.update({ partnerBirthdate: birthdate })); dispatch(actions.questionnaire.update({ partnerBirthdate: birthdate }));
navigate(routes.client.compatibilityV4BirthplacePartner()); navigate(routes.client.compatibilityV4BirthplacePartner());
updateSession( updateSession(

View File

@ -5,7 +5,6 @@ import { useState } from "react";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { actions, selectors } from "@/store"; import { actions, selectors } from "@/store";
import Button from "../../components/Button"; import Button from "../../components/Button";
import metricService from "@/services/metric/metricService";
import routes from "@/routes"; import routes from "@/routes";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useTranslations } from "@/hooks/translations"; import { useTranslations } from "@/hooks/translations";
@ -29,23 +28,7 @@ function DateEvent() {
setIsDisabled(_birthdate === ""); setIsDisabled(_birthdate === "");
}; };
const getAge = () => {
const today = new Date();
const date = new Date(dateEvent);
let age = today?.getFullYear() - date?.getFullYear();
const m = today?.getMonth() - date?.getMonth();
if (m < 0 || (m === 0 && today?.getDate() < date?.getDate())) {
age--;
}
return age;
};
const handleNext = () => { const handleNext = () => {
const age = getAge();
metricService.userParams({
age,
});
// dispatch(actions.form.addDate(birthdate));
dispatch(actions.compatibilityV4Answers.update({ dateEvent })); dispatch(actions.compatibilityV4Answers.update({ dateEvent }));
navigate(routes.client.compatibilityV4PartnerAnalysis()); navigate(routes.client.compatibilityV4PartnerAnalysis());
updateSession( updateSession(

View File

@ -21,11 +21,17 @@ import ProgressBarSubstrate from "./ProgressBarSubstrate";
import { useTranslations } from "@/hooks/translations"; import { useTranslations } from "@/hooks/translations";
import { ELocalesPlacement } from "@/locales"; import { ELocalesPlacement } from "@/locales";
import { useMetricABFlags } from "@/services/metric/metricService"; import { useMetricABFlags } from "@/services/metric/metricService";
import { EUnleashFlags, useUnleash } from "@/hooks/ab/unleash/useUnleash";
import { useAuthentication } from "@/hooks/authentication/use-authentication";
import { ESourceAuthorization } from "@/api/resources/User";
import { useSelector } from "react-redux";
import { selectors } from "@/store";
function LoadingProfilePage() { function LoadingProfilePage() {
// const userDeviceType = useSelector(selectors.selectUserDeviceType); // const userDeviceType = useSelector(selectors.selectUserDeviceType);
// const isShowTryApp = useSelector(selectors.selectIsShowTryApp); // const isShowTryApp = useSelector(selectors.selectIsShowTryApp);
const { width: pageWidth, elementRef: pageElement } = useDynamicSize({}); const { width: pageWidth, elementRef: pageElement } = useDynamicSize({});
const { authorization } = useAuthentication();
const navigate = useNavigate(); const navigate = useNavigate();
const { translate } = useTranslations(ELocalesPlacement.V1); const { translate } = useTranslations(ELocalesPlacement.V1);
@ -34,6 +40,19 @@ function LoadingProfilePage() {
const interval = useRef<NodeJS.Timeout>(); const interval = useRef<NodeJS.Timeout>();
const pointsRef = useRef<HTMLDivElement[]>([]); const pointsRef = useRef<HTMLDivElement[]>([]);
const { flags } = useMetricABFlags(); const { flags } = useMetricABFlags();
const { variant: emailEnterVariant } = useUnleash({
flag: EUnleashFlags.compatibilityV1EmailEnter,
});
const feature = useSelector(selectors.selectFeature);
const isHideEmailByFeature = feature?.includes("ios/link") ?? false;
useEffect(() => {
if (emailEnterVariant === "hide" || isHideEmailByFeature) {
(async () => {
await authorization("", ESourceAuthorization["aura.main.new"], true);
})();
}
}, [emailEnterVariant, isHideEmailByFeature]);
const onEndLoading = useCallback(() => { const onEndLoading = useCallback(() => {
// if (isShowTryApp && userDeviceType === EUserDeviceType.ios) { // if (isShowTryApp && userDeviceType === EUserDeviceType.ios) {
@ -43,8 +62,11 @@ function LoadingProfilePage() {
if (flags?.auraPalmistry?.[0] === "on") { if (flags?.auraPalmistry?.[0] === "on") {
return navigate(routes.client.findHappinessV1()); return navigate(routes.client.findHappinessV1());
} }
if (emailEnterVariant === "hide" || isHideEmailByFeature) {
return navigate(routes.client.onboardingV1());
}
return navigate(routes.client.emailEnterV1()); return navigate(routes.client.emailEnterV1());
}, [flags?.auraPalmistry, navigate]); }, [flags?.auraPalmistry, navigate, emailEnterVariant, isHideEmailByFeature]);
const getProgressValue = useCallback( const getProgressValue = useCallback(
(index: number) => { (index: number) => {
@ -114,9 +136,8 @@ function LoadingProfilePage() {
<div className={styles["points-container"]}> <div className={styles["points-container"]}>
{loadingProfilePoints.map(({ title, color }, index) => ( {loadingProfilePoints.map(({ title, color }, index) => (
<div <div
className={`${styles["point"]} ${ className={`${styles["point"]} ${getCurrentIndex() === index && styles["active"]
getCurrentIndex() === index && styles["active"] }`}
}`}
ref={(el) => (pointsRef.current[index] = el as HTMLDivElement)} ref={(el) => (pointsRef.current[index] = el as HTMLDivElement)}
key={`point-${index}`} key={`point-${index}`}
> >

View File

@ -36,7 +36,7 @@ function WithPartnerInformation(props: IWithPartnerInformationProps) {
<div className={styles["images-container"]}> <div className={styles["images-container"]}>
<div className={styles["image-container"]}> <div className={styles["image-container"]}>
<img <img
src={`/questionnaire-redesign/zodiacs/${gender}/pdf.sex.${zodiacSign?.toUpperCase()}.${gender.toUpperCase()}.webp`} src={`/questionnaire-redesign/zodiacs/${gender}/pdf.sex.${zodiacSign?.toUpperCase()}.${gender?.toUpperCase()}.webp`}
alt={`${gender} ${zodiacSign}`} alt={`${gender} ${zodiacSign}`}
/> />
<p>{translate("you")}</p> <p>{translate("you")}</p>
@ -44,7 +44,7 @@ function WithPartnerInformation(props: IWithPartnerInformationProps) {
<img src="/plus.svg" alt="Plus" /> <img src="/plus.svg" alt="Plus" />
<div className={styles["image-container"]}> <div className={styles["image-container"]}>
<img <img
src={`/questionnaire-redesign/zodiacs/${partnerGender}/pdf.sex.${partnerZodiacSign?.toUpperCase()}.${partnerGender.toUpperCase()}.webp`} src={`/questionnaire-redesign/zodiacs/${partnerGender}/pdf.sex.${partnerZodiacSign?.toUpperCase()}.${partnerGender?.toUpperCase()}.webp`}
alt={`${partnerGender} ${partnerZodiacSign}`} alt={`${partnerGender} ${partnerZodiacSign}`}
/> />
<p>{translate("partner")}</p> <p>{translate("partner")}</p>
@ -55,22 +55,22 @@ function WithPartnerInformation(props: IWithPartnerInformationProps) {
<li> <li>
<h6>{translate("/trial-payment.zodiac_sign")}</h6> <h6>{translate("/trial-payment.zodiac_sign")}</h6>
<p> <p>
{zodiacSign.length {zodiacSign?.length
? translate(`zodiac_signs.${zodiacSign?.toLowerCase()}`) ? translate(`zodiac_signs.${zodiacSign?.toLowerCase()}`)
: "-"} : "-"}
</p> </p>
</li> </li>
<li> <li>
<h6>{translate("gender")}</h6> <h6>{translate("gender")}</h6>
<p>{gender.length ? translate(gender?.toLowerCase()) : "-"}</p> <p>{gender?.length ? translate(gender?.toLowerCase()) : "-"}</p>
</li> </li>
<li> <li>
<h6>{translate("/trial-payment.date_of_birth")}</h6> <h6>{translate("/trial-payment.date_of_birth")}</h6>
<p>{birthdate.length ? birthdate : "-"}</p> <p>{birthdate?.length ? birthdate : "-"}</p>
</li> </li>
<li> <li>
<h6>{translate("/trial-payment.place_of_birth")}</h6> <h6>{translate("/trial-payment.place_of_birth")}</h6>
<p>{birthPlace.length ? birthPlace : "-"}</p> <p>{birthPlace?.length ? birthPlace : "-"}</p>
</li> </li>
</ul> </ul>
<ul> <ul>
@ -84,15 +84,15 @@ function WithPartnerInformation(props: IWithPartnerInformationProps) {
</li> </li>
<li> <li>
<h6>{translate("gender")}</h6> <h6>{translate("gender")}</h6>
<p>{partnerGender.length ? translate(partnerGender?.toLowerCase()) : "-"}</p> <p>{partnerGender?.length ? translate(partnerGender?.toLowerCase()) : "-"}</p>
</li> </li>
<li> <li>
<h6>{translate("/trial-payment.date_of_birth")}</h6> <h6>{translate("/trial-payment.date_of_birth")}</h6>
<p>{partnerBirthDate.length ? partnerBirthDate : "-"}</p> <p>{partnerBirthDate?.length ? partnerBirthDate : "-"}</p>
</li> </li>
<li> <li>
<h6>{translate("/trial-payment.place_of_birth")}</h6> <h6>{translate("/trial-payment.place_of_birth")}</h6>
<p>{partnerBirthPlace.length ? partnerBirthPlace : "-"}</p> <p>{partnerBirthPlace?.length ? partnerBirthPlace : "-"}</p>
</li> </li>
</ul> </ul>
</div> </div>

View File

@ -19,6 +19,7 @@ import { trialPaymentPointsList } from "@/data/pointsLists";
import BackgroundTopBlob from "../../ui/BackgroundTopBlob"; import BackgroundTopBlob from "../../ui/BackgroundTopBlob";
import { useDynamicSize } from "@/hooks/useDynamicSize"; import { useDynamicSize } from "@/hooks/useDynamicSize";
import metricService, { EGoals, EMetrics } from "@/services/metric/metricService"; import metricService, { EGoals, EMetrics } from "@/services/metric/metricService";
import { copyToClipboard } from "@/services/data";
function TryAppPage() { function TryAppPage() {
const { width: pageWidth, elementRef: pageRef } = useDynamicSize({}); const { width: pageWidth, elementRef: pageRef } = useDynamicSize({});
@ -48,8 +49,9 @@ function TryAppPage() {
setSingleOrWithPartner("single"); setSingleOrWithPartner("single");
}, [flowChoice]); }, [flowChoice]);
const downloadApp = () => { const downloadApp = async () => {
metricService.reachGoal(EGoals.DOWNLOAD_APP, [EMetrics.YANDEX]); metricService.reachGoal(EGoals.DOWNLOAD_APP, [EMetrics.YANDEX]);
await copyToClipboard(authCode);
// TODO // TODO
window.location.href = window.location.href =
"https://apps.apple.com/us/app/aura-astrology-horoscope/id1601978549"; "https://apps.apple.com/us/app/aura-astrology-horoscope/id1601978549";

View File

@ -22,6 +22,7 @@ export enum EUnleashFlags {
"headOrHeartResultPageCompatibilityV2" = "headOrHeartResultPageCompatibilityV2", "headOrHeartResultPageCompatibilityV2" = "headOrHeartResultPageCompatibilityV2",
"headOrHeartResultPageCompatibilityV3" = "headOrHeartResultPageCompatibilityV3", "headOrHeartResultPageCompatibilityV3" = "headOrHeartResultPageCompatibilityV3",
"headOrHeartResultPageCompatibilityV4" = "headOrHeartResultPageCompatibilityV4", "headOrHeartResultPageCompatibilityV4" = "headOrHeartResultPageCompatibilityV4",
"compatibilityV1EmailEnter" = "compatibilityV1EmailEnter",
} }
interface IUseUnleashProps<T extends EUnleashFlags> { interface IUseUnleashProps<T extends EUnleashFlags> {
@ -48,6 +49,7 @@ interface IVariants {
[EUnleashFlags.headOrHeartResultPageCompatibilityV2]: "v0" | "v1"; [EUnleashFlags.headOrHeartResultPageCompatibilityV2]: "v0" | "v1";
[EUnleashFlags.headOrHeartResultPageCompatibilityV3]: "v0" | "v1"; [EUnleashFlags.headOrHeartResultPageCompatibilityV3]: "v0" | "v1";
[EUnleashFlags.headOrHeartResultPageCompatibilityV4]: "v0" | "v1"; [EUnleashFlags.headOrHeartResultPageCompatibilityV4]: "v0" | "v1";
[EUnleashFlags.compatibilityV1EmailEnter]: "show" | "hide";
} }
/** /**