From 6746f1047c8854746dc3275fd1fb825f1bc8eb96 Mon Sep 17 00:00:00 2001 From: Arman Date: Mon, 26 Aug 2024 15:19:35 +0200 Subject: [PATCH] fix: downgrade feedback mandatory --- .../change-plan/+page.svelte | 33 +++++++------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/routes/(console)/organization-[organization]/change-plan/+page.svelte b/src/routes/(console)/organization-[organization]/change-plan/+page.svelte index 0e394e4a4..705b96abe 100644 --- a/src/routes/(console)/organization-[organization]/change-plan/+page.svelte +++ b/src/routes/(console)/organization-[organization]/change-plan/+page.svelte @@ -149,9 +149,9 @@ type: 'success', isHtml: true, message: ` - ${$organization.name} has been changed to ${ - tierToPlan(billingPlan).name - } plan.` + ${$organization.name} will change to ${ + tierToPlan(billingPlan).name + } plan at the end of the current billing cycle.` }); trackEvent(Submit.OrganizationDowngrade, { @@ -162,7 +162,7 @@ type: 'error', message: e.message }); - trackError(e, isUpgrade ? Submit.OrganizationUpgrade : Submit.OrganizationDowngrade); + trackError(e, Submit.OrganizationDowngrade); } } @@ -213,22 +213,12 @@ await invalidate(Dependencies.ORGANIZATION); await goto(`${base}/organization-${org.$id}`); - if (isUpgrade) { - addNotification({ - type: 'success', - message: 'Your organization has been upgraded' - }); - } else { - addNotification({ - type: 'success', - isHtml: true, - message: ` - ${$organization.name} will change to ${ - tierToPlan(billingPlan).name - } plan at the end of the current billing cycle.` - }); - } - trackEvent(isUpgrade ? Submit.OrganizationUpgrade : Submit.OrganizationDowngrade, { + addNotification({ + type: 'success', + message: 'Your organization has been upgraded' + }); + + trackEvent(Submit.OrganizationUpgrade, { plan: tierToPlan(billingPlan)?.name }); } catch (e) { @@ -236,7 +226,7 @@ type: 'error', message: e.message }); - trackError(e, isUpgrade ? Submit.OrganizationUpgrade : Submit.OrganizationDowngrade); + trackError(e, Submit.OrganizationUpgrade); } } @@ -324,6 +314,7 @@ bind:value={feedbackDowngradeReason} />