Fix missing limits data for non-standard tiers

This commit is contained in:
ernstmul
2024-11-20 15:09:44 +01:00
parent f2bd3cbef8
commit 8a69bf00a0
3 changed files with 18 additions and 45 deletions
+4 -2
View File
@@ -130,12 +130,14 @@ export type PlanServices =
| 'usersAddon'
| 'webhooks';
export function getServiceLimit(serviceId: PlanServices, tier: Tier = null): number {
export function getServiceLimit(serviceId: PlanServices, tier: Tier = null, plan?: Plan): number {
if (!isCloud) return 0;
if (!serviceId) return 0;
const info = get(plansInfo);
if (!info) return 0;
const plan = info.get(tier ?? get(organization)?.billingPlan);
if (!plan) {
plan = info.get(tier ?? get(organization)?.billingPlan);
}
return plan?.[serviceId];
}