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 PaymentMethodsChoice from "@/components/pages/ABDesign/v1/pages/TrialPayment/components/PaymentMethodsChoice"; import { paymentMethods } from "@/data/paymentMethods"; import { EPlacementKeys, IPaywallProduct } from "@/api/resources/Paywall"; import SecurityPayments from "@/components/pages/ABDesign/v1/pages/TrialPayment/components/SecurityPayments"; import CheckoutForm from "../CheckoutForm"; const paymentMethodsButtons = paymentMethods(null); const getPrice = (product: IPaywallProduct | null) => { if (!product) { return 0; } return (product.trialPrice === 100 ? 99 : product.trialPrice || 0) / 100; } interface IPaymentFormProps { isSinglePayment?: boolean; className?: string; placementKey: EPlacementKeys; onPaymentError?: () => void; onPaymentSuccess?: () => void; onModalClosed?: () => void; } function PaymentForm({ isSinglePayment = false, className, placementKey, onPaymentError, onPaymentSuccess, onModalClosed }: IPaymentFormProps) { const { translate } = useTranslations(ELocalesPlacement.V1); const currency = useSelector(selectors.selectCurrency); const activeProduct = useSelector(selectors.selectActiveProduct); const isLoading = false; return ( <> {isLoading && (
{translate("payment_modal.description", { priceForDays: ( {translate("payment_modal.price_for_days", { trialPrice: addCurrency( getPrice(activeProduct), currency ), trialDuration: activeProduct?.trialDuration, })} ), emailReminder: ( {translate("payment_modal.email_reminder")} ), })}
{translate("payment_modal.address")}