Skip to content

Commit

Permalink
Merge pull request #1627 from appwrite/chore-enable-scale-plan
Browse files Browse the repository at this point in the history
chore: enable scale plan
  • Loading branch information
ArmanNik authored Jan 23, 2025
2 parents dc2927d + f712ec5 commit d7105f7
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 48 deletions.
6 changes: 4 additions & 2 deletions src/lib/components/billing/estimatedTotalBox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@
>{!currentPlan.trialDays
? toLocaleDate(billingPayDate.toString())
: toLocaleDate(trialEndDate.toString())}</span
>. Once your credits run out, you'll be charged
<span class="u-bold">{formatCurrency(currentPlan.price)}</span> plus usage fees every 30 days.
>. {#if couponData?.status === 'active'}Once your credits run out, you'll be charged
<span class="u-bold">{formatCurrency(currentPlan.price)}</span> plus usage fees every 30
days.
{/if}
</p>

<FormList class="u-margin-block-start-24">
Expand Down
8 changes: 4 additions & 4 deletions src/lib/components/billing/planComparisonBox.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { BillingPlan } from '$lib/constants';
import { formatNum } from '$lib/helpers/string';
import { plansInfo, tierFree, tierPro, type Tier } from '$lib/stores/billing';
import { plansInfo, tierFree, tierPro, tierScale, type Tier } from '$lib/stores/billing';
import { Card, SecondaryTabs, SecondaryTabsItem } from '..';
let selectedTab: Tier = BillingPlan.FREE;
Expand All @@ -23,11 +23,11 @@
on:click={() => (selectedTab = BillingPlan.PRO)}>
{tierPro.name}
</SecondaryTabsItem>
<!-- <SecondaryTabsItem
<SecondaryTabsItem
disabled={selectedTab === BillingPlan.SCALE}
on:click={() => (selectedTab = BillingPlan.SCALE)}>
{tierScale.name}
</SecondaryTabsItem> -->
</SecondaryTabsItem>
</SecondaryTabs>
</div>

Expand Down Expand Up @@ -109,7 +109,7 @@
<p class="u-margin-block-start-8">Everything in the Pro plan, plus:</p>
<ul class="un-order-list u-margin-inline-start-4">
<li>Unlimited seats</li>
<li>Organization roles <span class="inline-tag">Coming soon</span></li>
<li>Organization roles</li>
<li>SOC-2, HIPAA compliance</li>
<li>SSO <span class="inline-tag">Coming soon</span></li>
<li>Priority support</li>
Expand Down
46 changes: 20 additions & 26 deletions src/lib/components/billing/planSelection.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -76,31 +76,25 @@
</svelte:fragment>
</LabelCard>
</li>
{#if $organization?.billingPlan === BillingPlan.SCALE}
<li>
<LabelCard
name="plan"
bind:group={billingPlan}
value={BillingPlan.SCALE}
padding={1.5}>
<svelte:fragment slot="custom">
<div class="u-flex u-flex-vertical u-gap-4 u-width-full-line">
<h4 class="body-text-2 u-bold">
{tierScale.name}
{#if $organization?.billingPlan === BillingPlan.SCALE && !isNewOrg}
<span class="inline-tag">Current plan</span>
{/if}
</h4>
<p class="u-color-text-offline u-small">
{tierScale.description}
</p>
<p>
{formatCurrency(scalePlan?.price ?? 0)} per month + usage
</p>
</div>
</svelte:fragment>
</LabelCard>
</li>
{/if}
<li>
<LabelCard name="plan" bind:group={billingPlan} value={BillingPlan.SCALE} padding={1.5}>
<svelte:fragment slot="custom">
<div class="u-flex u-flex-vertical u-gap-4 u-width-full-line">
<h4 class="body-text-2 u-bold">
{tierScale.name}
{#if $organization?.billingPlan === BillingPlan.SCALE && !isNewOrg}
<span class="inline-tag">Current plan</span>
{/if}
</h4>
<p class="u-color-text-offline u-small">
{tierScale.description}
</p>
<p>
{formatCurrency(scalePlan?.price ?? 0)} per month + usage
</p>
</div>
</svelte:fragment>
</LabelCard>
</li>
</ul>
{/if}
15 changes: 13 additions & 2 deletions src/lib/helpers/pricingRedirect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,21 @@ import { base } from '$app/paths';
export function checkPricingRefAndRedirect(searchParams: URLSearchParams, shouldRegister = false) {
if (searchParams.has('type')) {
const paramType = searchParams.get('type');
const hasPlan = searchParams.has('plan');
if (paramType === 'create') {
shouldRegister
? goto(
`${base}/register?type=create${hasPlan ? `&plan=${searchParams.get('plan')}` : ''}`
)
: goto(
`${base}/create-organization?type=create${hasPlan ? `&plan=${searchParams.get('plan')}` : ''}`
);
}
//Legacy
if (paramType === 'createPro') {
shouldRegister
? goto(`${base}/register?type=createPro`)
: goto(`${base}/create-organization?type=createPro`);
? goto(`${base}/register?type=create&plan=tier-1`)
: goto(`${base}/create-organization?type=create&plan=tier-1`);
}
}
}
2 changes: 1 addition & 1 deletion src/lib/layout/containerHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
<Pill button on:click={() => (showDropdown = !showDropdown)}>
<span class="icon-info" />{total}/{limit} created
</Pill>
{:else}
{:else if $organization?.billingPlan !== BillingPlan.SCALE}
<Pill button on:click={() => (showDropdown = !showDropdown)}>
<span class="icon-info" />Limits applied
</Pill>
Expand Down
7 changes: 0 additions & 7 deletions src/routes/(console)/create-organization/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,6 @@
billingPlan = plan as BillingPlan;
}
}
if (
anyOrgFree ||
($page.url.searchParams.has('type') &&
$page.url.searchParams.get('type') === 'createPro')
) {
billingPlan = BillingPlan.PRO;
}
});
async function loadPaymentMethods() {
Expand Down
8 changes: 4 additions & 4 deletions src/routes/(console)/onboarding/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
{
value: BillingPlan.PRO,
label: `${tierToPlan(BillingPlan.PRO).name} - ${formatCurrency($plansInfo.get(BillingPlan.PRO).price)} / month + add-ons`
},
{
value: BillingPlan.SCALE,
label: `${tierToPlan(BillingPlan.SCALE).name} - ${formatCurrency($plansInfo.get(BillingPlan.SCALE).price)}/month + usage`
}
// {
// value: BillingPlan.SCALE,
// label: `${tierToPlan(BillingPlan.SCALE).name} - ${formatCurrency($plansInfo.get(BillingPlan.SCALE).price)}/month + usage`
// }
]
: [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
tier={BillingPlan.FREE}
class="u-margin-block-start-24"
members={data?.members?.total ?? 0} />
{:else if billingPlan === BillingPlan.PRO && $organization.billingPlan === BillingPlan.SCALE}
{:else if billingPlan === BillingPlan.PRO && $organization.billingPlan === BillingPlan.SCALE && collaborators?.length > 0}
{@const extraMembers = collaborators?.length ?? 0}
<Alert type="error" class="u-margin-block-start-24">
<svelte:fragment slot="title">
Expand Down Expand Up @@ -316,7 +316,7 @@
</Button>
{/if}
{/if}
{#if isDowngrade}
{#if isDowngrade && billingPlan === BillingPlan.FREE}
<FormList class="u-margin-block-start-24">
<InputSelect
id="reason"
Expand Down

0 comments on commit d7105f7

Please sign in to comment.