Вернул воронку отмены

This commit is contained in:
dev.daminik00 2025-09-13 02:02:03 +02:00
parent ccc73506b2
commit ab02108a20
5 changed files with 41 additions and 7 deletions

View File

@ -177,7 +177,7 @@
"PlanCancelled": {
"title": "Standard plan cancelled!",
"icon": "🥳",
"description": "Completed transition to a free 30-day plan",
"description": "Your subscription has been successfully cancelled",
"button": "Done"
},
"SubscriptionStopped": {

View File

@ -177,7 +177,7 @@
"PlanCancelled": {
"title": "Standard plan cancelled!",
"icon": "🥳",
"description": "Completed transition to a free 30-day plan",
"description": "Your subscription has been successfully cancelled",
"button": "Done"
},
"SubscriptionStopped": {

View File

@ -177,7 +177,7 @@
"PlanCancelled": {
"title": "Standard plan cancelled!",
"icon": "🥳",
"description": "Completed transition to a free 30-day plan",
"description": "Your subscription has been successfully cancelled",
"button": "Done"
},
"SubscriptionStopped": {

View File

@ -69,13 +69,30 @@ export default function SecondChancePage() {
});
};
const handleCancelClick = () => {
const handleCancelClick = async () => {
if (isLoadingButton) return;
if (funnel === ERetainingFunnel.Red) {
router.push(ROUTES.retainingFunnelChangeMind());
}
if (funnel === ERetainingFunnel.Green) {
return router.push(ROUTES.retainingFunnelCancellationOfSubscription());
// Direct cancellation instead of 60-day pause screen
setIsLoadingButton(true);
const response = await performUserSubscriptionAction({
subscriptionId: cancellingSubscription?.id || "",
action: "cancel",
retainingJourney: journey || undefined,
});
if (response?.data?.status === "success") {
return router.push(ROUTES.retainingFunnelPlanCancelled());
}
setIsLoadingButton(false);
addToast({
variant: "error",
message: "Something went wrong. Please try again later.",
duration: 5000,
});
return;
}
if (funnel === ERetainingFunnel.Purple) {
return router.push(ROUTES.retainingFunnelStopFor30Days());

View File

@ -54,12 +54,29 @@ export default function Buttons() {
});
};
const handleCancelClick = () => {
const handleCancelClick = async () => {
if (isLoadingButton) return;
if (funnel === ERetainingFunnel.Green) {
return router.push(ROUTES.retainingFunnelChangeMind());
}
router.push(ROUTES.retainingFunnelCancellationOfSubscription());
// Direct cancellation instead of 60-day pause screen
setIsLoadingButton(true);
const response = await performUserSubscriptionAction({
subscriptionId: cancellingSubscription?.id || "",
action: "cancel",
retainingJourney: journey || undefined,
});
if (response?.data?.status === "success") {
return router.push(ROUTES.retainingFunnelPlanCancelled());
}
setIsLoadingButton(false);
addToast({
variant: "error",
message: "Something went wrong. Please try again later.",
duration: 5000,
});
};
return (