Get $50 Cloud credits for Appwrite Pro.
diff --git a/src/lib/components/billing/alerts/paymentMandate.svelte b/src/lib/components/billing/alerts/paymentMandate.svelte
index fa7f75a858..8a7e06b16e 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 369619afed..2375bb5754 100644
--- a/src/lib/components/billing/couponInput.svelte
+++ b/src/lib/components/billing/couponInput.svelte
@@ -1,15 +1,15 @@
- Your payment method will be charged this amount plus usage fees every 30 days {!currentPlan.trialDays
+ Your payment method will be charged this amount plus usage fees every 30 days {!currentPlan.trial
? `starting ${toLocaleDate(billingPayDate.toString())}`
: ` after your trial period ends on ${toLocaleDate(trialEndDate.toString())}`}.
diff --git a/src/lib/components/billing/planComparisonBox.svelte b/src/lib/components/billing/planComparisonBox.svelte
index c48dabfc38..1ab5d8fad2 100644
--- a/src/lib/components/billing/planComparisonBox.svelte
+++ b/src/lib/components/billing/planComparisonBox.svelte
@@ -1,10 +1,10 @@
{#if billingPlan}
@@ -24,7 +24,7 @@
name="plan"
bind:group={billingPlan}
disabled={anyOrgFree || !selfService}
- value={BillingPlan.FREE}
+ value={BillingPlan.Tier0}
tooltipShow={anyOrgFree}
tooltipText="You are limited to 1 Free organization per account."
padding={1.5}>
@@ -34,7 +34,7 @@
class:u-opacity-50={disabled}>
{tierFree.name}
- {#if $organization?.billingPlan === BillingPlan.FREE && !isNewOrg}
+ {#if $organization?.billingPlan === BillingPlan.Tier0 && !isNewOrg}
Current plan
{/if}
@@ -54,7 +54,7 @@
name="plan"
disabled={!selfService}
bind:group={billingPlan}
- value={BillingPlan.PRO}
+ value={BillingPlan.Tier1}
padding={1.5}>
{tierPro.name}
- {#if $organization?.billingPlan === BillingPlan.PRO && !isNewOrg}
+ {#if $organization?.billingPlan === BillingPlan.Tier1 && !isNewOrg}
Current plan
{/if}
@@ -76,18 +76,18 @@
- {#if $organization?.billingPlan === BillingPlan.SCALE}
+ {#if $organization?.billingPlan === BillingPlan.Tier2}
{tierScale.name}
- {#if $organization?.billingPlan === BillingPlan.SCALE && !isNewOrg}
+ {#if $organization?.billingPlan === BillingPlan.Tier2 && !isNewOrg}
Current plan
{/if}
diff --git a/src/lib/components/billing/selectPaymentMethod.svelte b/src/lib/components/billing/selectPaymentMethod.svelte
index 937d6bc67c..1f57582caf 100644
--- a/src/lib/components/billing/selectPaymentMethod.svelte
+++ b/src/lib/components/billing/selectPaymentMethod.svelte
@@ -1,14 +1,15 @@
{#if isFree}
- Usage on the {$plansInfo?.get(BillingPlan.FREE).name} plan is limited for the following resources.
+ Usage on the {$plansInfo?.get(BillingPlan.Tier0).name} plan is limited for the following resources.
Next billing period: {toLocaleDate(nextDate)}.
- {:else if org.billingPlan === BillingPlan.PRO}
+ {:else if org.billingPlan === BillingPlan.Tier1}
Usage on the Pro plan will be charged at the end of each billing period at the following
rates. Next billing period: {toLocaleDate(nextDate)}.
- {:else if org.billingPlan === BillingPlan.SCALE}
+ {:else if org.billingPlan === BillingPlan.Tier2}
Usage on the Scale plan will be charged at the end of each billing period at the
following rates. Next billing period: {toLocaleDate(nextDate)}.
diff --git a/src/lib/components/billing/validateCreditModal.svelte b/src/lib/components/billing/validateCreditModal.svelte
index 961e041442..a540506dbe 100644
--- a/src/lib/components/billing/validateCreditModal.svelte
+++ b/src/lib/components/billing/validateCreditModal.svelte
@@ -18,7 +18,7 @@
async function addCoupon() {
try {
- const response = await sdk.forConsole.billing.getCoupon(coupon);
+ const response = await sdk.forConsole.console.getCoupon(coupon);
couponData = response;
dispatch('validation', couponData);
coupon = null;
diff --git a/src/lib/components/bottomModalAlert.svelte b/src/lib/components/bottomModalAlert.svelte
index 03ace8873f..f4392cb9a6 100644
--- a/src/lib/components/bottomModalAlert.svelte
+++ b/src/lib/components/bottomModalAlert.svelte
@@ -10,7 +10,7 @@
} from '$lib/stores/bottom-alerts';
import { onMount } from 'svelte';
import { organization } from '$lib/stores/organization';
- import { BillingPlan } from '$lib/constants';
+ import { BillingPlan } from '@appwrite.io/console';
import { upgradeURL } from '$lib/stores/billing';
import { addBottomModalAlerts } from '$routes/(console)/bottomAlerts';
import { project } from '$routes/(console)/project-[project]/store';
@@ -74,10 +74,10 @@
case 'free':
return false;
case 'pro':
- return organizationPlan === BillingPlan.FREE;
+ return organizationPlan === BillingPlan.Tier0;
case 'scale':
return (
- organizationPlan === BillingPlan.FREE || organizationPlan === BillingPlan.PRO
+ organizationPlan === BillingPlan.Tier0 || organizationPlan === BillingPlan.Tier1
);
}
}
diff --git a/src/lib/components/creditCardInfo.svelte b/src/lib/components/creditCardInfo.svelte
index f187431340..27301a97e9 100644
--- a/src/lib/components/creditCardInfo.svelte
+++ b/src/lib/components/creditCardInfo.svelte
@@ -1,10 +1,10 @@
diff --git a/src/lib/components/roles/upgrade.svelte b/src/lib/components/roles/upgrade.svelte
index 9e54874762..ab0d519671 100644
--- a/src/lib/components/roles/upgrade.svelte
+++ b/src/lib/components/roles/upgrade.svelte
@@ -3,17 +3,17 @@
import { upgradeURL } from '$lib/stores/billing';
import { isCloud } from '$lib/system';
import { organization } from '$lib/stores/organization';
- import { BillingPlan } from '$lib/constants';
+ import { BillingPlan } from '@appwrite.io/console';
import Button from '$lib/elements/forms/button.svelte';
{#if isCloud}
- {#if $organization?.billingPlan !== BillingPlan.FREE}
+ {#if $organization?.billingPlan !== BillingPlan.Tier0}
Roles
- {#if $organization?.billingPlan === BillingPlan.FREE}
+ {#if $organization?.billingPlan === BillingPlan.Tier0}
Pro plan
{/if}
@@ -27,7 +27,7 @@
Roles
- {#if $organization?.billingPlan === BillingPlan.FREE}
+ {#if $organization?.billingPlan === BillingPlan.Tier0}
Pro plan
{/if}
diff --git a/src/lib/components/support.svelte b/src/lib/components/support.svelte
index 66d922d410..7e2ec964e9 100644
--- a/src/lib/components/support.svelte
+++ b/src/lib/components/support.svelte
@@ -6,7 +6,7 @@
import { showSupportModal } from '$routes/(console)/wizard/support/store';
import { isCloud } from '$lib/system';
import { organization } from '$lib/stores/organization';
- import { BillingPlan } from '$lib/constants';
+ import { BillingPlan } from '@appwrite.io/console';
import { trackEvent } from '$lib/actions/analytics';
import { localeTimezoneName, utcHourToLocaleHour } from '$lib/helpers/date';
import { upgradeURL } from '$lib/stores/billing';
@@ -14,8 +14,8 @@
export let show = false;
$: isPaid =
- $organization?.billingPlan === BillingPlan.PRO ||
- $organization?.billingPlan === BillingPlan.SCALE;
+ $organization?.billingPlan === BillingPlan.Tier1 ||
+ $organization?.billingPlan === BillingPlan.Tier2;
$: supportTimings = `${utcHourToLocaleHour('16:00')} - ${utcHourToLocaleHour('00:00')} ${localeTimezoneName()}`;
@@ -30,7 +30,7 @@
{/if}
- {#if $organization?.billingPlan === BillingPlan.FREE}
+ {#if $organization?.billingPlan === BillingPlan.Tier0}
= [
}
];
-export enum BillingPlan {
- FREE = 'tier-0',
- PRO = 'tier-1',
- SCALE = 'tier-2',
- CUSTOM = 'cont-1'
-}
-
export const feedbackDowngradeOptions = [
{
value: 'availableFeatures',
diff --git a/src/lib/layout/activity.svelte b/src/lib/layout/activity.svelte
index e1d691863f..f702a30345 100644
--- a/src/lib/layout/activity.svelte
+++ b/src/lib/layout/activity.svelte
@@ -22,7 +22,7 @@
import { isCloud } from '$lib/system';
import { organization } from '$lib/stores/organization';
import { Button } from '$lib/elements/forms';
- import { BillingPlan } from '$lib/constants';
+ import { BillingPlan } from '@appwrite.io/console';
export let logs: Models.LogList;
export let offset = 0;
@@ -52,7 +52,7 @@
Logs are retained in rolling {hoursToDays(limit)} intervals with the
{tierToPlan($organization.billingPlan).name}
plan.
- {#if $organization?.billingPlan === BillingPlan.FREE}
+ {#if $organization?.billingPlan === BillingPlan.Tier0}
Upgrade to increase your log
retention for a longer period.
{/if}
diff --git a/src/lib/layout/containerButton.svelte b/src/lib/layout/containerButton.svelte
index e0b0512d35..f1fc32b7bd 100644
--- a/src/lib/layout/containerButton.svelte
+++ b/src/lib/layout/containerButton.svelte
@@ -1,13 +1,13 @@
diff --git a/src/routes/(console)/apply-credit/+page.svelte b/src/routes/(console)/apply-credit/+page.svelte
index a621bff958..1c7b6b8b88 100644
--- a/src/routes/(console)/apply-credit/+page.svelte
+++ b/src/routes/(console)/apply-credit/+page.svelte
@@ -8,7 +8,7 @@
EstimatedTotalBox,
SelectPaymentMethod
} from '$lib/components/billing';
- import { BillingPlan, Dependencies } from '$lib/constants';
+ import { Dependencies } from '$lib/constants';
import { Button, Form, FormList, InputSelect, InputTags, InputText } from '$lib/elements/forms';
import { toLocaleDate } from '$lib/helpers/date';
import {
@@ -16,13 +16,12 @@
WizardSecondaryContent,
WizardSecondaryFooter
} from '$lib/layout';
- import { type PaymentList } from '$lib/sdk/billing';
import { app } from '$lib/stores/app';
import { campaigns } from '$lib/stores/campaigns';
import { addNotification } from '$lib/stores/notifications';
import { organizationList, type Organization } from '$lib/stores/organization';
import { sdk } from '$lib/stores/sdk';
- import { ID } from '@appwrite.io/console';
+ import { ID, BillingPlan, type Models } from '@appwrite.io/console';
import { onMount } from 'svelte';
import { writable } from 'svelte/store';
@@ -49,7 +48,7 @@
let formComponent: Form;
let couponForm: Form;
let isSubmitting = writable(false);
- let methods: PaymentList;
+ let methods: Models.PaymentMethodList;
let paymentMethodId: string;
let collaborators: string[];
let taxId: string;
@@ -69,7 +68,7 @@
let coupon: string;
let couponData = data?.couponData;
let campaign = campaigns.get(data?.couponData?.campaign ?? data?.campaign);
- let billingPlan = BillingPlan.PRO;
+ let billingPlan = BillingPlan.Tier1;
onMount(async () => {
await loadPaymentMethods();
@@ -86,7 +85,7 @@
});
async function loadPaymentMethods() {
- const methodList = await sdk.forConsole.billing.listPaymentMethods();
+ const methodList = await sdk.forConsole.account.listPaymentMethods();
const filteredMethods = methodList.paymentMethods.filter((method) => !!method?.last4);
methods = { paymentMethods: filteredMethods, total: filteredMethods.length };
paymentMethodId =
@@ -101,21 +100,21 @@
let org: Organization;
// Create new org
if (selectedOrgId === newOrgId) {
- org = await sdk.forConsole.billing.createOrganization(
+ org = (await sdk.forConsole.organizations.create(
newOrgId,
name,
billingPlan,
paymentMethodId
- );
+ )) as unknown as Organization;
}
// Upgrade existing org
- else if (selectedOrg?.billingPlan === BillingPlan.FREE) {
- org = await sdk.forConsole.billing.updatePlan(
+ else if (selectedOrg?.billingPlan === BillingPlan.Tier0) {
+ org = (await sdk.forConsole.organizations.updatePlan(
selectedOrg.$id,
billingPlan,
paymentMethodId,
null
- );
+ )) as unknown as Organization;
}
// Existing pro org
else {
@@ -124,12 +123,12 @@
// Add coupon
if (couponData?.code) {
- await sdk.forConsole.billing.addCredit(org.$id, couponData.code);
+ await sdk.forConsole.organizations.addCredit(org.$id, couponData.code);
}
// Add budget
if (billingBudget) {
- await sdk.forConsole.billing.updateBudget(org.$id, billingBudget, [75]);
+ await sdk.forConsole.organizations.updateBudget(org.$id, billingBudget, [75]);
}
// Add collaborators
@@ -148,7 +147,7 @@
// Add tax ID
if (taxId) {
- await sdk.forConsole.billing.updateTaxId(org.$id, taxId);
+ await sdk.forConsole.organizations.setBillingTaxId(org.$id, taxId);
}
trackEvent(Submit.CreditRedeem, {
coupon: couponData.code,
@@ -172,7 +171,7 @@
async function addCoupon() {
try {
- const response = await sdk.forConsole.billing.getCoupon(coupon);
+ const response = await sdk.forConsole.console.getCoupon(coupon);
couponData = response;
coupon = null;
addNotification({
@@ -212,7 +211,7 @@
placeholder="Select organization"
id="organization" />
{/if}
- {#if selectedOrgId && (selectedOrg?.billingPlan !== BillingPlan.PRO || !selectedOrg?.paymentMethodId)}
+ {#if selectedOrgId && (selectedOrg?.billingPlan !== BillingPlan.Tier1 || !selectedOrg?.paymentMethodId)}
{#if selectedOrgId === newOrgId}
{/if}
- {#if selectedOrg?.$id && selectedOrg?.billingPlan !== BillingPlan.FREE}
+ {#if selectedOrg?.$id && selectedOrg?.billingPlan !== BillingPlan.Tier0}
diff --git a/src/routes/(console)/apply-credit/+page.ts b/src/routes/(console)/apply-credit/+page.ts
index 96b06dd30d..6338e838af 100644
--- a/src/routes/(console)/apply-credit/+page.ts
+++ b/src/routes/(console)/apply-credit/+page.ts
@@ -11,7 +11,7 @@ export const load: PageLoad = async ({ url }) => {
let couponData: Coupon;
const code = url.searchParams.get('code');
try {
- couponData = await sdk.forConsole.billing.getCoupon(code);
+ couponData = await sdk.forConsole.console.getCoupon(code);
} catch (e) {
redirect(303, base);
}
diff --git a/src/routes/(console)/create-organization/+page.svelte b/src/routes/(console)/create-organization/+page.svelte
index 137ede330a..463f35ab25 100644
--- a/src/routes/(console)/create-organization/+page.svelte
+++ b/src/routes/(console)/create-organization/+page.svelte
@@ -11,24 +11,24 @@
} from '$lib/components/billing';
import ValidateCreditModal from '$lib/components/billing/validateCreditModal.svelte';
import Default from '$lib/components/roles/default.svelte';
- import { BillingPlan, Dependencies } from '$lib/constants';
+ import { Dependencies } from '$lib/constants';
import { Button, Form, FormList, InputTags, InputText, Label } from '$lib/elements/forms';
import {
WizardSecondaryContainer,
WizardSecondaryContent,
WizardSecondaryFooter
} from '$lib/layout';
- import type { Coupon, PaymentList } from '$lib/sdk/billing';
+ import type { Coupon } from '$lib/sdk/billing';
import { tierToPlan } from '$lib/stores/billing';
import { addNotification } from '$lib/stores/notifications';
import { organizationList, type Organization } from '$lib/stores/organization';
import { sdk } from '$lib/stores/sdk';
- import { ID } from '@appwrite.io/console';
+ import { ID, BillingPlan, type Models } from '@appwrite.io/console';
import { onMount } from 'svelte';
import { writable } from 'svelte/store';
$: anyOrgFree = $organizationList.teams?.some(
- (org) => (org as Organization)?.billingPlan === BillingPlan.FREE
+ (org) => (org as Organization)?.billingPlan === BillingPlan.Tier0
);
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$/i;
let previousPage: string = base;
@@ -41,9 +41,9 @@
let formComponent: Form;
let isSubmitting = writable(false);
- let methods: PaymentList;
+ let methods: Models.PaymentMethodList;
let name: string;
- let billingPlan: BillingPlan = BillingPlan.FREE;
+ let billingPlan: BillingPlan = BillingPlan.Tier0;
let paymentMethodId: string;
let collaborators: string[] = [];
let couponData: Partial = {
@@ -60,7 +60,7 @@
if ($page.url.searchParams.has('coupon')) {
const coupon = $page.url.searchParams.get('coupon');
try {
- const response = await sdk.forConsole.billing.getCoupon(coupon);
+ const response = await sdk.forConsole.console.getCoupon(coupon);
couponData = response;
} catch (e) {
couponData = {
@@ -80,12 +80,12 @@
}
}
if (anyOrgFree) {
- billingPlan = BillingPlan.PRO;
+ billingPlan = BillingPlan.Tier1;
}
});
async function loadPaymentMethods() {
- methods = await sdk.forConsole.billing.listPaymentMethods();
+ methods = await sdk.forConsole.account.listPaymentMethods();
paymentMethodId = methods.paymentMethods.find((method) => !!method?.last4)?.$id ?? null;
}
@@ -93,31 +93,31 @@
try {
let org: Organization;
- if (billingPlan === BillingPlan.FREE) {
- org = await sdk.forConsole.billing.createOrganization(
+ if (billingPlan === BillingPlan.Tier0) {
+ org = (await sdk.forConsole.organizations.create(
ID.unique(),
name,
- BillingPlan.FREE,
+ BillingPlan.Tier0,
null,
null
- );
+ )) as unknown as Organization;
} else {
- org = await sdk.forConsole.billing.createOrganization(
+ org = (await sdk.forConsole.organizations.create(
ID.unique(),
name,
billingPlan,
paymentMethodId,
null
- );
+ )) as unknown as Organization;
//Add budget
if (billingBudget) {
- await sdk.forConsole.billing.updateBudget(org.$id, billingBudget, [75]);
+ await sdk.forConsole.organizations.updateBudget(org.$id, billingBudget, [75]);
}
//Add coupon
if (couponData?.code) {
- await sdk.forConsole.billing.addCredit(org.$id, couponData.code);
+ await sdk.forConsole.organizations.addCredit(org.$id, couponData.code);
trackEvent(Submit.CreditRedeem);
}
@@ -137,7 +137,7 @@
// Add tax ID
if (taxId) {
- await sdk.forConsole.billing.updateTaxId(org.$id, taxId);
+ await sdk.forConsole.organizations.setBillingTaxId(org.$id, taxId);
}
}
@@ -163,7 +163,7 @@
}
}
- $: if (billingPlan !== BillingPlan.FREE) {
+ $: if (billingPlan !== BillingPlan.Tier0) {
loadPaymentMethods();
}
@@ -190,7 +190,7 @@
pricing page .
- {#if billingPlan !== BillingPlan.FREE}
+ {#if billingPlan !== BillingPlan.Tier0}
-
+
{#if !couponData?.code}
- {#if billingPlan !== BillingPlan.FREE}
+ {#if billingPlan !== BillingPlan.Tier0}
{
try {
if (isCloud) {
- const res = await sdk.forConsole.billing.getRoles(params.organization);
+ const res = await sdk.forConsole.organizations.getScopes(params.organization);
roles = res.roles;
scopes = res.scopes;
if (scopes.includes('billing.read')) {
diff --git a/src/routes/(console)/organization-[organization]/+page.svelte b/src/routes/(console)/organization-[organization]/+page.svelte
index d163390725..021274095e 100644
--- a/src/routes/(console)/organization-[organization]/+page.svelte
+++ b/src/routes/(console)/organization-[organization]/+page.svelte
@@ -28,7 +28,6 @@
import { ID, Region } from '@appwrite.io/console';
import { openImportWizard } from '../project-[project]/settings/migrations/(import)';
import { readOnly } from '$lib/stores/billing';
- import type { RegionList } from '$lib/sdk/billing';
import { onMount } from 'svelte';
import { organization } from '$lib/stores/organization';
import { canWriteProjects } from '$lib/stores/roles';
@@ -119,10 +118,10 @@
}
};
- let regions: RegionList;
+ let regions: Models.ConsoleRegionList;
onMount(async () => {
if (isCloud) {
- regions = await sdk.forConsole.billing.listRegions();
+ regions = await sdk.forConsole.console.regions();
if ($page.url.searchParams.has('type')) {
const paramType = $page.url.searchParams.get('type');
if (paramType === 'createPro') {
diff --git a/src/routes/(console)/organization-[organization]/billing/+page.svelte b/src/routes/(console)/organization-[organization]/billing/+page.svelte
index 30720f9125..ed71c8a2b1 100644
--- a/src/routes/(console)/organization-[organization]/billing/+page.svelte
+++ b/src/routes/(console)/organization-[organization]/billing/+page.svelte
@@ -11,13 +11,12 @@
import TaxId from './taxId.svelte';
import { Alert, Heading } from '$lib/components';
import { failedInvoice, paymentMethods, tierToPlan, upgradeURL } from '$lib/stores/billing';
- import type { PaymentMethodData } from '$lib/sdk/billing';
import { onMount } from 'svelte';
import { page } from '$app/stores';
import { confirmPayment } from '$lib/stores/stripe';
import { sdk } from '$lib/stores/sdk';
import { toLocaleDate } from '$lib/helpers/date';
- import { BillingPlan } from '$lib/constants';
+ import { BillingPlan, type Models } from '@appwrite.io/console';
import RetryPaymentModal from './retryPaymentModal.svelte';
import { selectedInvoice, showRetryModal } from './store';
import { Button } from '$lib/elements/forms';
@@ -26,11 +25,11 @@
export let data;
$: defaultPaymentMethod = $paymentMethods?.paymentMethods?.find(
- (method: PaymentMethodData) => method.$id === $organization?.paymentMethodId
+ (method: Models.PaymentMethod) => method.$id === $organization?.paymentMethodId
);
$: backupPaymentMethod = $paymentMethods?.paymentMethods?.find(
- (method: PaymentMethodData) => method.$id === $organization?.backupPaymentMethodId
+ (method: Models.PaymentMethod) => method.$id === $organization?.backupPaymentMethodId
);
onMount(async () => {
@@ -44,7 +43,7 @@
$page.url.searchParams.get('type') === 'confirmation'
) {
const invoiceId = $page.url.searchParams.get('invoice');
- const invoice = await sdk.forConsole.billing.getInvoice(
+ const invoice = await sdk.forConsole.organizations.getInvoice(
$page.params.organization,
invoiceId
);
@@ -61,7 +60,7 @@
$page.url.searchParams.get('type') === 'retry'
) {
const invoiceId = $page.url.searchParams.get('invoice');
- const invoice = await sdk.forConsole.billing.getInvoice(
+ const invoice = await sdk.forConsole.organizations.getInvoice(
$page.params.organization,
invoiceId
);
@@ -126,7 +125,7 @@
- {#if $organization?.billingPlan !== BillingPlan.FREE && !!$organization?.billingBudget}
+ {#if $organization?.billingPlan !== BillingPlan.Tier0 && !!$organization?.billingBudget}
{/if}
diff --git a/src/routes/(console)/organization-[organization]/billing/+page.ts b/src/routes/(console)/organization-[organization]/billing/+page.ts
index 3d92e2e744..b1b7e355ec 100644
--- a/src/routes/(console)/organization-[organization]/billing/+page.ts
+++ b/src/routes/(console)/organization-[organization]/billing/+page.ts
@@ -19,15 +19,15 @@ export const load: PageLoad = async ({ parent, depends }) => {
const billingAddressId = (organization as Organization)?.billingAddressId;
const billingAddressPromise: Promise = billingAddressId
- ? sdk.forConsole.billing
- .getOrganizationBillingAddress(organization.$id, billingAddressId)
+ ? sdk.forConsole.organizations
+ .getBillingAddress(organization.$id, billingAddressId)
.catch(() => null)
: null;
const [paymentMethods, addressList, aggregationList, billingAddress] = await Promise.all([
- sdk.forConsole.billing.listPaymentMethods(),
- sdk.forConsole.billing.listAddresses(),
- sdk.forConsole.billing.listAggregation(organization.$id),
+ sdk.forConsole.account.listPaymentMethods(),
+ sdk.forConsole.account.listBillingAddresses(),
+ sdk.forConsole.organizations.listAggregations(organization.$id),
billingAddressPromise
]);
diff --git a/src/routes/(console)/organization-[organization]/billing/addCreditModal.svelte b/src/routes/(console)/organization-[organization]/billing/addCreditModal.svelte
index f0bb10ba9b..51ce00b593 100644
--- a/src/routes/(console)/organization-[organization]/billing/addCreditModal.svelte
+++ b/src/routes/(console)/organization-[organization]/billing/addCreditModal.svelte
@@ -16,7 +16,7 @@
async function redeem() {
try {
- await sdk.forConsole.billing.addCredit($organization.$id, coupon);
+ await sdk.forConsole.organizations.addCredit($organization.$id, coupon);
show = false;
await invalidate(Dependencies.CREDIT);
await invalidate(Dependencies.ORGANIZATION);
diff --git a/src/routes/(console)/organization-[organization]/billing/addCreditWizard.svelte b/src/routes/(console)/organization-[organization]/billing/addCreditWizard.svelte
index 5b4029d34d..faa400355d 100644
--- a/src/routes/(console)/organization-[organization]/billing/addCreditWizard.svelte
+++ b/src/routes/(console)/organization-[organization]/billing/addCreditWizard.svelte
@@ -18,12 +18,15 @@
async function create() {
try {
- await sdk.forConsole.billing.setOrganizationPaymentMethod(
+ await sdk.forConsole.organizations.setDefaultPaymentMethod(
$organization.$id,
$addCreditWizardStore.paymentMethodId
);
- await sdk.forConsole.billing.addCredit($organization.$id, $addCreditWizardStore.coupon);
+ await sdk.forConsole.organizations.addCredit(
+ $organization.$id,
+ $addCreditWizardStore.coupon
+ );
addNotification({
type: 'success',
message: `Credit has been added to ${$organization.name}`
diff --git a/src/routes/(console)/organization-[organization]/billing/availableCredit.svelte b/src/routes/(console)/organization-[organization]/billing/availableCredit.svelte
index dfd9cd9166..c4c89c672c 100644
--- a/src/routes/(console)/organization-[organization]/billing/availableCredit.svelte
+++ b/src/routes/(console)/organization-[organization]/billing/availableCredit.svelte
@@ -19,7 +19,7 @@
import { Button } from '$lib/elements/forms';
import AddCreditModal from './addCreditModal.svelte';
import { formatCurrency } from '$lib/helpers/numbers';
- import { BillingPlan } from '$lib/constants';
+ import { BillingPlan } from '@appwrite.io/console';
import { trackEvent } from '$lib/actions/analytics';
import { upgradeURL } from '$lib/stores/billing';
@@ -47,7 +47,7 @@
async function request() {
if (!$organization?.$id) return;
- creditList = await sdk.forConsole.billing.listCredits($organization.$id, [
+ creditList = await sdk.forConsole.organizations.listCredits($organization.$id, [
Query.limit(limit),
Query.offset(offset)
]);
@@ -65,12 +65,12 @@
}
-
+
Available credit
Appwrite credit will automatically be applied to your next invoice.
- {#if $organization?.billingPlan === BillingPlan.FREE}
+ {#if $organization?.billingPlan === BillingPlan.Tier0}
Upgrade to Pro to add credits
Upgrade to a Pro plan to add credits to your organization. For more information on what
@@ -131,7 +131,7 @@
{/if}
- {#if $organization?.billingPlan === BillingPlan.FREE}
+ {#if $organization?.billingPlan === BillingPlan.Tier0}
Learn more about usage rates.
- {#if $organization?.billingPlan === BillingPlan.FREE}
+ {#if $organization?.billingPlan === BillingPlan.Tier0}
Budget caps are a Pro plan feature
@@ -92,7 +93,7 @@
- {#if $organization?.billingPlan === BillingPlan.FREE}
+ {#if $organization?.billingPlan === BillingPlan.Tier0}
(backupPaymentMethod = res));
}
$: if ($organization?.paymentMethodId) {
- sdk.forConsole.billing
- .getOrganizationPaymentMethod($organization.$id, $organization.paymentMethodId)
+ sdk.forConsole.organizations
+ .getPaymentMethod($organization.$id, $organization.paymentMethodId)
.then((res) => (defaultPaymentMethod = res));
}
@@ -332,5 +332,5 @@
bind:showDelete
{hasOtherMethod}
isBackup={isSelectedBackup}
- disabled={$organization?.billingPlan !== BillingPlan.FREE && !hasOtherMethod} />
+ disabled={$organization?.billingPlan !== BillingPlan.Tier0 && !hasOtherMethod} />
{/if}
diff --git a/src/routes/(console)/organization-[organization]/billing/planSummary.svelte b/src/routes/(console)/organization-[organization]/billing/planSummary.svelte
index f551afd401..8b009562b2 100644
--- a/src/routes/(console)/organization-[organization]/billing/planSummary.svelte
+++ b/src/routes/(console)/organization-[organization]/billing/planSummary.svelte
@@ -7,21 +7,20 @@
import { organization } from '$lib/stores/organization';
import { onMount } from 'svelte';
import { sdk } from '$lib/stores/sdk';
- import type { Invoice } from '$lib/sdk/billing';
- import { Query } from '@appwrite.io/console';
+ import { Query, type Models } from '@appwrite.io/console';
import { abbreviateNumber, formatCurrency, formatNumberWithCommas } from '$lib/helpers/numbers';
import { humanFileSize } from '$lib/helpers/sizeConvertion';
- import { BillingPlan } from '$lib/constants';
+ import { BillingPlan } from '@appwrite.io/console';
import { trackEvent } from '$lib/actions/analytics';
import { tooltip } from '$lib/actions/tooltip';
- let currentInvoice: Invoice;
+ let currentInvoice: Models.Invoice;
let extraMembers = 0;
- let currentPlan;
+ let currentPlan: Models.BillingPlan;
const today = new Date();
onMount(async () => {
- const invoices = await sdk.forConsole.billing.listInvoices($organization.$id, [
+ const invoices = await sdk.forConsole.organizations.listInvoices($organization.$id, [
Query.limit(1),
Query.equal('from', $organization.billingCurrentInvoiceDate)
]);
@@ -29,14 +28,14 @@
const members = await sdk.forConsole.teams.listMemberships($organization.$id, []);
extraMembers = members.total > 1 ? members.total - 1 : 0;
- currentPlan = await sdk.forConsole.billing.getPlan($organization?.$id);
+ currentPlan = await sdk.forConsole.organizations.getPlan($organization?.$id);
});
$: extraUsage = (currentInvoice?.amount ?? 0) - (currentPlan?.price ?? 0);
$: extraAddons = currentInvoice?.usage?.length ?? 0;
$: isTrial =
new Date($organization?.billingStartDate).getTime() - today.getTime() > 0 &&
- $plansInfo.get($organization.billingPlan)?.trialDays;
+ $plansInfo.get($organization.billingPlan)?.trial;
{#if $organization}
@@ -61,7 +60,7 @@
{isTrial ? formatCurrency(0) : formatCurrency(currentPlan?.price)}
- {#if $organization?.billingPlan !== BillingPlan.FREE && extraUsage > 0}
+ {#if $organization?.billingPlan !== BillingPlan.Tier0 && extraUsage > 0}
Add-ons
- {$organization?.billingPlan === BillingPlan.FREE
+ {$organization?.billingPlan === BillingPlan.Tier0
? formatCurrency(0)
: formatCurrency(currentInvoice?.amount ?? 0)}
@@ -159,7 +158,7 @@
- {#if $organization?.billingPlan === BillingPlan.FREE}
+ {#if $organization?.billingPlan === BillingPlan.Tier0}
View estimated usage
diff --git a/src/routes/(console)/organization-[organization]/billing/removeAddress.svelte b/src/routes/(console)/organization-[organization]/billing/removeAddress.svelte
index ae83c7399a..be39b842b6 100644
--- a/src/routes/(console)/organization-[organization]/billing/removeAddress.svelte
+++ b/src/routes/(console)/organization-[organization]/billing/removeAddress.svelte
@@ -14,7 +14,7 @@
async function removeAddress() {
try {
- await sdk.forConsole.billing.removeBillingAddress($organization.$id);
+ await sdk.forConsole.organizations.deleteBillingAddress($organization.$id);
addNotification({
type: 'success',
message: `The billing address has been removed from ${$organization.name}`
diff --git a/src/routes/(console)/organization-[organization]/billing/replaceAddress.svelte b/src/routes/(console)/organization-[organization]/billing/replaceAddress.svelte
index 0eb06bbef7..085a7c3229 100644
--- a/src/routes/(console)/organization-[organization]/billing/replaceAddress.svelte
+++ b/src/routes/(console)/organization-[organization]/billing/replaceAddress.svelte
@@ -6,13 +6,13 @@
import { organization } from '$lib/stores/organization';
import { Dependencies } from '$lib/constants';
import { onMount } from 'svelte';
- import type { AddressesList } from '$lib/sdk/billing';
import { addNotification } from '$lib/stores/notifications';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { Pill } from '$lib/elements';
+ import type { Models } from '@appwrite.io/console';
export let show = false;
- let addresses: AddressesList;
+ let addresses: Models.BillingAddressList;
let selectedAddress: string;
let error: string;
let country: string;
@@ -29,7 +29,7 @@
];
onMount(async () => {
- addresses = await sdk.forConsole.billing.listAddresses();
+ addresses = await sdk.forConsole.account.listBillingAddresses();
const firstNonCurrentAddress = addresses?.billingAddresses?.find(
(address) => address.$id !== $organization?.billingAddressId
@@ -57,7 +57,7 @@
if (selectedAddress === $organization.billingAddressId) {
show = false;
} else if (selectedAddress === null) {
- const address = await sdk.forConsole.billing.createAddress(
+ const address = await sdk.forConsole.account.createBillingAddress(
country,
streetAddress,
city,
@@ -65,7 +65,10 @@
postalCode ? postalCode : undefined,
addressLine2 ? postalCode : undefined
);
- await sdk.forConsole.billing.setBillingAddress($organization.$id, address.$id);
+ await sdk.forConsole.organizations.setBillingAddress(
+ $organization.$id,
+ address.$id
+ );
invalidate(Dependencies.ORGANIZATION);
invalidate(Dependencies.ADDRESS);
@@ -80,7 +83,10 @@
message: `Your billing address has been updated`
});
} else {
- await sdk.forConsole.billing.setBillingAddress($organization.$id, selectedAddress);
+ await sdk.forConsole.organizations.setBillingAddress(
+ $organization.$id,
+ selectedAddress
+ );
invalidate(Dependencies.ORGANIZATION);
invalidate(Dependencies.ADDRESS);
diff --git a/src/routes/(console)/organization-[organization]/billing/replaceCard.svelte b/src/routes/(console)/organization-[organization]/billing/replaceCard.svelte
index bf0f629169..c6e685ea4f 100644
--- a/src/routes/(console)/organization-[organization]/billing/replaceCard.svelte
+++ b/src/routes/(console)/organization-[organization]/billing/replaceCard.svelte
@@ -7,20 +7,20 @@
import { Dependencies } from '$lib/constants';
import { initializeStripe, isStripeInitialized, submitStripeCard } from '$lib/stores/stripe';
import { onMount } from 'svelte';
- import type { PaymentList } from '$lib/sdk/billing';
import { addNotification } from '$lib/stores/notifications';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { PaymentBoxes } from '$lib/components/billing';
+ import type { Models } from '@appwrite.io/console';
export let show = false;
export let isBackup = false;
- let methods: PaymentList;
+ let methods: Models.PaymentMethodList;
let selectedPaymentMethodId: string;
let name: string;
let error: string;
onMount(async () => {
- methods = await sdk.forConsole.billing.listPaymentMethods();
+ methods = await sdk.forConsole.account.listPaymentMethods();
if (!$organization.paymentMethodId && !$organization.backupPaymentMethodId) {
selectedPaymentMethodId = methods?.total ? methods.paymentMethods[0].$id : null;
@@ -68,7 +68,7 @@
async function addPaymentMethod(paymentMethodId: string) {
try {
- await sdk.forConsole.billing.setOrganizationPaymentMethod(
+ await sdk.forConsole.organizations.setDefaultPaymentMethod(
$organization.$id,
paymentMethodId
);
@@ -79,7 +79,7 @@
async function addBackupPaymentMethod(paymentMethodId: string) {
try {
- await sdk.forConsole.billing.setOrganizationPaymentMethodBackup(
+ await sdk.forConsole.organizations.setBackupPaymentMethod(
$organization.$id,
paymentMethodId
);
diff --git a/src/routes/(console)/organization-[organization]/billing/retryPaymentModal.svelte b/src/routes/(console)/organization-[organization]/billing/retryPaymentModal.svelte
index 2233d511c0..7eedddf602 100644
--- a/src/routes/(console)/organization-[organization]/billing/retryPaymentModal.svelte
+++ b/src/routes/(console)/organization-[organization]/billing/retryPaymentModal.svelte
@@ -3,7 +3,6 @@
import { FakeModal } from '$lib/components';
import { Button } from '$lib/elements/forms';
import { Dependencies } from '$lib/constants';
- import type { Invoice } from '$lib/sdk/billing';
import { addNotification } from '$lib/stores/notifications';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { page } from '$app/stores';
@@ -20,9 +19,10 @@
import { onMount } from 'svelte';
import { getApiEndpoint, sdk } from '$lib/stores/sdk';
import { formatCurrency } from '$lib/helpers/numbers';
+ import type { Models } from '@appwrite.io/console';
export let show = false;
- export let invoice: Invoice;
+ export let invoice: Models.Invoice;
let error: string = null;
let isButtonDisabled = false;
let name: string;
@@ -53,7 +53,7 @@
if (paymentMethodId === null) {
try {
const method = await submitStripeCard(name, $organization.$id);
- const card = await sdk.forConsole.billing.getPaymentMethod(method.$id);
+ const card = await sdk.forConsole.account.getPaymentMethod(method.$id);
if (card?.last4) {
paymentMethodId = card.$id;
} else {
@@ -68,9 +68,12 @@
}
}
if (setAsDefault) {
- await sdk.forConsole.billing.setDefaultPaymentMethod(paymentMethodId);
+ await sdk.forConsole.organizations.setDefaultPaymentMethod(
+ $organization.$id,
+ paymentMethodId
+ );
}
- const { clientSecret } = await sdk.forConsole.billing.retryPayment(
+ const { clientSecret } = await sdk.forConsole.organizations.createInvoicePayment(
$organization.$id,
invoice.$id,
paymentMethodId
diff --git a/src/routes/(console)/organization-[organization]/billing/store.ts b/src/routes/(console)/organization-[organization]/billing/store.ts
index ca081c2917..0f4239727e 100644
--- a/src/routes/(console)/organization-[organization]/billing/store.ts
+++ b/src/routes/(console)/organization-[organization]/billing/store.ts
@@ -1,6 +1,7 @@
import { page } from '$app/stores';
import type { WizardStepsType } from '$lib/layout/wizard.svelte';
-import type { AggregationList, Invoice } from '$lib/sdk/billing';
+import type { AggregationList } from '$lib/sdk/billing';
+import type { Models } from '@appwrite.io/console';
import { derived, writable } from 'svelte/store';
export const aggregationList = derived(
@@ -14,5 +15,5 @@ export const addCreditWizardStore = writable<{ coupon: string; paymentMethodId:
paymentMethodId: null
});
-export const selectedInvoice = writable(null);
+export const selectedInvoice = writable(null);
export const showRetryModal = writable(false);
diff --git a/src/routes/(console)/organization-[organization]/billing/taxId.svelte b/src/routes/(console)/organization-[organization]/billing/taxId.svelte
index 003012cbbe..573f3d19d6 100644
--- a/src/routes/(console)/organization-[organization]/billing/taxId.svelte
+++ b/src/routes/(console)/organization-[organization]/billing/taxId.svelte
@@ -17,7 +17,7 @@
async function updateTaxId() {
try {
- await sdk.forConsole.billing.updateTaxId($organization.$id, taxId);
+ await sdk.forConsole.organizations.setBillingTaxId($organization.$id, taxId);
await invalidate(Dependencies.ORGANIZATION);
addNotification({
type: 'success',
diff --git a/src/routes/(console)/organization-[organization]/billing/wizard/addCredit.svelte b/src/routes/(console)/organization-[organization]/billing/wizard/addCredit.svelte
index d62ffc7ab5..069dbff0e4 100644
--- a/src/routes/(console)/organization-[organization]/billing/wizard/addCredit.svelte
+++ b/src/routes/(console)/organization-[organization]/billing/wizard/addCredit.svelte
@@ -17,7 +17,7 @@
async function validateCoupon() {
if (couponData?.status === 'active') return;
try {
- const response = await sdk.forConsole.billing.getCoupon(coupon);
+ const response = await sdk.forConsole.console.getCoupon(coupon);
couponData = response;
$addCreditWizardStore.coupon = coupon;
coupon = null;
diff --git a/src/routes/(console)/organization-[organization]/billing/wizard/paymentDetails.svelte b/src/routes/(console)/organization-[organization]/billing/wizard/paymentDetails.svelte
index 8a142ac571..cb9c234e60 100644
--- a/src/routes/(console)/organization-[organization]/billing/wizard/paymentDetails.svelte
+++ b/src/routes/(console)/organization-[organization]/billing/wizard/paymentDetails.svelte
@@ -2,7 +2,6 @@
import { FormList } from '$lib/elements/forms';
import { WizardStep } from '$lib/layout';
import { onMount } from 'svelte';
- import type { PaymentList } from '$lib/sdk/billing';
import { invalidate } from '$app/navigation';
import { Dependencies } from '$lib/constants';
import { initializeStripe, isStripeInitialized, submitStripeCard } from '$lib/stores/stripe';
@@ -10,12 +9,13 @@
import { PaymentBoxes } from '$lib/components/billing';
import { addCreditWizardStore } from '../store';
import { organization } from '$lib/stores/organization';
+ import type { Models } from '@appwrite.io/console';
- let methods: PaymentList;
+ let methods: Models.PaymentMethodList;
let name: string;
onMount(async () => {
- methods = await sdk.forConsole.billing.listPaymentMethods();
+ methods = await sdk.forConsole.account.listPaymentMethods();
$addCreditWizardStore.paymentMethodId =
methods.paymentMethods.find((method) => !!method?.last4)?.$id ?? null;
});
diff --git a/src/routes/(console)/organization-[organization]/change-plan/+page.svelte b/src/routes/(console)/organization-[organization]/change-plan/+page.svelte
index 6b70855165..6fdd571dde 100644
--- a/src/routes/(console)/organization-[organization]/change-plan/+page.svelte
+++ b/src/routes/(console)/organization-[organization]/change-plan/+page.svelte
@@ -13,7 +13,7 @@
import PlanSelection from '$lib/components/billing/planSelection.svelte';
import ValidateCreditModal from '$lib/components/billing/validateCreditModal.svelte';
import Default from '$lib/components/roles/default.svelte';
- import { BillingPlan, Dependencies, feedbackDowngradeOptions } from '$lib/constants';
+ import { Dependencies, feedbackDowngradeOptions } from '$lib/constants';
import {
Button,
Form,
@@ -29,20 +29,20 @@
WizardSecondaryContent,
WizardSecondaryFooter
} from '$lib/layout';
- import { type Coupon, type PaymentList } from '$lib/sdk/billing';
- import { plansInfo, tierToPlan, type Tier } from '$lib/stores/billing';
+ import { plansInfo, tierToPlan } from '$lib/stores/billing';
import { addNotification } from '$lib/stores/notifications';
import { organization, organizationList, type Organization } from '$lib/stores/organization';
import { sdk } from '$lib/stores/sdk';
import { user } from '$lib/stores/user';
import { VARS } from '$lib/system';
+ import { BillingPlan, type Models } from '@appwrite.io/console';
import { onMount } from 'svelte';
import { writable } from 'svelte/store';
export let data;
$: anyOrgFree = $organizationList.teams?.find(
- (org) => (org as Organization)?.billingPlan === BillingPlan.FREE
+ (org) => (org as Organization)?.billingPlan === BillingPlan.Tier0
);
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$/i;
let previousPage: string = base;
@@ -53,8 +53,8 @@
let formComponent: Form;
let isSubmitting = writable(false);
- let methods: PaymentList;
- let billingPlan: Tier = $organization.billingPlan;
+ let methods: Models.PaymentMethodList;
+ let billingPlan = $organization.billingPlan;
let paymentMethodId: string;
let collaborators: string[] =
data?.members?.memberships
@@ -62,7 +62,7 @@
if (m.userEmail !== $user.email) return m.userEmail;
})
?.filter(Boolean) ?? [];
- let couponData: Partial = {
+ let couponData: Partial = {
code: null,
status: null,
credits: null
@@ -79,7 +79,7 @@
if ($page.url.searchParams.has('code')) {
const coupon = $page.url.searchParams.get('code');
try {
- const response = await sdk.forConsole.billing.getCoupon(coupon);
+ const response = await sdk.forConsole.console.getCoupon(coupon);
couponData = response;
} catch (e) {
couponData = {
@@ -95,18 +95,18 @@
billingPlan = plan as BillingPlan;
}
}
- if ($organization?.billingPlan === BillingPlan.SCALE) {
- billingPlan = BillingPlan.SCALE;
+ if ($organization?.billingPlan === BillingPlan.Tier2) {
+ billingPlan = BillingPlan.Tier2;
} else {
- billingPlan = BillingPlan.PRO;
+ billingPlan = BillingPlan.Tier1;
}
- const currentPlan = await sdk.forConsole.billing.getPlan($organization?.$id);
+ const currentPlan = await sdk.forConsole.organizations.getPlan($organization?.$id);
selfService = currentPlan.selfService;
});
async function loadPaymentMethods() {
- methods = await sdk.forConsole.billing.listPaymentMethods();
+ methods = await sdk.forConsole.account.listPaymentMethods();
paymentMethodId =
$organization?.paymentMethodId ??
@@ -124,7 +124,7 @@
async function downgrade() {
try {
- await sdk.forConsole.billing.updatePlan(
+ await sdk.forConsole.organizations.updatePlan(
$organization.$id,
billingPlan,
paymentMethodId,
@@ -173,7 +173,7 @@
async function upgrade() {
try {
- const org = await sdk.forConsole.billing.updatePlan(
+ const org = await sdk.forConsole.organizations.updatePlan(
$organization.$id,
billingPlan,
paymentMethodId,
@@ -182,13 +182,13 @@
//Add coupon
if (couponData?.code) {
- await sdk.forConsole.billing.addCredit(org.$id, couponData.code);
+ await sdk.forConsole.organizations.addCredit(org.$id, couponData.code);
trackEvent(Submit.CreditRedeem);
}
//Add budget
if (billingBudget) {
- await sdk.forConsole.billing.updateBudget(org.$id, billingBudget, [75]);
+ await sdk.forConsole.organizations.updateBudget(org.$id, billingBudget, [75]);
}
//Add collaborators
@@ -211,7 +211,7 @@
//Add tax ID
if (taxId) {
- await sdk.forConsole.billing.updateTaxId(org.$id, taxId);
+ await sdk.forConsole.organizations.setBillingTaxId(org.$id, taxId);
}
await invalidate(Dependencies.ACCOUNT);
@@ -237,7 +237,7 @@
$: isUpgrade = billingPlan > $organization.billingPlan;
$: isDowngrade = billingPlan < $organization.billingPlan;
- $: if (billingPlan !== BillingPlan.FREE) {
+ $: if (billingPlan !== BillingPlan.Tier0) {
loadPaymentMethods();
}
$: isButtonDisabled = $organization.billingPlan === billingPlan;
@@ -265,17 +265,17 @@
bind:billingPlan
bind:selfService
anyOrgFree={!!anyOrgFree}
- class={anyOrgFree && billingPlan !== BillingPlan.FREE
+ class={anyOrgFree && billingPlan !== BillingPlan.Tier0
? 'u-margin-block-start-16'
: ''} />
{#if isDowngrade}
- {#if billingPlan === BillingPlan.FREE}
+ {#if billingPlan === BillingPlan.Tier0}
- {:else if billingPlan === BillingPlan.PRO && $organization.billingPlan === BillingPlan.SCALE}
+ {:else if billingPlan === BillingPlan.Tier1 && $organization.billingPlan === BillingPlan.Tier2}
{@const extraMembers = collaborators?.length ?? 0}
@@ -292,7 +292,7 @@
{/if}
{/if}
- {#if billingPlan !== BillingPlan.FREE && $organization.billingPlan === BillingPlan.FREE}
+ {#if billingPlan !== BillingPlan.Tier0 && $organization.billingPlan === BillingPlan.Tier0}
- {#if billingPlan !== BillingPlan.FREE && $organization.billingPlan !== billingPlan && $organization.billingPlan !== BillingPlan.CUSTOM}
+ {#if billingPlan !== BillingPlan.Tier0 && $organization.billingPlan !== billingPlan && $organization.billingPlan.toString() !== 'cont-1'}
- {:else if $organization.billingPlan !== BillingPlan.CUSTOM}
+ {:else if $organization.billingPlan.toString() !== 'cont-1'}
{/if}
diff --git a/src/routes/(console)/organization-[organization]/createMember.svelte b/src/routes/(console)/organization-[organization]/createMember.svelte
index b9726f6296..4123f98c06 100644
--- a/src/routes/(console)/organization-[organization]/createMember.svelte
+++ b/src/routes/(console)/organization-[organization]/createMember.svelte
@@ -8,7 +8,8 @@
import { createEventDispatcher } from 'svelte';
import { organization } from '$lib/stores/organization';
import { invalidate } from '$app/navigation';
- import { BillingPlan, Dependencies } from '$lib/constants';
+ import { Dependencies } from '$lib/constants';
+ import { BillingPlan } from '@appwrite.io/console';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { isCloud } from '$lib/system';
import { roles } from '$lib/stores/billing';
@@ -63,7 +64,7 @@
{#if isCloud}
- {#if $organization?.billingPlan === BillingPlan.PRO}
+ {#if $organization?.billingPlan === BillingPlan.Tier1}
- {#if isCloud && $organization?.billingPlan === BillingPlan.FREE}
+ {#if isCloud && $organization?.billingPlan === BillingPlan.Tier0}
{/if}
diff --git a/src/routes/(console)/project-[project]/databases/create.svelte b/src/routes/(console)/project-[project]/databases/create.svelte
index 80b1bad00c..711fcf0b96 100644
--- a/src/routes/(console)/project-[project]/databases/create.svelte
+++ b/src/routes/(console)/project-[project]/databases/create.svelte
@@ -8,7 +8,7 @@
import { ID } from '@appwrite.io/console';
import { createEventDispatcher } from 'svelte';
import { isCloud } from '$lib/system';
- import { BillingPlan } from '$lib/constants';
+ import { BillingPlan } from '@appwrite.io/console';
import { organization } from '$lib/stores/organization';
import { upgradeURL } from '$lib/stores/billing';
import CreatePolicy from './database-[database]/backups/createPolicy.svelte';
@@ -126,7 +126,7 @@
{#if isCloud}
- {#if $organization?.billingPlan === BillingPlan.FREE}
+ {#if $organization?.billingPlan === BillingPlan.Tier0}
{#if showPlanUpgradeAlert}
{
// allow when on Pro and no policy exists
- if ($organization?.billingPlan === BillingPlan.PRO) {
+ if ($organization?.billingPlan === BillingPlan.Tier1) {
return data.policies.total > 0;
- } else if ($organization?.billingPlan === BillingPlan.SCALE) {
+ } else if ($organization?.billingPlan === BillingPlan.Tier2) {
return false;
}
};
diff --git a/src/routes/(console)/project-[project]/databases/database-[database]/backups/containerHeader.svelte b/src/routes/(console)/project-[project]/databases/database-[database]/backups/containerHeader.svelte
index a01b1c5819..46cb89203b 100644
--- a/src/routes/(console)/project-[project]/databases/database-[database]/backups/containerHeader.svelte
+++ b/src/routes/(console)/project-[project]/databases/database-[database]/backups/containerHeader.svelte
@@ -4,7 +4,7 @@
import { Pill } from '$lib/elements';
import { wizard } from '$lib/stores/wizard';
import SupportWizard from '$routes/(console)/supportWizard.svelte';
- import { BillingPlan } from '$lib/constants';
+ import { BillingPlan } from '@appwrite.io/console';
import { organization } from '$lib/stores/organization';
export let isFlex = true;
@@ -27,7 +27,7 @@
{title}
- {#if hasLimitations && $organization.billingPlan === BillingPlan.PRO}
+ {#if hasLimitations && $organization.billingPlan === BillingPlan.Tier1}
(showDropdown = true)}>
diff --git a/src/routes/(console)/project-[project]/databases/database-[database]/backups/createPolicy.svelte b/src/routes/(console)/project-[project]/databases/database-[database]/backups/createPolicy.svelte
index d44a7d9d56..1947e91443 100644
--- a/src/routes/(console)/project-[project]/databases/database-[database]/backups/createPolicy.svelte
+++ b/src/routes/(console)/project-[project]/databases/database-[database]/backups/createPolicy.svelte
@@ -22,7 +22,7 @@
} from '$lib/helpers/backups';
import { InputNumber } from '$lib/elements/forms/index.js';
import { organization } from '$lib/stores/organization';
- import { BillingPlan } from '$lib/constants';
+ import { BillingPlan } from '@appwrite.io/console';
import { Card } from '$lib/components';
import { wizard } from '$lib/stores/wizard';
import SupportWizard from '$routes/(console)/supportWizard.svelte';
@@ -146,7 +146,7 @@
);
// pre-check the hourly if on pro plan
- if ($organization.billingPlan === BillingPlan.PRO && isFromBackupsTab) {
+ if ($organization.billingPlan === BillingPlan.Tier1 && isFromBackupsTab) {
presetPolicies.update((all) =>
all.map((policy) => {
policy.id = ID.unique();
@@ -168,7 +168,7 @@
- {#if $organization.billingPlan === BillingPlan.SCALE}
+ {#if $organization.billingPlan === BillingPlan.Tier2}
{#if title || subtitle}
{#if title}
@@ -184,7 +184,7 @@
- {#if $organization.billingPlan === BillingPlan.PRO}
+ {#if $organization.billingPlan === BillingPlan.Tier1}
{@const dailyPolicy = $presetPolicies[1]}
{#if isFromBackupsTab}
diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/executions/+page.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/executions/+page.svelte
index 7e0d3b4ef7..06cb9ad8e1 100644
--- a/src/routes/(console)/project-[project]/functions/function-[function]/executions/+page.svelte
+++ b/src/routes/(console)/project-[project]/functions/function-[function]/executions/+page.svelte
@@ -1,7 +1,8 @@