|
| 1 | +--- |
| 2 | +'@objectstack/spec': minor |
| 3 | +'@objectstack/lint': minor |
| 4 | +'@objectstack/metadata-core': minor |
| 5 | +'@object-ui/core': patch |
| 6 | +--- |
| 7 | + |
| 8 | +feat(spec): `notices` on an action, warnings its dialog draws before submit, in `record:alert`'s vocabulary |
| 9 | + |
| 10 | +Clause-②: yes (widening) |
| 11 | +Metadata-protocol: added |
| 12 | + |
| 13 | +An action that opens a dialog before it runs (a param dialog, or the confirm dialog of `confirmText`) can now declare `notices`: a map from a snake_case notice name to a notice the dialog draws above its description, each while its condition holds. |
| 14 | + |
| 15 | +```yaml |
| 16 | +notices: |
| 17 | + mail_not_delivered: |
| 18 | + severity: warning |
| 19 | + title: No email will be sent |
| 20 | + body: This deployment does not deliver mail. |
| 21 | + visible: features.emailDelivery != true |
| 22 | +``` |
| 23 | +
|
| 24 | +- **`record:alert`'s vocabulary.** A notice takes the record page banner's names: `severity`, `title`, `body`, and `visible` for its condition. `severity` is the banner's own closed set (`info`, `warning`, `error`, `success`), one schema mounted by both: `RecordAlertProps.severity` now mounts it too, with the same values. The banner's `icon`, `action`, `dismissible` and `dismissKey` are refused on a notice, each with a sentence saying why; `label` renames to `title`, as it does in a translation bundle. |
| 25 | +- **Plain text.** `title` and `body` are `I18nLabel`s: a non-blank string or an inline locale map, with no markup, link, button or template. A notice declares at least one of them. An unknown severity, a non-string label, a blank one, or a notice with neither is refused at parse. |
| 26 | +- **Named, so each notice has a stable translation key.** The text is translated at `objects.<object>._actions.<action>.notices.<notice>.title` / `.body` (`globalActions.<action>.notices.<notice>.*` for an action with no object). `translateAction` overlays it leaf by leaf, only for the leaves a declared notice authors. `os validate` reports a translated notice the action does not declare, or a translated leaf the notice does not author (`translation-target-unknown`), and the translation extractor lists each declared leaf. |
| 27 | +- **The action's own condition.** `visible` takes the shape of the action's `visible` and reads the same scope (the record the surface holds, the signed-in user, `features`), with no new root. `os validate` checks it as it checks the action's `visible`. Omitted, the notice is drawn whenever the dialog opens. |
| 28 | +- **Only on a dialog host.** `notices` on an action with neither `confirmText` nor a non-empty `params` is refused at parse: no dialog opens to draw it. |
| 29 | +- **Display only.** Nothing gates on a notice. The action's endpoint, its outcome and its outcome copy are unchanged by it. The served object schema's field mask reads only a notice's `visible`: a notice whose `title` or `body` mentions a field the caller cannot read does not remove the action from what that caller is served, and a notice whose `visible` reads such a field removes the action, as any other condition on it does. |
| 30 | +- `alerts` and `warnings` on an action are refused with a rename to `notices`. |
| 31 | + |
| 32 | +The key is `planned` in the liveness ledger: it parses, translates and is checked, and the console's dialogs do not draw it yet. `@object-ui/core` lists `notices` among the spec's action keys, so the console stops treating it as an unknown key. |
0 commit comments