feat: Implement centralized module management system

- Add ModuleRegistry for managing built-in modules (newsletter, wishlist, affiliate, subscription, licensing)
- Add ModulesController REST API for module enable/disable
- Create Modules settings page with category grouping and toggle controls
- Integrate module checks across admin-spa and customer-spa
- Add useModules hook for both SPAs to check module status
- Hide newsletter from footer builder when module disabled
- Hide wishlist features when module disabled (product cards, account menu, wishlist page)
- Protect wishlist API endpoints with module checks
- Auto-update navigation tree when modules toggled
- Clean up obsolete documentation files
- Add comprehensive documentation:
  - MODULE_SYSTEM_IMPLEMENTATION.md
  - MODULE_INTEGRATION_SUMMARY.md
  - ADDON_MODULE_INTEGRATION.md (proposal)
  - ADDON_MODULE_DESIGN_DECISIONS.md (design doc)
  - FEATURE_ROADMAP.md
  - SHIPPING_INTEGRATION.md

Module system provides:
- Centralized enable/disable for all features
- Automatic navigation updates
- Frontend/backend integration
- Foundation for addon-module unification
This commit is contained in:
Dwindi Ramadhana
2025-12-26 19:19:49 +07:00
parent 0b2c8a56d6
commit 07020bc0dd
59 changed files with 3891 additions and 12132 deletions

View File

@@ -1,5 +1,6 @@
import React, { useState } from 'react';
import { toast } from 'sonner';
import { useModules } from '@/hooks/useModules';
interface NewsletterFormProps {
description?: string;
@@ -8,6 +9,12 @@ interface NewsletterFormProps {
export function NewsletterForm({ description }: NewsletterFormProps) {
const [email, setEmail] = useState('');
const [loading, setLoading] = useState(false);
const { isEnabled } = useModules();
// Don't render if newsletter module is disabled
if (!isEnabled('newsletter')) {
return null;
}
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();