From b7e99baeefd991aa84dc5862ba3f337d6ea9abd7 Mon Sep 17 00:00:00 2001 From: Harsh Mahajan Date: Mon, 3 Nov 2025 20:12:25 +0000 Subject: [PATCH 1/5] add screenshotsGenerated metric across console --- package.json | 2 +- pnpm-lock.yaml | 10 ++-- src/lib/sdk/billing.ts | 5 ++ src/lib/sdk/usage.ts | 10 ++++ src/lib/stores/billing.ts | 3 +- .../billing/planSummary.svelte | 16 +++++++ .../usage/[[invoice]]/+page.svelte | 47 +++++++++++++++++++ .../usage/[[invoice]]/+page.ts | 4 +- .../usage/[[invoice]]/ProjectBreakdown.svelte | 4 +- .../settings/usage/[[invoice]]/+page.svelte | 40 ++++++++++++++++ 10 files changed, 132 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 5a2e77773d..94dbeaf00e 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ }, "dependencies": { "@ai-sdk/svelte": "^1.1.24", - "@appwrite.io/console": "https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@fe3277e", + "@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@0aa6399", "@appwrite.io/pink-icons": "0.25.0", "@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@46f65c7", "@appwrite.io/pink-legacy": "^1.0.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 82b9a6afc8..830e895041 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^1.1.24 version: 1.1.24(svelte@5.25.3)(zod@3.24.3) '@appwrite.io/console': - specifier: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@fe3277e - version: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@fe3277e + specifier: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@2752 + version: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@2752 '@appwrite.io/pink-icons': specifier: 0.25.0 version: 0.25.0 @@ -260,8 +260,8 @@ packages: '@analytics/type-utils@0.6.2': resolution: {integrity: sha512-TD+xbmsBLyYy/IxFimW/YL/9L2IEnM7/EoV9Aeh56U64Ify8o27HJcKjo38XY9Tcn0uOq1AX3thkKgvtWvwFQg==} - '@appwrite.io/console@https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@fe3277e': - resolution: {tarball: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@fe3277e} + '@appwrite.io/console@https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@2752': + resolution: {tarball: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@2752} version: 1.10.0 '@appwrite.io/pink-icons-svelte@2.0.0-RC.1': @@ -3703,7 +3703,7 @@ snapshots: '@analytics/type-utils@0.6.2': {} - '@appwrite.io/console@https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@fe3277e': {} + '@appwrite.io/console@https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@2752': {} '@appwrite.io/pink-icons-svelte@2.0.0-RC.1(svelte@5.25.3)': dependencies: diff --git a/src/lib/sdk/billing.ts b/src/lib/sdk/billing.ts index 0361f59101..9d3328f5fb 100644 --- a/src/lib/sdk/billing.ts +++ b/src/lib/sdk/billing.ts @@ -292,12 +292,14 @@ export type OrganizationUsage = { databasesReads: Array; databasesWrites: Array; imageTransformations: Array; + screenshotsGenerated: Array; executionsTotal: number; filesStorageTotal: number; buildsStorageTotal: number; databasesReadsTotal: number; databasesWritesTotal: number; imageTransformationsTotal: number; + screenshotsGeneratedTotal: number; deploymentsStorageTotal: number; executionsMBSecondsTotal: number; buildsMBSecondsTotal: number; @@ -316,6 +318,7 @@ export type OrganizationUsage = { authPhoneTotal: number; authPhoneEstimate: number; imageTransformations: number; + screenshotsGenerated: number; }>; authPhoneTotal: number; authPhoneEstimate: number; @@ -384,6 +387,7 @@ export type Plan = { bandwidth: number; storage: number; imageTransformations: number; + screenshotsGenerated: number; webhooks: number; users: number; teams: number; @@ -411,6 +415,7 @@ export type Plan = { databasesWrites: AdditionalResource; GBHours: AdditionalResource; imageTransformations: AdditionalResource; + screenshotsGenerated: AdditionalResource; }; addons: { seats: PlanAddon; diff --git a/src/lib/sdk/usage.ts b/src/lib/sdk/usage.ts index b446bfa50f..268f785234 100644 --- a/src/lib/sdk/usage.ts +++ b/src/lib/sdk/usage.ts @@ -332,4 +332,14 @@ export type UsageProject = { * Aggregated statistics of total number of image transformations. */ imageTransformationsTotal: number; + + /** + * Array of screenshots generated per period. + */ + screenshotsGenerated: Metric[]; + + /** + * Aggregated statistics of total number of screenshots generated. + */ + screenshotsGeneratedTotal: number; }; diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts index 46134dde33..d5af1fe764 100644 --- a/src/lib/stores/billing.ts +++ b/src/lib/stores/billing.ts @@ -150,7 +150,8 @@ export type PlanServices = | 'webhooks' | 'sites' | 'authPhone' - | 'imageTransformations'; + | 'imageTransformations' + | 'screenshotsGenerated'; export function getServiceLimit(serviceId: PlanServices, tier: Tier = null, plan?: Plan): number { if (!isCloud) return 0; diff --git a/src/routes/(console)/organization-[organization]/billing/planSummary.svelte b/src/routes/(console)/organization-[organization]/billing/planSummary.svelte index 6a4a43f01c..64907af63f 100644 --- a/src/routes/(console)/organization-[organization]/billing/planSummary.svelte +++ b/src/routes/(console)/organization-[organization]/billing/planSummary.svelte @@ -127,6 +127,9 @@ imageTransformations: projectData?.resources?.find( (resource) => resource.resourceId === 'imageTransformations' ), + screenshotsGenerated: projectData?.resources?.find( + (resource) => resource.resourceId === 'screenshotsGenerated' + ), bandwidth: projectData?.resources?.find( (resource) => resource.resourceId === 'bandwidth' ), @@ -280,6 +283,19 @@ ), maxValue: currentPlan?.imageTransformations }, + { + id: `screenshots-generated`, + cells: { + item: 'Screenshots generated', + usage: `${formatNum(project.screenshotsGenerated.value || 0)} / ${currentPlan?.screenshotsGenerated ? formatNum(currentPlan.screenshotsGenerated) : 'Unlimited'}`, + price: formatCurrency(project.screenshotsGenerated.amount || 0) + }, + progressData: createProgressData( + project.screenshotsGenerated.value || 0, + currentPlan?.screenshotsGenerated + ), + maxValue: currentPlan?.screenshotsGenerated + }, { id: `gb-hours`, cells: { diff --git a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte index a9422df60b..cd8399e4fe 100644 --- a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte +++ b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte @@ -322,6 +322,53 @@ + + Screenshots generated + The total number of screenshots generated across all projects in your organization. + + {#if data.organizationUsage.screenshotsGeneratedTotal} + {@const current = data.organizationUsage.screenshotsGeneratedTotal} + {@const max = getServiceLimit('screenshotsGenerated', tier, plan)} + + [ + e.date, + e.value + ]) + ] + } + ]} /> + {#if projects?.length > 0} + + {/if} + {:else} + + + + No data to show + + + {/if} + + + Executions Calculated for all functions that are executed in all projects in your organization. diff --git a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.ts b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.ts index 8fd36fadfc..8143bcdc96 100644 --- a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.ts +++ b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.ts @@ -34,7 +34,9 @@ export const load: PageLoad = async ({ params, parent }) => { databasesReadsTotal: null, databasesWritesTotal: null, imageTransformations: null, - imageTransformationsTotal: null + imageTransformationsTotal: null, + screenshotsGenerated: null, + screenshotsGeneratedTotal: null } }; } diff --git a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte index 98a0282821..1772e6a4f5 100644 --- a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte +++ b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte @@ -16,7 +16,8 @@ | 'authPhoneTotal' | 'databasesReads' | 'databasesWrites' - | 'imageTransformations'; + | 'imageTransformations' + | 'screenshotsGenerated'; type Estimate = 'authPhoneEstimate'; @@ -89,6 +90,7 @@ switch (metric) { case 'imageTransformations': + case 'screenshotsGenerated': case 'authPhoneTotal': return formatNumberWithCommas(value); case 'executions': diff --git a/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.svelte b/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.svelte index 76d4d5e1e2..34d46ded63 100644 --- a/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.svelte @@ -30,6 +30,8 @@ data.usage.buildsStorageTotal; $: imageTransformations = data.usage.imageTransformations; $: imageTransformationsTotal = data.usage.imageTransformationsTotal; + $: screenshotsGenerated = (data.usage as any).screenshotsGenerated ?? null; + $: screenshotsGeneratedTotal = (data.usage as any).screenshotsGeneratedTotal ?? 0; $: dbReads = data.usage.databasesReads; $: dbWrites = data.usage.databasesWrites; @@ -241,6 +243,44 @@ {/if} + + Screenshots generated + Total number of screenshots generated in your project. + + {#if screenshotsGenerated} + {@const current = formatNum(screenshotsGeneratedTotal)} +
+
+

+ {current} + Screenshots +

+
+
+ [e.date, e.value])] + } + ]} /> + {:else} + + + + No data to show + + + {/if} +
+
Executions Calculated for all functions that are executed in this project. From 80fb7f6156e1c6a910c339b2291a4aed5b9d3d3a Mon Sep 17 00:00:00 2001 From: Harsh Mahajan Date: Mon, 3 Nov 2025 20:17:31 +0000 Subject: [PATCH 2/5] pnpm lockfile --- pnpm-lock.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 830e895041..0ca9702012 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^1.1.24 version: 1.1.24(svelte@5.25.3)(zod@3.24.3) '@appwrite.io/console': - specifier: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@2752 - version: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@2752 + specifier: https://pkg.vc/-/@appwrite/@appwrite.io/console@0aa6399 + version: https://pkg.vc/-/@appwrite/@appwrite.io/console@0aa6399 '@appwrite.io/pink-icons': specifier: 0.25.0 version: 0.25.0 @@ -260,8 +260,8 @@ packages: '@analytics/type-utils@0.6.2': resolution: {integrity: sha512-TD+xbmsBLyYy/IxFimW/YL/9L2IEnM7/EoV9Aeh56U64Ify8o27HJcKjo38XY9Tcn0uOq1AX3thkKgvtWvwFQg==} - '@appwrite.io/console@https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@2752': - resolution: {tarball: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@2752} + '@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@0aa6399': + resolution: {tarball: https://pkg.vc/-/@appwrite/@appwrite.io/console@0aa6399} version: 1.10.0 '@appwrite.io/pink-icons-svelte@2.0.0-RC.1': @@ -3703,7 +3703,7 @@ snapshots: '@analytics/type-utils@0.6.2': {} - '@appwrite.io/console@https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@2752': {} + '@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@0aa6399': {} '@appwrite.io/pink-icons-svelte@2.0.0-RC.1(svelte@5.25.3)': dependencies: From 930d0fb68f17838d593421842ea2a4a78e019d2d Mon Sep 17 00:00:00 2001 From: Harsh Mahajan Date: Mon, 3 Nov 2025 20:31:19 +0000 Subject: [PATCH 3/5] package upgrade --- package.json | 1 + pnpm-lock.yaml | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/package.json b/package.json index 94dbeaf00e..466a3854d5 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "deep-equal": "^2.2.3", "echarts": "^5.6.0", "ignore": "^6.0.2", + "install": "^0.13.0", "nanoid": "^5.1.5", "nanotar": "^0.1.1", "plausible-tracker": "^0.3.9", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0ca9702012..f75452c03f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -59,6 +59,9 @@ importers: ignore: specifier: ^6.0.2 version: 6.0.2 + install: + specifier: ^0.13.0 + version: 0.13.0 nanoid: specifier: ^5.1.5 version: 5.1.5 @@ -2408,6 +2411,10 @@ packages: resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==} engines: {node: '>=8'} + install@0.13.0: + resolution: {integrity: sha512-zDml/jzr2PKU9I8J/xyZBQn8rPCAY//UOYNmR01XwNwyfhEWObo2SWfSl1+0tm1u6PhxLwDnfsT/6jB7OUxqFA==} + engines: {node: '>= 0.10'} + internal-slot@1.1.0: resolution: {integrity: sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==} engines: {node: '>= 0.4'} @@ -6090,6 +6097,8 @@ snapshots: indent-string@4.0.0: {} + install@0.13.0: {} + internal-slot@1.1.0: dependencies: es-errors: 1.3.0 From 1af8a325de2329d0f09170711a3109b31722a21e Mon Sep 17 00:00:00 2001 From: Harsh Mahajan <127186841+HarshMN2345@users.noreply.github.com> Date: Tue, 4 Nov 2025 02:03:16 +0530 Subject: [PATCH 4/5] Refactor usage data handling for screenshots generated --- .../settings/usage/[[invoice]]/+page.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.svelte b/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.svelte index 34d46ded63..0bd816cc52 100644 --- a/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.svelte @@ -30,8 +30,8 @@ data.usage.buildsStorageTotal; $: imageTransformations = data.usage.imageTransformations; $: imageTransformationsTotal = data.usage.imageTransformationsTotal; - $: screenshotsGenerated = (data.usage as any).screenshotsGenerated ?? null; - $: screenshotsGeneratedTotal = (data.usage as any).screenshotsGeneratedTotal ?? 0; + $: screenshotsGenerated = data.usage.screenshotsGenerated; + $: screenshotsGeneratedTotal = data.usage.screenshotsGeneratedTotal; $: dbReads = data.usage.databasesReads; $: dbWrites = data.usage.databasesWrites; From 53b970764c9c26d36454ae89417fc2a138d3a850 Mon Sep 17 00:00:00 2001 From: Harsh Mahajan <127186841+HarshMN2345@users.noreply.github.com> Date: Sun, 7 Dec 2025 11:02:57 +0530 Subject: [PATCH 5/5] broken lockfile fix --- pnpm-lock.yaml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f75452c03f..a1cfb8a9c7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,20 +12,20 @@ importers: specifier: ^1.1.24 version: 1.1.24(svelte@5.25.3)(zod@3.24.3) '@appwrite.io/console': - specifier: https://pkg.vc/-/@appwrite/@appwrite.io/console@0aa6399 - version: https://pkg.vc/-/@appwrite/@appwrite.io/console@0aa6399 + specifier: https://pkg.vc/-/@appwrite/@appwrite.io/console@9b32107 + version: https://pkg.vc/-/@appwrite/@appwrite.io/console@9b32107 '@appwrite.io/pink-icons': specifier: 0.25.0 version: 0.25.0 '@appwrite.io/pink-icons-svelte': - specifier: https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@46f65c7 - version: https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@46f65c7(svelte@5.25.3) + specifier: https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@865e2fc + version: https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@865e2fc(svelte@5.25.3) '@appwrite.io/pink-legacy': specifier: ^1.0.3 version: 1.0.3 '@appwrite.io/pink-svelte': - specifier: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@46f65c7 - version: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@46f65c7(svelte@5.25.3) + specifier: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@865e2fc + version: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@865e2fc(svelte@5.25.3) '@faker-js/faker': specifier: ^9.9.0 version: 9.9.0 @@ -263,8 +263,8 @@ packages: '@analytics/type-utils@0.6.2': resolution: {integrity: sha512-TD+xbmsBLyYy/IxFimW/YL/9L2IEnM7/EoV9Aeh56U64Ify8o27HJcKjo38XY9Tcn0uOq1AX3thkKgvtWvwFQg==} - '@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@0aa6399': - resolution: {tarball: https://pkg.vc/-/@appwrite/@appwrite.io/console@0aa6399} + '@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@9b32107': + resolution: {tarball: https://pkg.vc/-/@appwrite/@appwrite.io/console@9b32107} version: 1.10.0 '@appwrite.io/pink-icons-svelte@2.0.0-RC.1': @@ -272,8 +272,8 @@ packages: peerDependencies: svelte: ^4.0.0 - '@appwrite.io/pink-icons-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@46f65c7': - resolution: {tarball: https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@46f65c7} + '@appwrite.io/pink-icons-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@865e2fc': + resolution: {tarball: https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@865e2fc} version: 2.0.0-RC.1 peerDependencies: svelte: ^4.0.0 @@ -287,8 +287,8 @@ packages: '@appwrite.io/pink-legacy@1.0.3': resolution: {integrity: sha512-GGde5fmPhs+s6/3aFeMPc/kKADG/gTFkYQSy6oBN8pK0y0XNCLrZZgBv+EBbdhwdtqVEWXa0X85Mv9w7jcIlwQ==} - '@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@46f65c7': - resolution: {tarball: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@46f65c7} + '@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@865e2fc': + resolution: {tarball: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@865e2fc} version: 2.0.0-RC.2 peerDependencies: svelte: ^4.0.0 @@ -3710,13 +3710,13 @@ snapshots: '@analytics/type-utils@0.6.2': {} - '@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@0aa6399': {} + '@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@9b32107': {} '@appwrite.io/pink-icons-svelte@2.0.0-RC.1(svelte@5.25.3)': dependencies: svelte: 5.25.3 - '@appwrite.io/pink-icons-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@46f65c7(svelte@5.25.3)': + '@appwrite.io/pink-icons-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@865e2fc(svelte@5.25.3)': dependencies: svelte: 5.25.3 @@ -3729,7 +3729,7 @@ snapshots: '@appwrite.io/pink-icons': 1.0.0 the-new-css-reset: 1.11.3 - '@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@46f65c7(svelte@5.25.3)': + '@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@865e2fc(svelte@5.25.3)': dependencies: '@appwrite.io/pink-icons-svelte': 2.0.0-RC.1(svelte@5.25.3) '@floating-ui/dom': 1.6.13