feat(subscription): gate insurance pages behind "insurance" plan feature

Wrap InsurancePricingPage and ClaimsPage in <FeatureGate feature="insurance">
so direct-URL access is blocked without an active subscription that enables
the feature. Add feature: "insurance" to the sidebar links (doctor/clinic/
secretary sections) so the menu items hide when the plan lacks it.

Make AdminSubscriptionPage feature controls dynamic: derive the plan feature
checkboxes from FEATURE_LABELS (now including "insurance") and switch the Zod
schema to z.record, so adding a feature only touches the label map.

No backend/migration change: plan.features is free-form JSON; existing plans
default to insurance:false and admins enable it per plan.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
hamed
2026-06-24 03:21:52 +03:30
co-authored by Claude Opus 4.8
parent fc87e4a04e
commit 15e7d92fc1
5 changed files with 181 additions and 16 deletions
+11 -8
View File
@@ -1,16 +1,19 @@
import PageHeader from '../components/ui/PageHeader';
import TenantInsuranceContracts from '../components/TenantInsuranceContracts';
import FreeVisitPrice from '../components/FreeVisitPrice';
import FeatureGate from '../components/ui/FeatureGate';
export default function InsurancePricingPage() {
return (
<div className="fade-in">
<PageHeader
title="بیمه و قیمت‌گذاری"
description="قیمت ویزیت آزاد و قراردادهای بیمه (پایه و تکمیلی)"
/>
<FreeVisitPrice />
<TenantInsuranceContracts />
</div>
<FeatureGate feature="insurance">
<div className="fade-in">
<PageHeader
title="بیمه و قیمت‌گذاری"
description="قیمت ویزیت آزاد و قراردادهای بیمه (پایه و تکمیلی)"
/>
<FreeVisitPrice />
<TenantInsuranceContracts />
</div>
</FeatureGate>
);
}