use pricing matrix in existing usePaidStatus funcitons

This commit is contained in:
miloschwartz
2026-02-09 18:17:18 -08:00
parent 1b5cfaa49b
commit a095dddd01
12 changed files with 33 additions and 17 deletions

View File

@@ -1,3 +1,5 @@
import { Tier } from "@server/types/Tiers";
export enum TierFeature {
OrgOidc = "orgOidc",
CustomAuthenticationDomain = "customAuthenticationDomain",
@@ -14,7 +16,7 @@ export enum TierFeature {
PasswordExpirationPolicies = "passwordExpirationPolicies"
}
export const tierMatrix: Record<TierFeature, string[]> = {
export const tierMatrix: Record<TierFeature, Tier[]> = {
[TierFeature.OrgOidc]: ["tier1", "tier2", "tier3", "enterprise"],
[TierFeature.CustomAuthenticationDomain]: [
"tier1",

View File

@@ -1,6 +1,8 @@
import { Tier } from "@server/types/Tiers";
export async function isLicensedOrSubscribed(
orgId: string,
tiers: string[]
tiers: Tier[]
): Promise<boolean> {
return false;
}

View File

@@ -1,6 +1,8 @@
import { Tier } from "@server/types/Tiers";
export async function isSubscribed(
orgId: string,
tiers: string[]
tiers: Tier[]
): Promise<boolean> {
return false;
}

View File

@@ -14,10 +14,11 @@
import { build } from "@server/build";
import license from "#private/license/license";
import { isSubscribed } from "#private/lib/isSubscribed";
import { Tier } from "@server/types/Tiers";
export async function isLicensedOrSubscribed(
orgId: string,
tiers: string[]
tiers: Tier[]
): Promise<boolean> {
if (build === "enterprise") {
return await license.isUnlocked();

View File

@@ -13,10 +13,11 @@
import { build } from "@server/build";
import { getOrgTierData } from "#private/lib/billing";
import { Tier } from "@server/types/Tiers";
export async function isSubscribed(
orgId: string,
tiers: string[]
tiers: Tier[]
): Promise<boolean> {
if (build === "saas") {
const { tier, active } = await getOrgTierData(orgId);

View File

@@ -16,8 +16,9 @@ import createHttpError from "http-errors";
import HttpCode from "@server/types/HttpCode";
import { build } from "@server/build";
import { getOrgTierData } from "#private/lib/billing";
import { Tier } from "@server/types/Tiers";
export function verifyValidSubscription(tiers: string[]) {
export function verifyValidSubscription(tiers: Tier[]) {
return async function (
req: Request,
res: Response,