diff --git a/package.json b/package.json
index 3debab377..bef52fab1 100644
--- a/package.json
+++ b/package.json
@@ -22,7 +22,7 @@
},
"dependencies": {
"@ai-sdk/svelte": "^1.1.24",
- "@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@5ce6dc7",
+ "@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@406d8be",
"@appwrite.io/pink-icons": "0.25.0",
"@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@5b26bb8",
"@appwrite.io/pink-legacy": "^1.0.3",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 351e441f1..9201f828e 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -12,8 +12,8 @@ importers:
specifier: ^1.1.24
version: 1.1.24(svelte@5.43.6)(zod@3.24.3)
'@appwrite.io/console':
- specifier: https://pkg.vc/-/@appwrite/@appwrite.io/console@5ce6dc7
- version: https://pkg.vc/-/@appwrite/@appwrite.io/console@5ce6dc7
+ specifier: https://pkg.vc/-/@appwrite/@appwrite.io/console@406d8be
+ version: https://pkg.vc/-/@appwrite/@appwrite.io/console@406d8be
'@appwrite.io/pink-icons':
specifier: 0.25.0
version: 0.25.0
@@ -278,8 +278,8 @@ packages:
'@apm-js-collab/tracing-hooks@0.3.1':
resolution: {integrity: sha512-Vu1CbmPURlN5fTboVuKMoJjbO5qcq9fA5YXpskx3dXe/zTBvjODFoerw+69rVBlRLrJpwPqSDqEuJDEKIrTldw==}
- '@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@5ce6dc7':
- resolution: {tarball: https://pkg.vc/-/@appwrite/@appwrite.io/console@5ce6dc7}
+ '@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@406d8be':
+ resolution: {tarball: https://pkg.vc/-/@appwrite/@appwrite.io/console@406d8be}
version: 1.10.0
'@appwrite.io/pink-icons-svelte@2.0.0-RC.1':
@@ -3667,7 +3667,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@5ce6dc7': {}
+ '@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@406d8be': {}
'@appwrite.io/pink-icons-svelte@2.0.0-RC.1(svelte@5.43.6)':
dependencies:
diff --git a/src/lib/components/billing/planComparisonBox.svelte b/src/lib/components/billing/planComparisonBox.svelte
index 54f91e8cb..b8a1df636 100644
--- a/src/lib/components/billing/planComparisonBox.svelte
+++ b/src/lib/components/billing/planComparisonBox.svelte
@@ -22,7 +22,7 @@
});
function getCleanPlanName(plan: Plan) {
- return plan.name.replace(resolvedProfile.platform, '');
+ return plan?.name?.replace(resolvedProfile.platform, '');
}
@@ -125,6 +125,6 @@
{#snippet imaginePlanView()}
- {currentPlan?.chatMessages} daily messages
+ {currentPlan?.limits?.credits} daily messages
{/snippet}
diff --git a/src/lib/components/billing/planSelection.svelte b/src/lib/components/billing/planSelection.svelte
index 6eea41c35..670bee512 100644
--- a/src/lib/components/billing/planSelection.svelte
+++ b/src/lib/components/billing/planSelection.svelte
@@ -8,6 +8,7 @@
import { page } from '$app/state';
import { ProfileMode, resolvedProfile } from '$lib/profiles/index.svelte';
+ export let disabled = false;
export let isNewOrg = false;
export let selfService = true;
export let anyOrgFree = false;
@@ -22,7 +23,7 @@
function message(plan: Plan): string {
const price = formatCurrency(plan?.price ?? 0);
if (resolvedProfile.id === ProfileMode.STUDIO) {
- return `${plan.chatMessages} daily messages for ${price} per month + usage`;
+ return `${plan.limits?.credits} daily messages for ${price} per month + usage`;
} else {
return `${price} per month + usage`;
}
@@ -34,7 +35,7 @@
diff --git a/src/lib/helpers/billing.ts b/src/lib/helpers/billing.ts
index 41f9074e5..6160a829a 100644
--- a/src/lib/helpers/billing.ts
+++ b/src/lib/helpers/billing.ts
@@ -2,7 +2,7 @@ import { BillingPlan } from '@appwrite.io/console';
export function isFreePlan(plan: BillingPlan | string): boolean {
switch (plan) {
- case BillingPlan.Imaginebasic:
+ case BillingPlan.Imaginetier0:
case BillingPlan.Tier0:
return true;
default:
@@ -11,11 +11,5 @@ export function isFreePlan(plan: BillingPlan | string): boolean {
}
export function isProPlan(plan: BillingPlan | string): boolean {
- switch (plan) {
- case BillingPlan.Imaginepro:
- case BillingPlan.Tier1:
- return true;
- default:
- return false;
- }
+ return !isFreePlan(plan);
}
diff --git a/src/lib/profiles/index.svelte.ts b/src/lib/profiles/index.svelte.ts
index aed8fa667..c09a37f83 100644
--- a/src/lib/profiles/index.svelte.ts
+++ b/src/lib/profiles/index.svelte.ts
@@ -101,7 +101,7 @@ export const studio: Profile = {
id: ProfileMode.STUDIO,
platform: 'Imagine',
organizationPlatform: Platform.Imagine,
- freeTier: BillingPlan.Imaginebasic,
+ freeTier: BillingPlan.Imaginetier0,
logo: {
src: {
dark: asset('/images/imagine-logo-dark.svg'),
diff --git a/src/lib/sdk/billing.ts b/src/lib/sdk/billing.ts
index d3c8a885c..37debf8dd 100644
--- a/src/lib/sdk/billing.ts
+++ b/src/lib/sdk/billing.ts
@@ -412,6 +412,9 @@ export type Plan = {
databasesWrites: AdditionalResource;
GBHours: AdditionalResource;
imageTransformations: AdditionalResource;
+
+ // imagine specific
+ credits: AdditionalResource;
};
addons: {
seats: PlanAddon;
@@ -432,8 +435,9 @@ export type Plan = {
buildSize: number; // in MB
deploymentSize: number; // in MB
usagePerProject: boolean;
- // imagine specifics
- chatMessages: number; // daily
+ limits: {
+ credits?: number
+ }
};
export type PlanList = {
diff --git a/src/routes/(console)/create-organization/+page.svelte b/src/routes/(console)/create-organization/+page.svelte
index 1c1092f73..d4219be5f 100644
--- a/src/routes/(console)/create-organization/+page.svelte
+++ b/src/routes/(console)/create-organization/+page.svelte
@@ -205,7 +205,11 @@
>.
-
+
{#if !isFreePlan(selectedPlan)}
diff --git a/src/routes/(console)/organization-[organization]/change-plan/+page.svelte b/src/routes/(console)/organization-[organization]/change-plan/+page.svelte
index 12a8f256f..dcf0ce7ea 100644
--- a/src/routes/(console)/organization-[organization]/change-plan/+page.svelte
+++ b/src/routes/(console)/organization-[organization]/change-plan/+page.svelte
@@ -250,6 +250,7 @@
!data?.members?.memberships?.find((m) => m.userEmail === collaborator)
);
}
+
const org = await sdk.forConsole.billing.updatePlan(
data.organization.$id,
selectedPlan,
@@ -310,6 +311,8 @@
}
}
+ $: console.log($plansInfo.get(selectedPlan));
+
$: isUpgrade = $plansInfo.get(selectedPlan)?.order > $currentPlan?.order;
$: isDowngrade = $plansInfo.get(selectedPlan)?.order < $currentPlan?.order;
$: isButtonDisabled =
@@ -342,7 +345,11 @@
{/if}
-
+
{#if isDowngrade && isFreePlan(selectedPlan) && data.hasFreeOrgs}