diff --git a/src/lib/components/billing/index.ts b/src/lib/components/billing/index.ts
index 266d217d8..0643e5922 100644
--- a/src/lib/components/billing/index.ts
+++ b/src/lib/components/billing/index.ts
@@ -7,3 +7,5 @@ export { default as PlanComparisonBox } from './planComparisonBox.svelte';
export { default as EmptyCardCloud } from './emptyCardCloud.svelte';
export { default as CreditsApplied } from './creditsApplied.svelte';
export { default as PlanSelection } from './planSelection.svelte';
+export { default as EstimatedTotal } from './estimatedTotal.svelte';
+export { default as SelectPlan } from './selectPlan.svelte';
\ No newline at end of file
diff --git a/src/lib/components/billing/selectPlan.svelte b/src/lib/components/billing/selectPlan.svelte
new file mode 100644
index 000000000..ecff50f99
--- /dev/null
+++ b/src/lib/components/billing/selectPlan.svelte
@@ -0,0 +1,52 @@
+
+
+{#if billingPlan}
+
+ {#each $plansInfo.values() as plan}
+
+
+
+
+
+ {plan.name}
+ {#if $organization?.billingPlan === plan.$id && !isNewOrg}
+ Current plan
+ {/if}
+
+
+ {plan.desc}
+
+
+ {formatCurrency(plan?.price ?? 0)}
+
+
+
+
+
+ {/each}
+
+{/if}
diff --git a/src/lib/sdk/billing.ts b/src/lib/sdk/billing.ts
index f4734d500..2245053c6 100644
--- a/src/lib/sdk/billing.ts
+++ b/src/lib/sdk/billing.ts
@@ -296,7 +296,9 @@ export type PlanAddon = {
export type Plan = {
$id: string;
name: string;
+ desc: string;
price: number;
+ order: number;
bandwidth: number;
storage: number;
webhooks: number;
@@ -332,7 +334,7 @@ export type Plan = {
supportsCredit: boolean;
};
-export type PlansInfo = {
+export type PlanList = {
plans: Plan[];
total: number;
};
@@ -1262,7 +1264,7 @@ export class Billing {
);
}
- async getPlansInfo(): Promise {
+ async getPlansInfo(): Promise {
const path = `/console/plans`;
const params = {};
const uri = new URL(this.client.config.endpoint + path);
diff --git a/src/routes/(console)/create-organization/+page.svelte b/src/routes/(console)/create-organization/+page.svelte
index 59e84076c..3b758b0d3 100644
--- a/src/routes/(console)/create-organization/+page.svelte
+++ b/src/routes/(console)/create-organization/+page.svelte
@@ -6,8 +6,10 @@
import {
EstimatedTotalBox,
PlanComparisonBox,
- PlanSelection,
- SelectPaymentMethod
+ SelectPaymentMethod,
+
+ SelectPlan
+
} from '$lib/components/billing';
import EstimatedTotal from '$lib/components/billing/estimatedTotal.svelte';
import ValidateCreditModal from '$lib/components/billing/validateCreditModal.svelte';
@@ -222,7 +224,7 @@
For more details on our plans, visit our
.
-
+
{#if billingPlan !== BillingPlan.FREE}
$organization.billingPlan;
- $: isDowngrade = billingPlan < $organization.billingPlan;
+ $: isUpgrade = $plansInfo.get(billingPlan).order > $currentPlan.order;
+ $: isDowngrade = $plansInfo.get(billingPlan).order < $currentPlan.order;
$: if (billingPlan !== BillingPlan.FREE) {
loadPaymentMethods();
}
@@ -300,9 +299,8 @@
>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 && $organization.billingPlan !== BillingPlan.CUSTOM}
+ {#if billingPlan !== BillingPlan.FREE && $organization.billingPlan !== billingPlan && $organization.billingPlan !== BillingPlan.CUSTOM && isUpgrade}
-
+ {couponId} />
{:else if $organization.billingPlan !== BillingPlan.CUSTOM}
{/if}