diff --git a/src/components/App/index.tsx b/src/components/App/index.tsx
index 070f3df..b111ed0 100755
--- a/src/components/App/index.tsx
+++ b/src/components/App/index.tsx
@@ -240,10 +240,7 @@ function App(): JSX.Element {
path={routes.client.emailConfirm()}
element={}
/>
- }
- />
+ } />
}
@@ -251,7 +248,9 @@ function App(): JSX.Element {
}
- />
+ >
+ } />
+
{/* Test Routes End */}
-
+
This option will help us support those who need to select the lowest
trial prices!
diff --git a/src/components/pages/TrialPayment/components/PaymentTable/index.tsx b/src/components/pages/TrialPayment/components/PaymentTable/index.tsx
index c6e4327..6589343 100755
--- a/src/components/pages/TrialPayment/components/PaymentTable/index.tsx
+++ b/src/components/pages/TrialPayment/components/PaymentTable/index.tsx
@@ -41,10 +41,10 @@ function PaymentTable({ subPlan, buttonClick }: IPaymentTableProps) {
You are enrolling in 2 weeks subscription. By continuing you agree that
- if you don't cancel prior to the end of the 7-day trial for the $5 you
- will automatically be charged $29 every 2 weeks until you cancel in
- settings. Learn more about cancellation and refund policy in{" "}
- Subscription policy
+ if you don't cancel prior to the end of the 3-day trial for the $
+ {getPriceFromTrial(subPlan?.trial)} you will automatically be charged
+ $19 every 2 weeks until you cancel in settings. Learn more about
+ cancellation and refund policy in Subscription policy
>
);
diff --git a/src/components/pages/TrialPayment/components/PersonalInformation/index.tsx b/src/components/pages/TrialPayment/components/PersonalInformation/index.tsx
index 71128dd..1e7e287 100755
--- a/src/components/pages/TrialPayment/components/PersonalInformation/index.tsx
+++ b/src/components/pages/TrialPayment/components/PersonalInformation/index.tsx
@@ -18,7 +18,7 @@ function PersonalInformation({
diff --git a/src/components/pages/TrialPayment/components/YourReading/index.tsx b/src/components/pages/TrialPayment/components/YourReading/index.tsx
index abb0faa..7575076 100755
--- a/src/components/pages/TrialPayment/components/YourReading/index.tsx
+++ b/src/components/pages/TrialPayment/components/YourReading/index.tsx
@@ -16,7 +16,7 @@ function YourReading({ gender, zodiacSign, buttonClick }: IYourReadingProps) {
diff --git a/src/components/pages/TrialPayment/components/YourReading/styles.module.css b/src/components/pages/TrialPayment/components/YourReading/styles.module.css
index 6306936..90a043e 100755
--- a/src/components/pages/TrialPayment/components/YourReading/styles.module.css
+++ b/src/components/pages/TrialPayment/components/YourReading/styles.module.css
@@ -111,6 +111,7 @@
rgba(251, 251, 255, 0.14) 75%,
rgba(251, 251, 255, 0.196) 89.58%
);
+ -webkit-backdrop-filter: blur(1.5px);
backdrop-filter: blur(1.5px);
border-radius: 20px;
height: 100%;
diff --git a/src/components/pages/TrialPayment/index.tsx b/src/components/pages/TrialPayment/index.tsx
index 571364f..8e5c027 100755
--- a/src/components/pages/TrialPayment/index.tsx
+++ b/src/components/pages/TrialPayment/index.tsx
@@ -6,25 +6,79 @@ import Goal from "./components/Goal";
import PaymentTable from "./components/PaymentTable";
import { useSelector } from "react-redux";
import { selectors } from "@/store";
-import { Navigate, useNavigate } from "react-router-dom";
+import { Navigate, useNavigate, useParams } from "react-router-dom";
import routes from "@/routes";
import { getZodiacSignByDate } from "@/services/zodiac-sign";
import YourReading from "./components/YourReading";
import Reviews from "./components/Reviews";
import YouGet from "./components/YouGet";
import OftenAsk from "./components/OftenAsk";
+import { ISubscriptionPlan } from "@/api/resources/SubscriptionPlans";
+import { useEffect, useState } from "react";
+import { useApi } from "@/api";
+import { getClientLocale } from "@/locales";
+import { Locale } from "@/components/PaymentTable";
+
+const locale = getClientLocale() as Locale;
function TrialPaymentPage() {
+ const api = useApi();
const navigate = useNavigate();
- const subPlan = useSelector(selectors.selectActiveSubPlan);
const birthdate = useSelector(selectors.selectBirthdate);
const zodiacSign = getZodiacSignByDate(birthdate);
const { gender, birthPlace } = useSelector(selectors.selectQuestionnaire);
+ const [subPlans, setSubPlans] = useState
([]);
+ const activeSubPlanFromStore = useSelector(selectors.selectActiveSubPlan);
+ const [activeSubPlan, setActiveSubPlan] = useState(
+ activeSubPlanFromStore
+ );
+ const { subPlan } = useParams();
- if (!subPlan) {
+ useEffect(() => {
+ (async () => {
+ const { sub_plans } = await api.getSubscriptionPlans({ locale });
+ const plans = sub_plans
+ .filter((plan: ISubscriptionPlan) => plan.provider === "stripe")
+ .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]);
+
+ useEffect(() => {
+ if (subPlan) {
+ const targetSubPlan = subPlans.find(
+ (sub_plan) =>
+ String(
+ sub_plan?.trial?.price_cents
+ ? Math.floor((sub_plan?.trial?.price_cents + 1) / 100)
+ : sub_plan.id.replace(".", "")
+ ) === subPlan
+ );
+ if (targetSubPlan) {
+ setActiveSubPlan(targetSubPlan);
+ }
+ }
+ }, [subPlan, subPlans]);
+
+ if (!activeSubPlan) {
return ;
}
+ if (!birthdate || !gender || !birthPlace) {
+ return ;
+ }
+
const handleNext = () => {
navigate(routes.client.paymentStripe());
};
@@ -42,7 +96,7 @@ function TrialPaymentPage() {
Your Personalized Clarity & Love Reading is ready!
-
+
-
+
);
}