feat: add license activation system with feature gates
- License key generator tool at ~/Desktop/LicenseGenerator - Backend validator route (GET /api/license/status, POST /api/license/activate) - Activation page in sidebar with status, key input, and free/premium feature list - useLicense hook for frontend license state - Feature gates: premium eligibility buttons (DDMA, DeltaIns, Tufts, United, CCA) disabled without license - Feature gates: premium claim buttons (CCA, Delta MA, United, Tufts) and all PreAuth buttons disabled without license - Free features always active: MassHealth eligibility/claim, Documents, Payments, Backups, Reports - README: license key generator usage instructions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { apiRequest } from "@/lib/queryClient";
|
||||
|
||||
interface LicenseStatus {
|
||||
activated: boolean;
|
||||
expired: boolean;
|
||||
expiry: string | null;
|
||||
daysLeft: number | null;
|
||||
}
|
||||
|
||||
export function useLicense() {
|
||||
const { data, isLoading } = useQuery<LicenseStatus>({
|
||||
queryKey: ["/api/license/status"],
|
||||
queryFn: async () => {
|
||||
const res = await apiRequest("GET", "/api/license/status");
|
||||
return res.json();
|
||||
},
|
||||
staleTime: 1000 * 60 * 5, // cache for 5 minutes
|
||||
});
|
||||
|
||||
const isLicensed = !isLoading && !!data?.activated && !data?.expired;
|
||||
|
||||
return { isLicensed, isLoading, licenseData: data };
|
||||
}
|
||||
Reference in New Issue
Block a user