#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
import { useLink, type LinkState } from "@processor/contexts/LinkContext";
import type { Tier } from "@processor/contexts/TierContext";
/** Maps the self-hosted link/subscription state onto the portal tier. */
function tierFromLinkState(linkState: LinkState): Tier {
switch (linkState) {
case "linked-subscribed":
return "pro";
case "linked-free":
case "unlinked":
return "free";
}
}
/**
* The plan tier the portal runs on, self-hosted flavor: derived from whether the
* org has linked its SaaS account and carries a live subscription. The SaaS
* build shadows this file to derive the tier from the wallet instead — there is
* no link concept there (see portal-saas/contexts/usePlanTier).
*/
export function usePlanTier(): Tier {
const { linkState } = useLink();
return tierFromLinkState(linkState);
}