@scalio-cloud/ui 0.39.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/nav.css +5 -0
  2. package/package.json +1 -1
  3. package/react/mail.js +43 -6
package/nav.css CHANGED
@@ -759,6 +759,11 @@
759
759
  .scalio-mail-providers { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin: 0; padding: 0; border: 0; }
760
760
  .scalio-mail-providers legend { width: 100%; margin-bottom: 0.5rem; }
761
761
  .scalio-mail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
762
+ .scalio-mail-default { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.75rem; border: 1px solid hsl(var(--border)); border-radius: 2px; background: hsl(var(--muted)); }
763
+ .scalio-mail-default p { margin: 0; }
764
+ .scalio-mail-default-facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; margin: 0; font-size: 0.875rem; }
765
+ .scalio-mail-default-facts dt { color: hsl(var(--muted-foreground)); }
766
+ .scalio-mail-default-facts dd { margin: 0; overflow-wrap: anywhere; }
762
767
  .scalio-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
763
768
  .scalio-mail-test { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
764
769
  .scalio-mail-test .scalio-input { flex: 1 1 15rem; width: auto; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalio-cloud/ui",
3
- "version": "0.39.0",
3
+ "version": "0.40.0",
4
4
  "description": "Scalio Control Room design tokens, Tailwind preset, self-hosted fonts, the shared app header, sign-in layout, sidebar and page blocks",
5
5
  "license": "SEE LICENSE IN README.md",
6
6
  "private": false,
package/react/mail.js CHANGED
@@ -12,7 +12,14 @@ const LABELS = {
12
12
  transportTitle: "E-Mail-Versand",
13
13
  transportHint: "Über welchen Server die App Mails schickt. Passwort und Client-Secret werden verschlüsselt gespeichert und nie angezeigt.",
14
14
  provider: "Mails senden mit",
15
- providers: { off: "Aus", smtp: "SMTP-Server", graph: "Microsoft 365", tenant: "Microsoft 365 über die Tenant-Verbindung" },
15
+ providers: { default: "Vorgabe verwenden (empfohlen)", off: "Aus", smtp: "SMTP-Server", graph: "Microsoft 365", tenant: "Microsoft 365 über die Tenant-Verbindung" },
16
+ defaultWays: { smtp: "SMTP-Server", graph: "Microsoft 365", tenant: "Microsoft 365 über die Tenant-Verbindung", scalio: "Über Scalio" },
17
+ defaultFrom: { compass: "Vorgabe aus Compass", installation: "Vorgabe der Installation" },
18
+ defaultSender: "Absender",
19
+ defaultServer: "Server",
20
+ defaultTenant: "Tenant",
21
+ defaultHint: "Gilt für alle Scalio-Apps dieses Kunden. Wählen Sie einen eigenen Weg, wenn diese App anders senden soll (z. B. mit einem eigenen Postfach).",
22
+ defaultNone: "Es gibt noch keine Vorgabe. Bis Compass oder die Installation eine liefert, sendet die App keine Mails.",
16
23
  fromName: "Absendername",
17
24
  fromAddress: "Absenderadresse",
18
25
  language: "Sprache der Mails",
@@ -78,7 +85,14 @@ const LABELS = {
78
85
  transportTitle: "E-mail sending",
79
86
  transportHint: "Which server the app sends mail through. Password and client secret are stored encrypted and never shown.",
80
87
  provider: "Send mail with",
81
- providers: { off: "Off", smtp: "SMTP server", graph: "Microsoft 365", tenant: "Microsoft 365 through the tenant connection" },
88
+ providers: { default: "Use the default (recommended)", off: "Off", smtp: "SMTP server", graph: "Microsoft 365", tenant: "Microsoft 365 through the tenant connection" },
89
+ defaultWays: { smtp: "SMTP server", graph: "Microsoft 365", tenant: "Microsoft 365 through the tenant connection", scalio: "Through Scalio" },
90
+ defaultFrom: { compass: "Default from Compass", installation: "Default of the installation" },
91
+ defaultSender: "Sender",
92
+ defaultServer: "Server",
93
+ defaultTenant: "Tenant",
94
+ defaultHint: "Applies to all Scalio apps of this customer. Choose an own way if this app should send differently (for example with an own mailbox).",
95
+ defaultNone: "There is no default yet. Until Compass or the installation provides one, the app sends no mail.",
82
96
  fromName: "Sender name",
83
97
  fromAddress: "Sender address",
84
98
  language: "Language of the mails",
@@ -223,7 +237,9 @@ function select(id, value, options, onChange, extra) {
223
237
  // offered when the backend lists it in settings.providers, scalio-platform 0.10.0), children (more blocks after «Testmail», e.g. Beacon's
224
238
  // mail intake), outbox (false hides «Letzte Mails»). With scalio-platform 0.12.0 the backend may list `tenants` (the app is
225
239
  // connected to several tenants: the administrator picks the one that sends) and `send_rights` (the block «Senderecht in
226
- // Exchange Online» shows the PowerShell from GET /mail/send-rights).
240
+ // Exchange Online» shows the PowerShell from GET /mail/send-rights). With scalio-platform 0.19.0 (ADR 0090) the backend may
241
+ // list the provider `default` («Vorgabe verwenden») and send `default` {available, source, provider, from_name,
242
+ // from_address, tenant_id, smtp_host}: the page shows where the default comes from and where mails go.
227
243
  function MailTransport(props) {
228
244
  const { client, lang } = props;
229
245
  const L = mailLabels(lang, props.labels);
@@ -262,6 +278,7 @@ function MailTransport(props) {
262
278
  m.clear();
263
279
  try {
264
280
  const body = { provider: form.provider, from_name: form.from_name, from_address: form.from_address, language: form.language };
281
+ if (form.provider === "default") delete body.from_address;
265
282
  if (form.provider === "smtp") body.smtp = Object.assign({}, form.smtp, { port: Number(form.smtp.port) || 587 });
266
283
  if (form.provider === "graph") body.graph = form.graph;
267
284
  if (form.provider === "tenant") {
@@ -318,6 +335,20 @@ function MailTransport(props) {
318
335
  const tenants = Array.isArray(form.tenants) ? form.tenants : null;
319
336
 
320
337
  const providers = (form.providers || ["off", "smtp", "graph"]).filter((id) => L.providers[id]);
338
+ // ADR 0090: the default from Compass or the installation (scalio-platform 0.19.0); never a secret in it
339
+ const dflt = form.default || null;
340
+ const defaultUsable = !!(dflt && dflt.available);
341
+ const defaultBlock = () => {
342
+ if (!defaultUsable) return h("div", { className: "scalio-notice is-info", "data-testid": "mail-default-none" }, L.defaultNone);
343
+ const facts = [[L.defaultSender, dflt.from_name ? `${dflt.from_name} <${dflt.from_address}>` : dflt.from_address]];
344
+ if (dflt.smtp_host) facts.push([L.defaultServer, dflt.smtp_host]);
345
+ if (dflt.tenant_id) facts.push([L.defaultTenant, dflt.tenant_id]);
346
+ return h("div", { className: "scalio-mail-default", "data-testid": "mail-default" },
347
+ h("p", { className: "scalio-field-label" }, `${L.defaultFrom[dflt.source] || L.defaultFrom.compass}: ${L.defaultWays[dflt.provider] || dflt.provider}`),
348
+ h("dl", { className: "scalio-mail-default-facts" },
349
+ facts.filter((f) => f[1]).map((f) => h(React.Fragment, { key: f[0] }, h("dt", null, f[0]), h("dd", null, f[1])))),
350
+ h("p", { className: "scalio-settings-help" }, L.defaultHint));
351
+ };
321
352
  const transport = h(
322
353
  SettingsSection,
323
354
  { id: "mail", title: L.transportTitle, description: L.transportHint, testId: "mail-transport" },
@@ -330,7 +361,13 @@ function MailTransport(props) {
330
361
  providers.map((id) => h("label", { key: id, className: "scalio-settings-check" },
331
362
  h("input", { type: "radio", name: "mail-provider", checked: form.provider === id, "data-testid": `mail-provider-${id}`,
332
363
  onChange: () => set({ provider: id }) }), h("span", null, L.providers[id])))),
333
- form.provider !== "off"
364
+ form.provider === "default" ? defaultBlock() : null,
365
+ form.provider === "default"
366
+ ? h("div", { className: "scalio-mail-grid" },
367
+ h(Field, { id: "mail-lang", label: L.language, hint: L.languageHint },
368
+ select("mail-lang", form.language, [["de", L.languages.de], ["en", L.languages.en]], (v) => set({ language: v }), { disabled: busy })))
369
+ : null,
370
+ form.provider !== "off" && form.provider !== "default"
334
371
  ? h("div", { className: "scalio-mail-grid" },
335
372
  h(Field, { id: "mail-from-name", label: L.fromName }, input("mail-from-name", form.from_name, (v) => set({ from_name: v }), { maxLength: 80, disabled: busy })),
336
373
  form.provider === "smtp"
@@ -392,12 +429,12 @@ function MailTransport(props) {
392
429
  { id: "mail-test", title: L.testTitle, description: L.testHint, testId: "mail-test-section" },
393
430
  h("div", { className: "scalio-mail-test" },
394
431
  input("mail-test-to", to, setTo, { type: "email", placeholder: L.recipient, "aria-label": L.recipient, maxLength: 254 }),
395
- h("button", { type: "button", className: "scalio-btn", onClick: test, disabled: testing || form.provider === "off", "data-testid": "mail-test" },
432
+ h("button", { type: "button", className: "scalio-btn", onClick: test, disabled: testing || form.provider === "off" || (form.provider === "default" && !defaultUsable), "data-testid": "mail-test" },
396
433
  h(Icons.CornerDownLeft, { className: "scalio-icon" }), L.sendTest)),
397
434
  h(Notice, { msg: testMsg, testId: "mail-test-message" })
398
435
  );
399
436
 
400
- const rights = form.send_rights && (form.provider === "graph" || form.provider === "tenant")
437
+ const rights = form.send_rights && (form.provider === "graph" || form.provider === "tenant" || form.provider === "default")
401
438
  ? h(
402
439
  SettingsSection,
403
440
  { id: "mail-rights", title: L.rightsTitle, description: L.rightsHint, testId: "mail-rights" },