diff --git a/src/routes/(console)/organization-[organization]/billing/cancelDowngradeModel.svelte b/src/routes/(console)/organization-[organization]/billing/cancelDowngradeModel.svelte new file mode 100644 index 000000000..78785305b --- /dev/null +++ b/src/routes/(console)/organization-[organization]/billing/cancelDowngradeModel.svelte @@ -0,0 +1,51 @@ + + +
+ +

+ Your organization is set to change to + {tierToPlan($organization?.billingPlanDowngrade).name} + plan on {toLocaleDate($organization.billingNextInvoiceDate)}. +

+

Are you sure you want to cancel the change?

+ + + + +
+
diff --git a/src/routes/(console)/organization-[organization]/billing/planSummary.svelte b/src/routes/(console)/organization-[organization]/billing/planSummary.svelte index d9b9ddc08..09cc3754e 100644 --- a/src/routes/(console)/organization-[organization]/billing/planSummary.svelte +++ b/src/routes/(console)/organization-[organization]/billing/planSummary.svelte @@ -8,18 +8,19 @@ import type { CreditList, Invoice, Plan } from '$lib/sdk/billing'; import { abbreviateNumber, formatCurrency, formatNumberWithCommas } from '$lib/helpers/numbers'; import { humanFileSize } from '$lib/helpers/sizeConvertion'; - import { BillingPlan, Dependencies } from '$lib/constants'; + import { BillingPlan } from '$lib/constants'; import { trackEvent } from '$lib/actions/analytics'; import { tooltip } from '$lib/actions/tooltip'; import { type Models } from '@appwrite.io/console'; - import { sdk } from '$lib/stores/sdk'; - import { invalidate } from '$app/navigation'; + import CancelDowngradeModel from './cancelDowngradeModel.svelte'; export let members: Models.MembershipList; export let currentPlan: Plan; export let creditList: CreditList; export let currentInvoice: Invoice | undefined = undefined; + let showCancel: boolean = false; + const extraMembers = members.total > 1 ? members.total - 1 : 0; const availableCredit = creditList.available; const today = new Date(); @@ -28,17 +29,6 @@ $plansInfo.get($organization.billingPlan)?.trialDays; const extraUsage = currentInvoice ? currentInvoice.amount - currentPlan?.price : 0; const extraAddons = currentInvoice ? currentInvoice.usage?.length : 0; - - const cancelDowngrade = async () => { - await sdk.forConsole.billing.cancelDowngrade( - $organization.$id - ); - await invalidate(Dependencies.ORGANIZATION); - trackEvent('click_organization_plan_update', { - from: 'button', - source: 'billing_tab' - }); - }; {#if $organization} @@ -214,7 +204,7 @@ {:else}
{#if $organization?.billingPlanDowngrade !== null} - + {:else}