Merge branch 'AW-41-addFreeTrial' into 'develop'

AW-41-addFreeTrial

See merge request witapp/aura-webapp!103
This commit is contained in:
Daniil Chemerkin 2024-04-22 22:20:54 +00:00
commit c9487bb2db
2 changed files with 8 additions and 2 deletions

View File

@ -3,4 +3,5 @@
display: flex;
flex-direction: row;
justify-content: space-between;
gap: 4px;
}

View File

@ -1,6 +1,6 @@
import PriceList from "@/components/PriceList";
import styles from "./styles.module.css";
import { useEffect, useState } from "react";
import { useEffect, useMemo, useState } from "react";
import { ISubscriptionPlan } from "@/api/resources/SubscriptionPlans";
import { useTranslation } from "react-i18next";
import { useApi } from "@/api";
@ -26,6 +26,7 @@ function TrialChoicePage() {
const email = useSelector(selectors.selectEmail);
const [subPlans, setSubPlans] = useState<ISubscriptionPlan[]>([]);
const [isDisabled, setIsDisabled] = useState(true);
const allowedPlans = useMemo(() => ["stripe.37"], []);
useEffect(() => {
(async () => {
@ -39,7 +40,10 @@ function TrialChoicePage() {
plansKeys[plan.name] = plansKeys[plan.name]
? plansKeys[plan.name] + 1
: 1;
if (plansKeys[plan.name] > 1 && !plan.trial?.is_free && !!plan.trial) {
if (
(plansKeys[plan.name] > 1 && !plan.trial?.is_free && !!plan.trial) ||
allowedPlans.includes(plan.id)
) {
const targetPlan = plansWithoutTest.find(
(item) => item.name === plan.name && item.id.includes("stripe")
);
@ -62,6 +66,7 @@ function TrialChoicePage() {
setSubPlans(plans);
})();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [api, locale]);
const handlePriceItem = () => {