From ab02108a20d224aad6880f649afed0d2e2a805ae Mon Sep 17 00:00:00 2001 From: "dev.daminik00" Date: Sat, 13 Sep 2025 02:02:03 +0200 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=B5=D1=80=D0=BD=D1=83=D0=BB=20=D0=B2?= =?UTF-8?q?=D0=BE=D1=80=D0=BE=D0=BD=D0=BA=D1=83=20=D0=BE=D1=82=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- messages/de.json | 2 +- messages/en.json | 2 +- messages/es.json | 2 +- .../SecondChancePage/SecondChancePage.tsx | 21 +++++++++++++++++-- .../stop-for-30-days/Buttons/Buttons.tsx | 21 +++++++++++++++++-- 5 files changed, 41 insertions(+), 7 deletions(-) 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 (