feat: implement plan upgrade logic with prorated pricing and MercadoPago integration

This commit is contained in:
2026-07-18 15:39:07 -03:00
parent f6e2bb8372
commit 8d74ae95c8
25 changed files with 2491 additions and 142 deletions
@@ -54,20 +54,23 @@ export default function Login(props: LoginProps) {
SessionToken.setToken(userSession.userToken);
SessionInfo.setLoginState("success");
alert.showSuccess(msg);
manageLoginActions(userSession);
};
const manageLoginActions = () => {
const toUrl = process.env.NEXT_PUBLIC_DEFAULT_PATH_AFTER_LOGIN || "/";
const manageLoginActions = (session: ISession = SessionInfo) => {
if (loginAction.action !== LOGIN_ACTIONS.NONE) {
goTo(loginAction.url);
loginAction.clear();
} else {
if (SessionInfo.subscription && SessionInfo.subscription.plan) {
const hasPlan = Boolean(session.subscription?.plan?.id);
const hasOrganization = Object.keys(session.organizationSubscriptions || {}).length > 0;
if (hasPlan && hasOrganization) {
goTo("/landing/dashboard");
return;
}
goTo(toUrl);
goTo("/landing/my-appointments");
}
};