From e0890ac098cdceaf6c96847f00bfe62bf47a438d Mon Sep 17 00:00:00 2001
From: ChiragAgg5k
Date: Tue, 25 Feb 2025 13:51:36 +0530
Subject: [PATCH] chore: updated component
---
src/lib/sdk/billing.ts | 1 +
src/lib/stores/billing.ts | 59 ++++++++++---------
.../usage/[[invoice]]/+page.svelte | 27 ++++-----
3 files changed, 42 insertions(+), 45 deletions(-)
diff --git a/src/lib/sdk/billing.ts b/src/lib/sdk/billing.ts
index b680c9d2e..e1fe75c89 100644
--- a/src/lib/sdk/billing.ts
+++ b/src/lib/sdk/billing.ts
@@ -315,6 +315,7 @@ export type Plan = {
order: number;
bandwidth: number;
storage: number;
+ imageTransformations: number;
webhooks: number;
users: number;
teams: number;
diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts
index 83cb2d1d6..dd698c912 100644
--- a/src/lib/stores/billing.ts
+++ b/src/lib/stores/billing.ts
@@ -1,37 +1,37 @@
-import { page } from '$app/stores';
-import { derived, get, writable } from 'svelte/store';
-import { sdk } from './sdk';
-import { organization, type Organization, type OrganizationError } from './organization';
-import type {
- InvoiceList,
- AddressesList,
- Invoice,
- PaymentList,
- PlansMap,
- PaymentMethodData,
- Plan,
- Aggregation
-} from '$lib/sdk/billing';
-import { isCloud } from '$lib/system';
-import { cachedStore } from '$lib/helpers/cache';
-import { Query } from '@appwrite.io/console';
-import { headerAlert } from './headerAlert';
-import PaymentAuthRequired from '$lib/components/billing/alerts/paymentAuthRequired.svelte';
-import { addNotification, notifications } from './notifications';
+import { browser } from '$app/environment';
import { goto } from '$app/navigation';
import { base } from '$app/paths';
-import { activeHeaderAlert, orgMissingPaymentMethod } from '$routes/(console)/store';
-import MarkedForDeletion from '$lib/components/billing/alerts/markedForDeletion.svelte';
-import { BillingPlan, NEW_DEV_PRO_UPGRADE_COUPON } from '$lib/constants';
-import PaymentMandate from '$lib/components/billing/alerts/paymentMandate.svelte';
-import MissingPaymentMethod from '$lib/components/billing/alerts/missingPaymentMethod.svelte';
-import LimitReached from '$lib/components/billing/alerts/limitReached.svelte';
+import { page } from '$app/stores';
import { trackEvent } from '$lib/actions/analytics';
+import LimitReached from '$lib/components/billing/alerts/limitReached.svelte';
+import MarkedForDeletion from '$lib/components/billing/alerts/markedForDeletion.svelte';
+import MissingPaymentMethod from '$lib/components/billing/alerts/missingPaymentMethod.svelte';
import newDevUpgradePro from '$lib/components/billing/alerts/newDevUpgradePro.svelte';
+import PaymentAuthRequired from '$lib/components/billing/alerts/paymentAuthRequired.svelte';
+import PaymentMandate from '$lib/components/billing/alerts/paymentMandate.svelte';
+import { BillingPlan, NEW_DEV_PRO_UPGRADE_COUPON } from '$lib/constants';
+import { cachedStore } from '$lib/helpers/cache';
import { sizeToBytes, type Size } from '$lib/helpers/sizeConvertion';
-import { user } from './user';
-import { browser } from '$app/environment';
+import type {
+ AddressesList,
+ Aggregation,
+ Invoice,
+ InvoiceList,
+ PaymentList,
+ PaymentMethodData,
+ Plan,
+ PlansMap
+} from '$lib/sdk/billing';
+import { isCloud } from '$lib/system';
+import { activeHeaderAlert, orgMissingPaymentMethod } from '$routes/(console)/store';
+import { Query } from '@appwrite.io/console';
+import { derived, get, writable } from 'svelte/store';
+import { headerAlert } from './headerAlert';
+import { addNotification, notifications } from './notifications';
+import { organization, type Organization, type OrganizationError } from './organization';
import { canSeeBilling } from './roles';
+import { sdk } from './sdk';
+import { user } from './user';
export type Tier = 'tier-0' | 'tier-1' | 'tier-2' | 'auto-1' | 'cont-1' | 'ent-1';
@@ -130,7 +130,8 @@ export type PlanServices =
| 'users'
| 'usersAddon'
| 'webhooks'
- | 'authPhone';
+ | 'authPhone'
+ | 'imageTransformations';
export function getServiceLimit(serviceId: PlanServices, tier: Tier = null, plan?: Plan): number {
if (!isCloud) return 0;
diff --git a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte
index 8782758b0..e172ae8f3 100644
--- a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte
+++ b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte
@@ -267,7 +267,17 @@
{#if data.organizationUsage.imageTransformationsTotal}
+ {@const current = data.organizationUsage.imageTransformationsTotal}
+ {@const max = getServiceLimit('imageTransformations', tier, plan)}
+
[e.date, e.value]
@@ -287,21 +297,6 @@
}
]} />
-
-
-
- {#if projects?.length > 0}
-
- {/if}
{:else}