diff --git a/src/lib/commandCenter/searchers/organizations.ts b/src/lib/commandCenter/searchers/organizations.ts index c24f38799e..9df8003a17 100644 --- a/src/lib/commandCenter/searchers/organizations.ts +++ b/src/lib/commandCenter/searchers/organizations.ts @@ -1,16 +1,10 @@ +import { resolve } from '$app/paths'; import { goto } from '$app/navigation'; -import { base } from '$app/paths'; -import { sdk } from '$lib/stores/sdk'; import type { Searcher } from '../commands'; -import { isCloud } from '$lib/system'; -import { Platform, Query } from '@appwrite.io/console'; +import { getTeamOrOrganizationList } from '$lib/stores/organization'; export const orgSearcher = (async (query: string) => { - const { teams } = !isCloud - ? await sdk.forConsole.teams.list() - : await sdk.forConsole.billing.listOrganization([ - Query.equal('platform', Platform.Appwrite) - ]); + const { teams } = await getTeamOrOrganizationList(); return teams .filter((organization) => organization.name.toLowerCase().includes(query.toLowerCase())) @@ -18,7 +12,11 @@ export const orgSearcher = (async (query: string) => { return { label: organization.name, callback: () => { - goto(`${base}/organization-${organization.$id}`); + goto( + resolve('/(console)/organization-[organization]', { + organization: organization.$id + }) + ); }, group: 'organizations' } as const; diff --git a/src/lib/components/archiveProject.svelte b/src/lib/components/archiveProject.svelte index 8eb3795914..8a324b395b 100644 --- a/src/lib/components/archiveProject.svelte +++ b/src/lib/components/archiveProject.svelte @@ -38,23 +38,21 @@ import { isSmallViewport } from '$lib/stores/viewport'; import { isCloud } from '$lib/system'; import { regions as regionsStore } from '$lib/stores/organization'; - import type { Organization } from '$lib/stores/organization'; - import type { Plan } from '$lib/sdk/billing'; // props interface Props { + currentPlan: Models.BillingPlan; + organization: Models.Organization; projectsToArchive: Models.Project[]; - organization: Organization; - currentPlan: Plan; archivedTotalOverall: number; archivedOffset: number; limit: number; } let { - projectsToArchive, - organization, currentPlan, + organization, + projectsToArchive, archivedTotalOverall, archivedOffset, limit diff --git a/src/lib/components/billing/alerts/limitReached.svelte b/src/lib/components/billing/alerts/limitReached.svelte index 4885db75e1..12605cded4 100644 --- a/src/lib/components/billing/alerts/limitReached.svelte +++ b/src/lib/components/billing/alerts/limitReached.svelte @@ -5,16 +5,21 @@ import { BillingPlan } from '$lib/constants'; import { Button } from '$lib/elements/forms'; import { HeaderAlert } from '$lib/layout'; - import { hideBillingHeaderRoutes, readOnly, tierToPlan, upgradeURL } from '$lib/stores/billing'; + import { + hideBillingHeaderRoutes, + readOnly, + billingIdToPlan, + upgradeURL + } from '$lib/stores/billing'; import { organization } from '$lib/stores/organization'; {#if $organization?.$id && $organization?.billingPlan === BillingPlan.FREE && $readOnly && !hideBillingHeaderRoutes.includes(page.url.pathname)} + title={`${$organization.name} usage has reached the ${billingIdToPlan($organization.billingPlan).name} plan limit`}> - Usage for the {$organization.name} organization has reached the limits of the {tierToPlan( + Usage for the {$organization.name} organization has reached the limits of the {billingIdToPlan( $organization.billingPlan ).name} plan. Consider upgrading to increase your resource usage. diff --git a/src/lib/components/billing/alerts/paymentMandate.svelte b/src/lib/components/billing/alerts/paymentMandate.svelte new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/lib/components/billing/alerts/selectProjectCloud.svelte b/src/lib/components/billing/alerts/selectProjectCloud.svelte index 510334aa2e..a0084f97ab 100644 --- a/src/lib/components/billing/alerts/selectProjectCloud.svelte +++ b/src/lib/components/billing/alerts/selectProjectCloud.svelte @@ -31,10 +31,10 @@ async function updateSelected() { try { - await sdk.forConsole.billing.updateSelectedProjects( - projects[0].teamId, - selectedProjects - ); + await sdk.forConsole.organizations.updateProjects({ + organizationId, + projects: selectedProjects + }); showSelectProject = false; invalidate(Dependencies.ORGANIZATION); diff --git a/src/lib/components/billing/couponInput.svelte b/src/lib/components/billing/couponInput.svelte index 85e73411c0..fc33df37df 100644 --- a/src/lib/components/billing/couponInput.svelte +++ b/src/lib/components/billing/couponInput.svelte @@ -1,16 +1,16 @@ - + {#if children} + {@render children()} + {:else} Upgrade to add {service} - Upgrade to a {tierToPlan(BillingPlan.PRO).name} plan to add {service} to your organization + Upgrade to a {proPlanName} plan to add {service} to your organization