mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
feat: restrict reauth to EE
This commit is contained in:
@ -1,3 +1,6 @@
|
||||
import { env } from 'next-runtime-env';
|
||||
|
||||
import { IS_BILLING_ENABLED } from '../constants/app';
|
||||
import type { Subscription } from '.prisma/client';
|
||||
import { SubscriptionStatus } from '.prisma/client';
|
||||
|
||||
@ -13,3 +16,15 @@ export const subscriptionsContainsActivePlan = (
|
||||
subscription.status === SubscriptionStatus.ACTIVE && priceIds.includes(subscription.priceId),
|
||||
);
|
||||
};
|
||||
|
||||
export const subscriptionsContainActiveEnterprisePlan = (
|
||||
subscriptions?: Subscription[],
|
||||
): boolean => {
|
||||
const enterprisePlanId = env('NEXT_PUBLIC_STRIPE_ENTERPRISE_PLAN_MONTHLY_PRICE_ID');
|
||||
|
||||
if (!enterprisePlanId || !subscriptions || !IS_BILLING_ENABLED()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return subscriptionsContainsActivePlan(subscriptions, [enterprisePlanId]);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user