diff --git a/src/components/CompatibilityV2/pages/BirthdatePartner/index.tsx b/src/components/CompatibilityV2/pages/BirthdatePartner/index.tsx index 3e2c69f..90d25cf 100644 --- a/src/components/CompatibilityV2/pages/BirthdatePartner/index.tsx +++ b/src/components/CompatibilityV2/pages/BirthdatePartner/index.tsx @@ -5,7 +5,6 @@ import { useState } from "react"; import { useDispatch, useSelector } from "react-redux"; import { actions, selectors } from "@/store"; import Button from "../../components/Button"; -import metricService from "@/services/metric/metricService"; import routes, { compatibilityV2Prefix } from "@/routes"; import { useNavigate } from "react-router-dom"; import { useTranslations } from "@/hooks/translations"; @@ -27,23 +26,7 @@ function BirthdatePartner() { 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 age = getAge(); - metricService.userParams({ - age, - }); - // dispatch(actions.form.addDate(birthdate)); dispatch(actions.questionnaire.update({ partnerBirthdate: birthdate })); navigate(routes.client.compatibilityV2PalmsInformationPartner()); updateSession( diff --git a/src/components/CompatibilityV2/pages/DateEvent/index.tsx b/src/components/CompatibilityV2/pages/DateEvent/index.tsx index fd7a471..2742984 100644 --- a/src/components/CompatibilityV2/pages/DateEvent/index.tsx +++ b/src/components/CompatibilityV2/pages/DateEvent/index.tsx @@ -5,7 +5,6 @@ import { useState } from "react"; import { useDispatch, useSelector } from "react-redux"; import { actions, selectors } from "@/store"; import Button from "../../components/Button"; -import metricService from "@/services/metric/metricService"; import routes, { compatibilityV2Prefix } from "@/routes"; import { useNavigate } from "react-router-dom"; import { useTranslations } from "@/hooks/translations"; @@ -29,23 +28,7 @@ function DateEvent() { 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 age = getAge(); - metricService.userParams({ - age, - }); - // dispatch(actions.form.addDate(birthdate)); dispatch(actions.compatibilityV2Answers.update({ dateEvent })); navigate(routes.client.compatibilityV2HeadOrHeart()); updateSession( diff --git a/src/components/CompatibilityV3/pages/BirthdatePartner/index.tsx b/src/components/CompatibilityV3/pages/BirthdatePartner/index.tsx index 5bc7232..c88b27f 100644 --- a/src/components/CompatibilityV3/pages/BirthdatePartner/index.tsx +++ b/src/components/CompatibilityV3/pages/BirthdatePartner/index.tsx @@ -5,7 +5,6 @@ import { useState } from "react"; import { useDispatch, useSelector } from "react-redux"; import { actions, selectors } from "@/store"; import Button from "../../components/Button"; -import metricService from "@/services/metric/metricService"; import routes, { compatibilityV3Prefix } from "@/routes"; import { useNavigate } from "react-router-dom"; import { useTranslations } from "@/hooks/translations"; @@ -27,23 +26,7 @@ function BirthdatePartner() { 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 age = getAge(); - metricService.userParams({ - age, - }); - // dispatch(actions.form.addDate(birthdate)); dispatch(actions.questionnaire.update({ partnerBirthdate: birthdate })); navigate(routes.client.compatibilityV3PalmsInformationPartner()); updateSession( diff --git a/src/components/CompatibilityV3/pages/DateEvent/index.tsx b/src/components/CompatibilityV3/pages/DateEvent/index.tsx index 253356f..710b98b 100644 --- a/src/components/CompatibilityV3/pages/DateEvent/index.tsx +++ b/src/components/CompatibilityV3/pages/DateEvent/index.tsx @@ -5,7 +5,6 @@ import { useState } from "react"; import { useDispatch, useSelector } from "react-redux"; import { actions, selectors } from "@/store"; import Button from "../../components/Button"; -import metricService from "@/services/metric/metricService"; import routes, { compatibilityV3Prefix } from "@/routes"; import { useNavigate } from "react-router-dom"; import { useTranslations } from "@/hooks/translations"; @@ -29,23 +28,7 @@ function DateEvent() { 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 age = getAge(); - metricService.userParams({ - age, - }); - // dispatch(actions.form.addDate(birthdate)); dispatch(actions.compatibilityV3Answers.update({ dateEvent })); navigate(routes.client.compatibilityV3HeadOrHeart()); updateSession( diff --git a/src/components/CompatibilityV4/pages/BirthdatePartner/index.tsx b/src/components/CompatibilityV4/pages/BirthdatePartner/index.tsx index aa9d73a..2791443 100644 --- a/src/components/CompatibilityV4/pages/BirthdatePartner/index.tsx +++ b/src/components/CompatibilityV4/pages/BirthdatePartner/index.tsx @@ -5,7 +5,6 @@ import { useState } from "react"; import { useDispatch, useSelector } from "react-redux"; import { actions, selectors } from "@/store"; import Button from "../../components/Button"; -import metricService from "@/services/metric/metricService"; import routes from "@/routes"; import { useNavigate } from "react-router-dom"; import { useTranslations } from "@/hooks/translations"; @@ -27,23 +26,7 @@ function BirthdatePartner() { 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 age = getAge(); - metricService.userParams({ - age, - }); - // dispatch(actions.form.addDate(birthdate)); dispatch(actions.questionnaire.update({ partnerBirthdate: birthdate })); navigate(routes.client.compatibilityV4BirthplacePartner()); updateSession( diff --git a/src/components/CompatibilityV4/pages/DateEvent/index.tsx b/src/components/CompatibilityV4/pages/DateEvent/index.tsx index 42cbee1..2bfaabe 100644 --- a/src/components/CompatibilityV4/pages/DateEvent/index.tsx +++ b/src/components/CompatibilityV4/pages/DateEvent/index.tsx @@ -5,7 +5,6 @@ import { useState } from "react"; import { useDispatch, useSelector } from "react-redux"; import { actions, selectors } from "@/store"; import Button from "../../components/Button"; -import metricService from "@/services/metric/metricService"; import routes from "@/routes"; import { useNavigate } from "react-router-dom"; import { useTranslations } from "@/hooks/translations"; @@ -29,23 +28,7 @@ function DateEvent() { 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 age = getAge(); - metricService.userParams({ - age, - }); - // dispatch(actions.form.addDate(birthdate)); dispatch(actions.compatibilityV4Answers.update({ dateEvent })); navigate(routes.client.compatibilityV4PartnerAnalysis()); updateSession( diff --git a/src/components/pages/ABDesign/v1/pages/LoadingProfile/index.tsx b/src/components/pages/ABDesign/v1/pages/LoadingProfile/index.tsx index 038b6df..1045f93 100644 --- a/src/components/pages/ABDesign/v1/pages/LoadingProfile/index.tsx +++ b/src/components/pages/ABDesign/v1/pages/LoadingProfile/index.tsx @@ -21,11 +21,17 @@ import ProgressBarSubstrate from "./ProgressBarSubstrate"; import { useTranslations } from "@/hooks/translations"; import { ELocalesPlacement } from "@/locales"; 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() { // const userDeviceType = useSelector(selectors.selectUserDeviceType); // const isShowTryApp = useSelector(selectors.selectIsShowTryApp); const { width: pageWidth, elementRef: pageElement } = useDynamicSize({}); + const { authorization } = useAuthentication(); const navigate = useNavigate(); const { translate } = useTranslations(ELocalesPlacement.V1); @@ -34,6 +40,19 @@ function LoadingProfilePage() { const interval = useRef(); const pointsRef = useRef([]); 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(() => { // if (isShowTryApp && userDeviceType === EUserDeviceType.ios) { @@ -43,8 +62,11 @@ function LoadingProfilePage() { if (flags?.auraPalmistry?.[0] === "on") { return navigate(routes.client.findHappinessV1()); } + if (emailEnterVariant === "hide" || isHideEmailByFeature) { + return navigate(routes.client.onboardingV1()); + } return navigate(routes.client.emailEnterV1()); - }, [flags?.auraPalmistry, navigate]); + }, [flags?.auraPalmistry, navigate, emailEnterVariant, isHideEmailByFeature]); const getProgressValue = useCallback( (index: number) => { @@ -114,9 +136,8 @@ function LoadingProfilePage() {
{loadingProfilePoints.map(({ title, color }, index) => (
(pointsRef.current[index] = el as HTMLDivElement)} key={`point-${index}`} > diff --git a/src/components/pages/ABDesign/v1/pages/TrialPayment/components/WithPartnerInformation/index.tsx b/src/components/pages/ABDesign/v1/pages/TrialPayment/components/WithPartnerInformation/index.tsx index a63f0e8..ca28391 100644 --- a/src/components/pages/ABDesign/v1/pages/TrialPayment/components/WithPartnerInformation/index.tsx +++ b/src/components/pages/ABDesign/v1/pages/TrialPayment/components/WithPartnerInformation/index.tsx @@ -36,7 +36,7 @@ function WithPartnerInformation(props: IWithPartnerInformationProps) {
{`${gender}

{translate("you")}

@@ -44,7 +44,7 @@ function WithPartnerInformation(props: IWithPartnerInformationProps) { Plus
{`${partnerGender}

{translate("partner")}

@@ -55,22 +55,22 @@ function WithPartnerInformation(props: IWithPartnerInformationProps) {
  • {translate("/trial-payment.zodiac_sign")}

    - {zodiacSign.length + {zodiacSign?.length ? translate(`zodiac_signs.${zodiacSign?.toLowerCase()}`) : "-"}

  • {translate("gender")}
    -

    {gender.length ? translate(gender?.toLowerCase()) : "-"}

    +

    {gender?.length ? translate(gender?.toLowerCase()) : "-"}

  • {translate("/trial-payment.date_of_birth")}
    -

    {birthdate.length ? birthdate : "-"}

    +

    {birthdate?.length ? birthdate : "-"}

  • {translate("/trial-payment.place_of_birth")}
    -

    {birthPlace.length ? birthPlace : "-"}

    +

    {birthPlace?.length ? birthPlace : "-"}

    • @@ -84,15 +84,15 @@ function WithPartnerInformation(props: IWithPartnerInformationProps) {
    • {translate("gender")}
      -

      {partnerGender.length ? translate(partnerGender?.toLowerCase()) : "-"}

      +

      {partnerGender?.length ? translate(partnerGender?.toLowerCase()) : "-"}

    • {translate("/trial-payment.date_of_birth")}
      -

      {partnerBirthDate.length ? partnerBirthDate : "-"}

      +

      {partnerBirthDate?.length ? partnerBirthDate : "-"}

    • {translate("/trial-payment.place_of_birth")}
      -

      {partnerBirthPlace.length ? partnerBirthPlace : "-"}

      +

      {partnerBirthPlace?.length ? partnerBirthPlace : "-"}

    diff --git a/src/components/pages/ABDesign/v1/pages/TryApp/index.tsx b/src/components/pages/ABDesign/v1/pages/TryApp/index.tsx index e600a85..00e9128 100644 --- a/src/components/pages/ABDesign/v1/pages/TryApp/index.tsx +++ b/src/components/pages/ABDesign/v1/pages/TryApp/index.tsx @@ -19,6 +19,7 @@ import { trialPaymentPointsList } from "@/data/pointsLists"; import BackgroundTopBlob from "../../ui/BackgroundTopBlob"; import { useDynamicSize } from "@/hooks/useDynamicSize"; import metricService, { EGoals, EMetrics } from "@/services/metric/metricService"; +import { copyToClipboard } from "@/services/data"; function TryAppPage() { const { width: pageWidth, elementRef: pageRef } = useDynamicSize({}); @@ -48,8 +49,9 @@ function TryAppPage() { setSingleOrWithPartner("single"); }, [flowChoice]); - const downloadApp = () => { + const downloadApp = async () => { metricService.reachGoal(EGoals.DOWNLOAD_APP, [EMetrics.YANDEX]); + await copyToClipboard(authCode); // TODO window.location.href = "https://apps.apple.com/us/app/aura-astrology-horoscope/id1601978549"; diff --git a/src/hooks/ab/unleash/useUnleash.ts b/src/hooks/ab/unleash/useUnleash.ts index bb6c638..b3b655d 100644 --- a/src/hooks/ab/unleash/useUnleash.ts +++ b/src/hooks/ab/unleash/useUnleash.ts @@ -22,6 +22,7 @@ export enum EUnleashFlags { "headOrHeartResultPageCompatibilityV2" = "headOrHeartResultPageCompatibilityV2", "headOrHeartResultPageCompatibilityV3" = "headOrHeartResultPageCompatibilityV3", "headOrHeartResultPageCompatibilityV4" = "headOrHeartResultPageCompatibilityV4", + "compatibilityV1EmailEnter" = "compatibilityV1EmailEnter", } interface IUseUnleashProps { @@ -48,6 +49,7 @@ interface IVariants { [EUnleashFlags.headOrHeartResultPageCompatibilityV2]: "v0" | "v1"; [EUnleashFlags.headOrHeartResultPageCompatibilityV3]: "v0" | "v1"; [EUnleashFlags.headOrHeartResultPageCompatibilityV4]: "v0" | "v1"; + [EUnleashFlags.compatibilityV1EmailEnter]: "show" | "hide"; } /**