diff --git a/client/src/components/inputs/SwitchSettings.tsx b/client/src/components/inputs/SwitchSettings.tsx index cce5e7159..01886b78c 100644 --- a/client/src/components/inputs/SwitchSettings.tsx +++ b/client/src/components/inputs/SwitchSettings.tsx @@ -12,6 +12,9 @@ import { Tooltip } from "@/components/design-elements"; const DEPLOYMENT_MODE = import.meta.env.VITE_APP_DEPLOYMENT_MODE; const IS_SAAS = DEPLOYMENT_MODE === "saas"; +console.log("Deployment mode:", DEPLOYMENT_MODE); +console.log("Is SaaS:", IS_SAAS); + export const SettingsSwitch = () => { const navigate = useNavigate(); const theme = useTheme(); diff --git a/client/src/pages/billing/Success.tsx b/client/src/pages/billing/Success.tsx index 112f2b933..59751b214 100644 --- a/client/src/pages/billing/Success.tsx +++ b/client/src/pages/billing/Success.tsx @@ -2,32 +2,85 @@ import { BasePage } from "@/components/design-elements"; import Stack from "@mui/material/Stack"; import CircularProgress from "@mui/material/CircularProgress"; import Typography from "@mui/material/Typography"; +import { Button } from "@/components/inputs"; import { useTheme } from "@mui/material/styles"; import { Navigate, useSearchParams } from "react-router-dom"; import { useGet } from "@/hooks/UseApi"; import type { ApiResponse } from "@/hooks/UseApi"; +import { useEffect, useMemo, useState } from "react"; const BillingSuccessPage = () => { const theme = useTheme(); const [searchParams] = useSearchParams(); const plan = searchParams.get("plan"); - const { response } = useGet>( - `/billing/confirm?plan=${plan}`, + const query = useMemo(() => `/billing/confirm?plan=${plan ?? ""}`, [plan]); + const { response, refetch } = useGet>( + query, {}, - {} + { refreshInterval: 2000 } ); const success = response?.data?.success ?? false; + const [elapsed, setElapsed] = useState(0); + + useEffect(() => { + if (success) return; + const id = setInterval(() => setElapsed((s) => s + 1), 1000); + return () => clearInterval(id); + }, [success]); + if (success === true) { return ; } else { return ( - - - Awaiting confirmation.. + + Finishing subscription update... + + + + + {plan ? ( + <> + {"Selected plan: "} + + {plan.charAt(0).toUpperCase() + plan.slice(1)} + + + ) : ( + "" + )} + + + Awaiting confirmation… + {elapsed > 0 ? ` (${elapsed}s)` : ""} + + + + {elapsed >= 30 && ( + + + No changes detected yet. If you didn’t confirm in the portal, + nothing will change. + + + + + )} );