diff --git a/messages/de.json b/messages/de.json index b2aef39..9e3ddcd 100644 --- a/messages/de.json +++ b/messages/de.json @@ -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": { diff --git a/messages/en.json b/messages/en.json index 4325b53..0b19c3c 100644 --- a/messages/en.json +++ b/messages/en.json @@ -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": { diff --git a/messages/es.json b/messages/es.json index 8ddb49d..1529272 100644 --- a/messages/es.json +++ b/messages/es.json @@ -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": { diff --git a/src/components/domains/retaining/second-chance/SecondChancePage/SecondChancePage.tsx b/src/components/domains/retaining/second-chance/SecondChancePage/SecondChancePage.tsx index 21dce73..afbf83a 100644 --- a/src/components/domains/retaining/second-chance/SecondChancePage/SecondChancePage.tsx +++ b/src/components/domains/retaining/second-chance/SecondChancePage/SecondChancePage.tsx @@ -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()); diff --git a/src/components/domains/retaining/stop-for-30-days/Buttons/Buttons.tsx b/src/components/domains/retaining/stop-for-30-days/Buttons/Buttons.tsx index 9506c12..a0604f2 100644 --- a/src/components/domains/retaining/stop-for-30-days/Buttons/Buttons.tsx +++ b/src/components/domains/retaining/stop-for-30-days/Buttons/Buttons.tsx @@ -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 (