35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
import type { IconName } from './icons';
|
|
/** Modules complémentaires : définitions envoyées par l'API (backend/src/modules/catalog.ts). */
|
|
export type Value = string | number | boolean;
|
|
|
|
export type FieldDef =
|
|
| { key: string; type: 'boolean'; label: string; help?: string; default: boolean }
|
|
| { key: string; type: 'int' | 'hour'; label: string; help?: string; default: number; min: number; max: number; unit?: string }
|
|
| { key: string; type: 'text' | 'textarea' | 'url'; label: string; help?: string; default: string; maxLength: number; variables?: string[] };
|
|
|
|
export interface ModuleInfo {
|
|
id: string;
|
|
name: string;
|
|
tagline: string;
|
|
description: string;
|
|
fields: FieldDef[];
|
|
inPlan: boolean;
|
|
override: boolean | null;
|
|
available: boolean;
|
|
config: Record<string, Value> & { enabled: boolean };
|
|
stats?: Record<string, number | string | null> | null;
|
|
}
|
|
|
|
/** Pictogramme et teinte de chaque module (liste et en-tête des réglages). */
|
|
export const MODULE_ICON: Record<string, IconName> = {
|
|
campaigns: 'megaphone',
|
|
reminders: 'clock',
|
|
birthday: 'cake',
|
|
reviews: 'star',
|
|
referral: 'userPlus',
|
|
stats: 'chart',
|
|
whiteLabel: 'tag',
|
|
};
|
|
|
|
/** Champs regroupés par section sur l'écran de réglages. */
|
|
export const isMessageField = (f: FieldDef) => f.type === 'text' || f.type === 'textarea';
|