feat(loyalty): Phase 4.1 — T&C via CMS integration
Some checks failed
Some checks failed
Add support for linking a loyalty program's Terms & Conditions to a
CMS page, replacing the simple terms_text textarea with a scalable
content source that supports rich HTML, multi-language, and store
overrides.
- Migration loyalty_006: adds terms_cms_page_slug column to
loyalty_programs (nullable, String 200).
- Model + schemas: new field on LoyaltyProgram, ProgramCreate,
ProgramUpdate, ProgramResponse.
- Program form: new "CMS Page Slug" input field with hint text,
placed above the legacy terms_text (now labeled as "fallback").
- Enrollment page: when terms_cms_page_slug is set, JS fetches the
CMS page content via /storefront/cms/pages/{slug} and displays
rendered HTML in the modal. Falls back to terms_text when no slug.
- i18n: 3 new keys in 4 locales (terms_cms_page, terms_cms_page_hint,
terms_fallback_hint).
Legacy terms_text field preserved as fallback for existing programs.
342 tests pass.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -110,7 +110,8 @@ class ProgramCreate(BaseModel):
|
||||
hero_image_url: str | None = Field(None, max_length=500, description="Hero image URL")
|
||||
|
||||
# Terms
|
||||
terms_text: str | None = Field(None, description="Terms and conditions")
|
||||
terms_text: str | None = Field(None, description="Terms and conditions (legacy)")
|
||||
terms_cms_page_slug: str | None = Field(None, max_length=200, description="CMS page slug for T&C")
|
||||
privacy_url: str | None = Field(None, max_length=500, description="Privacy policy URL")
|
||||
|
||||
|
||||
@@ -155,6 +156,7 @@ class ProgramUpdate(BaseModel):
|
||||
|
||||
# Terms
|
||||
terms_text: str | None = None
|
||||
terms_cms_page_slug: str | None = Field(None, max_length=200)
|
||||
privacy_url: str | None = Field(None, max_length=500)
|
||||
|
||||
# Wallet integration
|
||||
@@ -202,6 +204,7 @@ class ProgramResponse(BaseModel):
|
||||
|
||||
# Terms
|
||||
terms_text: str | None = None
|
||||
terms_cms_page_slug: str | None = None
|
||||
privacy_url: str | None = None
|
||||
|
||||
# Wallet
|
||||
|
||||
Reference in New Issue
Block a user