refactor front end hooks

This commit is contained in:
miloschwartz
2026-02-09 20:50:36 -08:00
committed by Owen
parent f991fd9c71
commit 911b5e6814
27 changed files with 82 additions and 183 deletions

View File

@@ -10,22 +10,23 @@ export function usePaidStatus() {
// Check if features are disabled due to licensing/subscription
const hasEnterpriseLicense = build === "enterprise" && isUnlocked();
const tierData = subscription?.getTier();
const hasSaasSubscription = build === "saas" && tierData?.active;
function hasSaasSubscription(tiers: Tier[]): boolean {
return (
(build === "saas" &&
tierData?.active &&
tierData?.tier &&
tiers.includes(tierData.tier)) ||
false
);
}
function isPaidUser(tiers: Tier[]): boolean {
if (hasEnterpriseLicense) {
return true;
}
if (
hasSaasSubscription &&
tierData?.tier &&
tiers.includes(tierData.tier)
) {
return true;
}
return false;
return hasSaasSubscription(tiers);
}
return {