Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .changeset/39045-invite-mail-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
'@objectstack/spec': patch
'@objectstack/platform-objects': patch
'@object-ui/core': patch
'@object-ui/types': patch
'@object-ui/i18n': patch
'@object-ui/react': patch
'@object-ui/components': patch
'@object-ui/app-shell': patch
---

feat(console): an action's confirm and param dialogs draw its declared `notices`; the invite dialogs warn before submit when this server delivers no mail

Clause-②: yes (widening)
Metadata-protocol: none

- **The console draws `notices`.** The dialog an action opens before it runs (the confirm dialog of a param-less action with `confirmText`, or the param dialog of an action with `params`; an action with both draws them in the param dialog only) shows each declared notice between its title and its description, while the notice's `visible` holds against the record the action runs against, the signed-in user and `features`. `severity` picks the tone and the icon (`info` when omitted). `title` and `body` read the translation bundle at `objects.<object>._actions.<action>.notices.<notice>.*` first, then the authored text. A condition that cannot be evaluated draws nothing and is reported once in the browser console, naming the action and the notice. The four action renderers forward the key to the runner.
- **Invite User and Resend Invitation warn first.** The four `invite_user` actions (`sys_user`, `sys_member`, `sys_invitation`, `sys_organization`) and `sys_invitation.resend_invitation` declare `mail_not_delivered`, a warning drawn while the server reports `features.emailDelivery` not true: no email will go out, who can still accept (an invitee whose social or SSO sign-in verifies the address), and that a platform administrator creates the account for anyone else. The invitation is still created, and the toast after it still reports the `link_only` outcome. Translated in all ten shipped locales.
- **The feature registry books notice reads.** `PublicAuthFeatureEntry` gains optional `noticePaths` (`<object>.actions.<action>.notices.<name>`) for notices whose condition reads a flag; a notice gates nothing, so it is booked apart from `gatedInputs`. `emailDelivery` books the five invite notices. The platform-objects guard checks both directions: every booked path is a declared notice reading the flag, and every `features.*` read in a notice condition is booked.
8 changes: 4 additions & 4 deletions content/docs/protocol/objectui/actions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,6 @@ cancelText: Keep invitation

### Warning before submit: `notices`

> **Planned.** The key parses, translates and is checked at build time, but the console's dialogs do not draw it yet. An author who writes it today sees no notice in the dialog.

Some actions need to tell the user something before they click, and only when a condition holds: no mail is delivered on this deployment, so the invitation will not reach anyone by email; this quote is past its expiry. `description` says the same thing every time. `notices` says it when it applies.

```yaml
Expand All @@ -585,15 +583,17 @@ notices:
severity: warning
title: No email will be sent
body: This deployment does not deliver mail. Only an invitee who signs in with a social or SSO account that verifies the address can accept.
visible: features.emailDelivery != true
visible: has(features.emailDelivery) && features.emailDelivery != true
```

- **`record:alert`'s vocabulary.** Each notice takes the record page banner's field names: `severity` (`info`, `warning`, `error` or `success`, the same closed set; omitted, the console draws `info`), `title`, `body`, and `visible` for its condition. The banner's `icon`, `action`, `dismissible` and `dismissKey` are not declared here, and each is refused with a sentence that says why.
- **Plain text.** `title` and `body` are `I18nLabel`s: a plain string or an inline locale map, never blank, with no markup, link, button or `${…}` template. A notice declares at least one of the two.
- **Named, so each has a stable translation key.** The map key is a snake_case notice name, and the text is translated at `objects.<object>._actions.<action>.notices.<notice>.title` and `.body` (`globalActions.<action>.notices.<notice>.*` for an action with no `objectName`). A translation keyed to a notice the action does not declare is reported by `os validate` (`translation-target-unknown`). Several notices are drawn in the order they are declared.
- **The condition is the action's own.** `visible` takes the shape of the action's `visible` (a boolean, a CEL string or a `{ dialect, source }` envelope) and reads the same scope: the record the surface holds, the signed-in user and `features`. It does not see the values typed into the dialog. Omit it to draw the notice whenever the dialog opens. `os validate` checks it as it checks the action's `visible`.
- **Either pre-run dialog.** The confirm dialog of a param-less action with `confirmText` and the param dialog of an action with a non-empty `params` draw the notices above the description. An action that declares neither opens no dialog, so `notices` there is refused at parse.
- **Either pre-run dialog.** The confirm dialog of a param-less action with `confirmText` and the param dialog of an action with a non-empty `params` draw the notices between the title and the description. An action with both draws them in the param dialog only. An action that declares neither opens no dialog, so `notices` there is refused at parse.
- **A condition that cannot be evaluated draws nothing.** The console reports it once in the browser console, naming the action and the notice. Reading a `features` flag the host has not received is such a fault, so guard it with `has()` as above when the notice should stay out of the dialog until the flag is known.
- **Display only.** The action's endpoint, its `outcome` answer and its outcome copy are the same with or without a notice. A notice that is wrong or not drawn misleads the reader and gates nothing.
- The platform's four **Invite User** actions and **Resend Invitation** declare `mail_not_delivered`, drawn while the deployment delivers no mail (`features.emailDelivery`).
- `alerts` and `warnings` are refused with a rename to `notices`.

