Add business modules column and selectable home charts.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-08-08 10:40:58 +03:30
co-authored by Cursor
parent a48a24e6f2
commit 0a2358b0c2
15 changed files with 788 additions and 137 deletions
@@ -1,5 +1,6 @@
import { apiRequest } from '../lib/api'
import type { BusinessPrimaryColorId } from '../utils/businessPrimaryColors'
import type { BusinessModuleId, HomeChartId } from '../utils/businessModules'
export type DashboardLocale = 'en' | 'fa'
@@ -8,6 +9,11 @@ export interface BrandingSettings {
defaultLocale: DashboardLocale
}
export interface ModulesSettings {
enabled: BusinessModuleId[]
charts: [HomeChartId, HomeChartId]
}
export interface BusinessSettings {
branding: BrandingSettings
dashboard: {
@@ -18,6 +24,7 @@ export interface BusinessSettings {
onlineSellEnabled: boolean
orderProcessSteps: Array<{ id: string; label: string; color: string }>
}
modules: ModulesSettings
}
export interface BusinessSettingsResponse {
@@ -68,3 +75,17 @@ export async function updateBusinessBranding(
body: { branding },
})
}
export async function updateBusinessModules(
businessId: string,
enabled: BusinessModuleId[],
charts: [HomeChartId, HomeChartId],
) {
return apiRequest<BusinessSettingsResponse>(`/businesses/${businessId}/settings`, {
method: 'PATCH',
auth: true,
body: {
modules: { enabled, charts },
},
})
}