diff --git a/src/app/[orgId]/settings/general/page.tsx b/src/app/[orgId]/settings/general/page.tsx
index 84f876d0..7928dc47 100644
--- a/src/app/[orgId]/settings/general/page.tsx
+++ b/src/app/[orgId]/settings/general/page.tsx
@@ -49,9 +49,10 @@ import { useUserContext } from "@app/hooks/useUserContext";
import { useTranslations } from "next-intl";
import { build } from "@server/build";
import { SwitchInput } from "@app/components/SwitchInput";
-import { SecurityFeaturesAlert } from "@app/components/SecurityFeaturesAlert";
+import { PaidFeaturesAlert } from "@app/components/PaidFeaturesAlert";
import { useLicenseStatusContext } from "@app/hooks/useLicenseStatusContext";
import { useSubscriptionStatusContext } from "@app/hooks/useSubscriptionStatusContext";
+import { usePaidStatus } from "@app/hooks/usePaidStatus";
// Session length options in hours
const SESSION_LENGTH_OPTIONS = [
@@ -113,16 +114,7 @@ export default function GeneralPage() {
const { user } = useUserContext();
const t = useTranslations();
const { env } = useEnvContext();
- const { isUnlocked } = useLicenseStatusContext();
- const subscription = useSubscriptionStatusContext();
-
- // Check if security features are disabled due to licensing/subscription
- const isSecurityFeatureDisabled = () => {
- const isEnterpriseNotLicensed = build === "enterprise" && !isUnlocked();
- const isSaasNotSubscribed =
- build === "saas" && !subscription?.isSubscribed();
- return isEnterpriseNotLicensed || isSaasNotSubscribed;
- };
+ const { isPaidUser, hasSaasSubscription } = usePaidStatus();
const [loadingDelete, setLoadingDelete] = useState(false);
const [loadingSave, setLoadingSave] = useState(false);
@@ -398,9 +390,7 @@ export default function GeneralPage() {
{LOG_RETENTION_OPTIONS.filter(
(option) => {
if (
- build ==
- "saas" &&
- !subscription?.subscribed &&
+ hasSaasSubscription &&
option.value >
30
) {
@@ -428,19 +418,15 @@ export default function GeneralPage() {
)}
/>
- {build != "oss" && (
+ {build !== "oss" && (
<>
-
+
{
- const isDisabled =
- (build == "saas" &&
- !subscription?.subscribed) ||
- (build == "enterprise" &&
- !isUnlocked());
+ const isDisabled = !isPaidUser;
return (
@@ -506,11 +492,7 @@ export default function GeneralPage() {
control={form.control}
name="settingsLogRetentionDaysAction"
render={({ field }) => {
- const isDisabled =
- (build == "saas" &&
- !subscription?.subscribed) ||
- (build == "enterprise" &&
- !isUnlocked());
+ const isDisabled = !isPaidUser;
return (
@@ -590,13 +572,12 @@ export default function GeneralPage() {
-
+
{
- const isDisabled =
- isSecurityFeatureDisabled();
+ const isDisabled = !isPaidUser;
return (
@@ -643,8 +624,7 @@ export default function GeneralPage() {
control={form.control}
name="maxSessionLengthHours"
render={({ field }) => {
- const isDisabled =
- isSecurityFeatureDisabled();
+ const isDisabled = !isPaidUser;
return (
@@ -730,8 +710,7 @@ export default function GeneralPage() {
control={form.control}
name="passwordExpiryDays"
render={({ field }) => {
- const isDisabled =
- isSecurityFeatureDisabled();
+ const isDisabled = !isPaidUser;
return (