# Marketplace Project Editor - Sprint 13 ## Scope Sprint 13 introduces first version of Marketplace Project Editor. Editor only manages bootstrap configuration. Out of scope: - products - categories - orders - analytics management ## Architecture ```text src/app/features/project-editor/ pages/ components/ sections/ models/ services/ facade/ ``` Editor uses strongly typed bootstrap models and isolated feature state. Components do not call APIs directly. ## Facade API `ProjectEditorFacade` exposes: - `loadBootstrap()` - `updateBootstrap()` - `exportBootstrap()` - `importBootstrap()` - `preview()` Current source of truth: - existing bootstrap provider via `ConfigService` Future backend integration: - replace local import/export/save flow with builder endpoints - keep component contracts unchanged ## Supported Sections - General - marketplace name - domain - description - default language - supported languages - Branding - logo - small logo - favicon - marketplace title - Theme - palette tokens via color pickers - Header - logo/search/categories/languages/cart/profile/wishlist/compare/region toggles - Footer - company information - address - phone - email - copyright - payment icons - social links - static pages - Homepage - home page sections list - visibility - order - layout - drag-and-drop ordering - Widgets - homepage widget configuration - typed shortcuts for hero/categories/product collection widgets - JSON fallback for other widget props - Marketplace Features - feature flags - search suggestions/history - recently viewed - reviews/questions/recommendations - Preview - export JSON - import JSON - runtime preview without full browser refresh - Languages (Sprint 16) - add/remove supported locale - set default locale - generically syncs translation keys across static pages and navigation labels (`LocaleSyncService`) - Navigation (Sprint 16) - header navigation: add/remove/reorder/edit label/URL/visibility - flat footer navigation: same actions - grouped footer navigation (column-based) is read-only in this tab for now ## Preview Strategy Preview updates bootstrap snapshot in memory and re-applies: - theme - branding - runtime state - route-based page rendering on next Angular navigation This keeps bootstrap engine intact while enabling fast local preview. ## Widget Configuration Current widget editor supports explicit fields for: - Hero - layout - height - overlay - autoplay - Categories - layout - columns - Product Collection - layout - cards per row - filters - badges - rating - price Other widgets use JSON props fallback until dedicated editors are added. ## Draft / Publish (Sprint 16) There is still no backend draft/publish API. This sprint models it client-side in `ProjectEditorFacade`: - `status: 'draft' | 'published'` and `dirty` (diffed against the last-saved snapshot) live in facade state. - `save()` snapshots the current in-memory bootstrap as "last saved" (no network call yet). - `publish()` runs `ProjectValidator`, and if there are no issues, applies the bootstrap via `PlatformRuntimeService.reloadFromBootstrap` and marks status `published`. **Backend gap, not yet implemented:** real persistence needs `PUT /builder/bootstrap/draft` and `POST /builder/bootstrap/publish` endpoints so drafts/publishes survive a reload and are shared across editors. ## Validation `ProjectValidator` (`services/project-validator.service.ts`) runs on every render of the save bar: missing logo, no languages, invalid marketplace URL, duplicate static-page slugs, empty homepage, a homepage widget with no `type`, duplicate header navigation links, invalid theme colors. Publish is blocked while any issue is present; Save is not. ## Rich HTML editing Static page HTML is edited via `MarketplaceHtmlEditorComponent` (`components/html-editor/`), a `contentEditable` + toolbar component with no external dependency. It emits raw HTML on every change and never sanitizes — sanitization remains a storefront-render concern. ## Constraints - runtime bootstrap engine not replaced - configuration stays source of truth - no hardcoded marketplace values - no business domain management mixed into editor