mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
add: current plan if not one of the base plans.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
import { BASE_BILLING_PLANS, BillingPlan } from '$lib/constants';
|
||||
import { formatCurrency } from '$lib/helpers/numbers';
|
||||
import { plansInfo, type Tier, tierFree, tierPro, tierScale } from '$lib/stores/billing';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
import { currentPlan, organization } from '$lib/stores/organization';
|
||||
import { Badge, Layout, Typography } from '@appwrite.io/pink-svelte';
|
||||
import { LabelCard } from '..';
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
$: freePlan = $plansInfo.get(BillingPlan.FREE);
|
||||
$: proPlan = $plansInfo.get(BillingPlan.PRO);
|
||||
$: scalePlan = $plansInfo.get(BillingPlan.SCALE);
|
||||
|
||||
$: isBasePlan = BASE_BILLING_PLANS.includes($currentPlan?.$id);
|
||||
</script>
|
||||
|
||||
<Layout.Stack>
|
||||
@@ -72,4 +74,25 @@
|
||||
{formatCurrency(scalePlan?.price ?? 0)} per month + usage
|
||||
</Typography.Text>
|
||||
</LabelCard>
|
||||
{#if !isBasePlan}
|
||||
<LabelCard
|
||||
name="plan"
|
||||
bind:group={billingPlan}
|
||||
value={$currentPlan.$id}
|
||||
title={$currentPlan.name}>
|
||||
<svelte:fragment slot="action">
|
||||
{#if $organization?.billingPlan === $currentPlan.$id && !isNewOrg}
|
||||
<Badge variant="secondary" size="xs" content="Current plan" />
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
<Typography.Caption variant="400">
|
||||
{$currentPlan.desc}
|
||||
</Typography.Caption>
|
||||
<Typography.Text>
|
||||
{@const isZeroPrice = ($currentPlan?.price ?? 0) <= 0}
|
||||
{@const price = formatCurrency($currentPlan?.price ?? 0)}
|
||||
{isZeroPrice ? price : `${price} per month + usage`}
|
||||
</Typography.Text>
|
||||
</LabelCard>
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
|
||||
@@ -530,6 +530,8 @@ export enum BillingPlan {
|
||||
ENTERPRISE = 'ent-1'
|
||||
}
|
||||
|
||||
export const BASE_BILLING_PLANS: string[] = [BillingPlan.FREE, BillingPlan.PRO, BillingPlan.SCALE];
|
||||
|
||||
export const feedbackDowngradeOptions = [
|
||||
{
|
||||
value: 'availableFeatures',
|
||||
|
||||
@@ -28,7 +28,12 @@ import { Query } from '@appwrite.io/console';
|
||||
import { derived, get, writable } from 'svelte/store';
|
||||
import { headerAlert } from './headerAlert';
|
||||
import { addNotification, notifications } from './notifications';
|
||||
import { currentPlan, organization, type Organization, type OrganizationError } from './organization';
|
||||
import {
|
||||
currentPlan,
|
||||
organization,
|
||||
type Organization,
|
||||
type OrganizationError
|
||||
} from './organization';
|
||||
import { canSeeBilling } from './roles';
|
||||
import { sdk } from './sdk';
|
||||
import { user } from './user';
|
||||
@@ -270,11 +275,11 @@ export function isServiceLimited(serviceId: PlanServices, plan: Tier, total: num
|
||||
}
|
||||
|
||||
export function checkForEnterpriseTrial(org: Organization) {
|
||||
const remaining = calculateEnterpriseTrial(org);
|
||||
const remaining = calculateEnterpriseTrial(org);
|
||||
console.log('remaining', remaining);
|
||||
if(calculateEnterpriseTrial(org) > 0) {
|
||||
headerAlert.add({
|
||||
id: 'temaEnterprieseTrial',
|
||||
if (calculateEnterpriseTrial(org) > 0) {
|
||||
headerAlert.add({
|
||||
id: 'teamEnterpriseTrial',
|
||||
component: EnterpriseTrial,
|
||||
show: true,
|
||||
importance: 11
|
||||
|
||||
@@ -55,12 +55,7 @@
|
||||
Your enterprise trial expires in {remainingDays} days.
|
||||
</Typography.Text>
|
||||
|
||||
|
||||
<Button
|
||||
secondary
|
||||
fullWidthMobile
|
||||
class="u-line-height-1 u-gap-16"
|
||||
href={upgradeUrl}>
|
||||
<Button secondary fullWidthMobile class="u-line-height-1 u-gap-16" href={upgradeUrl}>
|
||||
Upgrade
|
||||
</Button>
|
||||
</Layout.Stack>
|
||||
|
||||
Reference in New Issue
Block a user