mirror of
https://git.meshkee.com/Meshkee/backend.git
synced 2026-08-11 22:30:59 +04:30
133 lines
3.2 KiB
TypeScript
133 lines
3.2 KiB
TypeScript
import type { BusinessPrimaryColorId } from './business-primary-colors';
|
|
import { DEFAULT_BUSINESS_PRIMARY_COLOR_ID } from './business-primary-colors';
|
|
|
|
export type DashboardLocale = 'en' | 'fa';
|
|
|
|
export const DEFAULT_BUSINESS_DASHBOARD_LOCALE: DashboardLocale = 'fa';
|
|
|
|
export type BrandingSettings = {
|
|
primaryColor: BusinessPrimaryColorId;
|
|
/** Default UI language for business + customer dashboards. */
|
|
defaultLocale: DashboardLocale;
|
|
};
|
|
|
|
export type DashboardCommentsSettings = {
|
|
autoApprove: boolean;
|
|
};
|
|
|
|
export type DashboardExpertReviewsSettings = {
|
|
autoApprove: boolean;
|
|
};
|
|
|
|
/** Per-business dashboard settings. Add new sections here as the CMS grows. */
|
|
export type DashboardSettings = {
|
|
comments: DashboardCommentsSettings;
|
|
expertReviews: DashboardExpertReviewsSettings;
|
|
};
|
|
|
|
export type OrderProcessStep = {
|
|
id: string;
|
|
label: string;
|
|
labelFa: string;
|
|
color: string;
|
|
};
|
|
|
|
/** Per-business store / sales settings. */
|
|
export type StoreSettings = {
|
|
onlineSellEnabled: boolean;
|
|
orderProcessSteps: OrderProcessStep[];
|
|
};
|
|
|
|
/** Optional CMS modules a business can have. Always-on areas (customers, website, etc.) are not listed. */
|
|
export const BUSINESS_MODULE_IDS = [
|
|
'products',
|
|
'store',
|
|
'portfolio',
|
|
'blog',
|
|
'warehouse',
|
|
'videos',
|
|
] as const;
|
|
|
|
export type BusinessModuleId = (typeof BUSINESS_MODULE_IDS)[number];
|
|
|
|
/** Home dashboard chart types (super-admin selectable). */
|
|
export const HOME_CHART_IDS = [
|
|
'none',
|
|
'orders_30d',
|
|
'customers_joined_1y',
|
|
'blog_views_30d',
|
|
'products_added_1y',
|
|
] as const;
|
|
|
|
export type HomeChartId = (typeof HOME_CHART_IDS)[number];
|
|
|
|
export type ModulesSettings = {
|
|
enabled: BusinessModuleId[];
|
|
/** Two home-page chart slots (left, right). */
|
|
charts: [HomeChartId, HomeChartId];
|
|
};
|
|
|
|
/** Top-level business settings stored in `businesses.settings` JSONB. */
|
|
export type BusinessSettings = {
|
|
branding: BrandingSettings;
|
|
dashboard: DashboardSettings;
|
|
store: StoreSettings;
|
|
modules: ModulesSettings;
|
|
};
|
|
|
|
export const DEFAULT_ORDER_PROCESS_STEPS: OrderProcessStep[] = [
|
|
{
|
|
id: 'processing',
|
|
label: 'Under processing',
|
|
labelFa: 'در حال پردازش',
|
|
color: '#3B82F6',
|
|
},
|
|
{
|
|
id: 'ready-for-shipping',
|
|
label: 'Ready for shipping',
|
|
labelFa: 'آماده ارسال',
|
|
color: '#F59E0B',
|
|
},
|
|
{
|
|
id: 'shipped',
|
|
label: 'Shipped',
|
|
labelFa: 'ارسالشده',
|
|
color: '#8B5CF6',
|
|
},
|
|
{
|
|
id: 'delivered',
|
|
label: 'Delivered',
|
|
labelFa: 'تحویلشده',
|
|
color: '#22C55E',
|
|
},
|
|
];
|
|
|
|
/** Existing tenants without `settings.modules` keep every module enabled. */
|
|
export const DEFAULT_ENABLED_BUSINESS_MODULES: BusinessModuleId[] = [
|
|
...BUSINESS_MODULE_IDS,
|
|
];
|
|
|
|
export const DEFAULT_HOME_CHARTS: [HomeChartId, HomeChartId] = [
|
|
'orders_30d',
|
|
'customers_joined_1y',
|
|
];
|
|
|
|
export const DEFAULT_BUSINESS_SETTINGS: BusinessSettings = {
|
|
branding: {
|
|
primaryColor: DEFAULT_BUSINESS_PRIMARY_COLOR_ID,
|
|
defaultLocale: DEFAULT_BUSINESS_DASHBOARD_LOCALE,
|
|
},
|
|
dashboard: {
|
|
comments: { autoApprove: false },
|
|
expertReviews: { autoApprove: false },
|
|
},
|
|
store: {
|
|
onlineSellEnabled: true,
|
|
orderProcessSteps: DEFAULT_ORDER_PROCESS_STEPS,
|
|
},
|
|
modules: {
|
|
enabled: DEFAULT_ENABLED_BUSINESS_MODULES,
|
|
charts: DEFAULT_HOME_CHARTS,
|
|
},
|
|
};
|