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>
95 lines
2.9 KiB
Python
95 lines
2.9 KiB
Python
# app/modules/cart/definition.py
|
|
"""
|
|
Cart module definition.
|
|
|
|
This module provides shopping cart functionality for customer storefronts.
|
|
It is session-based and does not require customer authentication.
|
|
"""
|
|
|
|
from app.modules.base import (
|
|
MenuItemDefinition,
|
|
MenuSectionDefinition,
|
|
ModuleDefinition,
|
|
PermissionDefinition,
|
|
)
|
|
from app.modules.enums import FrontendType
|
|
|
|
# =============================================================================
|
|
# Router Lazy Imports
|
|
# =============================================================================
|
|
|
|
|
|
def _get_storefront_router():
|
|
"""Lazy import of storefront router to avoid circular imports."""
|
|
from app.modules.cart.routes.api.storefront import router
|
|
|
|
return router
|
|
|
|
|
|
# Cart module definition
|
|
cart_module = ModuleDefinition(
|
|
code="cart",
|
|
name="Shopping Cart",
|
|
description="Session-based shopping cart for storefronts",
|
|
version="1.0.0",
|
|
is_self_contained=True,
|
|
requires=["inventory", "catalog"], # Checks inventory availability and references Product model
|
|
migrations_path="migrations",
|
|
features=[
|
|
"cart_management", # Basic cart CRUD operations
|
|
"cart_persistence", # Session and database persistence
|
|
"cart_item_operations", # Add, update, remove items
|
|
"shipping_calculation", # Calculate shipping for cart
|
|
"promotion_application", # Apply discounts and promotions
|
|
],
|
|
# Note: Cart is primarily session-based storefront functionality.
|
|
# These permissions are for admin access to cart data/settings.
|
|
permissions=[
|
|
PermissionDefinition(
|
|
id="cart.view",
|
|
label_key="cart.permissions.view",
|
|
description_key="cart.permissions.view_desc",
|
|
category="cart",
|
|
),
|
|
PermissionDefinition(
|
|
id="cart.manage",
|
|
label_key="cart.permissions.manage",
|
|
description_key="cart.permissions.manage_desc",
|
|
category="cart",
|
|
),
|
|
],
|
|
# Cart is storefront-only - no admin/store menus needed
|
|
menus={
|
|
FrontendType.STOREFRONT: [
|
|
MenuSectionDefinition(
|
|
id="actions",
|
|
label_key=None,
|
|
order=10,
|
|
items=[
|
|
MenuItemDefinition(
|
|
id="cart",
|
|
label_key="cart.storefront.actions.cart",
|
|
icon="shopping-cart",
|
|
route="cart",
|
|
order=20,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
},
|
|
)
|
|
|
|
|
|
def get_cart_module_with_routers() -> ModuleDefinition:
|
|
"""
|
|
Get cart module with routers attached.
|
|
|
|
This function attaches the routers lazily to avoid circular imports
|
|
during module initialization.
|
|
"""
|
|
cart_module.storefront_router = _get_storefront_router()
|
|
return cart_module
|
|
|
|
|
|
__all__ = ["cart_module", "get_cart_module_with_routers"]
|