diff --git a/src/lib/sdk/billing.ts b/src/lib/sdk/billing.ts index e67dcbf86..219233c62 100644 --- a/src/lib/sdk/billing.ts +++ b/src/lib/sdk/billing.ts @@ -1,6 +1,7 @@ import type { Client, Query } from '@appwrite.io/console'; import type { Organization } from '../stores/organization'; import type { PaymentMethod } from '@stripe/stripe-js'; +import type { Tier } from '$lib/stores/billing'; export type PaymentMethodData = { $id: string; @@ -38,6 +39,7 @@ export type Invoice = { status: string; dueAt: string; clientSecret: string; + tier: Tier; }; export type InvoiceList = { @@ -156,7 +158,7 @@ export type Aggregation = { type UsageMetric = { date: string; value: number; -} +}; export type OrganizationUsage = { bandwidth: Array; executions: number; diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts index 9fc1a185e..9e71f81b3 100644 --- a/src/lib/stores/billing.ts +++ b/src/lib/stores/billing.ts @@ -58,10 +58,12 @@ export type PlanServices = | 'usersAddon' | 'webhooks'; -export function getServiceLimit(serviceId: PlanServices): number { +export function getServiceLimit(serviceId: PlanServices, tier: Tier = null): number { if (!isCloud) return 0; if (!serviceId) return 0; - const plan = get(plansInfo).plans.find((p) => p.$id === get(organization)?.billingPlan); + const plan = get(plansInfo).plans.find( + (p) => p.$id === (tier ?? get(organization)?.billingPlan) + ); return plan[serviceId]; } diff --git a/src/routes/console/organization-[organization]/usage/[[invoice]]/+page.svelte b/src/routes/console/organization-[organization]/usage/[[invoice]]/+page.svelte index 369495647..2ceac055e 100644 --- a/src/routes/console/organization-[organization]/usage/[[invoice]]/+page.svelte +++ b/src/routes/console/organization-[organization]/usage/[[invoice]]/+page.svelte @@ -1,17 +1,20 @@ @@ -42,7 +45,7 @@

{:else}

- If you exceed the limits of the {tier} plan, services for your projects may be disrupted. + If you exceed the limits of the {plan} plan, services for your projects may be disrupted.