mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: address billing estimation review feedback
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
export let isDowngrade = false;
|
||||
export let organizationId: string | undefined = undefined;
|
||||
export let estimationOverride: PlanChangeEstimate | null = null;
|
||||
export let preferExternalEstimate = false;
|
||||
|
||||
let budgetEnabled = false;
|
||||
let estimation: Models.Estimation | PlanChangeEstimate;
|
||||
@@ -103,6 +104,8 @@
|
||||
|
||||
$: if (estimationOverride) {
|
||||
estimation = estimationOverride;
|
||||
} else if (preferExternalEstimate) {
|
||||
estimation = undefined;
|
||||
} else if (organizationId) {
|
||||
getUpdatePlanEstimate(organizationId, billingPlan.$id, collaborators, couponData?.code);
|
||||
} else {
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
];
|
||||
}
|
||||
|
||||
return project.resources
|
||||
return (project.resources ?? [])
|
||||
.filter((resource) => resource.status !== 'compliant' || resource.excess > 0)
|
||||
.map((resource) => ({
|
||||
id: `${project.$id}-${resource.type}`,
|
||||
|
||||
@@ -211,6 +211,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
const additionalInviteEmails = $derived(getAdditionalInvites());
|
||||
const additionalInviteSignature = $derived(additionalInviteEmails.join(','));
|
||||
const selectedCouponCode = $derived(selectedCoupon?.code ?? null);
|
||||
|
||||
async function handleSubmit() {
|
||||
if (isDowngrade) {
|
||||
await downgrade();
|
||||
@@ -375,7 +379,12 @@
|
||||
|
||||
$: isUpgrade = selectedPlan.order > $currentPlan?.order;
|
||||
$: isDowngrade = selectedPlan.order < $currentPlan?.order;
|
||||
$: if (data?.organization?.$id && selectedPlan?.$id) {
|
||||
$: if (
|
||||
data?.organization?.$id &&
|
||||
selectedPlan?.$id &&
|
||||
additionalInviteSignature !== undefined &&
|
||||
selectedCouponCode !== undefined
|
||||
) {
|
||||
loadPlanChangeEstimate();
|
||||
}
|
||||
|
||||
@@ -383,7 +392,7 @@
|
||||
if ($organization?.billingPlanId === selectedPlan.$id) return true;
|
||||
if (isDowngrade && selectedPlan.group === BillingPlanGroup.Starter && data.hasFreeOrgs)
|
||||
return true;
|
||||
if (isDowngrade && selectedPlan.$id !== $organization?.billingPlanId) {
|
||||
if (isDowngrade) {
|
||||
if (isLoadingPlanEstimate) return true;
|
||||
|
||||
const limits = getPlanChangeLimits();
|
||||
@@ -561,7 +570,8 @@
|
||||
bind:couponData={selectedCoupon}
|
||||
bind:billingBudget
|
||||
organizationId={data.organization.$id}
|
||||
estimationOverride={planChangeEstimate} />
|
||||
estimationOverride={planChangeEstimate}
|
||||
preferExternalEstimate />
|
||||
{:else if isSelfService}
|
||||
<PlanComparisonBox downgrade={data.hasFreeOrgs ? false : isDowngrade} />
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user