Skip to content

Commit e863ba4

Browse files
Add Platform support and organizationPlatform
1 parent cedce45 commit e863ba4

12 files changed

Lines changed: 30 additions & 12 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
"dependencies": {
2424
"@ai-sdk/svelte": "^1.1.24",
25-
"@appwrite.io/console": "https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@2752",
25+
"@appwrite.io/console": "https://pkg.vc/-/@appwrite/@appwrite.io/console@5ce6dc7",
2626
"@appwrite.io/pink-icons": "0.25.0",
2727
"@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@4472521",
2828
"@appwrite.io/pink-legacy": "^1.0.3",

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/profiles/index.svelte.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { asset, resolve } from '$app/paths';
22
import type { ResolvedPathname } from '$app/types';
33
import { PUBLIC_CONSOLE_PROFILE } from '$env/static/public';
4+
import { Platform } from '@appwrite.io/console';
45

56
export const enum ProfileMode {
67
STUDIO = 'studio',
@@ -10,6 +11,7 @@ export const enum ProfileMode {
1011
export type Profile = {
1112
id: ProfileMode;
1213
platform: string;
14+
organizationPlatform: Platform;
1315
logo: {
1416
src: {
1517
dark: string;
@@ -42,6 +44,7 @@ export type Profile = {
4244
export const base: Profile = {
4345
id: ProfileMode.CONSOLE,
4446
platform: 'Appwrite',
47+
organizationPlatform: Platform.Appwrite,
4548
logo: {
4649
src: {
4750
dark: asset('/images/appwrite-logo-dark.svg'),
@@ -79,6 +82,7 @@ export const base: Profile = {
7982
export const studio: Profile = {
8083
id: ProfileMode.STUDIO,
8184
platform: 'Imagine',
85+
organizationPlatform: Platform.Imagine,
8286
logo: {
8387
src: {
8488
dark: asset('/images/imagine-logo-dark.svg'),

src/lib/sdk/billing.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Tier } from '$lib/stores/billing';
22
import type { Campaign } from '$lib/stores/campaigns';
3-
import type { Client, Models } from '@appwrite.io/console';
3+
import type { Client, Models, Platform } from '@appwrite.io/console';
44
import type { PaymentMethod } from '@stripe/stripe-js';
55
import type { Organization, OrganizationError, OrganizationList } from '../stores/organization';
66

@@ -490,6 +490,7 @@ export class Billing {
490490
name: string,
491491
billingPlan: string,
492492
paymentMethodId: string,
493+
platform: Platform,
493494
billingAddressId: string = null,
494495
couponId: string = null,
495496
invites: Array<string> = [],
@@ -500,6 +501,7 @@ export class Billing {
500501
const params = {
501502
organizationId,
502503
name,
504+
platform,
503505
billingPlan,
504506
paymentMethodId,
505507
billingAddressId,

src/lib/stores/organization.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { page } from '$app/stores';
22
import { derived, writable } from 'svelte/store';
3-
import type { Models } from '@appwrite.io/console';
3+
import type { Models, Platform } from '@appwrite.io/console';
44
import type { Tier } from './billing';
55
import type { Plan } from '$lib/sdk/billing';
66

@@ -35,6 +35,7 @@ export type Organization = Models.Team<Record<string, unknown>> & {
3535
status: string;
3636
remarks: string;
3737
projects: string[];
38+
platform: Platform;
3839
};
3940

4041
export type OrganizationList = {

src/lib/stores/sdk.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ import {
2222
Tokens,
2323
TablesDB,
2424
Domains,
25-
Realtime
25+
Realtime,
26+
Organizations
2627
} from '@appwrite.io/console';
2728
import { Billing } from '../sdk/billing';
2829
import { Backups } from '../sdk/backups';
@@ -95,7 +96,8 @@ function createConsoleSdk(client: Client) {
9596
sites: new Sites(client),
9697
domains: new Domains(client),
9798
storage: new Storage(client),
98-
realtime: new Realtime(client)
99+
realtime: new Realtime(client),
100+
organizations: new Organizations(client)
99101
};
100102
}
101103

src/routes/(console)/apply-credit/+page.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
name,
136136
billingPlan,
137137
paymentMethodId,
138+
resolvedProfile.organizationPlatform,
138139
null,
139140
couponData.code ? couponData.code : null,
140141
collaborators,

src/routes/(console)/create-organization/+page.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,16 @@
114114
name,
115115
BillingPlan.FREE,
116116
null,
117-
null
117+
null,
118+
resolvedProfile.organizationPlatform
118119
);
119120
} else {
120121
org = await sdk.forConsole.billing.createOrganization(
121122
ID.unique(),
122123
name,
123124
selectedPlan,
124125
paymentMethodId,
126+
resolvedProfile.organizationPlatform,
125127
null,
126128
selectedCoupon?.code,
127129
collaborators,

src/routes/(console)/onboarding/create-organization/+page.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
organizationName,
2828
BillingPlan.FREE,
2929
null,
30+
resolvedProfile.organizationPlatform,
3031
null
3132
);
3233

src/routes/(console)/onboarding/create-project/+page.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export const load: PageLoad = async ({ parent }) => {
4646
'Personal projects',
4747
BillingPlan.FREE,
4848
null,
49+
resolvedProfile.organizationPlatform,
4950
null
5051
);
5152
trackEvent(Submit.OrganizationCreate, {

0 commit comments

Comments
 (0)