Add Platform support and organizationPlatform

This commit is contained in:
Torsten Dittmann
2025-11-14 18:43:51 +04:00
parent cedce456ef
commit e863ba4696
12 changed files with 30 additions and 12 deletions
+1 -1
View File
@@ -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",
+5 -5
View File
@@ -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:
+4
View File
@@ -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'),
+3 -1
View File
@@ -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<string> = [],
@@ -500,6 +501,7 @@ export class Billing {
const params = {
organizationId,
name,
platform,
billingPlan,
paymentMethodId,
billingAddressId,
+2 -1
View File
@@ -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<Record<string, unknown>> & {
status: string;
remarks: string;
projects: string[];
platform: Platform;
};
export type OrganizationList = {
+4 -2
View File
@@ -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)
};
}
@@ -135,6 +135,7 @@
name,
billingPlan,
paymentMethodId,
resolvedProfile.organizationPlatform,
null,
couponData.code ? couponData.code : null,
collaborators,
@@ -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,
@@ -27,6 +27,7 @@
organizationName,
BillingPlan.FREE,
null,
resolvedProfile.organizationPlatform,
null
);
@@ -46,6 +46,7 @@ export const load: PageLoad = async ({ parent }) => {
'Personal projects',
BillingPlan.FREE,
null,
resolvedProfile.organizationPlatform,
null
);
trackEvent(Submit.OrganizationCreate, {
@@ -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 {
+3 -1
View File
@@ -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({