From bcbf5c75b5faa7ee1b82b3c0192949d586774809 Mon Sep 17 00:00:00 2001 From: Darshan Date: Thu, 19 Dec 2024 13:25:27 +0530 Subject: [PATCH] address comments. --- .../billing/estimatedTotalBox.svelte | 45 ++++++++++--------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/src/lib/components/billing/estimatedTotalBox.svelte b/src/lib/components/billing/estimatedTotalBox.svelte index df06ef0b7..b73c87378 100644 --- a/src/lib/components/billing/estimatedTotalBox.svelte +++ b/src/lib/components/billing/estimatedTotalBox.svelte @@ -34,17 +34,14 @@ : 0; $: extraSeatsCost = (collaborators?.length ?? 0) * (selectedPlan?.addons?.member?.price ?? 0); - $: grossCost = - isScaleUpgrade || isScaleDowngrade - ? selectedPlan.price + extraSeatsCost - unUsedBalances - : selectedPlan.price + extraSeatsCost; + $: grossCost = isScaleUpgrade + ? selectedPlan.price + extraSeatsCost - unUsedBalances + : selectedPlan.price + extraSeatsCost; $: estimatedTotal = couponData?.status === 'active' ? Math.max(0, grossCost - couponData.credits) : grossCost; $: trialEndDate = new Date( billingPayDate.getTime() + selectedPlan.trialDays * 24 * 60 * 60 * 1000 ); - - $: isRefund = isScaleDowngrade && grossCost < 0;

-{formatCurrency(unUsedBalances)}

- {:else if isScaleDowngrade} -
- Unused {currentOrgPlan.name} plan balance -

-{formatCurrency(currentOrgPlan.price)}

-
{/if} {#if couponData?.status === 'active'} @@ -107,15 +99,28 @@

- You'll {isRefund ? 'receive a refund of' : 'pay'} - {formatCurrency(estimatedTotal)} - now, with our first billing cycle starting on - {!selectedPlan.trialDays - ? toLocaleDate(billingPayDate.toString()) - : toLocaleDate(trialEndDate.toString())}. Once your credits run out, you'll be charged - {formatCurrency(selectedPlan.price)} plus usage fees every 30 days. + {#if isScaleDowngrade} + You'll continue using the {currentOrgPlan.name} plan until your current cycle ends on + {!selectedPlan.trialDays + ? toLocaleDate(billingPayDate.toString()) + : toLocaleDate(trialEndDate.toString())}. Starting the next cycle, your plan will switch to {selectedPlan.name}, and you'll be + charged + {formatCurrency(grossCost)} + every 30 days. + {:else} + You'll pay + {formatCurrency(estimatedTotal)} + now, with our first billing cycle starting on + {!selectedPlan.trialDays + ? toLocaleDate(billingPayDate.toString()) + : toLocaleDate(trialEndDate.toString())}. Once your credits run out, you'll be charged + {formatCurrency(selectedPlan.price)} plus usage fees every 30 + days. + {/if}