mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-02 08:46:38 +00:00
♻️some refactor
This commit is contained in:
@@ -39,18 +39,15 @@ import {
|
|||||||
resourceWhitelistProxy,
|
resourceWhitelistProxy,
|
||||||
resourceAccessProxy
|
resourceAccessProxy
|
||||||
} from "@app/actions/server";
|
} from "@app/actions/server";
|
||||||
import { createApiClient } from "@app/lib/api";
|
|
||||||
import { useEnvContext } from "@app/hooks/useEnvContext";
|
import { useEnvContext } from "@app/hooks/useEnvContext";
|
||||||
import { toast } from "@app/hooks/useToast";
|
import { toast } from "@app/hooks/useToast";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import Image from "next/image";
|
|
||||||
import BrandingLogo from "@app/components/BrandingLogo";
|
import BrandingLogo from "@app/components/BrandingLogo";
|
||||||
import { useSupporterStatusContext } from "@app/hooks/useSupporterStatusContext";
|
import { useSupporterStatusContext } from "@app/hooks/useSupporterStatusContext";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import { build } from "@server/build";
|
import { build } from "@server/build";
|
||||||
import { useLicenseStatusContext } from "@app/hooks/useLicenseStatusContext";
|
import { useLicenseStatusContext } from "@app/hooks/useLicenseStatusContext";
|
||||||
import { useSubscriptionStatusContext } from "@app/hooks/useSubscriptionStatusContext";
|
import type { GetLoginPageBrandingResponse } from "@server/routers/loginPage/types";
|
||||||
import { usePaidStatus } from "@app/hooks/usePaidStatus";
|
|
||||||
|
|
||||||
const pinSchema = z.object({
|
const pinSchema = z.object({
|
||||||
pin: z
|
pin: z
|
||||||
@@ -90,15 +87,7 @@ type ResourceAuthPortalProps = {
|
|||||||
redirect: string;
|
redirect: string;
|
||||||
idps?: LoginFormIDP[];
|
idps?: LoginFormIDP[];
|
||||||
orgId?: string;
|
orgId?: string;
|
||||||
branding?: {
|
branding?: Omit<GetLoginPageBrandingResponse, "loginPageBrandingId"> | null;
|
||||||
title: string;
|
|
||||||
logoUrl: string;
|
|
||||||
logoWidth: number;
|
|
||||||
logoHeight: number;
|
|
||||||
subtitle: string | null;
|
|
||||||
resourceTitle: string;
|
|
||||||
resourceSubtitle: string | null;
|
|
||||||
} | null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,12 +7,13 @@ export function usePaidStatus() {
|
|||||||
const subscription = useSubscriptionStatusContext();
|
const subscription = useSubscriptionStatusContext();
|
||||||
|
|
||||||
// Check if features are disabled due to licensing/subscription
|
// Check if features are disabled due to licensing/subscription
|
||||||
const isEnterpriseLicensed = build === "enterprise" && isUnlocked();
|
const hasEnterpriseLicense = build === "enterprise" && isUnlocked();
|
||||||
const isSaasSubscribed = build === "saas" && subscription?.isSubscribed();
|
const hasSaasSubscription =
|
||||||
|
build === "saas" && subscription?.isSubscribed();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isEnterpriseLicensed,
|
hasEnterpriseLicense,
|
||||||
isSaasSubscribed,
|
hasSaasSubscription,
|
||||||
isPaidUser: isEnterpriseLicensed || isSaasSubscribed
|
isPaidUser: hasEnterpriseLicense || hasSaasSubscription
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user