feat: more api and fixes

This commit is contained in:
Arman committed 2023-07-03 19:12:02 +02:00
1 parent 057dce5f8d
commit 2f7b58c123
3 files changed
+48 -8

No files matched your search

+34
View File
@@ -32,6 +32,22 @@ export class Billing {
);
}
async getPlan(organizationId: string): Promise<string> {
const path = `/organizations/${organizationId}/plan`;
const params = {
organizationId
};
const uri = new URL(this.client.config.endpoint + path);
return await this.client.call(
'get',
uri,
{
'content-type': 'application/json'
},
params
);
}
async updatePlan(
organizationId: string,
billingPlan: string,
@@ -232,6 +248,24 @@ export class Billing {
}
}
export const tierFree = {
price: 0,
name: 'Free',
description: 'For personal, passion projects.'
};
export const tierStarter = {
price: 10,
name: 'Starter',
description: 'For small organizations that want flexibility.'
};
export const tierPro = {
price: 20,
name: 'Pro',
description: 'For organizations that need the ability scale easily.'
};
export const apperanceLight = {
variables: {
colorPrimary: '#606a7b',
@@ -23,9 +23,11 @@
async function create() {
try {
const org = await sdk.forConsole.teams.create(
const org = await sdk.forConsole.billing.createOrganization(
$createOrganization.id ?? ID.unique(),
$createOrganization.name
$createOrganization.name,
$createOrganization.tier,
$createOrganization.payment
);
await invalidate(Dependencies.ACCOUNT);
dispatch('created');
+10 -6
View File
@@ -3,6 +3,7 @@
import { Pill } from '$lib/elements';
import { InputText, FormList } from '$lib/elements/forms';
import { WizardStep } from '$lib/layout';
import { tierFree, tierPro, tierStarter } from '$lib/stores/billing';
import { organizationList } from '$lib/stores/organization';
import { createOrganization } from './store';
@@ -53,8 +54,10 @@
<LabelCard name="plan" bind:group={$createOrganization.tier} value="free">
<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">Free - $0/month</h4>
<p class="u-color-text-gray u-small">For personal, passion projects.</p>
<h4 class="body-text-2 u-bold">
{tierFree.name} - ${tierFree.price}/month
</h4>
<p class="u-color-text-gray u-small">{tierFree.description}</p>
</div>
</svelte:fragment>
</LabelCard>
@@ -65,10 +68,10 @@
<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">
Starter - $10/month per organization member
{tierStarter.name} - ${tierStarter.price}/month per organization member
</h4>
<p class="u-color-text-gray u-small">
For small organizations that want flexibility.
{tierStarter.description}
</p>
</div>
<Pill>14 DAY FREE TRIAL</Pill>
@@ -80,10 +83,11 @@
<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">
Pro - $20/month per organization member + exta usage
{tierPro.name} - ${tierPro.price}/month per organization member + exta
usage
</h4>
<p class="u-color-text-gray u-small">
For organizations that need the ability scale easily.
{tierPro.description}
</p>
</div>
<Pill>14 DAY FREE TRIAL</Pill>