diff --git a/src/components/StripePage/index.tsx b/src/components/StripePage/index.tsx index c427081..73fc431 100644 --- a/src/components/StripePage/index.tsx +++ b/src/components/StripePage/index.tsx @@ -14,6 +14,7 @@ import SubPlanInformation from "../SubPlanInformation"; import Title from "../Title"; import { useTranslation } from "react-i18next"; import { ISubscriptionPlan } from "@/api/resources/SubscriptionPlans"; +import ApplePayButton from "./ApplePayButton"; export function StripePage(): JSX.Element { const { i18n } = useTranslation(); @@ -31,7 +32,7 @@ export function StripePage(): JSX.Element { if (!activeSubPlan) { navigate(routes.client.priceList()); } - const timeoutRef = useRef(); + // const timeoutRef = useRef(); // const appleReceipt = async () => { // const { subscription_receipt } = await api.createSubscriptionReceipt({ @@ -58,6 +59,26 @@ export function StripePage(): JSX.Element { })(); }, [activeSubPlan, api, locale, navigate]); + // useEffect(() => { + // timeoutRef.current = setTimeout(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); + // }, 4000); + // return () => { + // if (timeoutRef.current) { + // clearTimeout(timeoutRef.current); + // } + // }; + // }, [api, token]); + useEffect(() => { timeoutRef.current = setTimeout(async () => { const { subscription_receipt } = await api.createSubscriptionReceipt({ @@ -95,15 +116,11 @@ export function StripePage(): JSX.Element { )} {stripePromise && clientSecret && ( + - <> - {activeSubPlan && ( - - )} - + {activeSubPlan && ( + + )} )} diff --git a/src/components/SubPlanInformation/index.tsx b/src/components/SubPlanInformation/index.tsx index 15509f2..05e83b2 100644 --- a/src/components/SubPlanInformation/index.tsx +++ b/src/components/SubPlanInformation/index.tsx @@ -2,7 +2,7 @@ import { useTranslation } from "react-i18next"; import styles from "./styles.module.css"; import { ISubscriptionPlan } from "@/api/resources/SubscriptionPlans"; import TotalToday from "./TotalToday"; -import ApplePayButton from "../StripePage/ApplePayButton"; +// import ApplePayButton from "../StripePage/ApplePayButton"; import MainButton from "../MainButton"; import { useApi } from "@/api"; import { useAuth } from "@/auth"; @@ -87,7 +87,7 @@ function SubPlanInformation({ {isLoading && } )} - + {/* */}

{t("auweb.pay.information").replaceAll("%@", getPrice(subPlan))}