Merge pull request #54 from pennyteenycat/feature/cancelFunnel
Вернул воронку отмены
This commit is contained in:
commit
06bed2027f
@ -177,7 +177,7 @@
|
|||||||
"PlanCancelled": {
|
"PlanCancelled": {
|
||||||
"title": "Standard plan cancelled!",
|
"title": "Standard plan cancelled!",
|
||||||
"icon": "🥳",
|
"icon": "🥳",
|
||||||
"description": "Completed transition to a free 30-day plan",
|
"description": "Your subscription has been successfully cancelled",
|
||||||
"button": "Done"
|
"button": "Done"
|
||||||
},
|
},
|
||||||
"SubscriptionStopped": {
|
"SubscriptionStopped": {
|
||||||
|
|||||||
@ -177,7 +177,7 @@
|
|||||||
"PlanCancelled": {
|
"PlanCancelled": {
|
||||||
"title": "Standard plan cancelled!",
|
"title": "Standard plan cancelled!",
|
||||||
"icon": "🥳",
|
"icon": "🥳",
|
||||||
"description": "Completed transition to a free 30-day plan",
|
"description": "Your subscription has been successfully cancelled",
|
||||||
"button": "Done"
|
"button": "Done"
|
||||||
},
|
},
|
||||||
"SubscriptionStopped": {
|
"SubscriptionStopped": {
|
||||||
|
|||||||
@ -177,7 +177,7 @@
|
|||||||
"PlanCancelled": {
|
"PlanCancelled": {
|
||||||
"title": "Standard plan cancelled!",
|
"title": "Standard plan cancelled!",
|
||||||
"icon": "🥳",
|
"icon": "🥳",
|
||||||
"description": "Completed transition to a free 30-day plan",
|
"description": "Your subscription has been successfully cancelled",
|
||||||
"button": "Done"
|
"button": "Done"
|
||||||
},
|
},
|
||||||
"SubscriptionStopped": {
|
"SubscriptionStopped": {
|
||||||
|
|||||||
@ -69,13 +69,30 @@ export default function SecondChancePage() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCancelClick = () => {
|
const handleCancelClick = async () => {
|
||||||
if (isLoadingButton) return;
|
if (isLoadingButton) return;
|
||||||
if (funnel === ERetainingFunnel.Red) {
|
if (funnel === ERetainingFunnel.Red) {
|
||||||
router.push(ROUTES.retainingFunnelChangeMind());
|
router.push(ROUTES.retainingFunnelChangeMind());
|
||||||
}
|
}
|
||||||
if (funnel === ERetainingFunnel.Green) {
|
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) {
|
if (funnel === ERetainingFunnel.Purple) {
|
||||||
return router.push(ROUTES.retainingFunnelStopFor30Days());
|
return router.push(ROUTES.retainingFunnelStopFor30Days());
|
||||||
|
|||||||
@ -54,12 +54,29 @@ export default function Buttons() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCancelClick = () => {
|
const handleCancelClick = async () => {
|
||||||
if (isLoadingButton) return;
|
if (isLoadingButton) return;
|
||||||
if (funnel === ERetainingFunnel.Green) {
|
if (funnel === ERetainingFunnel.Green) {
|
||||||
return router.push(ROUTES.retainingFunnelChangeMind());
|
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 (
|
return (
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user