From e863ba4696bbcabc366138c40d98a2c4fca27a92 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 14 Nov 2025 18:43:51 +0400 Subject: [PATCH] Add Platform support and organizationPlatform --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- src/lib/profiles/index.svelte.ts | 4 ++++ src/lib/sdk/billing.ts | 4 +++- src/lib/stores/organization.ts | 3 ++- src/lib/stores/sdk.ts | 6 ++++-- src/routes/(console)/apply-credit/+page.svelte | 1 + src/routes/(console)/create-organization/+page.svelte | 4 +++- .../onboarding/create-organization/+page.svelte | 1 + .../(console)/onboarding/create-project/+page.ts | 1 + src/routes/(public)/functions/deploy/+page.ts | 2 ++ src/routes/(public)/sites/deploy/+page.ts | 4 +++- 12 files changed, 30 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 6ac79cd4e..80aeca8ff 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@2752", + "@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@5ce6dc7", "@appwrite.io/pink-icons": "0.25.0", "@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@4472521", "@appwrite.io/pink-legacy": "^1.0.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b680bc162..ec49e3767 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.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@5ce6dc7 + version: https://pkg.vc/-/@appwrite/@appwrite.io/console@5ce6dc7 '@appwrite.io/pink-icons': specifier: 0.25.0 version: 0.25.0 @@ -272,8 +272,8 @@ packages: '@analytics/type-utils@0.6.4': resolution: {integrity: sha512-Ou1gQxFakOWLcPnbFVsrPb8g1wLLUZYYJXDPjHkG07+5mustGs5yqACx42UAu4A6NszNN6Z5gGxhyH45zPWRxw==} - '@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@5ce6dc7': + resolution: {tarball: https://pkg.vc/-/@appwrite/@appwrite.io/console@5ce6dc7} version: 1.10.0 '@appwrite.io/pink-icons-svelte@2.0.0-RC.1': @@ -3648,7 +3648,7 @@ snapshots: '@analytics/type-utils@0.6.4': {} - '@appwrite.io/console@https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@2752': {} + '@appwrite.io/console@https://pkg.vc/-/@appwrite/@appwrite.io/console@5ce6dc7': {} '@appwrite.io/pink-icons-svelte@2.0.0-RC.1(svelte@5.43.6)': dependencies: diff --git a/src/lib/profiles/index.svelte.ts b/src/lib/profiles/index.svelte.ts index a8d94562d..b1f357fda 100644 --- a/src/lib/profiles/index.svelte.ts +++ b/src/lib/profiles/index.svelte.ts @@ -1,6 +1,7 @@ import { asset, resolve } from '$app/paths'; import type { ResolvedPathname } from '$app/types'; import { PUBLIC_CONSOLE_PROFILE } from '$env/static/public'; +import { Platform } from '@appwrite.io/console'; export const enum ProfileMode { STUDIO = 'studio', @@ -10,6 +11,7 @@ export const enum ProfileMode { export type Profile = { id: ProfileMode; platform: string; + organizationPlatform: Platform; logo: { src: { dark: string; @@ -42,6 +44,7 @@ export type Profile = { export const base: Profile = { id: ProfileMode.CONSOLE, platform: 'Appwrite', + organizationPlatform: Platform.Appwrite, logo: { src: { dark: asset('/images/appwrite-logo-dark.svg'), @@ -79,6 +82,7 @@ export const base: Profile = { export const studio: Profile = { id: ProfileMode.STUDIO, platform: 'Imagine', + organizationPlatform: Platform.Imagine, logo: { src: { dark: asset('/images/imagine-logo-dark.svg'), diff --git a/src/lib/sdk/billing.ts b/src/lib/sdk/billing.ts index 0361f5910..6e0c69802 100644 --- a/src/lib/sdk/billing.ts +++ b/src/lib/sdk/billing.ts @@ -1,6 +1,6 @@ import type { Tier } from '$lib/stores/billing'; import type { Campaign } from '$lib/stores/campaigns'; -import type { Client, Models } from '@appwrite.io/console'; +import type { Client, Models, Platform } from '@appwrite.io/console'; import type { PaymentMethod } from '@stripe/stripe-js'; import type { Organization, OrganizationError, OrganizationList } from '../stores/organization'; @@ -490,6 +490,7 @@ export class Billing { name: string, billingPlan: string, paymentMethodId: string, + platform: Platform, billingAddressId: string = null, couponId: string = null, invites: Array = [], @@ -500,6 +501,7 @@ export class Billing { const params = { organizationId, name, + platform, billingPlan, paymentMethodId, billingAddressId, diff --git a/src/lib/stores/organization.ts b/src/lib/stores/organization.ts index 79f218d8f..d0b49e50f 100644 --- a/src/lib/stores/organization.ts +++ b/src/lib/stores/organization.ts @@ -1,6 +1,6 @@ import { page } from '$app/stores'; import { derived, writable } from 'svelte/store'; -import type { Models } from '@appwrite.io/console'; +import type { Models, Platform } from '@appwrite.io/console'; import type { Tier } from './billing'; import type { Plan } from '$lib/sdk/billing'; @@ -35,6 +35,7 @@ export type Organization = Models.Team> & { status: string; remarks: string; projects: string[]; + platform: Platform; }; export type OrganizationList = { diff --git a/src/lib/stores/sdk.ts b/src/lib/stores/sdk.ts index daeb7ffba..05f9f54db 100644 --- a/src/lib/stores/sdk.ts +++ b/src/lib/stores/sdk.ts @@ -22,7 +22,8 @@ import { Tokens, TablesDB, Domains, - Realtime + Realtime, + Organizations } from '@appwrite.io/console'; import { Billing } from '../sdk/billing'; import { Backups } from '../sdk/backups'; @@ -95,7 +96,8 @@ function createConsoleSdk(client: Client) { sites: new Sites(client), domains: new Domains(client), storage: new Storage(client), - realtime: new Realtime(client) + realtime: new Realtime(client), + organizations: new Organizations(client) }; } diff --git a/src/routes/(console)/apply-credit/+page.svelte b/src/routes/(console)/apply-credit/+page.svelte index b5bb3926d..b8bc37a60 100644 --- a/src/routes/(console)/apply-credit/+page.svelte +++ b/src/routes/(console)/apply-credit/+page.svelte @@ -135,6 +135,7 @@ name, billingPlan, paymentMethodId, + resolvedProfile.organizationPlatform, null, couponData.code ? couponData.code : null, collaborators, diff --git a/src/routes/(console)/create-organization/+page.svelte b/src/routes/(console)/create-organization/+page.svelte index 54f6bbb48..15ccaa6f8 100644 --- a/src/routes/(console)/create-organization/+page.svelte +++ b/src/routes/(console)/create-organization/+page.svelte @@ -114,7 +114,8 @@ name, BillingPlan.FREE, null, - null + null, + resolvedProfile.organizationPlatform ); } else { org = await sdk.forConsole.billing.createOrganization( @@ -122,6 +123,7 @@ name, selectedPlan, paymentMethodId, + resolvedProfile.organizationPlatform, null, selectedCoupon?.code, collaborators, diff --git a/src/routes/(console)/onboarding/create-organization/+page.svelte b/src/routes/(console)/onboarding/create-organization/+page.svelte index 9fb1bc26b..11fd6d21e 100644 --- a/src/routes/(console)/onboarding/create-organization/+page.svelte +++ b/src/routes/(console)/onboarding/create-organization/+page.svelte @@ -27,6 +27,7 @@ organizationName, BillingPlan.FREE, null, + resolvedProfile.organizationPlatform, null ); diff --git a/src/routes/(console)/onboarding/create-project/+page.ts b/src/routes/(console)/onboarding/create-project/+page.ts index a12f3f5e0..a39592844 100644 --- a/src/routes/(console)/onboarding/create-project/+page.ts +++ b/src/routes/(console)/onboarding/create-project/+page.ts @@ -46,6 +46,7 @@ export const load: PageLoad = async ({ parent }) => { 'Personal projects', BillingPlan.FREE, null, + resolvedProfile.organizationPlatform, null ); trackEvent(Submit.OrganizationCreate, { diff --git a/src/routes/(public)/functions/deploy/+page.ts b/src/routes/(public)/functions/deploy/+page.ts index 978894e78..a5a61d420 100644 --- a/src/routes/(public)/functions/deploy/+page.ts +++ b/src/routes/(public)/functions/deploy/+page.ts @@ -8,6 +8,7 @@ import type { OrganizationList } from '$lib/stores/organization'; import { redirectTo } from '$routes/store'; import type { PageLoad } from './$types'; import { getRepositoryInfo } from '$lib/helpers/github'; +import { resolvedProfile } from '$lib/profiles/index.svelte'; export const load: PageLoad = async ({ parent, url }) => { const { account } = await parent(); @@ -79,6 +80,7 @@ export const load: PageLoad = async ({ parent, url }) => { 'Personal Projects', BillingPlan.FREE, null, + resolvedProfile.organizationPlatform, null ); } else { diff --git a/src/routes/(public)/sites/deploy/+page.ts b/src/routes/(public)/sites/deploy/+page.ts index 991de1bf5..341eda265 100644 --- a/src/routes/(public)/sites/deploy/+page.ts +++ b/src/routes/(public)/sites/deploy/+page.ts @@ -8,6 +8,7 @@ import type { OrganizationList } from '$lib/stores/organization'; import { redirectTo } from '$routes/store'; import type { PageLoad } from './$types'; import { getRepositoryInfo } from '$lib/helpers/github'; +import { resolvedProfile } from '$lib/profiles/index.svelte'; export const load: PageLoad = async ({ parent, url }) => { const { account } = await parent(); @@ -95,7 +96,8 @@ export const load: PageLoad = async ({ parent, url }) => { ID.unique(), 'Personal Projects', BillingPlan.FREE, - null + null, + resolvedProfile.organizationPlatform ); } else { await sdk.forConsole.teams.create({