### Showing a server read before submit: `preflight`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ export const arObjects: NonNullable<TranslationData['objects']> = {
sent: "أُرسلت الدعوة إلى {{ result.email }}",
link_only: "أُنشئت دعوة لـ {{ result.email }}. البريد غير مُهيَّأ على هذا الخادم، لذا لم تُرسَل أي رسالة. يتطلب قبول الدعوة عنوان بريد إلكتروني موثَّقًا: من دون البريد، لا يستطيع القبول إلا مدعو يوثّق تسجيلُ دخوله الاجتماعي أو عبر SSO عنوانَه. لأي شخص آخر، ينشئ مسؤول المنصة الحساب."
},
notices: {
mail_not_delivered: {
title: "البريد غير مُهيَّأ على هذا الخادم",
body: "لن تُرسَل أي رسالة، لذا لن يعلم المدعو بهذه الدعوة. يتطلب قبول الدعوة عنوان بريد إلكتروني موثَّقًا: من دون البريد، لا يستطيع القبول إلا مدعو يوثّق تسجيلُ دخوله الاجتماعي أو عبر SSO عنوانَه. لأي شخص آخر، ينشئ مسؤول المنصة الحساب."
}
},
params: {
role: {
helpText: "المالك: تحكم كامل في المؤسسة، بما في ذلك حذفها.\nالمسؤول: يدير الأعضاء والدعوات والفرق وإعدادات المؤسسة.\nالمسؤول المفوَّض: يدعو الأشخاص ويضعهم فقط حيث فوّضه المسؤول بذلك.\nالعضو: يعمل في تطبيقات المؤسسة بالوصول الذي تمنحه مجموعات أذوناته.\nالخارجي: شخص من خارج المؤسسة، مثل مورّد أو عميل، لا يرى إلا ما تتم مشاركته معه.",
Expand Down Expand Up @@ -725,6 +731,12 @@ export const arObjects: NonNullable<TranslationData['objects']> = {
sent: "أُرسلت الدعوة إلى {{ result.email }}",
link_only: "أُنشئت دعوة لـ {{ result.email }}. البريد غير مُهيَّأ على هذا الخادم، لذا لم تُرسَل أي رسالة. يتطلب قبول الدعوة عنوان بريد إلكتروني موثَّقًا: من دون البريد، لا يستطيع القبول إلا مدعو يوثّق تسجيلُ دخوله الاجتماعي أو عبر SSO عنوانَه. لأي شخص آخر، ينشئ مسؤول المنصة الحساب."
},
notices: {
mail_not_delivered: {
title: "البريد غير مُهيَّأ على هذا الخادم",
body: "لن تُرسَل أي رسالة، لذا لن يعلم المدعو بهذه الدعوة. يتطلب قبول الدعوة عنوان بريد إلكتروني موثَّقًا: من دون البريد، لا يستطيع القبول إلا مدعو يوثّق تسجيلُ دخوله الاجتماعي أو عبر SSO عنوانَه. لأي شخص آخر، ينشئ مسؤول المنصة الحساب."
}
},
params: {
role: {
helpText: "المالك: تحكم كامل في المؤسسة، بما في ذلك حذفها.\nالمسؤول: يدير الأعضاء والدعوات والفرق وإعدادات المؤسسة.\nالمسؤول المفوَّض: يدعو الأشخاص ويضعهم فقط حيث فوّضه المسؤول بذلك.\nالعضو: يعمل في تطبيقات المؤسسة بالوصول الذي تمنحه مجموعات أذوناته.\nالخارجي: شخص من خارج المؤسسة، مثل مورّد أو عميل، لا يرى إلا ما تتم مشاركته معه.",
Expand Down Expand Up @@ -831,6 +843,12 @@ export const arObjects: NonNullable<TranslationData['objects']> = {
sent: "أُرسلت الدعوة إلى {{ result.email }}",
link_only: "أُنشئت دعوة لـ {{ result.email }}. البريد غير مُهيَّأ على هذا الخادم، لذا لم تُرسَل أي رسالة. يتطلب قبول الدعوة عنوان بريد إلكتروني موثَّقًا: من دون البريد، لا يستطيع القبول إلا مدعو يوثّق تسجيلُ دخوله الاجتماعي أو عبر SSO عنوانَه. لأي شخص آخر، ينشئ مسؤول المنصة الحساب."
},
notices: {
mail_not_delivered: {
title: "البريد غير مُهيَّأ على هذا الخادم",
body: "لن تُرسَل أي رسالة، لذا لن يعلم المدعو بهذه الدعوة. يتطلب قبول الدعوة عنوان بريد إلكتروني موثَّقًا: من دون البريد، لا يستطيع القبول إلا مدعو يوثّق تسجيلُ دخوله الاجتماعي أو عبر SSO عنوانَه. لأي شخص آخر، ينشئ مسؤول المنصة الحساب."
}
},
params: {
role: {
helpText: "المالك: تحكم كامل في المؤسسة، بما في ذلك حذفها.\nالمسؤول: يدير الأعضاء والدعوات والفرق وإعدادات المؤسسة.\nالمسؤول المفوَّض: يدعو الأشخاص ويضعهم فقط حيث فوّضه المسؤول بذلك.\nالعضو: يعمل في تطبيقات المؤسسة بالوصول الذي تمنحه مجموعات أذوناته.\nالخارجي: شخص من خارج المؤسسة، مثل مورّد أو عميل، لا يرى إلا ما تتم مشاركته معه.",
Expand Down Expand Up @@ -983,6 +1001,12 @@ export const arObjects: NonNullable<TranslationData['objects']> = {
sent: "أُرسلت الدعوة إلى {{ result.email }}",
link_only: "أُنشئت دعوة لـ {{ result.email }}. البريد غير مُهيَّأ على هذا الخادم، لذا لم تُرسَل أي رسالة. يتطلب قبول الدعوة عنوان بريد إلكتروني موثَّقًا: من دون البريد، لا يستطيع القبول إلا مدعو يوثّق تسجيلُ دخوله الاجتماعي أو عبر SSO عنوانَه. لأي شخص آخر، ينشئ مسؤول المنصة الحساب."
},
notices: {
mail_not_delivered: {
title: "البريد غير مُهيَّأ على هذا الخادم",
body: "لن تُرسَل أي رسالة، لذا لن يعلم المدعو بهذه الدعوة. يتطلب قبول الدعوة عنوان بريد إلكتروني موثَّقًا: من دون البريد، لا يستطيع القبول إلا مدعو يوثّق تسجيلُ دخوله الاجتماعي أو عبر SSO عنوانَه. لأي شخص آخر، ينشئ مسؤول المنصة الحساب."
}
},
params: {
role: {
helpText: "المالك: تحكم كامل في المؤسسة، بما في ذلك حذفها.\nالمسؤول: يدير الأعضاء والدعوات والفرق وإعدادات المؤسسة.\nالمسؤول المفوَّض: يدعو الأشخاص ويضعهم فقط حيث فوّضه المسؤول بذلك.\nالعضو: يعمل في تطبيقات المؤسسة بالوصول الذي تمنحه مجموعات أذوناته.\nالخارجي: شخص من خارج المؤسسة، مثل مورّد أو عميل، لا يرى إلا ما تتم مشاركته معه.",
Expand All @@ -1009,6 +1033,12 @@ export const arObjects: NonNullable<TranslationData['objects']> = {
outcomeMessages: {
sent: "أُعيد إرسال الدعوة إلى {{ result.email }}",
link_only: "جُدِّدت الدعوة لـ {{ result.email }}. البريد غير مُهيَّأ على هذا الخادم، لذا لم تُرسَل أي رسالة. يتطلب قبول الدعوة عنوان بريد إلكتروني موثَّقًا: من دون البريد، لا يستطيع القبول إلا مدعو يوثّق تسجيلُ دخوله الاجتماعي أو عبر SSO عنوانَه. لأي شخص آخر، ينشئ مسؤول المنصة الحساب."
},
notices: {
mail_not_delivered: {
title: "البريد غير مُهيَّأ على هذا الخادم",
body: "لن تُرسَل أي رسالة، لذا لن يعلم المدعو بهذه الدعوة. يتطلب قبول الدعوة عنوان بريد إلكتروني موثَّقًا: من دون البريد، لا يستطيع القبول إلا مدعو يوثّق تسجيلُ دخوله الاجتماعي أو عبر SSO عنوانَه. لأي شخص آخر، ينشئ مسؤول المنصة الحساب."
}
}
},
copy_invitation_link: {
Expand Down
Loading
Loading