Retrieve plan info by detail call

This commit is contained in:
ernstmul committed 2024-12-09 10:21:32 +01:00
1 parent d528b71b42
commit 70dfdd8697
3 files changed
+19 -5

No files matched your search

@@ -87,6 +87,9 @@
import { readOnly } from '$lib/stores/billing';
import { GRACE_PERIOD_OVERRIDE } from '$lib/system';
import { isValueOfStringEnum } from '$lib/helpers/types';
import type { PageData } from './$types';
export let data: PageData;
let showDelete = false;
@@ -397,7 +400,7 @@
</CardGrid>
</Form>
<UpdateMaxFileSize />
<UpdateMaxFileSize currentPlan={data.currentPlan} />
<Form onSubmit={updateAllowedExtensions}>
<CardGrid hideOverflow>
@@ -0,0 +1,10 @@
import type { PageLoad } from './$types';
import { sdk } from '$lib/stores/sdk';
export const load: PageLoad = async ({ parent }) => {
const { organization } = await parent();
const currentPlan = await sdk.forConsole.billing.getPlan(organization.$id);
return {
currentPlan
};
};
@@ -5,13 +5,15 @@
import { Button, Form, FormItem, InputNumber, InputSelect } from '$lib/elements/forms';
import { humanFileSize, sizeToBytes } from '$lib/helpers/sizeConvertion';
import { createByteUnitPair } from '$lib/helpers/unit';
import { getServiceLimit, readOnly, tierToPlan, upgradeURL } from '$lib/stores/billing';
import { readOnly, upgradeURL } from '$lib/stores/billing';
import { organization } from '$lib/stores/organization';
import { GRACE_PERIOD_OVERRIDE, isCloud } from '$lib/system';
import { bucket } from '../store';
import { updateBucket } from './+page.svelte';
import type { Plan } from '$lib/sdk/billing';
export let currentPlan: Plan;
const service = getServiceLimit('fileSize');
const service = currentPlan['fileSize'];
const { value, unit, baseValue, units } = createByteUnitPair($bucket.maximumFileSize, 1000);
const options = units.map((v) => ({ label: v.name, value: v.name }));
@@ -35,10 +37,9 @@
<svelte:fragment slot="aside">
{#if isCloud}
{@const size = humanFileSize(sizeToBytes(service, 'MB', 1000))}
{@const plan = tierToPlan($organization?.billingPlan)}
<Alert type="info">
<p class="text">
The {plan.name} plan has a maximum upload file size limit of {Math.floor(
The {currentPlan.name} plan has a maximum upload file size limit of {Math.floor(
parseInt(size.value)
)}{size.unit}.
{#if $organization?.billingPlan === BillingPlan.FREE}