feat(user): gate menus by SuperAdmin flags and show physical delivery

Hide fund/earn/gift entries when access is off, add matching route guards, and surface physical delivery instead of price alert on mobile profile.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-25 14:19:26 +03:30
co-authored by Cursor
parent 2238a34c53
commit 16ade71598
8 changed files with 112 additions and 61 deletions
+37
View File
@@ -0,0 +1,37 @@
/**
* نگاشت منو/مسیر اپ کاربر → کلید دسترسی سوپرادمین.
* مقدار false/غایب = مخفی (پیش‌فرض امن).
*/
export const ROUTE_FEATURE_SETTING: Record<string, string> = {
fund: 'enable_product_funds',
fund_info: 'enable_product_funds',
fund_add: 'enable_product_funds',
piggy: 'enable_product_funds',
earnMoney: 'has_page_earn_money',
giftCard: 'has_page_gift_card',
notifyTrigger: 'has_page_price_trigger',
appNotifications: 'has_page_notification',
conditionalOrder: 'enable_conditional_order',
permissions: 'permision__enabled',
}
export const MENU_ID_FEATURE_SETTING: Record<string, string> = {
fund: 'enable_product_funds',
piggy: 'enable_product_funds',
earnMoney: 'has_page_earn_money',
giftCard: 'has_page_gift_card',
notify: 'has_page_price_trigger',
notifyTrigger: 'has_page_price_trigger',
conditionalOrder: 'enable_conditional_order',
permissions: 'permision__enabled',
}
export function featureSettingForRoute(routeName: string | null | undefined): string | null {
if (!routeName) return null
return ROUTE_FEATURE_SETTING[String(routeName)] ?? null
}
export function featureSettingForMenuId(id: string | null | undefined): string | null {
if (!id) return null
return MENU_ID_FEATURE_SETTING[String(id)] ?? null
}