Skip to content

Commit 0acf199

Browse files
committed
fix: outdated billing usage.
1 parent e271bca commit 0acf199

File tree

10 files changed

+33
-17
lines changed

10 files changed

+33
-17
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"e2e:ui": "playwright test tests/e2e --ui"
2020
},
2121
"dependencies": {
22-
"@appwrite.io/console": "1.4.7",
22+
"@appwrite.io/console": "1.5.2",
2323
"@appwrite.io/pink": "0.25.0",
2424
"@appwrite.io/pink-icons": "0.25.0",
2525
"@popperjs/core": "^2.11.8",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/components/billing/planExcess.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
{#if excess?.members}
8484
<TableRow>
8585
<TableCellText title="members">Organization members</TableCellText>
86-
<TableCellText title="limit">{plan.members} members</TableCellText>
86+
<TableCellText title="limit">{plan.addons.seats.limit} members</TableCellText>
8787
<TableCell title="excess">
8888
<p class="u-color-text-danger u-flex u-cross-center u-gap-4">
8989
<span class="icon-arrow-up" />

src/lib/components/billing/usageRates.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
</TableCellText>
8686
{#if !isFree}
8787
<TableCellText title="rate">
88-
{formatCurrency(plan.addons.member.price)}/{usage?.unit}
88+
{formatCurrency(plan.addons.seats.price)}/{usage?.unit}
8989
</TableCellText>
9090
{/if}
9191
</TableRow>

src/lib/sdk/billing.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,25 @@ export type AdditionalResource = {
257257
multiplier?: number;
258258
};
259259

260+
export type PlanAddon = {
261+
supported: boolean;
262+
currency: string;
263+
invoiceDesc: string;
264+
price: number;
265+
limit: number;
266+
value: number;
267+
type: string;
268+
};
269+
260270
export type Plan = {
261271
$id: string;
262272
name: string;
273+
desc: string;
263274
price: number;
275+
order: number;
264276
bandwidth: number;
265277
storage: number;
266-
members: number;
278+
imageTransformations: number;
267279
webhooks: number;
268280
users: number;
269281
teams: number;
@@ -275,14 +287,17 @@ export type Plan = {
275287
realtime: number;
276288
logs: number;
277289
authPhone: number;
278-
addons: {
290+
usage: {
279291
bandwidth: AdditionalResource;
280292
executions: AdditionalResource;
281293
member: AdditionalResource;
282294
realtime: AdditionalResource;
283295
storage: AdditionalResource;
284296
users: AdditionalResource;
285297
};
298+
addons: {
299+
seats: PlanAddon;
300+
};
286301
trialDays: number;
287302
isAvailable: boolean;
288303
selfService: boolean;
@@ -292,6 +307,7 @@ export type Plan = {
292307
backupsEnabled: boolean;
293308
backupPolicies: number;
294309
emailBranding: boolean;
310+
supportsCredits: boolean;
295311
};
296312

297313
export type PlansInfo = {

src/lib/stores/billing.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ export async function checkForUsageLimit(org: Organization) {
273273

274274
const members = org.total;
275275
const plan = get(plansInfo)?.get(org.billingPlan);
276-
const membersOverflow = members > plan.members ? members - (plan.members || members) : 0;
276+
const membersOverflow =
277+
members > plan.addons.seats.limit ? members - (plan.addons.seats.limit || members) : 0;
277278

278279
if (resources.some((r) => r.value >= 100) || membersOverflow > 0) {
279280
readOnly.set(true);
@@ -476,7 +477,7 @@ export function calculateExcess(usage: OrganizationUsage, plan: Plan, members: n
476477
storage: calculateResourceSurplus(usage?.storageTotal, plan.storage, 'GB'),
477478
users: calculateResourceSurplus(usage?.usersTotal, plan.users),
478479
executions: calculateResourceSurplus(usage?.executionsTotal, plan.executions, 'GB'),
479-
members: calculateResourceSurplus(members, plan.members)
480+
members: calculateResourceSurplus(members, plan.addons.seats.limit)
480481
};
481482
}
482483

src/routes/(console)/organization-[organization]/billing/planSummary.svelte

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@
8787
<div>
8888
{formatCurrency(
8989
extraMembers *
90-
(currentPlan?.addons?.member?.price ??
91-
0)
90+
(currentPlan?.addons?.seats?.price ?? 0)
9291
)}
9392
</div>
9493
</div>

src/routes/(console)/organization-[organization]/change-plan/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@
287287
<b
288288
>you will be charged {formatCurrency(
289289
extraMembers *
290-
($plansInfo?.get(billingPlan)?.addons?.member?.price ?? 0)
290+
($plansInfo?.get(billingPlan)?.addons?.seats?.price ?? 0)
291291
)} monthly for {extraMembers} team members.</b> This will be reflected in
292292
your next invoice.
293293
</Alert>

src/routes/(console)/organization-[organization]/usage/[[invoice]]/totalMembers.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<span
4747
class="icon-info"
4848
use:tooltip={{
49-
content: `You can add unlimited organization members on the ${tierToPlan($organization.billingPlan).name} plan ${$organization.billingPlan === BillingPlan.PRO ? `for ${formatCurrency(plan.addons.member.price)} each per billing period.` : '.'}`
49+
content: `You can add unlimited organization members on the ${tierToPlan($organization.billingPlan).name} plan ${$organization.billingPlan === BillingPlan.PRO ? `for ${formatCurrency(plan.addons.seats.price)} each per billing period.` : '.'}`
5050
}}></span>
5151
</p>
5252
</div>

src/routes/(console)/project-[region]-[project]/overview/platforms/wizard/web/step3.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import { page } from '$app/stores';
3+
import { Code } from '$lib/components';
34
import { WizardStep } from '$lib/layout';
4-
import { Code, Id } from '$lib/components';
55
import { getProjectEndpoint } from '$lib/helpers/project';
66
77
const project = $page.params.project;

0 commit comments

Comments
 (0)