diff --git a/src/routes/console/organization-[organization]/billing/deleteOrgPayment.svelte b/src/routes/console/organization-[organization]/billing/deleteOrgPayment.svelte
index 747b538ec..e2de60520 100644
--- a/src/routes/console/organization-[organization]/billing/deleteOrgPayment.svelte
+++ b/src/routes/console/organization-[organization]/billing/deleteOrgPayment.svelte
@@ -58,11 +58,10 @@
headerDivider={false}
title="Unable to delete payment method">
- The {isBackup ? 'backup' : 'default'} payment method cannot be deleted as
+ The {isBackup ? 'backup' : 'default'} payment method cannot be removed as
{$organization?.name}
- has an upcoming invoice. To proceed with deletion, set a {isBackup
- ? 'default'
- : 'backup'} or add a new {isBackup ? 'backup' : 'default'} payment method.
+ has an upcoming invoice. To proceed, set a {isBackup ? 'default' : 'backup'} or add a new
+ {isBackup ? 'backup' : 'default'} payment method.
@@ -76,13 +75,13 @@
icon="exclamation"
state="warning"
headerDivider={false}
- title="Delete payment method">
+ title="Remove payment method">
- Are you sure you want to delete the payment method from {$organization?.name}?
+ Are you sure you want to remove the payment method from {$organization?.name}?
-
+
{/if}
diff --git a/src/routes/console/organization-[organization]/billing/paymentHistory.svelte b/src/routes/console/organization-[organization]/billing/paymentHistory.svelte
index a8caf4348..8339ac60b 100644
--- a/src/routes/console/organization-[organization]/billing/paymentHistory.svelte
+++ b/src/routes/console/organization-[organization]/billing/paymentHistory.svelte
@@ -22,7 +22,7 @@
} from '$lib/elements/table';
import { toLocaleDate } from '$lib/helpers/date';
import { formatCurrency } from '$lib/helpers/numbers';
- import type { InvoiceList } from '$lib/sdk/billing';
+ import type { Invoice, InvoiceList } from '$lib/sdk/billing';
import { sdk } from '$lib/stores/sdk';
import { VARS } from '$lib/system';
import { Query } from '@appwrite.io/console';
@@ -31,6 +31,7 @@
import { selectedInvoice, showRetryModal } from './store';
let showDropdown = [];
+ let showFailedError = false;
let offset = 0;
let invoiceList: InvoiceList = {
@@ -51,6 +52,11 @@
]);
}
+ function retryPayment(invoice: Invoice) {
+ $selectedInvoice = invoice;
+ $showRetryModal = true;
+ }
+
$: if (offset !== null) {
request();
}
@@ -82,14 +88,45 @@
-
- {status === 'requires_authentication' ? 'failed' : status}
-
+ {#if invoice?.lastError}
+
+ (showFailedError = true)}
+ button>
+ {status === 'requires_authentication'
+ ? 'failed'
+ : status}
+
+
+
+ The scheduled payment has failed. .
+
+
+
+ {:else}
+
+ {status === 'requires_authentication'
+ ? 'failed'
+ : status}
+
+ {/if}
{formatCurrency(invoice.amount)}
@@ -132,8 +169,7 @@
{
- $selectedInvoice = invoice;
- $showRetryModal = true;
+ retryPayment(invoice);
showDropdown[i] = !showDropdown[i];
trackEvent(`click_retry_payment`, {
from: 'button',
diff --git a/src/routes/console/organization-[organization]/billing/paymentMethods.svelte b/src/routes/console/organization-[organization]/billing/paymentMethods.svelte
index ae44de05e..5a41e40a7 100644
--- a/src/routes/console/organization-[organization]/billing/paymentMethods.svelte
+++ b/src/routes/console/organization-[organization]/billing/paymentMethods.svelte
@@ -137,7 +137,7 @@
showDelete = true;
showDropdown = false;
}}>
- Delete
+ Remove
diff --git a/src/routes/console/organization-[organization]/billing/replaceCard.svelte b/src/routes/console/organization-[organization]/billing/replaceCard.svelte
index 639964119..bf0f62916 100644
--- a/src/routes/console/organization-[organization]/billing/replaceCard.svelte
+++ b/src/routes/console/organization-[organization]/billing/replaceCard.svelte
@@ -5,7 +5,7 @@
import { sdk } from '$lib/stores/sdk';
import { organization } from '$lib/stores/organization';
import { Dependencies } from '$lib/constants';
- import { submitStripeCard } from '$lib/stores/stripe';
+ 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';
@@ -24,10 +24,18 @@
if (!$organization.paymentMethodId && !$organization.backupPaymentMethodId) {
selectedPaymentMethodId = methods?.total ? methods.paymentMethods[0].$id : null;
+ } else {
+ selectedPaymentMethodId = isBackup
+ ? $organization.backupPaymentMethodId
+ : $organization.paymentMethodId;
+ // If the selected payment method does not belong to the current user, select the first one.
+ if (
+ methods?.total &&
+ !methods.paymentMethods.some((method) => method.$id === selectedPaymentMethodId)
+ ) {
+ selectedPaymentMethodId = methods.paymentMethods[0].$id;
+ }
}
- selectedPaymentMethodId = isBackup
- ? $organization.backupPaymentMethodId
- : $organization.paymentMethodId;
});
async function handleSubmit() {
@@ -82,6 +90,14 @@
$: filteredMethods = methods?.paymentMethods.filter((method) => !!method?.last4);
+ $: if (selectedPaymentMethodId === null && !$isStripeInitialized) {
+ initializeStripe();
+ }
+
+ $: if (selectedPaymentMethodId) {
+ isStripeInitialized.set(false);
+ }
+
$: if (!show) {
selectedPaymentMethodId = null;
}
diff --git a/src/routes/console/organization-[organization]/billing/retryPaymentModal.svelte b/src/routes/console/organization-[organization]/billing/retryPaymentModal.svelte
index e0f034029..06dde940f 100644
--- a/src/routes/console/organization-[organization]/billing/retryPaymentModal.svelte
+++ b/src/routes/console/organization-[organization]/billing/retryPaymentModal.svelte
@@ -30,8 +30,21 @@
let paymentMethodId: string;
let setAsDefault = false;
- onMount(() => {
- paymentMethodId = $organization.paymentMethodId;
+ onMount(async () => {
+ if (!$organization.paymentMethodId && !$organization.backupPaymentMethodId) {
+ paymentMethodId = $paymentMethods?.total ? $paymentMethods.paymentMethods[0].$id : null;
+ } else {
+ paymentMethodId = $organization.paymentMethodId
+ ? $organization.paymentMethodId
+ : $organization.backupPaymentMethodId;
+ // If the selected payment method does not belong to the current user, select the first one.
+ if (
+ $paymentMethods?.total &&
+ !$paymentMethods.paymentMethods.some((method) => method.$id === paymentMethodId)
+ ) {
+ paymentMethodId = $paymentMethods.paymentMethods[0].$id;
+ }
+ }
});
async function handleSubmit() {
diff --git a/src/routes/console/organization-[organization]/createProjectCloud.svelte b/src/routes/console/organization-[organization]/createProjectCloud.svelte
index 4c228c28e..953c70023 100644
--- a/src/routes/console/organization-[organization]/createProjectCloud.svelte
+++ b/src/routes/console/organization-[organization]/createProjectCloud.svelte
@@ -67,4 +67,4 @@
});
-
+
diff --git a/src/routes/console/organization-[organization]/excesLimitModal.svelte b/src/routes/console/organization-[organization]/excesLimitModal.svelte
deleted file mode 100644
index bead52e17..000000000
--- a/src/routes/console/organization-[organization]/excesLimitModal.svelte
+++ /dev/null
@@ -1,106 +0,0 @@
-
-
-
-
- Your usage exceeds the {tierToPlan($organization.billingPlan).name} plan limits
-
-
- {#if $organization.billingPlan === BillingPlan.STARTER}
-
- Usage for {$organization.name} organization has reached the limits of the {tierToPlan(
- $organization.billingPlan
- ).name} plan. Consider upgrading to increase your resource usage.
-
- {:else}
-
- Usage for {$organization.name} organization has reached the limits of the {tierToPlan(
- $organization.billingPlan
- ).name} plan. Excess usage fees will apply.
-
- {/if}
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/routes/console/organization-[organization]/store.ts b/src/routes/console/organization-[organization]/store.ts
index 07b0ca110..28e9e735a 100644
--- a/src/routes/console/organization-[organization]/store.ts
+++ b/src/routes/console/organization-[organization]/store.ts
@@ -1,6 +1,5 @@
import { page } from '$app/stores';
import type { Models } from '@appwrite.io/console';
-import { derived, writable } from 'svelte/store';
+import { derived } from 'svelte/store';
-export const showExcess = writable
(false);
export const projects = derived(page, ($page) => $page.data?.projects as Models.ProjectList);
diff --git a/src/routes/console/organization-[organization]/usage/[[invoice]]/+page.svelte b/src/routes/console/organization-[organization]/usage/[[invoice]]/+page.svelte
index 38779b21b..9bc13dc07 100644
--- a/src/routes/console/organization-[organization]/usage/[[invoice]]/+page.svelte
+++ b/src/routes/console/organization-[organization]/usage/[[invoice]]/+page.svelte
@@ -107,7 +107,8 @@
Bandwidth
- Calculated for all bandwidth used across all projects in your organization.
+ Calculated for all bandwidth used across all projects in your organization. Resets at
+ the start of each billing cycle.
diff --git a/src/routes/console/project-[project]/functions/function-[function]/settings/+page.svelte b/src/routes/console/project-[project]/functions/function-[function]/settings/+page.svelte
index 4dac5f427..db5149a6a 100644
--- a/src/routes/console/project-[project]/functions/function-[function]/settings/+page.svelte
+++ b/src/routes/console/project-[project]/functions/function-[function]/settings/+page.svelte
@@ -24,20 +24,17 @@
const sdkCreateVariable = async (key: string, value: string) => {
await sdk.forProject.functions.createVariable($func.$id, key, value);
- await invalidate(Dependencies.VARIABLES);
- await invalidate(Dependencies.FUNCTION);
+ await Promise.all([invalidate(Dependencies.VARIABLES), invalidate(Dependencies.FUNCTION)]);
};
const sdkUpdateVariable = async (variableId: string, key: string, value: string) => {
await sdk.forProject.functions.updateVariable($func.$id, variableId, key, value);
- await invalidate(Dependencies.VARIABLES);
- await invalidate(Dependencies.FUNCTION);
+ await Promise.all([invalidate(Dependencies.VARIABLES), invalidate(Dependencies.FUNCTION)]);
};
const sdkDeleteVariable = async (variableId: string) => {
await sdk.forProject.functions.deleteVariable($func.$id, variableId);
- await invalidate(Dependencies.VARIABLES);
- await invalidate(Dependencies.FUNCTION);
+ await Promise.all([invalidate(Dependencies.VARIABLES), invalidate(Dependencies.FUNCTION)]);
};
diff --git a/src/routes/console/project-[project]/functions/store.ts b/src/routes/console/project-[project]/functions/store.ts
index 3acf62136..172a5ce42 100644
--- a/src/routes/console/project-[project]/functions/store.ts
+++ b/src/routes/console/project-[project]/functions/store.ts
@@ -2,10 +2,11 @@ import { page } from '$app/stores';
import { derived } from 'svelte/store';
import type { Models } from '@appwrite.io/console';
-export const runtimesList = derived(
- page,
- async ($page) => (await $page.data.runtimesList) as Models.RuntimeList
-);
+export const runtimesList = derived(page, async ($page) => {
+ const { runtimes } = (await $page.data.runtimesList) as Models.RuntimeList;
+ const filtered = runtimes.filter((runtime) => !runtime.$id.startsWith('python-ml'));
+ return { runtimes: filtered, total: filtered.length };
+});
export const baseRuntimesList = derived(runtimesList, async ($runtimesList) => {
const baseRuntimes = new Map();
diff --git a/src/routes/console/project-[project]/settings/usage/[[invoice]]/+page.svelte b/src/routes/console/project-[project]/settings/usage/[[invoice]]/+page.svelte
index a8b55e03c..76e865e6b 100644
--- a/src/routes/console/project-[project]/settings/usage/[[invoice]]/+page.svelte
+++ b/src/routes/console/project-[project]/settings/usage/[[invoice]]/+page.svelte
@@ -104,7 +104,10 @@