diff --git a/src/components/Compatibility/index.tsx b/src/components/Compatibility/index.tsx
index a110b52..9ef9e3e 100644
--- a/src/components/Compatibility/index.tsx
+++ b/src/components/Compatibility/index.tsx
@@ -176,9 +176,6 @@ function CompatibilityPage(): JSX.Element {
{!showNavbarFooter && (
)}
- {/*
- {t("compatibility")}
- */}
{onboardingCompatibility && (
diff --git a/src/components/CreateProfilePage/ProcessFlow.tsx b/src/components/CreateProfilePage/ProcessFlow.tsx
index 41f0e4a..60bdd34 100644
--- a/src/components/CreateProfilePage/ProcessFlow.tsx
+++ b/src/components/CreateProfilePage/ProcessFlow.tsx
@@ -38,9 +38,6 @@ const calculateTop = (currentIdx: number, length: number, items: HTMLDivElement[
if (!item) return accumulator;
return accumulator + item.clientHeight
}, 1) + 8 * getMultiplier(currentIdx, length)
-
- // const itemHeight = 63
- // return getMultiplier(currentIdx, length) * itemHeight1?.clientHeight
}
function ProcessFlow({ items, onDone }: ProcessFlowProps): JSX.Element {
diff --git a/src/components/DidYouKnowPage/index.tsx b/src/components/DidYouKnowPage/index.tsx
index 23aedb4..f6da302 100644
--- a/src/components/DidYouKnowPage/index.tsx
+++ b/src/components/DidYouKnowPage/index.tsx
@@ -1,44 +1,38 @@
-import { useNavigate } from 'react-router-dom'
-import { useTranslation } from 'react-i18next'
-import MainButton from '../MainButton'
-import Title from '../Title'
-import routes from '@/routes'
-import styles from './styles.module.css'
-import { useSelector } from 'react-redux'
-import { selectors } from '@/store'
-import { getZodiacSignByDate } from '@/services/zodiac-sign'
-// import SpecialWelcomeOffer from '../SpecialWelcomeOffer'
-// import { useState } from 'react'
+import { useNavigate } from "react-router-dom";
+import { useTranslation } from "react-i18next";
+import MainButton from "../MainButton";
+import Title from "../Title";
+import routes from "@/routes";
+import styles from "./styles.module.css";
+import { useSelector } from "react-redux";
+import { selectors } from "@/store";
+import { getZodiacSignByDate } from "@/services/zodiac-sign";
function DidYouKnowPage(): JSX.Element {
- const { t } = useTranslation()
- const navigate = useNavigate()
- const handleNext = () => navigate(routes.client.freePeriodInfo())
- // const [isOpenModal, setIsOpenModal] = useState(false)
- // const handleSpecialOffer = () => {
- // setIsOpenModal(true)
- // }
- const birthdate = useSelector(selectors.selectBirthdate)
- const zodiacSign = getZodiacSignByDate(birthdate)
-
+ const { t } = useTranslation();
+ const navigate = useNavigate();
+ const handleNext = () => navigate(routes.client.freePeriodInfo());
+ const birthdate = useSelector(selectors.selectBirthdate);
+ const zodiacSign = getZodiacSignByDate(birthdate);
return (
- {/* */}
-
{t('did_you_know')}
+
{t("did_you_know")}
- {t('zodiac_sign_info', { zodiacSign })}
+ {t("zodiac_sign_info", { zodiacSign })}
- )
+ );
}
-export default DidYouKnowPage
+export default DidYouKnowPage;
diff --git a/src/components/FeedbackPage/index.tsx b/src/components/FeedbackPage/index.tsx
index 024c450..3b26183 100644
--- a/src/components/FeedbackPage/index.tsx
+++ b/src/components/FeedbackPage/index.tsx
@@ -12,7 +12,7 @@ function FeedbackPage(): JSX.Element {
const { t } = useTranslation();
const navigate = useNavigate();
const api = useApi();
- const handleNext = () => navigate(routes.client.emailEnter());
+ const handleNext = () => navigate(routes.client.auth());
const assetsData = useCallback(async () => {
const { assets } = await api.getAssets({ category: String("au") });
diff --git a/src/components/PaymentPage/index.tsx b/src/components/PaymentPage/index.tsx
index c3f40e1..bd146cd 100644
--- a/src/components/PaymentPage/index.tsx
+++ b/src/components/PaymentPage/index.tsx
@@ -1,18 +1,10 @@
-import { useCallback, useState } from "react";
+import { useState } from "react";
import { useTranslation } from "react-i18next";
-import { useDispatch, useSelector } from "react-redux";
+import { useSelector } from "react-redux";
import { useNavigate } from "react-router-dom";
import { selectors } from "@/store";
import { usePayment } from "@/payment";
-import { actions } from "@/store";
-import {
- ApplePayBanner,
- // ApplePayButton,
- GooglePayBanner,
- // GooglePayButton,
- // CardButton,
- // CardModal,
-} from "./methods";
+import { ApplePayBanner, GooglePayBanner } from "./methods";
import ErrorModal from "./ErrorModal";
import UserHeader from "../UserHeader";
import Title from "../Title";
@@ -21,33 +13,56 @@ import secure from "./secure.png";
import routes from "@/routes";
import "./styles.css";
import Header from "../Header";
-import { StripeButton, StripeModal } from "./methods/Stripe";
+import { StripeButton } from "./methods/Stripe";
+import { PayPalButton } from "./methods/PayPal/Button";
+import { useAuth } from "@/auth";
+import { useApi } from "@/api";
+import { PayPalReceiptPayload } from "@/api/resources/UserSubscriptionReceipts";
+import { ISubscriptionPlan } from "@/api/resources/SubscriptionPlans";
+
+const getPrice = (activeSubPlan: ISubscriptionPlan | null) => {
+ if (!activeSubPlan) return 0;
+ return String(
+ activeSubPlan?.trial?.price_cents
+ ? activeSubPlan.trial.price_cents / 100
+ : 0
+ );
+};
function PaymentPage(): JSX.Element {
const { t } = useTranslation();
const { applePay } = usePayment();
- // const [openCardModal, setOpenCardModal] = useState(false);
- const [openStripeModal, setOpenStripeModal] = useState(false);
+ const api = useApi();
+ const { token } = useAuth();
const [openErrorModal, setOpenErrorModal] = useState(false);
- const dispatch = useDispatch();
const navigate = useNavigate();
const isLoading = applePay === null;
const isApplePayAvailable =
import.meta.env.PROD && applePay?.canMakePayments();
const email = useSelector(selectors.selectEmail);
- const isDiscount = useSelector(selectors.selectIsDiscount);
- const selectedPrice = useSelector(selectors.selectSelectedPrice);
- const price = isDiscount
- ? (Math.round(selectedPrice || 0) / 2).toFixed(2)
- : selectedPrice;
- const onSuccess = useCallback(() => {
- dispatch(actions.status.update("subscribed"));
- navigate(routes.client.wallpaper());
- }, [dispatch, navigate]);
- const onError = useCallback((error: Error) => {
- console.error(error);
- setOpenErrorModal(true);
- }, []);
+ const activeSubPlan = useSelector(selectors.selectActiveSubPlan);
+
+ const navigateToStripe = () => {
+ navigate(routes.client.paymentStripe());
+ };
+
+ const navigateToPayPal = async () => {
+ const { subscription_receipt } = await api.createSubscriptionReceipt({
+ token,
+ itemInterval: "year",
+ way: "paypal",
+ subscription_receipt: {
+ sub_plan_id: activeSubPlan?.id || "",
+ },
+ } as PayPalReceiptPayload);
+ const url = subscription_receipt.data.links?.find(
+ (link) => link.rel === "approve"
+ )?.href;
+ if (!url?.length) {
+ return setOpenErrorModal(true);
+ }
+ window.location.href = url;
+ };
return (
<>
@@ -68,33 +83,21 @@ function PaymentPage(): JSX.Element {
{t("choose_payment")}
- {/* {isApplePayAvailable ? (
-
- ) : (
-
- )}
- {t("or").toUpperCase()}
- setOpenCardModal(true)} /> */}
- setOpenStripeModal(true)} />
+
{t("will_be_charged", {
strongText: (
- {t("trial_price", { price: price })}
+
+ {t("trial_price", {
+ price: getPrice(activeSubPlan || null),
+ })}
+
),
})}
- {/* setOpenCardModal(false)}
- onSuccess={onSuccess}
- onError={onError}
- /> */}
- setOpenStripeModal(false)}
- onSuccess={onSuccess}
- onError={onError}
- />
setOpenErrorModal(false)}
diff --git a/src/components/PaymentPage/methods/PayPal/Button.tsx b/src/components/PaymentPage/methods/PayPal/Button.tsx
new file mode 100644
index 0000000..78e32a5
--- /dev/null
+++ b/src/components/PaymentPage/methods/PayPal/Button.tsx
@@ -0,0 +1,15 @@
+import { useTranslation } from "react-i18next";
+import MainButton from "@/components/MainButton";
+
+interface IPayPalButtonProps {
+ onClick: () => void;
+}
+
+export function PayPalButton({ onClick }: IPayPalButtonProps): JSX.Element {
+ const { t } = useTranslation();
+ return (
+
+ {t("payPal")}
+
+ );
+}
diff --git a/src/components/PaymentPage/methods/Stripe/Button.tsx b/src/components/PaymentPage/methods/Stripe/Button.tsx
index 2f35277..cba41d3 100644
--- a/src/components/PaymentPage/methods/Stripe/Button.tsx
+++ b/src/components/PaymentPage/methods/Stripe/Button.tsx
@@ -1,7 +1,6 @@
import { useTranslation } from 'react-i18next'
import MainButton from '@/components/MainButton'
-// import card from './card.svg'
interface IStripeButtonProps {
onClick: () => void
@@ -11,7 +10,6 @@ export function StripeButton({ onClick }: IStripeButtonProps): JSX.Element {
const { t } = useTranslation()
return (
- {/*
*/}
{t('stripe')}
)
diff --git a/src/components/PaymentPage/methods/Stripe/CheckoutForm.tsx b/src/components/PaymentPage/methods/Stripe/CheckoutForm.tsx
index 2487d31..244fc4e 100644
--- a/src/components/PaymentPage/methods/Stripe/CheckoutForm.tsx
+++ b/src/components/PaymentPage/methods/Stripe/CheckoutForm.tsx
@@ -1,15 +1,18 @@
import MainButton from "@/components/MainButton";
import Title from "@/components/Title";
+import { actions } from "@/store";
import {
PaymentElement,
useElements,
useStripe,
} from "@stripe/react-stripe-js";
import { useState } from "react";
+import { useDispatch } from "react-redux";
export default function CheckoutForm() {
const stripe = useStripe();
const elements = useElements();
+ const dispatch = useDispatch();
const [message, setMessage] = useState("");
const [isProcessing, setIsProcessing] = useState(false);
@@ -27,18 +30,22 @@ export default function CheckoutForm() {
elements,
confirmParams: {
return_url: `https://${window.location.host}/payment/result`,
- }
+ },
});
if (error) {
setMessage(error?.message || "Oops! Something went wrong.");
}
-
+ dispatch(actions.status.update("subscribed"));
setIsProcessing(false);
};
return (
-
-
{t("auweb.pay_good.button")}
+
+ {t("auweb.pay_good.button")}
+
);
}
diff --git a/src/components/PaymentPage/results/index.tsx b/src/components/PaymentPage/results/index.tsx
index e9356e8..4871444 100644
--- a/src/components/PaymentPage/results/index.tsx
+++ b/src/components/PaymentPage/results/index.tsx
@@ -2,18 +2,22 @@ import { useNavigate } from "react-router-dom";
import routes from "@/routes";
import { useEffect } from "react";
import { useSearchParams } from "react-router-dom";
+import { useDispatch } from "react-redux";
+import { actions } from "@/store";
function PaymentResultPage(): JSX.Element {
const navigate = useNavigate();
+ const dispatch = useDispatch();
const [searchParams] = useSearchParams();
const status = searchParams.get("redirect_status");
useEffect(() => {
if (status === "succeeded") {
+ dispatch(actions.status.update("subscribed"));
return navigate(routes.client.paymentSuccess());
}
return navigate(routes.client.paymentFail());
- }, [navigate, status]);
+ }, [navigate, status, dispatch]);
return <>>;
}
diff --git a/src/components/PaymentPage/styles.css b/src/components/PaymentPage/styles.css
index e734aca..89be04d 100644
--- a/src/components/PaymentPage/styles.css
+++ b/src/components/PaymentPage/styles.css
@@ -41,7 +41,7 @@
.payment-inforamtion {
font-size: 12px;
line-height: 1.5;
- letter-spacing: .0008em;
+ letter-spacing: 0.0008em;
}
.payment-chargebee {
@@ -82,6 +82,13 @@
margin-right: 12px;
}
+.payment-form-stripe {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 16px;
+}
+
.payment-loader {
display: flex;
justify-content: center;
@@ -100,6 +107,14 @@
font-weight: 500;
}
+.payment-buttons-container {
+ width: 100%;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 16px;
+}
+
.pay-btn,
.gpay-button-fake-loader,
.apple-pay-button-placeholder {
@@ -138,6 +153,6 @@
display: flex;
align-items: end;
background-repeat: no-repeat;
- background-color: rgba(0,0,0,.5);
+ background-color: rgba(0, 0, 0, 0.5);
padding: 12px 15% 10px;
}
diff --git a/src/components/Policy/index.tsx b/src/components/Policy/index.tsx
index b62527d..f4053ea 100644
--- a/src/components/Policy/index.tsx
+++ b/src/components/Policy/index.tsx
@@ -1,23 +1,27 @@
-import './styles.css'
+import "./styles.css";
interface PolicyProps {
- children: string
- sizing?: 'small' | 'medium' | 'large'
- className?: string
+ children: string | JSX.Element | null;
+ sizing?: "small" | "medium" | "large";
+ className?: string;
}
const sizes = {
- small: 'policy--small',
- medium: 'policy--medium',
- large: 'policy--large',
-}
+ small: "policy--small",
+ medium: "policy--medium",
+ large: "policy--large",
+};
-function Policy({ children, sizing = 'small', className = '' }: PolicyProps): JSX.Element {
+function Policy({
+ children,
+ sizing = "small",
+ className = "",
+}: PolicyProps): JSX.Element {
return (
- )
+ );
}
-export default Policy
+export default Policy;
diff --git a/src/components/PriceItem/index.tsx b/src/components/PriceItem/index.tsx
index a930345..0b48af5 100644
--- a/src/components/PriceItem/index.tsx
+++ b/src/components/PriceItem/index.tsx
@@ -1,29 +1,17 @@
+import { removeAfterDot, roundToWhole } from "@/services/price";
import { Currency, Locale, Price } from "../PaymentTable";
-import { IPrice } from "../PriceList";
import styles from "./styles.module.css";
const currency = Currency.USD;
const locale = Locale.EN;
-const roundToWhole = (value: string | number): number => {
- value = Number(value);
- if (value % Math.floor(value) !== 0) {
- return value;
- }
- return Math.floor(value);
-};
-const removeAfterDot = (value: string): string => {
- const _value = Number(value.split("$")[1]);
- if (_value % Math.floor(_value) !== 0 && _value !== 0) {
- return value;
- }
- return value.split(".")[0];
-};
interface PriceItemProps {
+ id: string,
+ value: number,
active: boolean;
- click: (id: number) => void;
+ click: (id: string) => void;
}
function PriceItem({
@@ -31,11 +19,11 @@ function PriceItem({
value,
active,
click,
-}: IPrice & PriceItemProps): JSX.Element {
+}: PriceItemProps): JSX.Element {
const _price = new Price(roundToWhole(value), currency, locale);
const compatClassName = () => {
- const isPopular = id === 3;
+ const isPopular = id === 'stripe.7';
const isActive = active;
return `${styles.container} ${isPopular ? styles.popular : ""} ${isActive ? styles.active : ""}`;
};
diff --git a/src/components/PriceList/index.tsx b/src/components/PriceList/index.tsx
index fd51fb6..b3a1bd9 100644
--- a/src/components/PriceList/index.tsx
+++ b/src/components/PriceList/index.tsx
@@ -1,64 +1,53 @@
-import { useState } from 'react'
-import PriceItem from '../PriceItem'
-import styles from './styles.module.css'
-import { useDispatch } from 'react-redux'
-import { actions } from '@/store'
-
-export interface IPrice {
- id: number
- value: number
-}
-
-const prices: IPrice[] = [
- {
- id: 1,
- value: 0
- },
- {
- id: 2,
- value: 5
- },
- {
- id: 3,
- value: 9
- },
- {
- id: 4,
- value: 13.67
- },
-]
+import { useState } from "react";
+import PriceItem from "../PriceItem";
+import styles from "./styles.module.css";
+import { useDispatch } from "react-redux";
+import { actions } from "@/store";
+import { ISubscriptionPlan } from "@/api/resources/SubscriptionPlans";
interface PriceListProps {
- activeItem: number | null
- click: () => void
+ subPlans: ISubscriptionPlan[];
+ activeItem: number | null;
+ click: () => void;
}
-function PriceList({click}: PriceListProps): JSX.Element {
- const dispatch = useDispatch();
- const [activePriceItem, setActivePriceItem] = useState
(null)
+const getPrice = (plan: ISubscriptionPlan) => {
+ return (plan.trial?.price_cents || 0) / 100;
+};
- const priceItemClick = (id: number) => {
- setActivePriceItem(id)
- const activePriceItem = prices.find((item) => item.id === Number(id))
- if (activePriceItem) {
+function PriceList({ click, subPlans }: PriceListProps): JSX.Element {
+ const dispatch = useDispatch();
+ const [activePlanItem, setActivePlanItem] =
+ useState(null);
+
+ const priceItemClick = (id: string) => {
+ const activePlan = subPlans.find((item) => item.id === String(id)) || null;
+ setActivePlanItem(activePlan);
+ if (activePlan) {
dispatch(
actions.payment.update({
- selectedPrice: activePriceItem.value
+ activeSubPlan: activePlan,
})
);
}
setTimeout(() => {
- click()
- }, 1000)
- }
+ click();
+ }, 1000);
+ };
return (
- {prices.map((price, idx) => (
-
+ {subPlans.map((plan, idx) => (
+
))}
- )
+ );
}
-export default PriceList
+export default PriceList;
diff --git a/src/components/PriceListPage/index.tsx b/src/components/PriceListPage/index.tsx
index 554bc6d..69e6668 100644
--- a/src/components/PriceListPage/index.tsx
+++ b/src/components/PriceListPage/index.tsx
@@ -1,46 +1,87 @@
-import { useNavigate } from 'react-router-dom'
-import routes from '@/routes'
-import styles from './styles.module.css'
-import UserHeader from '../UserHeader'
-import { useDispatch, useSelector } from 'react-redux'
-import { actions, selectors } from '@/store'
-import Title from '../Title'
-import { useTranslation } from 'react-i18next'
-import EmailsList from '../EmailsList'
-import PriceList from '../PriceList'
+import { useNavigate } from "react-router-dom";
+import routes from "@/routes";
+import styles from "./styles.module.css";
+import UserHeader from "../UserHeader";
+import { useDispatch, useSelector } from "react-redux";
+import { actions, selectors } from "@/store";
+import Title from "../Title";
+import { useTranslation } from "react-i18next";
+import EmailsList from "../EmailsList";
+import PriceList from "../PriceList";
+import { useApi } from "@/api";
+import { useEffect, useState } from "react";
+import { ISubscriptionPlan } from "@/api/resources/SubscriptionPlans";
+import Loader from "../Loader";
function PriceListPage(): JSX.Element {
- const { t } = useTranslation()
- const navigate = useNavigate()
+ const { t, i18n } = useTranslation();
+ const locale = i18n.language;
+ const api = useApi();
+ const navigate = useNavigate();
const dispatch = useDispatch();
const homeConfig = useSelector(selectors.selectHome);
- const selectedPrice = useSelector(selectors.selectSelectedPrice)
-
- const email = useSelector(selectors.selectEmail)
+ const selectedPrice = useSelector(selectors.selectSelectedPrice);
+ const [subPlans, setSubPlans] = useState([]);
+ const email = useSelector(selectors.selectEmail);
+
+ useEffect(() => {
+ (async () => {
+ const { sub_plans } = await api.getSubscriptionPlans({ locale });
+ const plans = sub_plans
+ .filter(
+ (plan: ISubscriptionPlan) => plan.provider === "stripe" && plan.trial
+ )
+ .sort((a, b) => {
+ if (!a.trial || !b.trial) {
+ return 0;
+ }
+ if (a.trial.price_cents < b.trial.price_cents) {
+ return -1;
+ }
+ if (a.trial.price_cents > b.trial.price_cents) {
+ return 1;
+ }
+ return 0;
+ });
+ setSubPlans(plans);
+ })();
+ }, [api]);
+
const handleNext = () => {
dispatch(
actions.siteConfig.update({
home: { pathFromHome: homeConfig.pathFromHome, isShowNavbar: false },
})
);
- navigate(routes.client.subscription())
- }
+ navigate(routes.client.subscription());
+ };
return (
<>
-
-
- {t('choose_your_own_fee')}
- {t('aura.web.price_selection')}
-
-
+
+
+ {!!subPlans.length && (
+ <>
+
+ {t("choose_your_own_fee")}
+
+ {t("aura.web.price_selection")}
+
+
-
-
+
-
+ >
+ )}
+ {!subPlans.length &&
}
+
>
- )
+ );
}
-export default PriceListPage
+export default PriceListPage;
diff --git a/src/components/SpecialWelcomeOffer/index.tsx b/src/components/SpecialWelcomeOffer/index.tsx
index eea012e..2305a2b 100644
--- a/src/components/SpecialWelcomeOffer/index.tsx
+++ b/src/components/SpecialWelcomeOffer/index.tsx
@@ -33,6 +33,10 @@ function SpecialWelcomeOffer({ open, onClose }: ModalTopProps): JSX.Element {
navigate(routes.client.paymentMethod());
};
+ const handleMoreAbout = () => {
+ window.location.href = "https://witapps.us/en/aura";
+ };
+
return (
<>
{open ? (
@@ -69,9 +73,7 @@ function SpecialWelcomeOffer({ open, onClose }: ModalTopProps): JSX.Element {
{
- console.log("click");
- }}
+ onClick={handleMoreAbout}
>
{t("au.more_llc.button")}
diff --git a/src/components/StripePage/index.tsx b/src/components/StripePage/index.tsx
new file mode 100644
index 0000000..dfa1ec4
--- /dev/null
+++ b/src/components/StripePage/index.tsx
@@ -0,0 +1,63 @@
+import { useApi } from "@/api";
+import Loader from "@/components/Loader";
+import { useEffect, useState } from "react";
+import { Stripe, loadStripe } from "@stripe/stripe-js";
+import { Elements } from "@stripe/react-stripe-js";
+import CheckoutForm from "../PaymentPage/methods/Stripe/CheckoutForm";
+import { useAuth } from "@/auth";
+import styles from "./styles.module.css";
+import { useSelector } from "react-redux";
+import { selectors } from "@/store";
+import { useNavigate } from "react-router-dom";
+import routes from "@/routes";
+
+export function StripePage(): JSX.Element {
+ const api = useApi();
+ const { token } = useAuth();
+ const navigate = useNavigate();
+ const activeSubPlan = useSelector(selectors.selectActiveSubPlan);
+ const [stripePromise, setStripePromise] =
+ useState | null>(null);
+ const [clientSecret, setClientSecret] = useState("");
+ const [isLoading, setIsLoading] = useState(true);
+ if (!activeSubPlan) {
+ navigate(routes.client.priceList());
+ }
+
+ useEffect(() => {
+ (async () => {
+ const siteConfig = await api.getAppConfig({ bundleId: "auraweb" });
+ setStripePromise(loadStripe(siteConfig.data.stripe_public_key));
+ })();
+ }, [api]);
+
+ useEffect(() => {
+ (async () => {
+ const { subscription_receipt } = await api.createSubscriptionReceipt({
+ token,
+ way: "stripe",
+ subscription_receipt: {
+ sub_plan_id: activeSubPlan?.id || "stripe.7",
+ },
+ });
+ const { client_secret } = subscription_receipt.data;
+ setClientSecret(client_secret);
+ setIsLoading(false);
+ })();
+ }, [api, token]);
+
+ return (
+
+ {isLoading ? (
+
+
+
+ ) : null}
+ {stripePromise && clientSecret && (
+
+
+
+ )}
+
+ );
+}
diff --git a/src/components/StripePage/styles.module.css b/src/components/StripePage/styles.module.css
new file mode 100644
index 0000000..dda5732
--- /dev/null
+++ b/src/components/StripePage/styles.module.css
@@ -0,0 +1,16 @@
+.page {
+ position: relative;
+ /* height: calc(100vh - 50px);
+ max-height: -webkit-fill-available; */
+ flex: auto;
+ justify-content: center;
+ display: grid;
+ grid-template-rows: 1fr 96px;
+ justify-items: center;
+}
+
+.payment-loader {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
diff --git a/src/components/SubscriptionPage/index.tsx b/src/components/SubscriptionPage/index.tsx
index 1addcd2..11b7161 100644
--- a/src/components/SubscriptionPage/index.tsx
+++ b/src/components/SubscriptionPage/index.tsx
@@ -13,28 +13,34 @@ import styles from "./styles.module.css";
import Header from "../Header";
import SpecialWelcomeOffer from "../SpecialWelcomeOffer";
import { useState } from "react";
+import { ITrial } from "@/api/resources/SubscriptionPlans";
const currency = Currency.USD;
const locale = Locale.EN;
-const itemPriceId = "aura-membership-2-week-USD";
+
+const getPriceFromTrial = (trial: ITrial | null) => {
+ if (!trial) {
+ return 0;
+ }
+ return (trial.price_cents || 0) / 100;
+};
function SubscriptionPage(): JSX.Element {
const [isOpenModal, setIsOpenModal] = useState(false);
const { t } = useTranslation();
+ const activeSubPlan = useSelector(selectors.selectActiveSubPlan);
const paymentItems = [
{
- title: "Per 7-Day Trial For",
- price: 1.0,
- description: t("au.2week_plan.web"),
+ title: activeSubPlan?.name || "Per 7-Day Trial For",
+ price: getPriceFromTrial(activeSubPlan?.trial || null),
+ description: activeSubPlan?.desc.length
+ ? activeSubPlan?.desc
+ : t("au.2week_plan.web"),
},
];
+
const navigate = useNavigate();
const email = useSelector(selectors.selectEmail);
- const itemPrice = useSelector(selectors.selectPlanById(itemPriceId));
- const selectedPrice = useSelector(selectors.selectSelectedPrice);
- if (selectedPrice || selectedPrice === 0) {
- paymentItems[0].price = selectedPrice;
- }
const handleClick = () => navigate(routes.client.paymentMethod());
const handleCross = () => setIsOpenModal(true);
const policyLink = (
@@ -42,13 +48,13 @@ function SubscriptionPage(): JSX.Element {
{t("subscription_policy")}
);
- console.log({ itemPrice });
+
return (
<>
-
- {t("subscription_text", { policyLink })}
+
+ <>
+ {t("auweb.agree.text1")}
+ {t("subscription_text", { policyLink })}
+ >
+
>
);
diff --git a/src/components/SubscriptionPage/styles.module.css b/src/components/SubscriptionPage/styles.module.css
index 97d1d54..15061b0 100644
--- a/src/components/SubscriptionPage/styles.module.css
+++ b/src/components/SubscriptionPage/styles.module.css
@@ -1,3 +1,7 @@
+.page {
+ padding-bottom: 32px !important;
+}
+
.subscription-action {
position: fixed;
bottom: 0;
@@ -5,7 +9,7 @@
right: 0;
display: flex;
justify-content: center;
- background-color: #fff;
+ background-color: transparent;
padding: 15px;
}
diff --git a/src/components/WallpaperPage/index.tsx b/src/components/WallpaperPage/index.tsx
index 3719670..7dd060a 100644
--- a/src/components/WallpaperPage/index.tsx
+++ b/src/components/WallpaperPage/index.tsx
@@ -47,7 +47,9 @@ function getZodiacParagraphs(
{paragraph.title}
{getTypeOfContent(paragraph.content) === "string"
- ? paragraph.content.map((content, _index) =>
{content as string}
)
+ ? paragraph.content.map((content, _index) => (
+
{content as string}
+ ))
: getZodiacParagraphs(paragraph.content as ZodiacParagraph[], depth)}
);
@@ -58,7 +60,7 @@ function WallpaperPage(): JSX.Element {
const api = useApi();
const { i18n } = useTranslation();
const locale = i18n.language;
- const token = useSelector(selectors.selectToken)
+ const token = useSelector(selectors.selectToken);
const {
user,
@@ -111,20 +113,6 @@ function WallpaperPage(): JSX.Element {