import { useTranslations } from "@/hooks/translations"; import styles from "./styles.module.scss"; import { addCurrency, ELocalesPlacement } from "@/locales"; import { useSelector } from "react-redux"; import { selectors } from "@/store"; import Loader from "@/components/Loader"; import Title from "@/components/Title"; import CheckoutForm from "../CheckoutForm"; import PaymentMethodsChoice from "../../PaymentMethodsChoice"; import { EPaymentMethod } from "@/data/paymentMethods"; import { IFunnelPaymentVariant } from "@/api/resources/Session"; const getPrice = (product: IFunnelPaymentVariant | null) => { if (!product) { return 0; } return (product.trialPrice || 0) / 100; }; interface IPaymentFormProps { isSinglePayment?: boolean; className?: string; funnel: ELocalesPlacement; paymentPlacement: string; trialInterval: number; onPaymentError?: (error?: string | null) => void; onPaymentSuccess?: () => void; onModalClosed?: () => void; } function PaymentForm({ isSinglePayment = false, className, funnel, paymentPlacement, trialInterval, onPaymentError, onPaymentSuccess, onModalClosed, }: IPaymentFormProps) { const { translate } = useTranslations(ELocalesPlacement.V1); const currency = useSelector(selectors.selectCurrency); const activeProduct = useSelector(selectors.selectActiveProduct); const isLoading = false; const paymentMethodsButtons = [ { id: EPaymentMethod.CREDIT_CARD, icon: "/payment-form/credit-card.svg", title: translate("payment_modal.credit_card"), }, ]; return ( <> {isLoading && (
)}
{!isSinglePayment && ( {translate("payment_modal.title")} )} {}} /> {!isSinglePayment && activeProduct && (

{translate("payment_modal.description", { priceForDays: ( {translate("payment_modal.price_for_days", { trialPrice: addCurrency( getPrice(activeProduct), currency ), trialDuration: trialInterval, })} ), emailReminder: ( {translate("payment_modal.email_reminder")} ), })}

)}
{!!activeProduct && ( )}

{translate("payment_modal.address")}

); } export default PaymentForm;