fix: loyalty storefront and store card detail — enrollment, context, and Alpine.js
Some checks failed
Some checks failed
- Fix storefront enabled_modules always empty (page_context overwrote computed
set with empty default via extra_context)
- Fix storefront loyalty JS using store's data() instead of shopLayoutData()
- Remove defer from storefront loyalty scripts to prevent Alpine race condition
- Fix enrollment field name mismatch (customer_email → email) in both store
and storefront JS
- Add self-enrollment customer creation (resolve_customer_id with
create_if_missing) including hashed_password and customer_number
- Fix card list showing "Unknown" — add customer_name/email to CardResponse
- Add GET /cards/{card_id} detail endpoint for store card detail page
- Fix enroll-success.html using data() instead of shopLayoutData()
- Fix enrollment redirect reading response.card_number instead of
response.card.card_number
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -359,14 +359,12 @@ def get_storefront_context(
|
||||
"clean_path": clean_path,
|
||||
"access_method": access_method,
|
||||
"base_url": base_url,
|
||||
"enabled_modules": set(),
|
||||
"storefront_nav": {},
|
||||
"subscription": subscription,
|
||||
"subscription_tier": subscription_tier,
|
||||
"tier_code": subscription_tier.code if subscription_tier else None,
|
||||
}
|
||||
|
||||
# If no db session, return just the base context
|
||||
# If no db session, return just the base context with safe defaults
|
||||
if db is None:
|
||||
context = _build_base_context(
|
||||
request,
|
||||
@@ -374,10 +372,13 @@ def get_storefront_context(
|
||||
getattr(request.state, "language", "en"),
|
||||
)
|
||||
context.update(storefront_base)
|
||||
context["enabled_modules"] = set()
|
||||
context["storefront_nav"] = {}
|
||||
context.update(extra_context)
|
||||
return context
|
||||
|
||||
# Full context with module contributions
|
||||
# (get_context_for_frontend computes enabled_modules and storefront_nav)
|
||||
return get_context_for_frontend(
|
||||
FrontendType.STOREFRONT,
|
||||
request,
|
||||
|
||||
Reference in New Issue
Block a user