@smartsoft001-mobilems/models
v2.100.0
Published
Framework-wide entities, interfaces and enums shared by the other `@smartsoft001-mobilems` packages: CMS config, pages, files, users and content widgets.
Readme
@smartsoft001-mobilems/models
Framework-wide entities, interfaces and enums shared by the other @smartsoft001-mobilems packages:
CMS config, pages, files, users and content widgets.
import { Config, Page, MsFile, ArticleWidgetType } from '@smartsoft001-mobilems/models';Entities
| Export | Purpose |
| ---------------- | ----------------------------------------------------------------- |
| Config | CMS app config (ITheme, menu, feature flags) — IEntity<string> |
| ConfigPageType | Page-type enum used by the config menu |
| ConfigMenuItem | Union of menu-item shapes |
| ITheme | Theme block of Config (colours, fonts, per-area flags) |
| Page | CMS page — IEntity<number>; optional slug, seo: PageSeo \| null, sections: PageSectionRaw[] \| null (raw API shape — normalize before use) |
| PageSlide | Slide of a CMS page |
| MsFile | Multimedia file — IEntity<number> |
| MsFileFromFeature | Enum of file feature sources (image, audio, video, 3d, …) |
Page sections
Dynamic CMS page sections — Page.sections, returned by GET page/<id> / GET page/slug/<slug> and
rendered by PageSectionsComponent (smart-mobilems-page-sections) in
@smartsoft001-mobilems/angular. Shapes follow the real API response
(GET page/slug/test-sekcje, the TEST_SECTIONS fixture of the angular package). Fields the API may
send as null are typed as such. PageSectionRaw is what the API sends and what Page.sections
holds (positions and lists may be missing/null, lists may hold null items);
normalizePageSections turns it into PageSection — the shape variants receive (lists always
arrays without nulls, everything sorted by position, position always a number). Every
PageSection is a valid PageSectionRaw.
| Export | Shape |
| ------------------------------- | --------------------------------------------------------------------------------------- |
| PageSection | type, theme (component key type/theme), position, appearance, content, blocks, cta, grid? (container children only), widget? (banner), children? (grid_container) |
| PageSectionRaw | PageSection as sent by the API: position?, blocks?, cta?, children?, widget.search?/counter? may be missing or null, list items may be null |
| PageSectionBlockRaw / PageSectionCtaRaw / PageSectionSearchWidgetRaw / PageSectionCounterWidgetRaw | API shapes of blocks, CTAs and widgets — position?: number \| null |
| PageSectionWidgetRaw | search?/counter?: lists of raw widgets (or null items), or null |
| PageSectionContent | title?, lead? (HTML), description? (HTML) — already in the requested language |
| PageSectionBlock | position, content, media: PageSectionBlockMedia \| null, target, grid?: PageSectionGrid \| null |
| PageSectionBlockMedia | background: PageSectionMedia \| null, audiovisual?: PageSectionMedia \| null |
| PageSectionGrid | { x, y, w, h } on the CMS 12-column grid (0-based x/y) |
| PageSectionCta | position, target |
| PageSectionAppearance | margin?/padding?: PageSectionSpacing \| null, background: PageSectionBackground \| null |
| PageSectionSpacing | top?, right?, bottom?, left? — each number (CMS scale 0–12) or null |
| PageSectionBackground | color: string \| null, file?: PageSectionFile \| null, type?: 'image' \| 'video' \| string \| null |
| PageSectionMedia | position?, file: PageSectionFile \| null, type: 'image' \| 'video' \| null |
| PageSectionFile | filePath (relative to the multimedia host, or an absolute CDN URL), id?, extension?, altText?, fileName? |
| PageSectionWidget | banner widgets: search: PageSectionSearchWidget[], counter: PageSectionCounterWidget[] |
| PageSectionSearchWidget | position, placeholder: string \| null |
| PageSectionCounterWidget | position, source ('creators' \| 'museum_objects' \| string), value (computed by the API) |
| PageSectionTarget | Union of the targets below, discriminated by targetType; every target has targetLabel? |
| PageSectionLinkTarget | targetType: 'link', url (http(s)://, mailto:, tel:, #anchor or internal path) |
| PageSectionPageTarget | targetType: 'page', page (CMS page id) |
| PageSectionDictionaryTarget | targetType: 'dictionary', dictionaryType: PageSectionDictionaryType, dictionary: number \| null — an entry id (selected record) or null/missing = the whole dictionary (expanded by the angular smart-mobilems-page-sections) |
| PageSectionDictionaryType | 'creator' \| 'department' \| 'tag' \| 'cycle' \| string |
| PageSectionMuseumObjectTarget | targetType: 'museum_object', object (id) |
| PageSectionCardTypeCodeTarget | targetType: 'card_type_code', cardTypeCodes: number[] (any matches) |
| PageSectionModuleTarget | targetType: 'module' — exists in the CMS, fields not sent by the API yet (never clickable) |
| PageSeo | title?, description? — SEO fields of a Page |
User
IUser, IUserInfo, IUserRegister, IUserModify, ILoginResponse — the API-payload shapes.
Name collision.
@smartsoft001-mobilems/angulardeclares its own types under all five of these names, with different shapes (itsIUserInfocarriesuserID/avatar/newsletterAcceptance; this one is{ username?, email, [key: string]: any }). They are not interchangeable — use these for API payloads and the angular ones in UI code, and never mix the two in one type position.
Content / articles
IArticle— the article shape shared by articles, news and thematic publicationsArticleWidget(union),ArticleWidgetType(enum),IArticleWidget(base) and the per-type widgets:IArticleWidgetText,IArticleWidgetImage,IArticleWidgetMedia,IArticleWidgetVideo,IArticleWidgetAudio,IArticleWidgetGalleryImage,IArticleWidgetGalleryArticle,IArticleWidgetGalleryObject- Shared descriptors:
IAuthor,ICreator,IKeyword,ICycle,ICopyrights,MenuItem,ITab
WidgetComponent in @smartsoft001-mobilems/angular maps an
ArticleWidgetType to the component that renders it; a new widget type is an IArticleWidget
extension declared here plus an entry in that component's type map.
