@scalio-cloud/ui 0.84.1 → 0.86.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/README.md +2 -1
  2. package/package.json +1 -1
  3. package/react/mail.js +28 -13
package/README.md CHANGED
@@ -746,7 +746,8 @@ const mail = mailApi(api); // once, outside the component; mailApi(api, "/admi
746
746
 
747
747
  `MailTransport` shows three blocks: «E-Mail-Versand» (off, SMTP or Microsoft 365, sender, language; secrets come back
748
748
  as a mask and the mask is sent back unchanged), «Testmail» (empty recipient: to me) and «Letzte Mails» (`outbox={false}`
749
- hides it). On a test instance the backend answers `test_mailbox: true` and the server fields are locked.
749
+ hides it). On a test instance the backend answers `test_instance: true`; while no own way is saved there it also answers
750
+ `test_mailbox: true` (the test mailbox sends). The form stays editable on test: a saved way counts (scalio-platform 0.52.0).
750
751
  `MailTemplates` picks mail and language, offers the placeholders as buttons, shows the preview of the real rendering
751
752
  in a sandboxed frame, and saves, tests («Test an mich») or resets to the built-in text. A switchable mail gets the
752
753
  checkbox «Diese Mail senden». The `editor` gets `{value, onChange, testId}`; without it a text field is used, so this
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalio-cloud/ui",
3
- "version": "0.84.1",
3
+ "version": "0.86.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
@@ -28,6 +28,7 @@ const LABELS = {
28
28
  rightsCheck: "Status prüfen",
29
29
  rightsState: { ok: "Senderecht vorhanden", missing: "Senderecht fehlt" },
30
30
  rightsUnknown: "Senden Sie eine Testmail, um das Senderecht zu bestätigen.",
31
+ rightsSettling: (at) => `Die App hat das Senderecht eben geändert. Exchange übernimmt es bis spätestens ${at}; bis dahin kann Microsoft die Mail noch ablehnen.`,
31
32
  rightsScriptAlso: "Lieber selbst ausführen? Skript anzeigen",
32
33
  testFirst: "Speichern Sie zuerst Weg und Postfach.",
33
34
  transportHint: "Über welchen Server die App Mails schickt. Passwort und Client-Secret werden verschlüsselt gespeichert und nie angezeigt.",
@@ -65,7 +66,8 @@ const LABELS = {
65
66
  copy: "Kopieren",
66
67
  copied: "Skript kopiert",
67
68
  copyFailed: "Kopieren nicht möglich. Bitte markieren und kopieren.",
68
- testMailbox: "Testinstanz: Mails gehen über das Testpostfach, die Einstellungen hier gelten nicht.",
69
+ testMailbox: "Testinstanz: Solange hier kein eigener Weg gespeichert ist, gehen Mails über das Testpostfach. Mails gehen nur an Adressen der Testdomains.",
70
+ testInstance: "Testinstanz: Mails gehen über die Einstellungen hier, aber nur an Adressen der Testdomains.",
69
71
  save: "Speichern",
70
72
  saved: "Gespeichert",
71
73
  testTitle: "Testmail",
@@ -121,6 +123,7 @@ const LABELS = {
121
123
  rightsCheck: "Check status",
122
124
  rightsState: { ok: "Send right in place", missing: "Send right missing" },
123
125
  rightsUnknown: "Send a test mail to confirm the send right.",
126
+ rightsSettling: (at) => `The app has just changed the send right. Exchange applies it by ${at} at the latest; until then Microsoft may still refuse the mail.`,
124
127
  rightsScriptAlso: "Rather run it yourself? Show script",
125
128
  testFirst: "Save the way and the mailbox first.",
126
129
  transportHint: "Which server the app sends mail through. Password and client secret are stored encrypted and never shown.",
@@ -158,7 +161,8 @@ const LABELS = {
158
161
  copy: "Copy",
159
162
  copied: "Script copied",
160
163
  copyFailed: "Copying is not possible. Please select and copy.",
161
- testMailbox: "Test instance: mails go through the test mailbox, the settings here do not apply.",
164
+ testMailbox: "Test instance: as long as no own way is saved here, mails go through the test mailbox. Mails only go to addresses of the test domains.",
165
+ testInstance: "Test instance: mails go through the settings here, but only to addresses of the test domains.",
162
166
  save: "Save",
163
167
  saved: "Saved",
164
168
  testTitle: "Test mail",
@@ -287,6 +291,12 @@ function select(id, value, options, onChange, extra) {
287
291
  // With scalio-platform 0.45.0 the status names a `reason` when the app can not set the send right itself: the button
288
292
  // «Senderecht setzen» stays visible but greyed out with that reason (grantOffHint {read_only, no_exchange, identity}:
289
293
  // the app's own texts, e.g. Citadel «Mit Scalio Schreiben setzt Citadel das Senderecht selbst»).
294
+ function settlingTime(iso, lang) {
295
+ const d = new Date(iso);
296
+ if (isNaN(d.getTime())) return iso;
297
+ return d.toLocaleTimeString(lang === "en" ? "en-GB" : "de-CH", { hour: "2-digit", minute: "2-digit" });
298
+ }
299
+
290
300
  function MailTransport(props) {
291
301
  const { client, lang } = props;
292
302
  const L = mailLabels(lang, props.labels);
@@ -339,7 +349,6 @@ function MailTransport(props) {
339
349
 
340
350
  const set = (patch) => setForm(Object.assign({}, form, patch));
341
351
  const part = (name, key) => (v) => set({ [name]: Object.assign({}, form[name], { [key]: v }) });
342
- const locked = !!form.test_mailbox;
343
352
 
344
353
  const save = async (e) => {
345
354
  e.preventDefault();
@@ -456,8 +465,9 @@ function MailTransport(props) {
456
465
  h(
457
466
  "form",
458
467
  { className: "scalio-settings-form", onSubmit: save },
459
- locked ? h("div", { className: "scalio-notice is-info", "data-testid": "mail-test-mailbox" }, L.testMailbox) : null,
460
- h("fieldset", { className: "scalio-mail-providers", disabled: busy || locked },
468
+ form.test_mailbox ? h("div", { className: "scalio-notice is-info", "data-testid": "mail-test-mailbox" }, L.testMailbox)
469
+ : (form.test_instance ? h("div", { className: "scalio-notice is-info", "data-testid": "mail-test-instance" }, L.testInstance) : null),
470
+ h("fieldset", { className: "scalio-mail-providers", disabled: busy },
461
471
  h("legend", { className: "scalio-field-label" }, L.provider),
462
472
  providers.map((id) => h("label", { key: id, className: "scalio-settings-check" },
463
473
  h("input", { type: "radio", name: "mail-provider", checked: form.provider === id, "data-testid": `mail-provider-${id}`,
@@ -473,20 +483,20 @@ function MailTransport(props) {
473
483
  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 })),
474
484
  form.provider === "smtp"
475
485
  ? h(Field, { id: "mail-from", label: L.fromAddress }, input("mail-from", form.from_address, (v) => set({ from_address: v }),
476
- { type: "email", maxLength: 254, placeholder: "noreply@example.com", disabled: busy || locked }))
486
+ { type: "email", maxLength: 254, placeholder: "noreply@example.com", disabled: busy }))
477
487
  : null,
478
488
  h(Field, { id: "mail-lang", label: L.language, hint: L.languageHint },
479
489
  select("mail-lang", form.language, [["de", L.languages.de], ["en", L.languages.en]], (v) => set({ language: v }), { disabled: busy })))
480
490
  : null,
481
491
  form.provider === "smtp"
482
492
  ? h("div", { className: "scalio-mail-grid", "data-testid": "mail-smtp" },
483
- h(Field, { id: "mail-smtp-host", label: L.host }, input("mail-smtp-host", form.smtp.host, part("smtp", "host"), { maxLength: 253, placeholder: "smtp.example.com", disabled: busy || locked })),
484
- h(Field, { id: "mail-smtp-port", label: L.port }, input("mail-smtp-port", form.smtp.port, part("smtp", "port"), { type: "number", min: 1, max: 65535, disabled: busy || locked })),
493
+ h(Field, { id: "mail-smtp-host", label: L.host }, input("mail-smtp-host", form.smtp.host, part("smtp", "host"), { maxLength: 253, placeholder: "smtp.example.com", disabled: busy })),
494
+ h(Field, { id: "mail-smtp-port", label: L.port }, input("mail-smtp-port", form.smtp.port, part("smtp", "port"), { type: "number", min: 1, max: 65535, disabled: busy })),
485
495
  h(Field, { id: "mail-smtp-security", label: L.security },
486
- select("mail-smtp-security", form.smtp.security, Object.keys(L.securities).map((k) => [k, L.securities[k]]), part("smtp", "security"), { disabled: busy || locked })),
487
- h(Field, { id: "mail-smtp-user", label: L.username }, input("mail-smtp-user", form.smtp.username, part("smtp", "username"), { maxLength: 200, autoComplete: "off", disabled: busy || locked })),
496
+ select("mail-smtp-security", form.smtp.security, Object.keys(L.securities).map((k) => [k, L.securities[k]]), part("smtp", "security"), { disabled: busy })),
497
+ h(Field, { id: "mail-smtp-user", label: L.username }, input("mail-smtp-user", form.smtp.username, part("smtp", "username"), { maxLength: 200, autoComplete: "off", disabled: busy })),
488
498
  h(Field, { id: "mail-smtp-password", label: L.password }, input("mail-smtp-password", form.smtp.password, part("smtp", "password"),
489
- { type: "password", maxLength: 500, autoComplete: "new-password", disabled: busy || locked })))
499
+ { type: "password", maxLength: 500, autoComplete: "new-password", disabled: busy })))
490
500
  : null,
491
501
  form.provider === "graph"
492
502
  ? h("div", { "data-testid": "mail-graph" },
@@ -525,7 +535,7 @@ function MailTransport(props) {
525
535
  : null,
526
536
  h(Notice, { msg: m.msg, testId: "mail-message" }),
527
537
  h("div", { className: "scalio-settings-section-footer" },
528
- h("button", { type: "submit", className: "scalio-btn is-primary", disabled: busy || locked, "data-testid": "mail-save" },
538
+ h("button", { type: "submit", className: "scalio-btn is-primary", disabled: busy, "data-testid": "mail-save" },
529
539
  h(Icons.Check, { className: "scalio-icon" }), L.save))
530
540
  )
531
541
  );
@@ -562,6 +572,11 @@ function MailTransport(props) {
562
572
  rightsInfo && rightsInfo.mode !== "none" && !rightsKnown
563
573
  ? h("p", { className: "scalio-settings-help", "data-testid": "mail-rights-unknown" }, L.rightsUnknown)
564
574
  : null,
575
+ // scalio-platform 0.53.0: after a change Exchange needs up to two hours; the badge says «vorhanden», this says until when
576
+ rightsOk && rightsInfo.settling_until
577
+ ? h("p", { className: "scalio-settings-help", "data-testid": "mail-rights-settling" },
578
+ L.rightsSettling(settlingTime(rightsInfo.settling_until, lang)))
579
+ : null,
565
580
  rightsInfo && rightsInfo.detail && !rightsOk
566
581
  ? h("p", { className: "scalio-settings-help is-error", "data-testid": "mail-rights-detail" }, rightsInfo.detail)
567
582
  : null,
@@ -619,7 +634,7 @@ function MailTransport(props) {
619
634
  !form.send_rights ? "none" : (rightsInfo && rightsInfo.state === "ok" ? "done" : (rightsInfo && rightsInfo.state === "missing" ? "open" : "check")),
620
635
  testOk ? "done" : "open",
621
636
  ];
622
- const steps = locked ? null : h("ol", { className: "scalio-mail-steps", "aria-label": L.stepsTitle, "data-testid": "mail-steps" },
637
+ const steps = h("ol", { className: "scalio-mail-steps", "aria-label": L.stepsTitle, "data-testid": "mail-steps" },
623
638
  L.steps.map((name, i) => h("li", { key: name, className: `scalio-mail-step is-${stepStates[i]}`, "data-testid": `mail-step-${i + 1}`, "data-state": stepStates[i] },
624
639
  h("span", { className: `scalio-wizard-dot ${stepStates[i] === "done" ? "is-done" : ""}`.trim() },
625
640
  stepStates[i] === "done" ? h(Icons.Check, { width: 14, height: 14 }) : i + 1),