- Sanitize form data by trimming whitespace from string inputs
- Implement validation for required fields with user feedback for empty inputs
- Enhance error handling by displaying messages for invalid form fields
- Update API submission to use sanitized data while maintaining hcaptcha token integration
- Delete unused favicon.ico file to clean up project assets
- Add smooth scrolling behavior to html element for improved user experience
- Refactor box-shadow property in Toastify styles for better readability
- Update button states in Contact Us and Inquiries forms to include hcaptchaToken validation
- Implement real-time validation with `isValid` state in Contact Us and Inquiries forms
- Add `trigger` function to validate forms before submission
- Disable submit button based on form validity and loading state
- Improve user experience by preventing submission of invalid forms
- Change required fields in inquiries form to enforce mandatory input
- Enhance API error handler to provide user-friendly messages without exposing raw server text
- Improve test cases for API error handling to ensure accurate message mapping and validation
- Refactor error messages for clarity and consistency across the application
- Add validation rules for form fields with XSS protection
- Create API error handler to parse and manage server validation errors
- Integrate validation rules into contact and inquiries forms
- Enhance error handling with user feedback for form submissions
- Introduce unit tests for validation and error handling functionalities
- Add sanitize.ts utility module with sanitizeText(), sanitizeUrl(), and sanitizeHtml() functions
- Implement server-side HTML entity escaping and client-side DOMPurify sanitization
- Add comprehensive test suite for sanitization functions in lib/__tests__/sanitize.test.ts
- Secure marketing pages by sanitizing all CMS data (hero, features, challenges, advantages, footer)
- Secure inquiries form by sanitizing field labels, placeholders, and button text
- Add SECURITY.md documentation outlining XSS protection measures and best practices
- Add USAGE_EXAMPLES.md with detailed examples of sanitization function usage
- Add XSS_PROTECTION_SUMMARY.md with implementation overview
- Update package.json to include dompurify (^3.3.0) dependency
- Protects against common XSS attack vectors including script injection, event handlers, and malicious URLs
- Convert field property names from PascalCase to snake_case (Name → name, Label → label, Placeholder → placeholder, Required → required)
- Update contactData property access from PascalCase to snake_case (Fields → fields, SubmitButtonText → submit_button_text)
- Update all field references throughout the component to use new snake_case naming convention
- Maintain consistency with standardized CMS data types established in previous refactoring
- Add CmsContact type support to FooterForm, Inquires, and InquiresForm components
- Make form fields dynamic by accepting contactData prop with configurable Fields array
- Add placeholder prop to InputGroup component for enhanced field customization
- Replace hardcoded form fields with dynamic field mapping from CMS data
- Support dynamic form title and description from contactData
- Use CMS-provided submit button text with fallback to default "Submit"
- Implement field-level validation configuration including required field handling
- Auto-detect input type based on field name (email, phone, text)
- Pass contact data from marketing page to FooterForm component
- Maintain backward compatibility with default fields when contactData is not provided
This commit refactors the contact form into a more robust inquiries form, relocating it from `/contact-us` to a new `/inquires` route.
Key changes include:
- Renamed and moved the component from `ContactUs` to `Inquires`.
- Updated form fields: removed "Company Name", added "Message", and renamed "Work Email" and "Phone Number" for clarity.
- Implemented comprehensive client-side validation for all fields using `react-hook-form`.
- Added a loading state to the submit button to provide user feedback during submission.
- The form now automatically resets upon successful submission.
- Introduced new reusable `TextareaGroup` and `Loading` components to support the enhanced form functionality.