From 6470ede548f1c616d6b483d5d205c8fdfeb7040f Mon Sep 17 00:00:00 2001 From: ernstmul Date: Mon, 7 Oct 2024 15:44:31 +0200 Subject: [PATCH] Disable change plan --- src/lib/components/billing/planSelection.svelte | 16 ++++++++++++---- src/lib/sdk/billing.ts | 2 ++ .../change-plan/+page.svelte | 17 ++++++++++++++--- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/lib/components/billing/planSelection.svelte b/src/lib/components/billing/planSelection.svelte index 2fb005922..0d484a9b4 100644 --- a/src/lib/components/billing/planSelection.svelte +++ b/src/lib/components/billing/planSelection.svelte @@ -8,6 +8,7 @@ export let billingPlan: Tier; export let anyOrgFree = false; export let isNewOrg = false; + export let selfService = true; let classes: string = ''; export { classes as class }; @@ -22,7 +23,7 @@
  • - - -
    + + +

    {tierPro.name} {#if $organization?.billingPlan === BillingPlan.PRO && !isNewOrg} diff --git a/src/lib/sdk/billing.ts b/src/lib/sdk/billing.ts index a665d2e72..720b6c394 100644 --- a/src/lib/sdk/billing.ts +++ b/src/lib/sdk/billing.ts @@ -277,6 +277,8 @@ export type Plan = { users: AdditionalResource; }; trialDays: number; + isAvailable: boolean; + selfService: boolean; }; export type PlansInfo = { diff --git a/src/routes/(console)/organization-[organization]/change-plan/+page.svelte b/src/routes/(console)/organization-[organization]/change-plan/+page.svelte index dbfb4fbc7..23dbf61de 100644 --- a/src/routes/(console)/organization-[organization]/change-plan/+page.svelte +++ b/src/routes/(console)/organization-[organization]/change-plan/+page.svelte @@ -18,6 +18,7 @@ Button, Form, FormList, + Helper, InputSelect, InputTags, InputTextarea, @@ -73,6 +74,7 @@ let feedbackDowngradeReason: string; let feedbackMessage: string; + let selfService: boolean; onMount(async () => { if ($page.url.searchParams.has('code')) { @@ -99,6 +101,9 @@ } else { billingPlan = BillingPlan.PRO; } + + const currentPlan = await sdk.forConsole.billing.getPlan($organization?.$id); + selfService = false; //currentPlan.selfService; }); async function loadPaymentMethods() { @@ -252,8 +257,14 @@ For more details on our plans, visit our .

    + {#if !selfService} + Your contract is not eligible for manual changes. Please reach out to schedule a call or setup a dialog. + {/if} - {#if billingPlan !== BillingPlan.FREE && $organization.billingPlan !== billingPlan} + {#if billingPlan !== BillingPlan.FREE && $organization.billingPlan !== billingPlan && $organization.billingPlan !== BillingPlan.CUSTOM} - {:else} + {:else if $organization.billingPlan !== BillingPlan.CUSTOM} {/if} @@ -341,7 +352,7 @@