feat(automations): gate menu and route behind enable_automation

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-24 16:15:52 +03:30
co-authored by Cursor
parent 010e287c70
commit 67652f0cd8
6 changed files with 36 additions and 4 deletions
+15
View File
@@ -46,6 +46,9 @@ export const customerDirectSmsEnabledSetting = ref(false)
/** reactive — منو و UI سفارش شرطی (ادمین + کنترل‌های مشتری) */
export const conditionalOrderEnabledSetting = ref(false)
/** reactive — منوی اتوماسیون در تنظیمات ادمین */
export const automationEnabledSetting = ref(false)
/** reactive — قلک per-product در اپ مشتری */
export const productFundsEnabledSetting = ref(false)
@@ -167,6 +170,10 @@ export function setConditionalOrderEnabledFromSettings(value: boolean): void {
conditionalOrderEnabledSetting.value = value
}
export function setAutomationEnabledFromSettings(value: boolean): void {
automationEnabledSetting.value = value
}
export function setProductFundsEnabledFromSettings(value: boolean): void {
productFundsEnabledSetting.value = value
}
@@ -283,6 +290,13 @@ export function applyConditionalOrderEnabledFromRows(
if (row) setConditionalOrderEnabledFromSettings(isSwitchOn(row.value))
}
export function applyAutomationEnabledFromRows(
rows: Array<{ key?: string; value?: string | null }>
) {
const row = rows.find((item) => item.key === 'enable_automation')
if (row) setAutomationEnabledFromSettings(isSwitchOn(row.value))
}
export function applyProductFundsEnabledFromRows(
rows: Array<{ key?: string; value?: string | null }>
) {
@@ -346,6 +360,7 @@ async function bootstrapSettingsFromApi(): Promise<void> {
applyGroupSmsFromRows(list)
applyCustomerSpecialPricingFromRows(list)
applyConditionalOrderEnabledFromRows(list)
applyAutomationEnabledFromRows(list)
applyProductFundsEnabledFromRows(list)
applyCustomerLevelProfitEnabledFromRows(list)
applyPriceTriggerEnabledFromRows(list)