Goal
Make tenant Theme Editor logic easy to maintain through the SurveyJS 3 upgrade: consume paged GET /themes, talk to the API only via lib/endatix-api, and keep CRUD + Creator dialogs in a dedicated features/themes vertical slice—not nested under forms/.
Parent: endatix-hub#908 (SurveyJS 3.0.2). API envelope: endatix#991. Same Hub paging pattern as form templates (endatix#990).
Implementation Notes
Work is in the Hub branch that also lands SurveyJS 3. Track here so review and release notes stay on the themes refactor, not the whole upgrade.
Paged client (lib/endatix-api/themes/)
list() returns one NormalizedPagedResponse page (items, hasNextPage, totals).
listAll() drains pages for the Theme Editor chooser (no paging UI), bounded max pages.
- Query builder: paging + sort + created/modified filters (
buildListThemesEndpoint).
- Path ids via
validateEndatixId on update/delete.
- Drop
getThemes / parseThemesPayload from services/api.ts. Paged envelope only—no array dual-read.
Server actions
- Map
ApiResult with toResult(...). Chooser uses listAll.
- Keep action names (
getThemesAction, createThemeAction, …) to limit churn.
Vertical slice (features/themes/)
| Slice |
Role |
create-theme / update-theme / delete-theme / list-themes |
CRUD actions |
list-forms-for-theme |
Delete guard |
update-form-theme |
Assign themeId on a form |
manage-theme-editor |
Hook + save/delete dialogs |
- Shared:
types.ts (StoredTheme). Client barrel index.ts (UI/hook only). Actions via server.ts or slice paths—do not re-export "use server" from the client barrel.
- Form editor still hosts Creator; import theme UI from
@/features/themes/manage-theme-editor.
- Hub chrome / SurveyJS tokens stay in
lib/themes/ (not tenant CRUD).
Docs
hub/project-structure.md (Themes table), hub/DESIGN.md, hub/AGENTS.md, ARCHITECTURE.md (dialog paths).
Acceptance Criteria
Goal
Make tenant Theme Editor logic easy to maintain through the SurveyJS 3 upgrade: consume paged
GET /themes, talk to the API only vialib/endatix-api, and keep CRUD + Creator dialogs in a dedicatedfeatures/themesvertical slice—not nested underforms/.Parent: endatix-hub#908 (SurveyJS 3.0.2). API envelope: endatix#991. Same Hub paging pattern as form templates (endatix#990).
Implementation Notes
Work is in the Hub branch that also lands SurveyJS 3. Track here so review and release notes stay on the themes refactor, not the whole upgrade.
Paged client (
lib/endatix-api/themes/)list()returns oneNormalizedPagedResponsepage (items,hasNextPage, totals).listAll()drains pages for the Theme Editor chooser (no paging UI), bounded max pages.buildListThemesEndpoint).validateEndatixIdon update/delete.getThemes/parseThemesPayloadfromservices/api.ts. Paged envelope only—no array dual-read.Server actions
ApiResultwithtoResult(...). Chooser useslistAll.getThemesAction,createThemeAction, …) to limit churn.Vertical slice (
features/themes/)create-theme/update-theme/delete-theme/list-themeslist-forms-for-themeupdate-form-themethemeIdon a formmanage-theme-editortypes.ts(StoredTheme). Client barrelindex.ts(UI/hook only). Actions viaserver.tsor slice paths—do not re-export"use server"from the client barrel.@/features/themes/manage-theme-editor.lib/themes/(not tenant CRUD).Docs
hub/project-structure.md(Themes table),hub/DESIGN.md,hub/AGENTS.md,ARCHITECTURE.md(dialog paths).Acceptance Criteria
GET /themesasPaged.itemsonly (Theme Editor not empty against API after #991).lib/endatix-api/themes/withlistvslistAll; tests cover the query contract.features/themes/{verb-noun}/and returnResultviatoResult.useThemeManagementlive inmanage-theme-editor; form editor imports them.lib/themes/remains Hub product tokens only.