feat(storefront): homepage, module gating, widget protocol, i18n fixes
Some checks failed
Some checks failed
Storefront homepage & module gating:
- CMS owns storefront GET / (slug="home" with 3-tier resolution)
- Catalog loses GET / (keeps /products only)
- Store root redirect (GET / → /store/dashboard or /store/login)
- Route gating: non-core modules return 404 when disabled for platform
- Seed store default homepages per platform
Widget protocol for customer dashboard:
- StorefrontDashboardCard contract in widgets.py
- Widget aggregator get_storefront_dashboard_cards()
- Orders and Loyalty module widget providers
- Dashboard template renders contributed cards (no module names)
Landing template module-agnostic:
- CTAs driven by storefront_nav (not hardcoded module names)
- Header actions check nav item IDs (not enabled_modules)
- Remove hardcoded "Add Product" sidebar button
- Remove all enabled_modules checks from storefront templates
i18n fixes:
- Title placeholder resolution ({{store_name}}) for store default pages
- Storefront nav label_keys prefixed with module code
- Add storefront.account.* keys to 6 modules (en/fr/de/lb)
- Header/footer CMS pages use get_translated_title(current_language)
- Footer labels use i18n keys instead of hardcoded English
Icon cleanup:
- Standardize on map-pin (remove location-marker alias)
- Replace all location-marker references across templates and docs
Docs:
- Storefront builder vision proposal (6 phases)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
20
main.py
20
main.py
@@ -463,10 +463,28 @@ for route_info in store_page_routes:
|
||||
# Customer shop pages - Register at TWO prefixes:
|
||||
# 1. /storefront/* (for prod: subdomain/custom domain, after path rewrite by middleware)
|
||||
# 2. /storefront/{store_code}/* (for dev: path-based, after /platforms/{code}/ strip)
|
||||
#
|
||||
# Non-core module routes get a module-gate dependency injected automatically
|
||||
# so disabled modules return 404 without any hardcoded path map.
|
||||
logger.info("Auto-discovering storefront page routes...")
|
||||
storefront_page_routes = get_storefront_page_routes()
|
||||
logger.info(f" Found {len(storefront_page_routes)} storefront page route modules")
|
||||
|
||||
|
||||
def _storefront_deps_for(route_info):
|
||||
"""Build dependency list for a storefront route — gates non-core modules."""
|
||||
from app.api.deps import make_storefront_module_gate
|
||||
from app.modules.registry import MODULES
|
||||
|
||||
code = route_info.module_code
|
||||
if not code:
|
||||
return []
|
||||
module_def = MODULES.get(code)
|
||||
if module_def and module_def.is_core:
|
||||
return []
|
||||
return [Depends(make_storefront_module_gate(code))]
|
||||
|
||||
|
||||
# Register at /storefront/* (prod mode — middleware rewrites /products → /storefront/products)
|
||||
logger.info(" Registering storefront routes at /storefront/*")
|
||||
for route_info in storefront_page_routes:
|
||||
@@ -477,6 +495,7 @@ for route_info in storefront_page_routes:
|
||||
prefix=prefix,
|
||||
tags=["storefront-pages"],
|
||||
include_in_schema=False,
|
||||
dependencies=_storefront_deps_for(route_info),
|
||||
)
|
||||
|
||||
# Register at /storefront/{store_code}/* (dev mode — /platforms/oms/storefront/WIZATECH/...)
|
||||
@@ -488,6 +507,7 @@ for route_info in storefront_page_routes:
|
||||
prefix=prefix,
|
||||
tags=["storefront-pages"],
|
||||
include_in_schema=False,
|
||||
dependencies=_storefront_deps_for(route_info),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user