Merge branch 'develop' into 'main'
Develop See merge request witapp/aura-webapp!408
This commit is contained in:
commit
97d674a0cd
@ -59,7 +59,7 @@ function Email() {
|
|||||||
EMetrics.YANDEX,
|
EMetrics.YANDEX,
|
||||||
EMetrics.FACEBOOK,
|
EMetrics.FACEBOOK,
|
||||||
]);
|
]);
|
||||||
metricService.reachGoal(EGoals.ENTER_EMAIL_PALMISTRY, [EMetrics.YANDEX]);
|
metricService.reachGoal(EGoals.ENTERED_EMAIL_PALMISTRY, [EMetrics.YANDEX]);
|
||||||
await authorization(email, ESourceAuthorization["aura.palmistry.new"]);
|
await authorization(email, ESourceAuthorization["aura.palmistry.new"]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
|
|
||||||
@ -10,7 +10,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 52px;
|
max-height: 80px;
|
||||||
padding: 12px 9px;
|
padding: 12px 9px;
|
||||||
border: solid 2px #3871c1;
|
border: solid 2px #3871c1;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
|
|||||||
@ -1,16 +1,12 @@
|
|||||||
import { useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import PaymentInformation from "../../components/PaymentInformation";
|
import PaymentInformation from "../../components/PaymentInformation";
|
||||||
import styles from "./styles.module.scss";
|
import styles from "./styles.module.scss";
|
||||||
import { selectors } from "@/store";
|
import { actions, selectors } from "@/store";
|
||||||
import { getFormattedPrice } from "@/utils/price.utils";
|
import { getFormattedPrice } from "@/utils/price.utils";
|
||||||
import Guarantees from "../../components/Guarantees";
|
import Guarantees from "../../components/Guarantees";
|
||||||
import Button from "../../components/Button";
|
import Button from "../../components/Button";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import {
|
import { useNavigate, useSearchParams } from "react-router-dom";
|
||||||
useNavigate,
|
|
||||||
useOutletContext,
|
|
||||||
useSearchParams,
|
|
||||||
} from "react-router-dom";
|
|
||||||
import routes from "@/routes";
|
import routes from "@/routes";
|
||||||
import { addCurrency, ELocalesPlacement } from "@/locales";
|
import { addCurrency, ELocalesPlacement } from "@/locales";
|
||||||
import { useTranslations } from "@/hooks/translations";
|
import { useTranslations } from "@/hooks/translations";
|
||||||
@ -20,27 +16,23 @@ import metricService, {
|
|||||||
EMetrics,
|
EMetrics,
|
||||||
} from "@/services/metric/metricService";
|
} from "@/services/metric/metricService";
|
||||||
|
|
||||||
interface IPaymentContext {
|
|
||||||
isShowPaymentModal: boolean;
|
|
||||||
setIsShowPaymentModal: React.Dispatch<React.SetStateAction<boolean>>;
|
|
||||||
}
|
|
||||||
|
|
||||||
function Payment() {
|
function Payment() {
|
||||||
|
const dispatch = useDispatch();
|
||||||
const { translate } = useTranslations(ELocalesPlacement.PalmistryV1);
|
const { translate } = useTranslations(ELocalesPlacement.PalmistryV1);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const activeProductFromStore = useSelector(selectors.selectActiveProduct);
|
const activeProductFromStore = useSelector(selectors.selectActiveProduct);
|
||||||
const currency = useSelector(selectors.selectCurrency);
|
const currency = useSelector(selectors.selectCurrency);
|
||||||
const trialPrice = activeProductFromStore?.trialPrice || 0;
|
const trialPrice = activeProductFromStore?.trialPrice || 0;
|
||||||
const fullPrice = activeProductFromStore?.price || 0;
|
const fullPrice = activeProductFromStore?.price || 0;
|
||||||
const { isShowPaymentModal, setIsShowPaymentModal } =
|
const isShowPaymentModal = useSelector(
|
||||||
useOutletContext<IPaymentContext>();
|
selectors.selectPalmistryIsShowPaymentModalV1
|
||||||
|
);
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const subscriptionStatus =
|
const subscriptionStatus =
|
||||||
searchParams.get("redirect_status") === "succeeded" ? "subscribed" : "lead";
|
searchParams.get("redirect_status") === "succeeded" ? "subscribed" : "lead";
|
||||||
|
|
||||||
const showModal = () => {
|
const showModal = () => {
|
||||||
setIsShowPaymentModal(true);
|
dispatch(actions.palmistry.setIsShowPaymentModalV1(true));
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -49,11 +41,17 @@ function Payment() {
|
|||||||
metricService.reachGoal(EGoals.PAYMENT_SUCCESS_PALMISTRY, [
|
metricService.reachGoal(EGoals.PAYMENT_SUCCESS_PALMISTRY, [
|
||||||
EMetrics.YANDEX,
|
EMetrics.YANDEX,
|
||||||
]);
|
]);
|
||||||
|
if (activeProductFromStore) {
|
||||||
|
metricService.reachGoal(EGoals.PURCHASE, [EMetrics.FACEBOOK], {
|
||||||
|
currency: "USD",
|
||||||
|
value: ((activeProductFromStore.trialPrice || 100) / 100).toFixed(2),
|
||||||
|
});
|
||||||
|
}
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
navigate(routes.client.skipTrial());
|
navigate(routes.client.skipTrial());
|
||||||
}, 1500);
|
}, 1500);
|
||||||
return () => clearTimeout(timer);
|
return () => clearTimeout(timer);
|
||||||
}, [navigate, subscriptionStatus]);
|
}, [activeProductFromStore, navigate, subscriptionStatus]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import Title from "@/components/Title";
|
import Title from "@/components/Title";
|
||||||
import styles from "./styles.module.css";
|
import styles from "./styles.module.scss";
|
||||||
import { useCallback, useEffect, useRef, useState } from "react";
|
import { useCallback, useEffect, useRef, useState } from "react";
|
||||||
import routes from "@/routes";
|
import routes from "@/routes";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
@ -16,6 +16,7 @@ import metricService, {
|
|||||||
} from "@/services/metric/metricService";
|
} from "@/services/metric/metricService";
|
||||||
import { useTranslations } from "@/hooks/translations";
|
import { useTranslations } from "@/hooks/translations";
|
||||||
import { ELocalesPlacement } from "@/locales";
|
import { ELocalesPlacement } from "@/locales";
|
||||||
|
import QuestionnaireGreenButton from "../../ui/GreenButton";
|
||||||
|
|
||||||
function OnboardingPage() {
|
function OnboardingPage() {
|
||||||
const { translate } = useTranslations(ELocalesPlacement.V1);
|
const { translate } = useTranslations(ELocalesPlacement.V1);
|
||||||
@ -25,6 +26,7 @@ function OnboardingPage() {
|
|||||||
const titleInterval = useRef<NodeJS.Timeout>();
|
const titleInterval = useRef<NodeJS.Timeout>();
|
||||||
const classNameTimeOut = useRef<NodeJS.Timeout>();
|
const classNameTimeOut = useRef<NodeJS.Timeout>();
|
||||||
const [progress, setProgress] = useState(0);
|
const [progress, setProgress] = useState(0);
|
||||||
|
const [isLoadingEnd, setIsLoadingEnd] = useState(false);
|
||||||
const progressInterval = useRef<NodeJS.Timeout>();
|
const progressInterval = useRef<NodeJS.Timeout>();
|
||||||
usePaywall({
|
usePaywall({
|
||||||
placementKey: EPlacementKeys["aura.placement.redesign.main"],
|
placementKey: EPlacementKeys["aura.placement.redesign.main"],
|
||||||
@ -50,9 +52,12 @@ function OnboardingPage() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isVideoReady && progress >= 100) {
|
if (isVideoReady && progress >= 100) {
|
||||||
handleNext();
|
if (auraVideoTrial === "on") {
|
||||||
|
return setIsLoadingEnd(true);
|
||||||
|
}
|
||||||
|
return handleNext();
|
||||||
}
|
}
|
||||||
}, [activeIndexTitle, handleNext, isVideoReady, progress]);
|
}, [activeIndexTitle, auraVideoTrial, handleNext, isVideoReady, progress]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setPeriodClassName("to-nontransparent");
|
setPeriodClassName("to-nontransparent");
|
||||||
@ -115,19 +120,33 @@ function OnboardingPage() {
|
|||||||
</Title>
|
</Title>
|
||||||
)}
|
)}
|
||||||
<footer className={styles.footer}>
|
<footer className={styles.footer}>
|
||||||
<div className={styles["progress-bar__text-container"]}>
|
<div
|
||||||
|
className={`${styles["progress-bar__text-container"]} ${
|
||||||
|
isLoadingEnd && styles.hide
|
||||||
|
}`}
|
||||||
|
>
|
||||||
<Title variant="h2" className={styles["progress-bar__title"]}>
|
<Title variant="h2" className={styles["progress-bar__title"]}>
|
||||||
{translate("/onboarding.loader_title")}
|
{translate("/onboarding.loader_title")}
|
||||||
</Title>
|
</Title>
|
||||||
<p className={styles["progress-bar__percentage"]}>{progress}%</p>
|
<p className={styles["progress-bar__percentage"]}>{progress}%</p>
|
||||||
</div>
|
</div>
|
||||||
<ProgressBarLine
|
<ProgressBarLine
|
||||||
containerClassName={styles["progress-bar__container"]}
|
containerClassName={`${styles["progress-bar__container"]} ${
|
||||||
|
isLoadingEnd && styles.hide
|
||||||
|
}`}
|
||||||
lineClassName={styles["progress-bar__line"]}
|
lineClassName={styles["progress-bar__line"]}
|
||||||
lineColor={"#3750A8"}
|
lineColor={"#3750A8"}
|
||||||
value={progress}
|
value={progress}
|
||||||
delay={(onboardingTitles.length * 5000) / 100}
|
delay={(onboardingTitles.length * 5000) / 100}
|
||||||
/>
|
/>
|
||||||
|
{isLoadingEnd && (
|
||||||
|
<QuestionnaireGreenButton
|
||||||
|
className={styles.button}
|
||||||
|
onClick={handleNext}
|
||||||
|
>
|
||||||
|
Next
|
||||||
|
</QuestionnaireGreenButton>
|
||||||
|
)}
|
||||||
</footer>
|
</footer>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
height: fit-content;
|
height: fit-content;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
min-height: 100dvh;
|
min-height: 100dvh;
|
||||||
background: #0F1323;
|
background: #0f1323;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 460px;
|
max-width: 460px;
|
||||||
padding: 15px 40px calc(0dvh + 63px);
|
padding: 15px 40px calc(0dvh + 63px);
|
||||||
@ -20,7 +20,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
color: #BDEBFF;
|
color: #bdebff;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
max-width: 300px;
|
max-width: 300px;
|
||||||
font-size: 32px;
|
font-size: 32px;
|
||||||
@ -40,8 +40,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.progress-bar__container {
|
.progress-bar__container {
|
||||||
background-color: #ACDCFF;
|
background-color: #acdcff;
|
||||||
height: 9px;
|
height: 9px;
|
||||||
|
transition: opacity 1s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hide {
|
||||||
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.progress-bar__text-container {
|
.progress-bar__text-container {
|
||||||
@ -51,6 +56,7 @@
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0 12px;
|
padding: 0 12px;
|
||||||
|
transition: opacity 1s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.progress-bar__text-container * {
|
.progress-bar__text-container * {
|
||||||
@ -63,6 +69,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@ -84,3 +91,19 @@
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
animation: appearance 1s forwards 1s;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes appearance {
|
||||||
|
0% {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,7 +2,7 @@ import styles from "./styles.module.scss";
|
|||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, 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 { useNavigate } from "react-router-dom";
|
import { useNavigate, useOutletContext } from "react-router-dom";
|
||||||
import routes from "@/routes";
|
import routes from "@/routes";
|
||||||
import EmailsList from "@/components/EmailsList";
|
import EmailsList from "@/components/EmailsList";
|
||||||
import Header from "../../components/Header";
|
import Header from "../../components/Header";
|
||||||
@ -19,12 +19,12 @@ import metricService, {
|
|||||||
EMetrics,
|
EMetrics,
|
||||||
useMetricABFlags,
|
useMetricABFlags,
|
||||||
} from "@/services/metric/metricService";
|
} from "@/services/metric/metricService";
|
||||||
import PersonalVideo from "../TrialPayment/components/PersonalVideo";
|
|
||||||
import Toast from "../../components/Toast";
|
import Toast from "../../components/Toast";
|
||||||
import BlurComponent from "@/components/BlurComponent";
|
import BlurComponent from "@/components/BlurComponent";
|
||||||
import { useTranslations } from "@/hooks/translations";
|
import { useTranslations } from "@/hooks/translations";
|
||||||
import { ELocalesPlacement } from "@/locales";
|
import { ELocalesPlacement } from "@/locales";
|
||||||
import DiscountExpires from "../TrialPayment/components/DiscountExpires";
|
import DiscountExpires from "../TrialPayment/components/DiscountExpires";
|
||||||
|
import { IOutletContext } from "@/routerComponents/ABDesign/v1/LayoutABDesignV1";
|
||||||
|
|
||||||
enum EDisplayOptionButton {
|
enum EDisplayOptionButton {
|
||||||
"alwaysVisible" = "alwaysVisible",
|
"alwaysVisible" = "alwaysVisible",
|
||||||
@ -44,7 +44,6 @@ function TrialChoiceVideoPage() {
|
|||||||
const [isDisabled, setIsDisabled] = useState(true);
|
const [isDisabled, setIsDisabled] = useState(true);
|
||||||
const [visibleToast, setVisibleToast] = useState(false);
|
const [visibleToast, setVisibleToast] = useState(false);
|
||||||
const [countUsers, setCountUsers] = useState(752);
|
const [countUsers, setCountUsers] = useState(752);
|
||||||
const [isVisibleElements, setIsVisibleElements] = useState(false);
|
|
||||||
const { width: pageWidth, elementRef: pageRef } = useDynamicSize({});
|
const { width: pageWidth, elementRef: pageRef } = useDynamicSize({});
|
||||||
const { gender } = useSelector(selectors.selectQuestionnaire);
|
const { gender } = useSelector(selectors.selectQuestionnaire);
|
||||||
const { products, isLoading, currency, getText } = usePaywall({
|
const { products, isLoading, currency, getText } = usePaywall({
|
||||||
@ -52,31 +51,26 @@ function TrialChoiceVideoPage() {
|
|||||||
localesPlacement: ELocalesPlacement.V1,
|
localesPlacement: ELocalesPlacement.V1,
|
||||||
});
|
});
|
||||||
const arrowLeft = useSelector(selectors.selectTrialChoiceArrowOptions)?.left;
|
const arrowLeft = useSelector(selectors.selectTrialChoiceArrowOptions)?.left;
|
||||||
const showElementsTimer = useRef<NodeJS.Timeout>();
|
const containerVideoRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
|
const { containerVideoRef: videoRef, isVisibleElements } =
|
||||||
|
useOutletContext<IOutletContext>();
|
||||||
|
|
||||||
const { flags } = useMetricABFlags();
|
const { flags } = useMetricABFlags();
|
||||||
const isShowTimer = flags?.showTimerTrial?.[0] === "show";
|
const isShowTimer = flags?.showTimerTrial?.[0] === "show";
|
||||||
|
|
||||||
const { videoUrl } = useSelector(selectors.selectPersonalVideo);
|
const { videoUrl } = useSelector(selectors.selectPersonalVideo);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
dispatch(actions.personalVideo.updateIsVideoPlaying(true));
|
||||||
|
}, [dispatch]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
metricService.reachGoal(EGoals.AURA_TRIAL_CHOICE_PAGE_VISIT, [
|
metricService.reachGoal(EGoals.AURA_TRIAL_CHOICE_PAGE_VISIT, [
|
||||||
EMetrics.KLAVIYO,
|
EMetrics.KLAVIYO,
|
||||||
]);
|
]);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
return () => {
|
|
||||||
if (showElementsTimer.current) clearTimeout(showElementsTimer.current);
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const showElements = () => {
|
|
||||||
showElementsTimer.current = setTimeout(() => {
|
|
||||||
setIsVisibleElements(true);
|
|
||||||
}, 33_000);
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const randomDelay = getRandomArbitrary(3000, 5000);
|
const randomDelay = getRandomArbitrary(3000, 5000);
|
||||||
const countUsersTimeOut = setTimeout(() => {
|
const countUsersTimeOut = setTimeout(() => {
|
||||||
@ -111,6 +105,12 @@ function TrialChoiceVideoPage() {
|
|||||||
return () => clearTimeout(timeOut);
|
return () => clearTimeout(timeOut);
|
||||||
}, [visibleToast]);
|
}, [visibleToast]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!containerVideoRef.current || !videoRef.current) return;
|
||||||
|
containerVideoRef.current?.appendChild(videoRef.current);
|
||||||
|
videoRef.current.classList.add(styles["personal-video"]);
|
||||||
|
}, [videoRef]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section
|
<section
|
||||||
className={`${styles.page} page`}
|
className={`${styles.page} page`}
|
||||||
@ -126,13 +126,15 @@ function TrialChoiceVideoPage() {
|
|||||||
height={180}
|
height={180}
|
||||||
/>
|
/>
|
||||||
<Header className={styles.header} />
|
<Header className={styles.header} />
|
||||||
<PersonalVideo
|
<div ref={containerVideoRef} />
|
||||||
|
{/* <PersonalVideo
|
||||||
gender={gender}
|
gender={gender}
|
||||||
url={"/trial-choice.MOV"}
|
url={"/trial-choice.MOV"}
|
||||||
classNameContainer={styles["personal-video"]}
|
classNameContainer={styles["personal-video"]}
|
||||||
isVisibleControllers={isVisibleElements}
|
isVisibleControllers={isVisibleElements}
|
||||||
onVideoStart={showElements}
|
onVideoStart={showElements}
|
||||||
/>
|
/> */}
|
||||||
|
{/* {containerVideoRef.current?.ELEMENT_NODE} */}
|
||||||
{!isLoading && isVisibleElements && (
|
{!isLoading && isVisibleElements && (
|
||||||
<>
|
<>
|
||||||
{isShowTimer && (
|
{isShowTimer && (
|
||||||
|
|||||||
@ -156,6 +156,7 @@
|
|||||||
bottom: calc(0dvh + 16px);
|
bottom: calc(0dvh + 16px);
|
||||||
width: calc(100% - 84px) !important;
|
width: calc(100% - 84px) !important;
|
||||||
max-width: 396px;
|
max-width: 396px;
|
||||||
|
z-index: 999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gradient-blur {
|
.gradient-blur {
|
||||||
@ -195,6 +196,8 @@
|
|||||||
// position: fixed !important;
|
// position: fixed !important;
|
||||||
// top: 0dvh;
|
// top: 0dvh;
|
||||||
// z-index: 30;
|
// z-index: 30;
|
||||||
|
|
||||||
|
display: block;
|
||||||
margin-top: 32px !important;
|
margin-top: 32px !important;
|
||||||
border-radius: 0 !important;
|
border-radius: 0 !important;
|
||||||
background-image: url("/trial-choice-preview.png") !important;
|
background-image: url("/trial-choice-preview.png") !important;
|
||||||
|
|||||||
@ -5,12 +5,16 @@ import Loader from "@/components/Loader";
|
|||||||
import PlayButton from "../../../../ui/PlayButton";
|
import PlayButton from "../../../../ui/PlayButton";
|
||||||
import metricService, { EGoals } from "@/services/metric/metricService";
|
import metricService, { EGoals } from "@/services/metric/metricService";
|
||||||
import PlayPauseButton from "../../../../ui/PlayPauseButton";
|
import PlayPauseButton from "../../../../ui/PlayPauseButton";
|
||||||
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
import { actions, selectors } from "@/store";
|
||||||
|
|
||||||
interface IPersonalVideoProps {
|
interface IPersonalVideoProps {
|
||||||
gender: string;
|
gender: string;
|
||||||
url: string;
|
url: string;
|
||||||
classNameContainer?: string;
|
classNameContainer?: string;
|
||||||
isVisibleControllers?: boolean;
|
isVisibleControllers?: boolean;
|
||||||
|
containerRef?: React.RefObject<HTMLDivElement>;
|
||||||
|
isAutoPlay?: boolean;
|
||||||
onVideoStart?: () => void;
|
onVideoStart?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,12 +24,19 @@ const PersonalVideo = React.memo<IPersonalVideoProps>(
|
|||||||
gender,
|
gender,
|
||||||
classNameContainer = "",
|
classNameContainer = "",
|
||||||
isVisibleControllers = true,
|
isVisibleControllers = true,
|
||||||
|
containerRef,
|
||||||
|
isAutoPlay = true,
|
||||||
onVideoStart,
|
onVideoStart,
|
||||||
}) => {
|
}) => {
|
||||||
const [isPlaying, setIsPlaying] = useState(false);
|
const dispatch = useDispatch();
|
||||||
|
const { isVideoPlaying } = useSelector(selectors.selectPersonalVideo);
|
||||||
const [isStarted, setIsStarted] = useState(false);
|
const [isStarted, setIsStarted] = useState(false);
|
||||||
const [isError, setIsError] = useState(false);
|
const [isError, setIsError] = useState(false);
|
||||||
|
|
||||||
|
const setIsPlaying = (isPlaying: boolean) => {
|
||||||
|
dispatch(actions.personalVideo.updateIsVideoPlaying(isPlaying));
|
||||||
|
};
|
||||||
|
|
||||||
const onError = (error: unknown) => {
|
const onError = (error: unknown) => {
|
||||||
if (!error) return;
|
if (!error) return;
|
||||||
setIsError(true);
|
setIsError(true);
|
||||||
@ -34,6 +45,7 @@ const PersonalVideo = React.memo<IPersonalVideoProps>(
|
|||||||
|
|
||||||
const onStart = () => {
|
const onStart = () => {
|
||||||
setIsStarted(true);
|
setIsStarted(true);
|
||||||
|
setIsError(false);
|
||||||
if (onVideoStart) onVideoStart();
|
if (onVideoStart) onVideoStart();
|
||||||
metricService.reachGoal(EGoals.ROSE_VIDEO_PLAY_START);
|
metricService.reachGoal(EGoals.ROSE_VIDEO_PLAY_START);
|
||||||
};
|
};
|
||||||
@ -43,14 +55,19 @@ const PersonalVideo = React.memo<IPersonalVideoProps>(
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handlePlayPause = () => {
|
const handlePlayPause = () => {
|
||||||
setIsPlaying((prev) => !prev);
|
setIsPlaying(!isVideoPlaying);
|
||||||
if (isPlaying) metricService.reachGoal(EGoals.ROSE_VIDEO_PLAY_USER_PLAY);
|
if (isVideoPlaying)
|
||||||
if (!isPlaying) metricService.reachGoal(EGoals.ROSE_VIDEO_PLAY_USER_STOP);
|
metricService.reachGoal(EGoals.ROSE_VIDEO_PLAY_USER_PLAY);
|
||||||
|
if (!isVideoPlaying)
|
||||||
|
metricService.reachGoal(EGoals.ROSE_VIDEO_PLAY_USER_STOP);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`${styles.container} ${classNameContainer}`}>
|
<div
|
||||||
{!isPlaying && !isError && !isStarted && (
|
className={`${styles.container} ${classNameContainer}`}
|
||||||
|
ref={containerRef}
|
||||||
|
>
|
||||||
|
{!isVideoPlaying && !isError && !isStarted && (
|
||||||
<Loader className={styles.loader} />
|
<Loader className={styles.loader} />
|
||||||
)}
|
)}
|
||||||
{isError && (
|
{isError && (
|
||||||
@ -68,22 +85,24 @@ const PersonalVideo = React.memo<IPersonalVideoProps>(
|
|||||||
controls={false}
|
controls={false}
|
||||||
light={false}
|
light={false}
|
||||||
muted={false}
|
muted={false}
|
||||||
playing={isPlaying}
|
playing={isVideoPlaying}
|
||||||
stopOnUnmount={true}
|
stopOnUnmount={true}
|
||||||
width="100%"
|
width="100%"
|
||||||
onStart={onStart}
|
onStart={onStart}
|
||||||
onReady={() => setIsPlaying(true)}
|
onReady={() => setIsPlaying(isAutoPlay)}
|
||||||
onEnded={onEnded}
|
onEnded={onEnded}
|
||||||
onError={onError}
|
onError={onError}
|
||||||
playsinline={true}
|
playsinline={true}
|
||||||
height={"auto"}
|
height={"auto"}
|
||||||
style={{
|
style={{
|
||||||
aspectRatio: "16 / 9",
|
aspectRatio: "16 / 9",
|
||||||
|
position: "relative",
|
||||||
|
zIndex: 1,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{!isError && isStarted && isVisibleControllers && (
|
{!isError && isStarted && isVisibleControllers && (
|
||||||
<PlayPauseButton
|
<PlayPauseButton
|
||||||
state={isPlaying ? "pause" : "play"}
|
state={isVideoPlaying ? "pause" : "play"}
|
||||||
onClick={handlePlayPause}
|
onClick={handlePlayPause}
|
||||||
className={styles["play-pause-button"]}
|
className={styles["play-pause-button"]}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -17,10 +17,6 @@ import { Elements } from "@stripe/react-stripe-js";
|
|||||||
import CheckoutForm from "@/components/PaymentPage/methods/CheckoutForm";
|
import CheckoutForm from "@/components/PaymentPage/methods/CheckoutForm";
|
||||||
import { useSinglePayment } from "@/hooks/payment/useSinglePayment";
|
import { useSinglePayment } from "@/hooks/payment/useSinglePayment";
|
||||||
import { useTranslations } from "@/hooks/translations";
|
import { useTranslations } from "@/hooks/translations";
|
||||||
import metricService, {
|
|
||||||
EGoals,
|
|
||||||
EMetrics,
|
|
||||||
} from "@/services/metric/metricService";
|
|
||||||
|
|
||||||
const currentProductKey = "skip.trial.subscription.aura";
|
const currentProductKey = "skip.trial.subscription.aura";
|
||||||
const returnUrl = `${window.location.host}${routes.client.addConsultant()}`;
|
const returnUrl = `${window.location.host}${routes.client.addConsultant()}`;
|
||||||
@ -42,14 +38,6 @@ function SkipTrial() {
|
|||||||
|
|
||||||
const activeProductFromStore = useSelector(selectors.selectActiveProduct);
|
const activeProductFromStore = useSelector(selectors.selectActiveProduct);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!activeProductFromStore?.trialPrice) return;
|
|
||||||
metricService.reachGoal(EGoals.PURCHASE, [EMetrics.FACEBOOK], {
|
|
||||||
currency: "USD",
|
|
||||||
value: ((activeProductFromStore.trialPrice || 100) / 100).toFixed(2),
|
|
||||||
});
|
|
||||||
}, [activeProductFromStore?.trialPrice]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
const isPurchasedSkipTrial = await checkProductPurchased(
|
const isPurchasedSkipTrial = await checkProductPurchased(
|
||||||
|
|||||||
@ -47,12 +47,12 @@ export default function StepEmail() {
|
|||||||
|
|
||||||
const authorize = async () => {
|
const authorize = async () => {
|
||||||
await authorization(email, ESourceAuthorization["aura.palmistry"]);
|
await authorization(email, ESourceAuthorization["aura.palmistry"]);
|
||||||
|
metricService.reachGoal(EGoals.ENTERED_EMAIL_PALMISTRY, [EMetrics.YANDEX]);
|
||||||
metricService.reachGoal(EGoals.ENTERED_EMAIL, [
|
metricService.reachGoal(EGoals.ENTERED_EMAIL, [
|
||||||
EMetrics.KLAVIYO,
|
EMetrics.KLAVIYO,
|
||||||
EMetrics.YANDEX,
|
EMetrics.YANDEX,
|
||||||
EMetrics.FACEBOOK,
|
EMetrics.FACEBOOK,
|
||||||
]);
|
]);
|
||||||
metricService.reachGoal(EGoals.ENTER_EMAIL_PALMISTRY, [EMetrics.YANDEX]);
|
|
||||||
metricService.reachGoal(EGoals.LEAD, [EMetrics.FACEBOOK]);
|
metricService.reachGoal(EGoals.LEAD, [EMetrics.FACEBOOK]);
|
||||||
setIsAuth(true);
|
setIsAuth(true);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,20 +1,66 @@
|
|||||||
|
import PersonalVideo from "@/components/pages/ABDesign/v1/pages/TrialPayment/components/PersonalVideo";
|
||||||
import styles from "./styles.module.css";
|
import styles from "./styles.module.css";
|
||||||
import { useSchemeColorByElement } from "@/hooks/useSchemeColorByElement";
|
import { useSchemeColorByElement } from "@/hooks/useSchemeColorByElement";
|
||||||
import { useRef } from "react";
|
import { useCallback, useEffect, useRef, useState } from "react";
|
||||||
import { Outlet, useLocation } from "react-router-dom";
|
import { Outlet, useLocation } from "react-router-dom";
|
||||||
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
import { actions, selectors } from "@/store";
|
||||||
|
import routes from "@/routes";
|
||||||
|
|
||||||
|
export interface IOutletContext {
|
||||||
|
containerVideoRef: React.RefObject<HTMLDivElement>;
|
||||||
|
isVisibleElements: boolean;
|
||||||
|
setIsVisibleElements: (value: boolean) => void;
|
||||||
|
setShowElements: (value: () => void) => void;
|
||||||
|
}
|
||||||
|
|
||||||
function LayoutABDesignV1() {
|
function LayoutABDesignV1() {
|
||||||
|
const dispatch = useDispatch();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const mainRef = useRef<HTMLDivElement>(null);
|
const mainRef = useRef<HTMLDivElement>(null);
|
||||||
useSchemeColorByElement(mainRef.current, "section.page, .page, section", [
|
useSchemeColorByElement(mainRef.current, "section.page, .page, section", [
|
||||||
location,
|
location,
|
||||||
]);
|
]);
|
||||||
|
const [isVisibleElements, setIsVisibleElements] = useState(false);
|
||||||
|
const { gender } = useSelector(selectors.selectQuestionnaire);
|
||||||
|
const containerVideoRef = useRef<HTMLDivElement>(null);
|
||||||
|
const showElementsTimer = useRef<NodeJS.Timeout>();
|
||||||
|
|
||||||
|
const showElements = useCallback(() => {
|
||||||
|
showElementsTimer.current = setTimeout(() => {
|
||||||
|
setIsVisibleElements(true);
|
||||||
|
}, 33_000);
|
||||||
|
}, [setIsVisibleElements]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (location.pathname !== routes.client.trialChoiceVideoV1()) {
|
||||||
|
dispatch(actions.personalVideo.updateIsVideoPlaying(false));
|
||||||
|
}
|
||||||
|
}, [dispatch, location.pathname]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<main className={`${styles.main} content`} ref={mainRef}>
|
<main className={`${styles.main} content`} ref={mainRef}>
|
||||||
{/* <Suspense fallback={<LoadingPage />}> */}
|
{/* <Suspense fallback={<LoadingPage />}> */}
|
||||||
<Outlet />
|
<PersonalVideo
|
||||||
|
gender={gender}
|
||||||
|
url={"/trial-choice.MOV"}
|
||||||
|
classNameContainer={
|
||||||
|
location.pathname !== routes.client.trialChoiceVideoV1()
|
||||||
|
? styles["personal-video"]
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
isVisibleControllers={isVisibleElements}
|
||||||
|
onVideoStart={showElements}
|
||||||
|
containerRef={containerVideoRef}
|
||||||
|
isAutoPlay={location.pathname === routes.client.trialChoiceVideoV1()}
|
||||||
|
/>
|
||||||
|
<Outlet
|
||||||
|
context={{
|
||||||
|
containerVideoRef,
|
||||||
|
isVisibleElements,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
{/* </Suspense> */}
|
{/* </Suspense> */}
|
||||||
</main>
|
</main>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
.main {
|
.main {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.personal-video, .personal-video > * {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
import { useAuth } from "@/auth";
|
||||||
|
import routes from "@/routes";
|
||||||
|
import { selectors } from "@/store";
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
import { Navigate, Outlet } from "react-router-dom";
|
||||||
|
|
||||||
|
interface ICheckSubscriptionOutletProps {
|
||||||
|
subscribedReturnUrl?: string;
|
||||||
|
unsubscribedReturnUrl?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function CheckSubscriptionOutlet({
|
||||||
|
subscribedReturnUrl = routes.client.home(),
|
||||||
|
unsubscribedReturnUrl,
|
||||||
|
}: ICheckSubscriptionOutletProps) {
|
||||||
|
const status = useSelector(selectors.selectStatus);
|
||||||
|
const { user } = useAuth();
|
||||||
|
|
||||||
|
if (user && status === "subscribed") {
|
||||||
|
return <Navigate to={subscribedReturnUrl} replace={true} />;
|
||||||
|
}
|
||||||
|
if (unsubscribedReturnUrl?.length) {
|
||||||
|
return <Navigate to={unsubscribedReturnUrl} replace={true} />;
|
||||||
|
}
|
||||||
|
return <Outlet />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CheckSubscriptionOutlet;
|
||||||
@ -1,12 +1,12 @@
|
|||||||
import Header from "@/components/pages/ABDesign/v1/components/Header";
|
import Header from "@/components/pages/ABDesign/v1/components/Header";
|
||||||
import styles from "./styles.module.css";
|
import styles from "./styles.module.css";
|
||||||
import { useSchemeColorByElement } from "@/hooks/useSchemeColorByElement";
|
import { useSchemeColorByElement } from "@/hooks/useSchemeColorByElement";
|
||||||
import { useRef, useState } from "react";
|
import { useEffect, useRef } from "react";
|
||||||
import { Outlet, useLocation, useSearchParams } from "react-router-dom";
|
import { Outlet, useLocation, useSearchParams } from "react-router-dom";
|
||||||
import routes from "@/routes";
|
import routes from "@/routes";
|
||||||
import PaymentModal from "@/components/PalmistryV1/components/PaymentModal";
|
import PaymentModal from "@/components/PalmistryV1/components/PaymentModal";
|
||||||
import { useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { selectors } from "@/store";
|
import { actions, selectors } from "@/store";
|
||||||
|
|
||||||
const isBackButtonVisibleRoutes = [
|
const isBackButtonVisibleRoutes = [
|
||||||
routes.client.palmistryV1Birthdate(),
|
routes.client.palmistryV1Birthdate(),
|
||||||
@ -27,6 +27,7 @@ const isBackButtonVisibleRoutes = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
function LayoutPalmistryV1() {
|
function LayoutPalmistryV1() {
|
||||||
|
const dispatch = useDispatch();
|
||||||
const token = useSelector(selectors.selectToken);
|
const token = useSelector(selectors.selectToken);
|
||||||
const activeProductFromStore = useSelector(selectors.selectActiveProduct);
|
const activeProductFromStore = useSelector(selectors.selectActiveProduct);
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
@ -34,7 +35,9 @@ function LayoutPalmistryV1() {
|
|||||||
useSchemeColorByElement(mainRef.current, "section.page, .page, section", [
|
useSchemeColorByElement(mainRef.current, "section.page, .page, section", [
|
||||||
location,
|
location,
|
||||||
]);
|
]);
|
||||||
const [isShowPaymentModal, setIsShowPaymentModal] = useState(false);
|
const isShowPaymentModal = useSelector(
|
||||||
|
selectors.selectPalmistryIsShowPaymentModalV1
|
||||||
|
);
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const subscriptionStatus =
|
const subscriptionStatus =
|
||||||
searchParams.get("redirect_status") === "succeeded" ? "subscribed" : "lead";
|
searchParams.get("redirect_status") === "succeeded" ? "subscribed" : "lead";
|
||||||
@ -46,6 +49,11 @@ function LayoutPalmistryV1() {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
dispatch(actions.palmistry.setIsShowPaymentModalV1(false));
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [location]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<main className={`${styles.main} content`} ref={mainRef}>
|
<main className={`${styles.main} content`} ref={mainRef}>
|
||||||
@ -56,7 +64,7 @@ function LayoutPalmistryV1() {
|
|||||||
/>
|
/>
|
||||||
{/* <Suspense fallback={<LoadingPage />}> */}
|
{/* <Suspense fallback={<LoadingPage />}> */}
|
||||||
<section className={styles.page}>
|
<section className={styles.page}>
|
||||||
<Outlet context={{ isShowPaymentModal, setIsShowPaymentModal }} />
|
<Outlet />
|
||||||
{!!token.length && !!activeProductFromStore && (
|
{!!token.length && !!activeProductFromStore && (
|
||||||
<PaymentModal
|
<PaymentModal
|
||||||
className={
|
className={
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import { useEffect } from "react";
|
|||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
import { actions } from "@/store";
|
import { actions } from "@/store";
|
||||||
import GenderPalmistry from "@/components/PalmistryV1/pages/GenderPalmistry";
|
import GenderPalmistry from "@/components/PalmistryV1/pages/GenderPalmistry";
|
||||||
|
import CheckSubscriptionOutlet from "./CheckSubscriptionOutlet";
|
||||||
|
|
||||||
const removePrefix = (path: string) => path.replace(palmistryV1Prefix, "");
|
const removePrefix = (path: string) => path.replace(palmistryV1Prefix, "");
|
||||||
|
|
||||||
@ -39,89 +40,97 @@ function PalmistryV1Routes() {
|
|||||||
<Routes>
|
<Routes>
|
||||||
<Route element={<LayoutPalmistryV1 />}>
|
<Route element={<LayoutPalmistryV1 />}>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.palmistryV1Gender())}
|
element={
|
||||||
element={<GenderPalmistry />}
|
<CheckSubscriptionOutlet
|
||||||
/>
|
subscribedReturnUrl={routes.client.skipTrial()}
|
||||||
<Route
|
/>
|
||||||
path={removePrefix(routes.client.palmistryV1Welcome())}
|
}
|
||||||
element={<FindHappiness />}
|
|
||||||
>
|
>
|
||||||
<Route path="*" element={<FindHappiness />} />
|
|
||||||
</Route>
|
|
||||||
<Route element={<StepperLayoutPalmistryV1 />}>
|
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.palmistryV1Birthdate())}
|
path={removePrefix(routes.client.palmistryV1Gender())}
|
||||||
element={<Birthdate />}
|
element={<GenderPalmistry />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.palmistryV1PalmsInformation())}
|
path={removePrefix(routes.client.palmistryV1Welcome())}
|
||||||
element={<PalmsInformation />}
|
element={<FindHappiness />}
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path={removePrefix(routes.client.palmistryV1WhatAspects())}
|
|
||||||
element={<WhatAspects />}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path={removePrefix(routes.client.palmistryV1RelationshipStatus())}
|
|
||||||
element={<RelationshipStatus />}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path={removePrefix(routes.client.palmistryV1ElementResonates())}
|
|
||||||
element={<ElementResonates />}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path={removePrefix(routes.client.palmistryV1FavoriteColor())}
|
|
||||||
element={<FavoriteColor />}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path={removePrefix(routes.client.palmistryV1HeadOrHeart())}
|
|
||||||
element={<HeadOrHeart />}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path={removePrefix(routes.client.palmistryV1HeadOrHeartResult())}
|
|
||||||
element={<HeadOrHeartResult />}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path={removePrefix(routes.client.palmistryV1RelateFollowing())}
|
|
||||||
element={<RelateFollowing />}
|
|
||||||
>
|
>
|
||||||
<Route path=":questionId" element={<RelateFollowing />} />
|
<Route path="*" element={<FindHappiness />} />
|
||||||
|
</Route>
|
||||||
|
<Route element={<StepperLayoutPalmistryV1 />}>
|
||||||
|
<Route
|
||||||
|
path={removePrefix(routes.client.palmistryV1Birthdate())}
|
||||||
|
element={<Birthdate />}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path={removePrefix(routes.client.palmistryV1PalmsInformation())}
|
||||||
|
element={<PalmsInformation />}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path={removePrefix(routes.client.palmistryV1WhatAspects())}
|
||||||
|
element={<WhatAspects />}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path={removePrefix(routes.client.palmistryV1RelationshipStatus())}
|
||||||
|
element={<RelationshipStatus />}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path={removePrefix(routes.client.palmistryV1ElementResonates())}
|
||||||
|
element={<ElementResonates />}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path={removePrefix(routes.client.palmistryV1FavoriteColor())}
|
||||||
|
element={<FavoriteColor />}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path={removePrefix(routes.client.palmistryV1HeadOrHeart())}
|
||||||
|
element={<HeadOrHeart />}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path={removePrefix(routes.client.palmistryV1HeadOrHeartResult())}
|
||||||
|
element={<HeadOrHeartResult />}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path={removePrefix(routes.client.palmistryV1RelateFollowing())}
|
||||||
|
element={<RelateFollowing />}
|
||||||
|
>
|
||||||
|
<Route path=":questionId" element={<RelateFollowing />} />
|
||||||
|
</Route>
|
||||||
|
<Route
|
||||||
|
path={removePrefix(routes.client.palmistryV1Email())}
|
||||||
|
element={<Email />}
|
||||||
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.palmistryV1Email())}
|
path={removePrefix(routes.client.palmistryV1LetScan())}
|
||||||
element={<Email />}
|
element={<LetScan />}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path={removePrefix(routes.client.palmistryV1ScanInstruction())}
|
||||||
|
element={<ScanInstruction />}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path={removePrefix(routes.client.palmistryV1Camera())}
|
||||||
|
element={<Camera />}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path={removePrefix(routes.client.palmistryV1TrialChoice())}
|
||||||
|
element={<TrialChoice />}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path={removePrefix(routes.client.palmistryV1TrialPayment())}
|
||||||
|
element={<TrialPayment />}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path={removePrefix(routes.client.palmistryV1Payment())}
|
||||||
|
element={<Payment />}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.palmistryV1LetScan())}
|
path={removePrefix(routes.client.palmistryV1ScannedPhoto())}
|
||||||
element={<LetScan />}
|
element={<ScannedPhoto />}
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path={removePrefix(routes.client.palmistryV1ScanInstruction())}
|
|
||||||
element={<ScanInstruction />}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path={removePrefix(routes.client.palmistryV1Camera())}
|
|
||||||
element={<Camera />}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path={removePrefix(routes.client.palmistryV1TrialChoice())}
|
|
||||||
element={<TrialChoice />}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path={removePrefix(routes.client.palmistryV1TrialPayment())}
|
|
||||||
element={<TrialPayment />}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path={removePrefix(routes.client.palmistryV1Payment())}
|
|
||||||
element={<Payment />}
|
|
||||||
/>
|
/>
|
||||||
|
<Route path="*" element={<NotFoundPage />} />
|
||||||
</Route>
|
</Route>
|
||||||
<Route
|
|
||||||
path={removePrefix(routes.client.palmistryV1ScannedPhoto())}
|
|
||||||
element={<ScannedPhoto />}
|
|
||||||
/>
|
|
||||||
<Route path="*" element={<NotFoundPage />} />
|
|
||||||
</Routes>
|
</Routes>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@ export enum EGoals {
|
|||||||
AURA_TRIAL_CHOICE_PAGE_VISIT = "AuraTrialChoicePageVisit",
|
AURA_TRIAL_CHOICE_PAGE_VISIT = "AuraTrialChoicePageVisit",
|
||||||
AURA_TRIAL_PAYMENT_PAGE_VISIT = "AuraTrialPaymentPageVisit",
|
AURA_TRIAL_PAYMENT_PAGE_VISIT = "AuraTrialPaymentPageVisit",
|
||||||
PAYMENT_SUCCESS_PALMISTRY = "PaymentSuccessPalmistry",
|
PAYMENT_SUCCESS_PALMISTRY = "PaymentSuccessPalmistry",
|
||||||
ENTER_EMAIL_PALMISTRY = "EnterEmailPalmistry"
|
ENTERED_EMAIL_PALMISTRY = "EnteredEmailPalmistry"
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum EFlags {
|
export enum EFlags {
|
||||||
@ -77,21 +77,34 @@ const userParams = (parameters: Partial<IUserParams>) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const reachGoal = (goal: EGoals, usingMetrics = [EMetrics.KLAVIYO, EMetrics.YANDEX], options?: unknown) => {
|
const reachGoal = (goal: EGoals, usingMetrics = [EMetrics.KLAVIYO, EMetrics.YANDEX], options?: unknown) => {
|
||||||
if (!checkIsAvailableYandexMetric()) return;
|
|
||||||
|
|
||||||
if (usingMetrics.includes(EMetrics.YANDEX)) window.ym(metricCounterNumber, "reachGoal", goal);
|
|
||||||
console.log("goal: ", goal);
|
console.log("goal: ", goal);
|
||||||
|
|
||||||
if (!window.klaviyo) return console.error("Klaviyo.Metric not found");
|
if (usingMetrics.includes(EMetrics.YANDEX)) {
|
||||||
if (usingMetrics.includes(EMetrics.KLAVIYO)) window.klaviyo.push(['track', goal]);
|
if (typeof window.ym !== "function") {
|
||||||
|
console.error("Yandex.Metric not found")
|
||||||
if (!window.fbq) return console.error("Facebook.Metric not found");
|
} else {
|
||||||
|
window.ym(metricCounterNumber, "reachGoal", goal)
|
||||||
if (goal === EGoals.ENTERED_EMAIL) {
|
console.log("goalYM: ", goal);
|
||||||
if (usingMetrics.includes(EMetrics.FACEBOOK)) window.fbq('track', EGoals.LEAD, options);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usingMetrics.includes(EMetrics.FACEBOOK)) window.fbq('track', goal, options);
|
if (usingMetrics.includes(EMetrics.KLAVIYO)) {
|
||||||
|
if (!window.klaviyo) {
|
||||||
|
console.error("Klaviyo.Metric not found")
|
||||||
|
} else {
|
||||||
|
window.klaviyo.push(['track', goal]);
|
||||||
|
console.log("goalKLAVIYO: ", goal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (usingMetrics.includes(EMetrics.FACEBOOK)) {
|
||||||
|
if (typeof window.fbq !== "function") {
|
||||||
|
console.error("Facebook.Metric not found")
|
||||||
|
} else {
|
||||||
|
window.fbq('track', goal === EGoals.ENTERED_EMAIL ? EGoals.LEAD : goal, options)
|
||||||
|
console.log("goalFB: ", goal);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type THitOptions = {
|
type THitOptions = {
|
||||||
|
|||||||
@ -78,6 +78,7 @@ import palmistry, {
|
|||||||
actions as palmistryActions,
|
actions as palmistryActions,
|
||||||
selectPalmistryFingers,
|
selectPalmistryFingers,
|
||||||
selectPalmistryFromRedesign,
|
selectPalmistryFromRedesign,
|
||||||
|
selectPalmistryIsShowPaymentModalV1,
|
||||||
selectPalmistryLines,
|
selectPalmistryLines,
|
||||||
selectPalmistryPhoto
|
selectPalmistryPhoto
|
||||||
} from "./palmistry";
|
} from "./palmistry";
|
||||||
@ -150,6 +151,7 @@ export const selectors = {
|
|||||||
selectPersonalVideo,
|
selectPersonalVideo,
|
||||||
selectCurrency,
|
selectCurrency,
|
||||||
selectPalmistryFromRedesign,
|
selectPalmistryFromRedesign,
|
||||||
|
selectPalmistryIsShowPaymentModalV1,
|
||||||
...formSelectors,
|
...formSelectors,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -9,13 +9,15 @@ interface IPalmistry {
|
|||||||
fingers: IPalmistryFingerLocal[];
|
fingers: IPalmistryFingerLocal[];
|
||||||
photo: string;
|
photo: string;
|
||||||
fromRedesign: boolean;
|
fromRedesign: boolean;
|
||||||
|
isShowPaymentModalV1: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const initialState: IPalmistry = {
|
const initialState: IPalmistry = {
|
||||||
lines: [],
|
lines: [],
|
||||||
fingers: [],
|
fingers: [],
|
||||||
photo: "",
|
photo: "",
|
||||||
fromRedesign: false
|
fromRedesign: false,
|
||||||
|
isShowPaymentModalV1: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const palmistrySlice = createSlice({
|
const palmistrySlice = createSlice({
|
||||||
@ -25,6 +27,9 @@ const palmistrySlice = createSlice({
|
|||||||
update(state, action: PayloadAction<Partial<IPalmistry>>) {
|
update(state, action: PayloadAction<Partial<IPalmistry>>) {
|
||||||
return { ...state, ...action.payload };
|
return { ...state, ...action.payload };
|
||||||
},
|
},
|
||||||
|
setIsShowPaymentModalV1(state, action: PayloadAction<boolean>) {
|
||||||
|
return { ...state, isShowPaymentModalV1: action.payload };
|
||||||
|
}
|
||||||
},
|
},
|
||||||
extraReducers: (builder) => builder.addCase("reset", () => initialState),
|
extraReducers: (builder) => builder.addCase("reset", () => initialState),
|
||||||
});
|
});
|
||||||
@ -46,4 +51,8 @@ export const selectPalmistryFromRedesign = createSelector(
|
|||||||
(state: { palmistry: IPalmistry }) => state.palmistry.fromRedesign,
|
(state: { palmistry: IPalmistry }) => state.palmistry.fromRedesign,
|
||||||
(palmistry) => palmistry
|
(palmistry) => palmistry
|
||||||
);
|
);
|
||||||
|
export const selectPalmistryIsShowPaymentModalV1 = createSelector(
|
||||||
|
(state: { palmistry: IPalmistry }) => state.palmistry.isShowPaymentModalV1,
|
||||||
|
(palmistry) => palmistry
|
||||||
|
);
|
||||||
export default palmistrySlice.reducer;
|
export default palmistrySlice.reducer;
|
||||||
|
|||||||
@ -6,24 +6,29 @@ interface IPersonalVideo {
|
|||||||
videoId: string
|
videoId: string
|
||||||
videoUrl: string
|
videoUrl: string
|
||||||
createdDate: number
|
createdDate: number
|
||||||
|
isVideoPlaying: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const initialState: IPersonalVideo = {
|
const initialState: IPersonalVideo = {
|
||||||
generatingVideo: false,
|
generatingVideo: false,
|
||||||
videoId: "",
|
videoId: "",
|
||||||
videoUrl: "",
|
videoUrl: "",
|
||||||
createdDate: 0
|
createdDate: 0,
|
||||||
|
isVideoPlaying: false
|
||||||
}
|
}
|
||||||
|
|
||||||
const personalVideoSlice = createSlice({
|
const personalVideoSlice = createSlice({
|
||||||
name: 'personalVideo',
|
name: 'personalVideo',
|
||||||
initialState,
|
initialState,
|
||||||
reducers: {
|
reducers: {
|
||||||
updateStatus(state, action: PayloadAction<Omit<IPersonalVideo, 'createdDate' | 'videoUrl'>>) {
|
updateStatus(state, action: PayloadAction<Pick<IPersonalVideo, 'generatingVideo' | 'videoId'>>) {
|
||||||
return { ...state, ...action.payload, createdDate: new Date().getTime() }
|
return { ...state, ...action.payload, createdDate: new Date().getTime() }
|
||||||
},
|
},
|
||||||
updateUrl(state, action: PayloadAction<string>) {
|
updateUrl(state, action: PayloadAction<string>) {
|
||||||
return { ...state, videoUrl: action.payload }
|
return { ...state, videoUrl: action.payload }
|
||||||
|
},
|
||||||
|
updateIsVideoPlaying(state, action: PayloadAction<boolean>) {
|
||||||
|
return { ...state, isVideoPlaying: action.payload }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
extraReducers: (builder) => builder.addCase('reset', () => initialState),
|
extraReducers: (builder) => builder.addCase('reset', () => initialState),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user