From 3d85c759ecb7fbddd988a053e5195246cbe464c3 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 20 May 2025 00:42:56 +0200 Subject: [PATCH] Update console URL from pkg.pr.new to try-module.cloud and migrate billing API calls --- package.json | 2 +- pnpm-lock.yaml | 10 +- .../commandCenter/searchers/organizations.ts | 2 +- .../billing/alerts/paymentMandate.svelte | 3 +- src/lib/components/billing/couponInput.svelte | 2 +- .../billing/estimatedTotalBox.svelte | 13 +-- .../billing/planComparisonBox.svelte | 4 +- src/lib/components/billing/planExcess.svelte | 10 +- .../billing/validateCreditModal.svelte | 3 +- src/lib/constants.ts | 3 + src/lib/layout/unauthenticated.svelte | 10 +- src/lib/sdk/billing.ts | 8 +- src/lib/stores/billing.ts | 103 +++++++++--------- src/lib/stores/campaigns.ts | 2 +- src/lib/stores/organization.ts | 30 +---- src/lib/stores/sdk.ts | 4 +- src/lib/stores/stripe.ts | 12 +- src/routes/(console)/+layout.svelte | 2 +- src/routes/(console)/+layout.ts | 11 +- .../account/organizations/+page.svelte | 2 +- .../(console)/account/organizations/+page.ts | 2 +- .../(console)/account/payments/+page.ts | 4 +- .../account/payments/addressModal.svelte | 11 +- .../payments/deleteAddressModal.svelte | 2 +- .../payments/deletePaymentModal.svelte | 2 +- .../account/payments/editAddressModal.svelte | 2 +- .../account/payments/editPaymentModal.svelte | 32 +++--- .../(console)/apply-credit/+page.svelte | 70 ++++++------ src/routes/(console)/apply-credit/+page.ts | 12 +- .../create-organization/+page.svelte | 46 ++++---- .../(console)/create-organization/+page.ts | 14 +-- .../onboarding/create-project/+page.ts | 15 +-- .../organization-[organization]/+layout.ts | 8 +- .../billing/+page.svelte | 16 ++- .../billing/+page.ts | 10 +- .../billing/addCreditModal.svelte | 2 +- .../billing/addCreditWizard.svelte | 7 +- .../billing/availableCredit.svelte | 2 +- .../billing/billingAddress.svelte | 2 +- .../billing/budgetAlert.svelte | 2 +- .../billing/budgetCap.svelte | 2 +- .../billing/cancelDowngradeModal.svelte | 2 +- .../billing/deleteOrgPayment.svelte | 4 +- .../billing/paymentHistory.svelte | 9 +- .../billing/paymentMethods.svelte | 4 +- .../billing/planSummary.svelte | 2 +- .../billing/removeAddress.svelte | 2 +- .../billing/replaceAddress.svelte | 14 ++- .../billing/replaceCard.svelte | 6 +- .../billing/retryPaymentModal.svelte | 19 ++-- .../billing/store.ts | 5 +- .../billing/taxId.svelte | 2 +- .../billing/wizard/addCredit.svelte | 2 +- .../billing/wizard/paymentDetails.svelte | 2 +- .../change-plan/+page.svelte | 32 +++--- .../change-plan/+page.ts | 15 +-- .../domains/domain-[domain]/settings/+page.ts | 2 +- .../organization-[organization]/header.svelte | 2 +- .../invoices/[invoiceId]/download/+page.ts | 5 +- .../invoices/[invoiceId]/view/+page.ts | 5 +- .../settings/+page.ts | 2 +- .../settings/deleteOrganizationModal.svelte | 7 +- .../settings/invoicesTable.svelte | 6 +- .../usage/[[invoice]]/+page.svelte | 12 +- .../usage/[[invoice]]/+page.ts | 9 +- .../usage/[[invoice]]/totalMembers.svelte | 2 +- .../project-[region]-[project]/+layout.ts | 8 +- .../databases/+page.ts | 3 +- .../template-[template]/+page.svelte | 8 +- .../settings/usage/[[invoice]]/+page.ts | 10 +- .../sites/+page.svelte | 9 +- .../settings/updateMaxFileSize.svelte | 3 +- src/routes/(console)/store.ts | 3 +- src/routes/(public)/(guest)/login/+page.ts | 12 +- src/routes/(public)/(guest)/register/+page.ts | 12 +- .../(public)/template-[template]/+page.ts | 9 +- src/routes/+layout.svelte | 2 +- src/routes/+layout.ts | 2 +- 78 files changed, 378 insertions(+), 374 deletions(-) diff --git a/package.json b/package.json index 99a3e173f..d1ae6b6ad 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@1959", + "@appwrite.io/console": "https://try-module.cloud/module/@appwrite/%40appwrite.io%2Fconsole@e50c8d0b7", "@appwrite.io/pink": "0.25.0", "@appwrite.io/pink-icons": "0.25.0", "@appwrite.io/pink-icons-svelte": "^2.0.0-RC.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8ceb043ad..2bb3573a2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^1.1.24 version: 1.1.24(svelte@5.25.3)(zod@3.24.3) '@appwrite.io/console': - specifier: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@1959 - version: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@1959 + specifier: https://try-module.cloud/module/@appwrite/%40appwrite.io%2Fconsole@e50c8d0b7 + version: https://try-module.cloud/module/@appwrite/%40appwrite.io%2Fconsole@e50c8d0b7 '@appwrite.io/pink': specifier: 0.25.0 version: 0.25.0 @@ -254,8 +254,8 @@ packages: '@analytics/type-utils@0.6.2': resolution: {integrity: sha512-TD+xbmsBLyYy/IxFimW/YL/9L2IEnM7/EoV9Aeh56U64Ify8o27HJcKjo38XY9Tcn0uOq1AX3thkKgvtWvwFQg==} - '@appwrite.io/console@https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@1959': - resolution: {tarball: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@1959} + '@appwrite.io/console@https://try-module.cloud/module/@appwrite/%40appwrite.io%2Fconsole@e50c8d0b7': + resolution: {tarball: https://try-module.cloud/module/@appwrite/%40appwrite.io%2Fconsole@e50c8d0b7} version: 1.5.2 '@appwrite.io/pink-icons-svelte@2.0.0-RC.1': @@ -3615,7 +3615,7 @@ snapshots: '@analytics/type-utils@0.6.2': {} - '@appwrite.io/console@https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@1959': {} + '@appwrite.io/console@https://try-module.cloud/module/@appwrite/%40appwrite.io%2Fconsole@e50c8d0b7': {} '@appwrite.io/pink-icons-svelte@2.0.0-RC.1(svelte@5.25.3)': dependencies: diff --git a/src/lib/commandCenter/searchers/organizations.ts b/src/lib/commandCenter/searchers/organizations.ts index 1d959e992..2a333d6cd 100644 --- a/src/lib/commandCenter/searchers/organizations.ts +++ b/src/lib/commandCenter/searchers/organizations.ts @@ -7,7 +7,7 @@ import { isCloud } from '$lib/system'; export const orgSearcher = (async (query: string) => { const { teams } = !isCloud ? await sdk.forConsole.teams.list() - : await sdk.forConsole.billing.listOrganization(); + : await sdk.forConsole.organizations.list(); return teams .filter((organization) => organization.name.toLowerCase().includes(query.toLowerCase())) diff --git a/src/lib/components/billing/alerts/paymentMandate.svelte b/src/lib/components/billing/alerts/paymentMandate.svelte index b55f5d20b..c38027920 100644 --- a/src/lib/components/billing/alerts/paymentMandate.svelte +++ b/src/lib/components/billing/alerts/paymentMandate.svelte @@ -8,8 +8,7 @@ import { confirmSetup } from '$lib/stores/stripe'; async function verifyPaymentMethod() { - const method = await sdk.forConsole.billing.setupPaymentMandate( - $organization.$id, + const method = await sdk.forConsole.account.updatePaymentMethodMandateOptions( $paymentMissingMandate.$id ); await confirmSetup(method.clientSecret, method.$id); diff --git a/src/lib/components/billing/couponInput.svelte b/src/lib/components/billing/couponInput.svelte index 85e73411c..60dcadfe0 100644 --- a/src/lib/components/billing/couponInput.svelte +++ b/src/lib/components/billing/couponInput.svelte @@ -18,7 +18,7 @@ async function addCoupon() { try { - const response = await sdk.forConsole.billing.getCouponAccount(coupon); + const response = await sdk.forConsole.account.getCoupon(coupon); couponData = response; dispatch('validation', couponData); coupon = null; diff --git a/src/lib/components/billing/estimatedTotalBox.svelte b/src/lib/components/billing/estimatedTotalBox.svelte index 112d506c1..5e66057ad 100644 --- a/src/lib/components/billing/estimatedTotalBox.svelte +++ b/src/lib/components/billing/estimatedTotalBox.svelte @@ -2,15 +2,16 @@ import { InputChoice, InputNumber } from '$lib/elements/forms'; import { toLocaleDate } from '$lib/helpers/date'; import { formatCurrency } from '$lib/helpers/numbers'; - import type { Coupon, PlansMap } from '$lib/sdk/billing'; + import type { Coupon } from '$lib/sdk/billing'; import { type Tier } from '$lib/stores/billing'; import { Card, Divider, Layout, Typography } from '@appwrite.io/pink-svelte'; import { CreditsApplied } from '.'; + import type { Models } from '@appwrite.io/console'; export let billingPlan: Tier; export let collaborators: string[]; export let couponData: Partial; - export let plans: PlansMap; + export let plans: Map; export let billingBudget: number; export let fixedCoupon = false; // If true, the coupon cannot be removed export let isDowngrade = false; @@ -29,9 +30,7 @@ ? grossCost - couponData.credits : 0 : grossCost; - $: trialEndDate = new Date( - billingPayDate.getTime() + currentPlan.trialDays * 24 * 60 * 60 * 1000 - ); + $: trialEndDate = new Date(billingPayDate.getTime() + currentPlan.trial * 24 * 60 * 60 * 1000); @@ -54,7 +53,7 @@ Upcoming charge
- Due on {!currentPlan.trialDays + Due on {!currentPlan.trial ? toLocaleDate(billingPayDate.toString()) : toLocaleDate(trialEndDate.toString())}
{formatCurrency(estimatedTotal)} @@ -64,7 +63,7 @@ You'll pay {formatCurrency(estimatedTotal)} now, with your first billing cycle starting on {!currentPlan.trialDays + >{!currentPlan.trial ? toLocaleDate(billingPayDate.toString()) : toLocaleDate(trialEndDate.toString())}. {#if couponData?.status === 'active'}Once your credits run out, you'll be charged diff --git a/src/lib/components/billing/planComparisonBox.svelte b/src/lib/components/billing/planComparisonBox.svelte index 9d7443df4..c3e1e3dbf 100644 --- a/src/lib/components/billing/planComparisonBox.svelte +++ b/src/lib/components/billing/planComparisonBox.svelte @@ -1,12 +1,12 @@ diff --git a/src/lib/components/billing/planExcess.svelte b/src/lib/components/billing/planExcess.svelte index 02793dc70..63dca3e88 100644 --- a/src/lib/components/billing/planExcess.svelte +++ b/src/lib/components/billing/planExcess.svelte @@ -1,18 +1,18 @@ diff --git a/src/routes/(console)/project-[region]-[project]/+layout.ts b/src/routes/(console)/project-[region]-[project]/+layout.ts index f90abed15..7317c0f9b 100644 --- a/src/routes/(console)/project-[region]-[project]/+layout.ts +++ b/src/routes/(console)/project-[region]-[project]/+layout.ts @@ -6,16 +6,16 @@ import { preferences } from '$lib/stores/preferences'; import { failedInvoice } from '$lib/stores/billing'; import { isCloud } from '$lib/system'; import { defaultRoles, defaultScopes } from '$lib/constants'; -import type { Plan } from '$lib/sdk/billing'; import { get } from 'svelte/store'; import { headerAlert } from '$lib/stores/headerAlert'; import PaymentFailed from '$lib/components/billing/alerts/paymentFailed.svelte'; import { loadAvailableRegions } from '$routes/(console)/regions'; import type { Organization } from '$lib/stores/organization'; +import type { Models } from '@appwrite.io/console'; export const load: LayoutLoad = async ({ params, depends }) => { depends(Dependencies.PROJECT); - let currentPlan: Plan = null; + let currentPlan: Models.BillingPlan = null; try { const project = await sdk.forConsole.projects.get(params.project); @@ -34,8 +34,8 @@ export const load: LayoutLoad = async ({ params, depends }) => { let roles = isCloud ? [] : defaultRoles; let scopes = isCloud ? [] : defaultScopes; if (isCloud) { - currentPlan = await sdk.forConsole.billing.getOrganizationPlan(project.teamId); - const res = await sdk.forConsole.billing.getRoles(project.teamId); + currentPlan = await sdk.forConsole.organizations.getPlan(project.teamId); + const res = await sdk.forConsole.organizations.getScopes(project.teamId); roles = res.roles; scopes = res.scopes; if (scopes.includes('billing.read')) { diff --git a/src/routes/(console)/project-[region]-[project]/databases/+page.ts b/src/routes/(console)/project-[region]-[project]/databases/+page.ts index 6abcffdc5..9c0ede9ad 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/+page.ts +++ b/src/routes/(console)/project-[region]-[project]/databases/+page.ts @@ -7,7 +7,6 @@ import type { PageLoad, RouteParams } from './$types'; import type { BackupPolicy } from '$lib/sdk/backups'; import { isSelfHosted } from '$lib/system'; import { isCloud } from '$lib/system'; -import type { Plan } from '$lib/sdk/billing'; export const load: PageLoad = async ({ url, route, depends, params, parent }) => { depends(Dependencies.DATABASES); @@ -45,7 +44,7 @@ async function fetchDatabasesAndBackups( offset: number, params: RouteParams, search?: string | undefined, - currentPlan?: Plan + currentPlan?: Models.BillingPlan ) { const backupsEnabled = currentPlan?.backupsEnabled ?? true; diff --git a/src/routes/(console)/project-[region]-[project]/functions/templates/template-[template]/+page.svelte b/src/routes/(console)/project-[region]-[project]/functions/templates/template-[template]/+page.svelte index 4f5ca68a1..9d4fe4359 100644 --- a/src/routes/(console)/project-[region]-[project]/functions/templates/template-[template]/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/functions/templates/template-[template]/+page.svelte @@ -24,9 +24,15 @@ import { page } from '$app/state'; import { capitalize } from '$lib/helpers/string'; import { IconExternalLink } from '@appwrite.io/pink-icons-svelte'; + import type { BillingPlan } from '$lib/constants'; $: buttonDisabled = - isCloud && isServiceLimited('functions', $organization?.billingPlan, $functionsList?.total); + isCloud && + isServiceLimited( + 'functions', + $organization?.billingPlan as BillingPlan, + $functionsList?.total + ); diff --git a/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.ts b/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.ts index c432d29b8..543289184 100644 --- a/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.ts +++ b/src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.ts @@ -1,7 +1,7 @@ -import type { Aggregation, Invoice } from '$lib/sdk/billing'; +import type { Aggregation } from '$lib/sdk/billing'; import { accumulateUsage } from '$lib/sdk/usage'; import { sdk } from '$lib/stores/sdk'; -import { Query } from '@appwrite.io/console'; +import { Query, type Models } from '@appwrite.io/console'; import type { PageLoad } from './$types'; export const load: PageLoad = async ({ params, parent }) => { @@ -10,11 +10,11 @@ export const load: PageLoad = async ({ params, parent }) => { let startDate: string = organization.billingCurrentInvoiceDate; let endDate: string = organization.billingNextInvoiceDate; - let currentInvoice: Invoice = undefined; + let currentInvoice: Models.Invoice = undefined; let currentAggregation: Aggregation = undefined; if (invoice) { - currentInvoice = await sdk.forConsole.billing.getInvoice(organization.$id, invoice); + currentInvoice = await sdk.forConsole.organizations.getInvoice(organization.$id, invoice); currentAggregation = await sdk.forConsole.billing.getAggregation( organization.$id, currentInvoice.aggregationId @@ -25,7 +25,7 @@ export const load: PageLoad = async ({ params, parent }) => { } const [invoices, usage] = await Promise.all([ - sdk.forConsole.billing.listInvoices(organization.$id, [Query.orderDesc('from')]), + sdk.forConsole.organizations.listInvoices(organization.$id, [Query.orderDesc('from')]), sdk.forProject(region, project).project.getUsage(startDate, endDate) ]); diff --git a/src/routes/(console)/project-[region]-[project]/sites/+page.svelte b/src/routes/(console)/project-[region]-[project]/sites/+page.svelte index 855274fa4..fd6f9e001 100644 --- a/src/routes/(console)/project-[region]-[project]/sites/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/sites/+page.svelte @@ -24,7 +24,7 @@ import Table from './table.svelte'; import { onMount } from 'svelte'; import { invalidate } from '$app/navigation'; - import { Dependencies } from '$lib/constants'; + import { BillingPlan, Dependencies } from '$lib/constants'; import { sdk } from '$lib/stores/sdk'; export let data; let show = false; @@ -37,8 +37,11 @@ }, keys: ['c'], disabled: - isServiceLimited('sites', $organization?.billingPlan, data.siteList?.total) || - !$canWriteSites, + isServiceLimited( + 'sites', + $organization?.billingPlan as BillingPlan, + data.siteList?.total + ) || !$canWriteSites, icon: IconPlus, group: 'sites' } diff --git a/src/routes/(console)/project-[region]-[project]/storage/bucket-[bucket]/settings/updateMaxFileSize.svelte b/src/routes/(console)/project-[region]-[project]/storage/bucket-[bucket]/settings/updateMaxFileSize.svelte index 62bbb8c4b..ad9b42600 100644 --- a/src/routes/(console)/project-[region]-[project]/storage/bucket-[bucket]/settings/updateMaxFileSize.svelte +++ b/src/routes/(console)/project-[region]-[project]/storage/bucket-[bucket]/settings/updateMaxFileSize.svelte @@ -9,11 +9,10 @@ import { organization } from '$lib/stores/organization'; import { GRACE_PERIOD_OVERRIDE, isCloud } from '$lib/system'; import { updateBucket } from './+page.svelte'; - import type { Plan } from '$lib/sdk/billing'; import type { Models } from '@appwrite.io/console'; export let bucket: Models.Bucket; - export let currentPlan: Plan | null; + export let currentPlan: Models.BillingPlan | null; const service = currentPlan ? currentPlan['fileSize'] : null; const { value, unit, baseValue, units } = createByteUnitPair(bucket.maximumFileSize, 1000); diff --git a/src/routes/(console)/store.ts b/src/routes/(console)/store.ts index 7735d4c29..146a8e00e 100644 --- a/src/routes/(console)/store.ts +++ b/src/routes/(console)/store.ts @@ -1,6 +1,5 @@ import { page } from '$app/stores'; import type { HeaderAlert } from '$lib/stores/headerAlert'; -import type { Organization } from '$lib/stores/organization'; import type { Models } from '@appwrite.io/console'; import { derived, writable } from 'svelte/store'; @@ -16,4 +15,4 @@ export const protocol = derived(page, ($page) => ); export const activeHeaderAlert = writable(null); -export const orgMissingPaymentMethod = writable(null); +export const orgMissingPaymentMethod = writable>>(null); diff --git a/src/routes/(public)/(guest)/login/+page.ts b/src/routes/(public)/(guest)/login/+page.ts index 33d808b7e..4a48303d1 100644 --- a/src/routes/(public)/(guest)/login/+page.ts +++ b/src/routes/(public)/(guest)/login/+page.ts @@ -1,17 +1,17 @@ import { base } from '$app/paths'; -import type { Campaign } from '$lib/stores/campaigns'; import { sdk } from '$lib/stores/sdk'; import { redirect } from '@sveltejs/kit'; import type { PageLoad } from './$types'; +import type { Models } from '@appwrite.io/console'; export const load: PageLoad = async ({ url }) => { if (url.searchParams.has('code')) { const code = url.searchParams.get('code'); - let campaign: Campaign; + let campaign: Models.Campaign; try { - const couponData = await sdk.forConsole.billing.getCoupon(code); + const couponData = await sdk.forConsole.console.getCoupon(code); if (couponData.campaign) { - campaign = await sdk.forConsole.billing.getCampaign(couponData.campaign); + campaign = await sdk.forConsole.console.getCampaign(couponData.campaign); return { couponData, campaign @@ -23,9 +23,9 @@ export const load: PageLoad = async ({ url }) => { } if (url.searchParams.has('campaign')) { const campaignId = url.searchParams.get('campaign'); - let campaign: Campaign; + let campaign: Models.Campaign; try { - campaign = await sdk.forConsole.billing.getCampaign(campaignId); + campaign = await sdk.forConsole.console.getCampaign(campaignId); return { campaign }; } catch (e) { redirect(303, `${base}/login`); diff --git a/src/routes/(public)/(guest)/register/+page.ts b/src/routes/(public)/(guest)/register/+page.ts index 1fa2e79de..852e7d0c9 100644 --- a/src/routes/(public)/(guest)/register/+page.ts +++ b/src/routes/(public)/(guest)/register/+page.ts @@ -1,17 +1,17 @@ import { base } from '$app/paths'; -import type { Campaign } from '$lib/stores/campaigns.js'; import { sdk } from '$lib/stores/sdk'; import { redirect } from '@sveltejs/kit'; import type { PageLoad } from './$types'; +import type { Models } from '@appwrite.io/console'; export const load: PageLoad = async ({ url }) => { if (url.searchParams.has('code')) { const code = url.searchParams.get('code'); - let campaign: Campaign; + let campaign: Models.Campaign; try { - const couponData = await sdk.forConsole.billing.getCoupon(code); + const couponData = await sdk.forConsole.console.getCoupon(code); if (couponData.campaign) { - campaign = await sdk.forConsole.billing.getCampaign(couponData.campaign); + campaign = await sdk.forConsole.console.getCampaign(couponData.campaign); return { couponData, campaign @@ -23,9 +23,9 @@ export const load: PageLoad = async ({ url }) => { } if (url.searchParams.has('campaign')) { const campaignId = url.searchParams.get('campaign'); - let campaign: Campaign; + let campaign: Models.Campaign; try { - campaign = await sdk.forConsole.billing.getCampaign(campaignId); + campaign = await sdk.forConsole.console.getCampaign(campaignId); return { campaign }; } catch (e) { redirect(303, `${base}/register`); diff --git a/src/routes/(public)/template-[template]/+page.ts b/src/routes/(public)/template-[template]/+page.ts index dad1d1a06..f706267f8 100644 --- a/src/routes/(public)/template-[template]/+page.ts +++ b/src/routes/(public)/template-[template]/+page.ts @@ -1,6 +1,5 @@ -import { BillingPlan } from '$lib/constants.js'; import { sdk } from '$lib/stores/sdk.js'; -import { ID, type Models } from '@appwrite.io/console'; +import { BillingPlan, ID, type Models } from '@appwrite.io/console'; import { isCloud } from '$lib/system.js'; import { error, redirect } from '@sveltejs/kit'; import type { OrganizationList } from '$lib/stores/organization.js'; @@ -34,16 +33,16 @@ export const load = async ({ parent, url, params }) => { let organizations: Models.TeamList> | OrganizationList | undefined; if (isCloud) { - organizations = account?.$id ? await sdk.forConsole.billing.listOrganization() : undefined; + organizations = account?.$id ? await sdk.forConsole.organizations.list() : undefined; } else { organizations = account?.$id ? await sdk.forConsole.teams.list() : undefined; } if (!organizations?.total && account?.$id) { - await sdk.forConsole.billing.createOrganization( + await sdk.forConsole.organizations.create( ID.unique(), 'Personal project', - BillingPlan.FREE, + BillingPlan.Tier0, null, null ); diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index f5bed4b86..852a19037 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -68,7 +68,7 @@ if (page.url.searchParams.has('code')) { const code = page.url.searchParams.get('code'); - const coupon = await sdk.forConsole.billing.getCoupon(code).catch(() => null); + const coupon = await sdk.forConsole.console.getCoupon(code).catch(() => null); if (coupon?.campaign) { const campaign = await sdk.forConsole.billing .getCampaign(coupon.campaign) diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index 78d86d2e4..ebe0dfeff 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -32,7 +32,7 @@ export const load: LayoutLoad = async ({ depends, url, route }) => { account: account, organizations: !isCloud ? await sdk.forConsole.teams.list() - : await sdk.forConsole.billing.listOrganization() + : await sdk.forConsole.organizations.list() }; }