@masterteam/system-settings
v0.0.26
Published
`mt-system-settings` loads and updates the host's system settings through the configured `apiBasePath` (default: `settings`).
Readme
@masterteam/system-settings
mt-system-settings loads and updates the host's system settings through the
configured apiBasePath (default: settings).
The retired generic SMTP setting is intentionally not rendered or updated.
Outgoing notification email is managed through the Email Delivery routes below.
mt-system-settings Inputs
| Input | Type | Default | Purpose |
| -------------------- | ------------------------------------ | ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| apiBasePath | string | 'settings' | Base path the settings/timezone HTTP calls are built from. Safe to omit from a route's data even when the host uses withComponentInputBinding() - an unset value resolves to the default, not undefined. |
| backRoute | string \| null | '/control-panel/product-settings' | Route the page's back button navigates to. null hides/no-ops the back navigation. Safe to omit from a route's data even when the host uses withComponentInputBinding() - an unset value resolves to the default, not undefined. |
| formatSchema | SystemSettingsFormatSchema \| null | null | Overrides the built-in date/time format option lists. |
| homeRoute | string \| null | '/control-panel/workspaces' | Breadcrumb "home" crumb's link. null renders that crumb as non-navigable (no routerLink), for hosts whose top-level list route isn't workspaces. Safe to omit from a route's data even when the host uses withComponentInputBinding() - an unset value resolves to the default, not undefined. |
| hideTimeSheet | boolean | false | Hides the Timesheet Policy card only - Global Working Hours always stays visible and required, since it's host-relevant on its own (working days/hours feed scheduling and calendar logic beyond timesheets). While hidden, Timesheet Policy's three fields lose their validators (so they can no longer block Save for the whole page), the cross-field max-hours check is skipped (a visible hoursPerDay must never be blocked by a comparison against a hidden maxDailyHours), and TimeSheetPolicy is excluded from the save diff - even if its hydrated value differs from what's stored. GlobalWorkingHours is unaffected and saves normally. The Timesheet Policy setting is still fetched and hydrated in the background, and toggling hideTimeSheet back to false at runtime restores the card and its validators. |
| exploreViewOptions | ExploreDefaultView[] \| null | null | Restricts which Explore-default-view options the Explore Experience card offers. null preserves pplus5's original two options ('cards', 'timeline') - not the full catalog, since the catalog also contains 'table' (added for splus4) and an unset input must not silently surface it. Pass ids explicitly (e.g. ['cards', 'table']) to opt into anything else. A stored value outside the resolved subset (e.g. legacy 'timeline' data under ['cards', 'table']) resolves to the first allowed option, on both hydration and save - not a hardcoded 'cards', since a host's configured subset may exclude it. |
homeRoute, hideTimeSheet, and exploreViewOptions all default to today's
pplus5 behavior, so a version bump alone does not change pplus5-web's
rendered page.
Email Delivery Control Panel
EMAIL_DELIVERY_ROUTES provides the descriptor-driven Email Delivery page. It
uses the backend HTTP contract directly; the production feature has no mock
adapter or fixture fallback:
{
path: 'email-delivery',
loadChildren: () =>
import('@masterteam/system-settings').then(
(module) => module.EMAIL_DELIVERY_ROUTES,
),
}The default paths are relative to the host application's API base so the host authentication interceptor can attach the correct application origin:
import { provideEmailDelivery } from "@masterteam/system-settings";
provideEmailDelivery({
apiBasePath: "control-panel/email-delivery",
notificationApiBasePath: "Notifications",
currentUserAccessibilitiesApiPath: "identity/users/me/accessibilities",
permissionKeys: ["CONTROL_PANEL"],
});Those are the defaults, so provideEmailDelivery is only needed when a host
must override a base path or its permission assertion. In Pplus they resolve to
/api/control-panel/email-delivery and /api/Notifications after the Admin
application API base is prepended.
The page uses one CONTROL_PANEL access rule, resolved from the signed-in
user's GET /api/identity/users/me/accessibilities response. permissionKeys
declares the required accessibility; it is not treated as proof that the user
has it. The page contains Connections and Activity tabs plus a collapsed
Advanced Support section. Provider fields and actions come from
GET /api/control-panel/email-delivery/providers; the error presentation uses
GET /api/control-panel/email-delivery/error-catalog; secret values, external
secret values, authorization URLs, and evidence exports are never retained in
browser storage.
The package also exports EmailUserTestDialog and
collectEmailTemplatePlaceholders for the saved email editors in
@masterteam/notification and @masterteam/alert. The dialog sends to 1–10
ad-hoc test addresses and renders one value field per saved {{placeholder}}.
Editors pass buildEmailTemplatePlaceholderFields(...) the property catalog
and active language so the dialog shows localized property labels while still
posting the original placeholder keys in metadata. A saved _en or _ar
placeholder can use the matching base property's translated label when the
catalog exposes only the base key. Unknown custom keys fall back to the key
instead of being dropped. The dialog retains one
caller-generated testRequestId; a timeout or bare 202 starts a read-only
status lookup with that same ID and never automatically repeats the POST.
Implementation and source-contract paths are indexed in
../../../.github/instructions/email-delivery/Email-Delivery-Frontend-Implementation-Guide.md.
General Settings Layout
The responsive general-settings grid contains three cards:
- Date, Time & Weekend for date/time formats and weekend days. The stored timezone region is preserved but is not editable from this card.
- Currency for the default currency and display format.
- Explore Experience for the default Explore view:
'cards','timeline', or'table'. TheexploreViewOptionsinput (see Inputs above) restricts which of these are offered; the card always renders only the currently allowed subset.
Host Cache Contract
After a successful getsystemsettings response, and again after a successful
updatesystemsettings request, the component stores the complete canonical
SystemSetting[] array in:
localStorage['systemSettings.settings']Consumers must resolve settings by their key; array position is not an
identity. The Currency value keeps the backend contract unchanged:
{
key: 'Currency',
label: 'Currency',
description: 'Currency',
value: {
name: 'SAR',
unit: { en: 'SAR', ar: 'ريال سعودي' },
format: '{0:#,0.00}',
},
}The cache is written only after the backend request succeeds. Unavailable or blocked browser storage does not convert a successful API operation into a UI error.
