Вернул воронку отмены
This commit is contained in:
parent
ccc73506b2
commit
ab02108a20
@ -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": {
|
||||
|
||||
@ -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": {
|
||||
|
||||
@ -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": {
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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 (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user