Disable change plan

This commit is contained in:
ernstmul committed 2024-10-07 15:44:31 +02:00
1 parent 6593c80a3f
commit 6470ede548
3 files changed
+28 -7

No files matched your search

@@ -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 @@
<LabelCard
name="plan"
bind:group={billingPlan}
disabled={anyOrgFree}
disabled={anyOrgFree || !selfService}
value={BillingPlan.FREE}
tooltipShow={anyOrgFree}
tooltipText="You are limited to 1 Free organization per account."
@@ -49,9 +50,16 @@
</li>
<li>
<LabelCard name="plan" bind:group={billingPlan} value={BillingPlan.PRO} padding={1.5}>
<svelte:fragment slot="custom">
<div class="u-flex u-flex-vertical u-gap-4 u-width-full-line">
<LabelCard
name="plan"
disabled={!selfService}
bind:group={billingPlan}
value={BillingPlan.PRO}
padding={1.5}>
<svelte:fragment slot="custom" let:disabled>
<div
class="u-flex u-flex-vertical u-gap-4 u-width-full-line"
class:u-opacity-50={disabled}>
<h4 class="body-text-2 u-bold">
{tierPro.name}
{#if $organization?.billingPlan === BillingPlan.PRO && !isNewOrg}
+2
View File
@@ -277,6 +277,8 @@ export type Plan = {
users: AdditionalResource;
};
trialDays: number;
isAvailable: boolean;
selfService: boolean;
};
export type PlansInfo = {
@@ -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
<Button href="https://appwrite.io/pricing" external link>pricing page</Button>.
</p>
{#if !selfService}
<Helper class="u-position-relative" type="warning"
>Your contract is not eligible for manual changes. Please <a
href="/contact-us/enterprise">reach out</a> to schedule a call or setup a dialog.</Helper>
{/if}
<PlanSelection
bind:billingPlan
bind:selfService
anyOrgFree={!!anyOrgFree}
class={anyOrgFree && billingPlan !== BillingPlan.FREE
? 'u-margin-block-start-16'
@@ -323,14 +334,14 @@
{/if}
</Form>
<svelte:fragment slot="aside">
{#if billingPlan !== BillingPlan.FREE && $organization.billingPlan !== billingPlan}
{#if billingPlan !== BillingPlan.FREE && $organization.billingPlan !== billingPlan && $organization.billingPlan !== BillingPlan.CUSTOM}
<EstimatedTotalBox
{billingPlan}
{collaborators}
bind:couponData
bind:billingBudget
{isDowngrade} />
{:else}
{:else if $organization.billingPlan !== BillingPlan.CUSTOM}
<PlanComparisonBox downgrade={isDowngrade} />
{/if}
</svelte:fragment>
@@ -341,7 +352,7 @@
<Button
fullWidthMobile
on:click={() => formComponent.triggerSubmit()}
disabled={$isSubmitting || isButtonDisabled}>
disabled={$isSubmitting || isButtonDisabled || !selfService}>
Change plan
</Button>
</WizardSecondaryFooter>