Configuration Structure
ThesegurosConfig object is located in lib/segurosConfig.ts and defines all available insurance types and their field configurations.
TypeScript Types
The configuration system uses several TypeScript types to ensure type safety:lib/segurosConfig.ts
Field Types Explained
CampoBase - Base Field Properties
CampoBase - Base Field Properties
All field types inherit from
CampoBase which provides:name: Unique identifier for the fieldlabel: Display label shown to usersrequired: Whether the field must be completed
CampoTextual - Text Input Fields
CampoTextual - Text Input Fields
For text-based inputs with types:
text: General text inputemail: Email address with validationtel: Telephone number input
CampoNumber - Numeric Fields
CampoNumber - Numeric Fields
For numeric inputs with optional constraints:
min: Minimum allowed valuemax: Maximum allowed value
CampoSelect - Dropdown Fields
CampoSelect - Dropdown Fields
For selection fields with predefined options:
options: Array of selectable values
Insurance Types
Automotor (Auto Insurance)
lib/segurosConfig.ts
Vida (Life Insurance)
lib/segurosConfig.ts
Hogar (Home Insurance)
lib/segurosConfig.ts
Responsabilidad Civil (Liability Insurance)
lib/segurosConfig.ts
Accidentes Personales (Personal Accident Insurance)
lib/segurosConfig.ts
Incendio (Fire Insurance)
lib/segurosConfig.ts
Otros (Other Insurance)
lib/segurosConfig.ts
Adding New Insurance Types
To add a new insurance type, follow these steps:Add to the form select
Update the select dropdown in
app/components/CotizacionForm.tsx:app/components/CotizacionForm.tsx
Test validation
The validation system will automatically handle your new fields based on their types. See Form Validation for details.
Usage in Components
The configuration is imported and used in the quotation form:app/components/CotizacionForm.tsx
Best Practices
Use Descriptive Labels
Labels should be clear and user-friendly. Use terminology that customers understand.
Set Appropriate Constraints
Use
min and max values for numeric fields to prevent invalid data entry.Mark Required Fields
Only set
required: true for fields that are absolutely necessary for processing quotes.Provide Meaningful Options
For select fields, ensure options cover all common cases or include an “Other” option.