1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

feat: only email users billable (#3205)

This commit is contained in:
Jaanus Sellin 2023-02-28 08:50:11 +02:00 committed by GitHub
parent 66c2fa469d
commit dcc02dc229
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,6 +76,8 @@ export const BillingPlan: FC<IBillingPlanProps> = ({ instanceStatus }) => {
const expired = trialHasExpired(instanceStatus);
const { uiConfig } = useUiConfig();
const eligibleUsers = users.filter((user: any) => user.email);
const price = {
[InstancePlan.PRO]: 80,
[InstancePlan.COMPANY]: 0,
@ -86,8 +88,8 @@ export const BillingPlan: FC<IBillingPlanProps> = ({ instanceStatus }) => {
const planPrice = price[instanceStatus.plan];
const seats = instanceStatus.seats ?? 5;
const freeAssigned = Math.min(users.length, seats);
const paidAssigned = users.length - freeAssigned;
const freeAssigned = Math.min(eligibleUsers.length, seats);
const paidAssigned = eligibleUsers.length - freeAssigned;
const paidAssignedPrice = price.user * paidAssigned;
const finalPrice = planPrice + paidAssignedPrice;
const inactive = instanceStatus.state !== InstanceState.ACTIVE;