feat(automations): gate menu and route behind enable_automation
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user