fix: update addons and types

This commit is contained in:
Arman committed 2023-11-09 17:40:28 +01:00
1 parent 2430a00881
commit 2939a08e5d
9 files changed
+30 -19

No files matched your search

+2 -1
View File
@@ -18,12 +18,13 @@
import { Container, ContainerHeader } from '$lib/layout';
import { hoursToDays, toLocaleDateTime } from '$lib/helpers/date';
import type { Models } from '@appwrite.io/console';
import type { PlanServices } from '$lib/stores/billing';
export let logs: Models.LogList;
export let offset = 0;
export let limit = 0;
export let service: string = null;
export let service: PlanServices = null;
</script>
<Container>
+11 -7
View File
@@ -165,10 +165,12 @@ export type AddressesList = {
};
export type AdditionalResource = {
unit: string;
currency: string;
invoiceDesc: string;
price: number;
unit: string;
value: number;
multiplier?: number;
};
export type Plan = {
@@ -188,12 +190,14 @@ export type Plan = {
executions: number;
realtime: number;
logs: number;
bandwidthAddon: AdditionalResource | null;
storageAddon: AdditionalResource | null;
memberAddon: AdditionalResource | null;
usersAddon: AdditionalResource | null;
executionsAddon: AdditionalResource | null;
realtimeAddon: AdditionalResource | null;
addons: {
bandwidth: AdditionalResource;
executions: AdditionalResource;
member: AdditionalResource;
realtime: AdditionalResource;
storage: AdditionalResource;
users: AdditionalResource;
};
};
export type PlansInfo = {
@@ -60,7 +60,7 @@
You can add unlimited organization members on the {plan.name} plan at no cost.
{:else if $organization?.billingPlan === 'tier-1'}
You can add unlimited organization members on the {plan.name} plan for
<b>${plan.memberAddon.price} each per billing period</b>.
<b>${plan.addons.member.price} each per billing period</b>.
{/if}
</Alert>
{/if}
@@ -3,7 +3,11 @@ import type { Models } from '@appwrite.io/console';
import type { BarSeriesOption } from 'echarts/charts';
import { derived, writable } from 'svelte/store';
export const project = derived(page, ($page) => $page.data.project as Models.Project);
// TODO: remove region type once the SDK is updated
export const project = derived(
page,
($page) => $page.data.project as Models.Project & { region?: string }
);
export const onboarding = derived(
project,
($project) => $project?.platforms?.length === 0 && $project?.keys?.length === 0
@@ -14,8 +14,6 @@
import { plansInfo } from '$lib/stores/billing';
import { createOrganization } from './store';
const plan = $plansInfo.plans.find((p) => p.$id === $createOrganization.billingPlan);
let email: string;
function addCollaborator() {
@@ -30,6 +28,10 @@
(collaborator) => collaborator !== email
);
}
const plan = $plansInfo.plans.find((p) => p.$id === $createOrganization.billingPlan);
$: console.log(plan);
</script>
<WizardStep>
@@ -45,8 +47,8 @@
added will receive an email invite to your organization on completion.
{:else if $createOrganization.billingPlan === 'tier-1'}
You can add unlimited organization members on the {plan.name} plan for
<b>${plan.memberAddon.price} each per month</b>. Each member added will receive an email
invite to your organization on completion.
<b>${plan.addons.member.price} each per month</b>. Each member added will receive an
email invite to your organization on completion.
{/if}
</Alert>
@@ -8,7 +8,7 @@
import { createOrganization } from './store';
const plan = $plansInfo.plans.find((p) => p.$id === $createOrganization.billingPlan);
const collaboratorPrice = plan?.memberAddon?.price ?? 0;
const collaboratorPrice = plan?.addons.member?.price ?? 0;
const collaboratorsNumber = $createOrganization?.collaborators?.length ?? 0;
const totalExpences = plan.price + collaboratorPrice * collaboratorsNumber;
const today = new Date();
@@ -81,7 +81,7 @@
</TableCellText>
{#if !isFree}
<TableCellText title="rate">
${plan.memberAddon.price}/{usage?.unit}
${plan.addons.member.price}/{usage?.unit}
</TableCellText>
{/if}
</TableRow>
@@ -45,8 +45,8 @@
added will receive an email invite to your organization on completion.
{:else if $changeOrganizationTier.billingPlan === 'tier-1'}
You can add unlimited organization members on the {plan.name} plan for
<b>${plan.memberAddon.price} each per month</b>. Each member added will receive an email
invite to your organization on completion.
<b>${plan.addons.member.price} each per month</b>. Each member added will receive an
email invite to your organization on completion.
{/if}
</Alert>
@@ -10,7 +10,7 @@
import { changeOrganizationFinalAction, changeOrganizationTier, isUpgrade } from './store';
const plan = $plansInfo.plans.find((p) => p.$id === $changeOrganizationTier.billingPlan);
const collaboratorPrice = plan?.memberAddon?.price ?? 0;
const collaboratorPrice = plan?.addons.member?.price ?? 0;
const collaboratorsNumber = $changeOrganizationTier?.collaborators?.length ?? 0;
const totalExpences = plan.price + collaboratorPrice * collaboratorsNumber;
const today = new Date();