|
150 | 150 | await goto(previousPage); |
151 | 151 | addNotification({ |
152 | 152 | type: 'success', |
153 | | - isHtml: true, |
154 | | - message: `<b>${$organization.name}</b> plan has been successfully updated.` |
| 153 | + message: `${$organization.name} plan has been successfully updated.` |
155 | 154 | }); |
156 | 155 |
|
157 | 156 | trackEvent(Submit.OrganizationDowngrade, { |
|
264 | 263 |
|
265 | 264 | $: isUpgrade = $plansInfo.get(selectedPlan).order > $currentPlan?.order; |
266 | 265 | $: isDowngrade = $plansInfo.get(selectedPlan).order < $currentPlan?.order; |
267 | | - $: isButtonDisabled = $organization?.billingPlan === selectedPlan; |
| 266 | + $: isButtonDisabled = |
| 267 | + $organization?.billingPlan === selectedPlan || |
| 268 | + (isDowngrade && selectedPlan === BillingPlan.FREE && data.hasFreeOrgs); |
268 | 269 | </script> |
269 | 270 |
|
270 | 271 | <svelte:head> |
|
297 | 298 | selfService={data.selfService} |
298 | 299 | anyOrgFree={data.hasFreeOrgs} /> |
299 | 300 |
|
| 301 | + {#if isDowngrade && selectedPlan === BillingPlan.FREE && data.hasFreeOrgs} |
| 302 | + <Alert.Inline |
| 303 | + status="warning" |
| 304 | + title="You can only have one free organization per account"> |
| 305 | + To downgrade this organization, first migrate or delete one of your |
| 306 | + existing paid organizations. |
| 307 | + <Button |
| 308 | + compact |
| 309 | + href="https://appwrite.io/docs/advanced/migrations/cloud" |
| 310 | + >Migration guide</Button> |
| 311 | + </Alert.Inline> |
| 312 | + {/if} |
| 313 | + |
300 | 314 | {#if isDowngrade} |
301 | | - {#if selectedPlan === BillingPlan.FREE} |
| 315 | + {#if selectedPlan === BillingPlan.FREE && !data.hasFreeOrgs} |
302 | 316 | <PlanExcess tier={BillingPlan.FREE} /> |
303 | 317 | {:else if selectedPlan === BillingPlan.PRO && data.organization.billingPlan === BillingPlan.SCALE && collaborators?.length > 0} |
304 | 318 | {@const extraMembers = collaborators?.length ?? 0} |
|
364 | 378 | id="members" /> |
365 | 379 | </Fieldset> |
366 | 380 | {/if} |
367 | | - {#if isDowngrade && selectedPlan === BillingPlan.FREE} |
| 381 | + {#if isDowngrade && selectedPlan === BillingPlan.FREE && !data.hasFreeOrgs} |
368 | 382 | <Fieldset legend="Feedback"> |
369 | 383 | <Layout.Stack gap="xl"> |
370 | 384 | <InputSelect |
|
395 | 409 | bind:billingBudget |
396 | 410 | organizationId={data.organization.$id} /> |
397 | 411 | {:else if data.organization.billingPlan !== BillingPlan.CUSTOM} |
398 | | - <PlanComparisonBox downgrade={isDowngrade} /> |
| 412 | + <PlanComparisonBox downgrade={data.hasFreeOrgs ? false : isDowngrade} /> |
399 | 413 | {/if} |
400 | 414 | </svelte:fragment> |
401 | 415 | <svelte:fragment slot="footer"> |
|
0 commit comments