diff --git a/server/private/middlewares/verifySubscription.ts b/server/private/middlewares/verifySubscription.ts index 9673f8f5..8a8f8e3b 100644 --- a/server/private/middlewares/verifySubscription.ts +++ b/server/private/middlewares/verifySubscription.ts @@ -45,7 +45,7 @@ export function verifyValidSubscription(tiers: Tier[]) { } const { tier, active } = await getOrgTierData(orgId); - const isTier = tiers.includes(tier || ""); + const isTier = tiers.includes(tier as Tier); if (!active) { return next( createHttpError( diff --git a/server/private/routers/billing/hooks/handleSubscriptionUpdated.ts b/server/private/routers/billing/hooks/handleSubscriptionUpdated.ts index 83472ac0..9b36b55e 100644 --- a/server/private/routers/billing/hooks/handleSubscriptionUpdated.ts +++ b/server/private/routers/billing/hooks/handleSubscriptionUpdated.ts @@ -90,7 +90,7 @@ export async function handleSubscriptionUpdated( const itemsToUpsert = fullSubscription.items.data.map((item) => { // Try to get featureId from price let featureId: string | null = getFeatureIdByPriceId(item.price.id) || null; - + // If no match, try to preserve existing featureId if (!featureId) { const existingItem = existingItems.find( diff --git a/src/app/[orgId]/settings/(private)/billing/page.tsx b/src/app/[orgId]/settings/(private)/billing/page.tsx index 134ec204..458a9269 100644 --- a/src/app/[orgId]/settings/(private)/billing/page.tsx +++ b/src/app/[orgId]/settings/(private)/billing/page.tsx @@ -37,10 +37,6 @@ import { cn } from "@app/lib/cn"; import { CreditCard, ExternalLink, - Users, - Globe, - Server, - Layout, Check } from "lucide-react"; import { @@ -50,7 +46,6 @@ import { import { useTranslations } from "use-intl"; import Link from "next/link"; import { Tier } from "@server/types/Tiers"; -import { w } from "@faker-js/faker/dist/airline-DF6RqYmq"; // Plan tier definitions matching the mockup type PlanId = "free" | "homelab" | "team" | "business" | "enterprise"; @@ -63,35 +58,6 @@ interface PlanOption { tierType: Tier | null; } -// Tier limits for display in confirmation dialog -interface TierLimits { - sites: number; - users: number; - domains: number; - remoteNodes: number; -} - -const tierLimits: Record = { - tier1: { - sites: 3, - users: 3, - domains: 3, - remoteNodes: 1 - }, - tier2: { - sites: 10, - users: 150, - domains: 250, - remoteNodes: 5 - }, - tier3: { - sites: 10, - users: 150, - domains: 250, - remoteNodes: 5 - } -}; - const planOptions: PlanOption[] = [ { id: "free", diff --git a/src/app/[orgId]/settings/clients/user/[niceId]/general/page.tsx b/src/app/[orgId]/settings/clients/user/[niceId]/general/page.tsx index e5b9de66..d39b5c5b 100644 --- a/src/app/[orgId]/settings/clients/user/[niceId]/general/page.tsx +++ b/src/app/[orgId]/settings/clients/user/[niceId]/general/page.tsx @@ -616,7 +616,7 @@ export default function GeneralPage() { {t("diskEncrypted")} - {isPaidUser + {isPaidUser(tierMatrix.devicePosture) ? formatPostureValue( client.posture .diskEncrypted @@ -634,7 +634,7 @@ export default function GeneralPage() { {t("firewallEnabled")} - {isPaidUser + {isPaidUser(tierMatrix.devicePosture) ? formatPostureValue( client.posture .firewallEnabled @@ -653,7 +653,7 @@ export default function GeneralPage() { {t("autoUpdatesEnabled")} - {isPaidUser + {isPaidUser(tierMatrix.devicePosture) ? formatPostureValue( client.posture .autoUpdatesEnabled @@ -671,7 +671,7 @@ export default function GeneralPage() { {t("tpmAvailable")} - {isPaidUser + {isPaidUser(tierMatrix.devicePosture) ? formatPostureValue( client.posture .tpmAvailable @@ -693,7 +693,7 @@ export default function GeneralPage() { )} - {isPaidUser + {isPaidUser(tierMatrix.devicePosture) ? formatPostureValue( client.posture .windowsAntivirusEnabled @@ -711,7 +711,7 @@ export default function GeneralPage() { {t("macosSipEnabled")} - {isPaidUser + {isPaidUser(tierMatrix.devicePosture) ? formatPostureValue( client.posture .macosSipEnabled @@ -733,7 +733,7 @@ export default function GeneralPage() { )} - {isPaidUser + {isPaidUser(tierMatrix.devicePosture) ? formatPostureValue( client.posture .macosGatekeeperEnabled @@ -755,7 +755,7 @@ export default function GeneralPage() { )} - {isPaidUser + {isPaidUser(tierMatrix.devicePosture) ? formatPostureValue( client.posture .macosFirewallStealthMode @@ -774,7 +774,7 @@ export default function GeneralPage() { {t("linuxAppArmorEnabled")} - {isPaidUser + {isPaidUser(tierMatrix.devicePosture) ? formatPostureValue( client.posture .linuxAppArmorEnabled @@ -793,7 +793,7 @@ export default function GeneralPage() { {t("linuxSELinuxEnabled")} - {isPaidUser + {isPaidUser(tierMatrix.devicePosture) ? formatPostureValue( client.posture .linuxSELinuxEnabled