import styles from "./styles.module.scss"; import Title from "@/components/Title"; import Button from "../../components/Button"; import routes from "@/routes"; import { useNavigate } from "react-router-dom"; import { useTranslations } from "@/hooks/translations"; import { ELocalesPlacement } from "@/locales"; import { images } from "../../data"; import DiscountExpires from "../../components/DiscountExpires"; import PaymentTable from "../../components/PaymentTable"; import { useDispatch, useSelector } from "react-redux"; import { actions, selectors } from "@/store"; import { EPlacementKeys } from "@/api/resources/Paywall"; import { usePaywall } from "@/hooks/paywall/usePaywall"; import MoneyBackGuarantee from "../../components/MoneyBackGuarantee"; import PalmsSayAbout from "../../components/PalmsSayAbout"; import { useCallback, useEffect, useMemo } from "react"; import { getZodiacSignByDate } from "@/services/zodiac-sign"; import WithPartnerInformation from "../../components/WithPartnerInformation"; import PersonalInformation from "../../components/PersonalInformation"; import Reviews from "../../components/Reviews"; import Address from "../../components/Address"; import { useApi, useApiCall, User } from "@/api"; const placementKey = EPlacementKeys["aura.placement.email.palmistry"]; function TrialPayment() { const api = useApi(); const token = useSelector(selectors.selectToken); const dispatch = useDispatch(); const { translate } = useTranslations(ELocalesPlacement.EmailMarketingPalmistryV2); const { products } = usePaywall({ placementKey, localesPlacement: ELocalesPlacement.PalmistryV1, }); const activeProduct = products[0] const trialDuration = activeProduct?.trialDuration || 7; const { gender, birthPlace, partnerBirthPlace, partnerBirthdate, partnerGender, birthdate, } = useSelector(selectors.selectQuestionnaire) const zodiacSign = getZodiacSignByDate(birthdate); const partnerZodiacSign = getZodiacSignByDate(partnerBirthdate); const navigate = useNavigate(); // const [isPaymentModalOpen, setIsPaymentModalOpen] = useState(false); // const { // error, // isPaymentSuccess, // isModalClosed, // isLoading, // showCreditCardForm, // } = usePayment({ // placementKey, // activeProduct, // paymentFormType: "lightbox" // }); // useEffect(() => { // if (error) { // onPaymentError(); // } // }, [error]) // useEffect(() => { // if (isPaymentSuccess) { // onPaymentSuccess(); // } // }, [isPaymentSuccess]) // useEffect(() => { // if (isModalClosed) { // onModalClosed(); // } // }, [isModalClosed]) // const onPaymentSuccess = () => { // return navigate(routes.client.paymentSuccess()) // } // const onModalClosed = () => { // // setIsPaymentModalOpen(false); // if (isPaymentSuccess || isLoading || error) return; // return handleDiscount() // } // const handleDiscount = () => { // navigate(routes.client.palmistryV2SaveOff()); // }; // const onPaymentError = () => { // return navigate(routes.client.paymentFail()) // } const openPaymentModal = () => { // setIsPaymentModalOpen(true); // showCreditCardForm(); navigate(routes.client.palmistryV2PaymentModal()); }; const userData = useCallback(async () => { if (!token) return null; const { user } = await api.getMe({ token: token }); return user; }, [api, token]); const { data: user } = useApiCall(userData); const singleOrWithPartner = useMemo(() => { return user?.partner ? "partner" : "single"; }, [user]); useEffect(() => { if (!activeProduct) return; dispatch(actions.payment.update({ activeProduct })) }, [activeProduct]) if (!activeProduct) return null; return ( <> {/* */}
{translate("trial-payment.transform_your_life")} Hand
{translate("trial-payment.personalized_reading_ready")} {translate("trial-payment.hands_reveal_title")}

{translate("trial-payment.hands_reveal_description")}

{translate("trial-payment.prepare_personalized_plan")} {singleOrWithPartner === "partner" && ( )} {singleOrWithPartner === "single" && ( )} {translate("trial-payment.aura_users_stories")} {translate("trial-payment.as_featured_in")}
Featured
); } export default TrialPayment;