@zaclinley/dsh-mailharbor 0.4.0 → 0.4.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 3ce3ed1: Fix raw HTML in AI translation cards and silent connection checks.
8
+
9
+ - A translated email body is normalized: the card shows readable text, and
10
+ "insert into reply" uses the translated body without the document wrapper.
11
+ - The account "check connection" button now shows a busy state and prints the
12
+ result under the account it belongs to; it previously only appeared while the
13
+ row was expanded in edit mode.
14
+
3
15
  ## 0.4.0
4
16
 
5
17
  ### Minor Changes
package/lib/client.js CHANGED
@@ -2493,7 +2493,7 @@ function MailSettings() {
2493
2493
  const [styleMeta, setStyleMeta] = (0, import_react9.useState)({ updatedAt: "", sampleCount: 0 });
2494
2494
  const [styleBusy, setStyleBusy] = (0, import_react9.useState)(null);
2495
2495
  const [editing, setEditing] = (0, import_react9.useState)(null);
2496
- const [checkResult, setCheckResult] = (0, import_react9.useState)("");
2496
+ const [checkResults, setCheckResults] = (0, import_react9.useState)({});
2497
2497
  const [adding, setAdding] = (0, import_react9.useState)(false);
2498
2498
  const [tick, setTick] = (0, import_react9.useState)(0);
2499
2499
  (0, import_react9.useEffect)(() => {
@@ -2582,10 +2582,10 @@ function MailSettings() {
2582
2582
  active: item.id === settings.activeAccountId,
2583
2583
  loggedIn: item.id === settings.activeAccountId ? state.loggedIn : void 0,
2584
2584
  editing: editing === item.id,
2585
- checkResult: editing === item.id ? checkResult : "",
2585
+ checkResult: checkResults[item.id] ?? "",
2586
2586
  onToggleEdit: () => {
2587
2587
  setEditing(editing === item.id ? null : item.id);
2588
- setCheckResult("");
2588
+ setCheckResults((prev) => ({ ...prev, [item.id]: "" }));
2589
2589
  },
2590
2590
  onActivate: async () => {
2591
2591
  await api.activateAccount(item.id);
@@ -2602,11 +2602,12 @@ function MailSettings() {
2602
2602
  onCheck: async () => {
2603
2603
  try {
2604
2604
  const result = await api.check(item.id);
2605
- setCheckResult(
2606
- `IMAP \u6B63\u5E38\uFF08${String(result.imap.mailboxes.length)} \u4E2A\u6587\u4EF6\u5939\uFF09\xB7 SMTP ${result.smtp.ok ? "\u6B63\u5E38" : `\u5931\u8D25: ${result.smtp.error ?? ""}`}`
2607
- );
2605
+ setCheckResults((prev) => ({
2606
+ ...prev,
2607
+ [item.id]: `IMAP \u6B63\u5E38\uFF08${String(result.imap.mailboxes.length)} \u4E2A\u6587\u4EF6\u5939\uFF09\xB7 SMTP ${result.smtp.ok ? "\u6B63\u5E38" : `\u5931\u8D25: ${result.smtp.error ?? ""}`}`
2608
+ }));
2608
2609
  } catch (caught) {
2609
- setCheckResult(`\u5931\u8D25: ${errorText6(caught)}`);
2610
+ setCheckResults((prev) => ({ ...prev, [item.id]: `\u5931\u8D25: ${errorText6(caught)}` }));
2610
2611
  }
2611
2612
  },
2612
2613
  onSave: async (patch) => {
@@ -2894,6 +2895,7 @@ function AccountRow({
2894
2895
  const [smtpSecure, setSmtpSecure] = (0, import_react9.useState)(account.smtp.secure);
2895
2896
  const [fromName, setFromName] = (0, import_react9.useState)(account.smtp.fromName);
2896
2897
  const [busy, setBusy] = (0, import_react9.useState)(false);
2898
+ const [checking, setChecking] = (0, import_react9.useState)(false);
2897
2899
  (0, import_react9.useEffect)(() => {
2898
2900
  setLabel(account.label);
2899
2901
  setUsername(account.username);
@@ -2930,9 +2932,28 @@ function AccountRow({
2930
2932
  loggedIn === false ? (0, import_react9.createElement)("span", { className: "badge warn" }, "\u672A\u767B\u5F55") : null,
2931
2933
  (0, import_react9.createElement)("span", { className: "spacer" }),
2932
2934
  active ? null : (0, import_react9.createElement)("button", { className: "ghost small", onClick: () => void wrap(onActivate) }, "\u8BBE\u4E3A\u5F53\u524D"),
2933
- (0, import_react9.createElement)("button", { className: "ghost small", onClick: () => void wrap(onCheck) }, "\u68C0\u67E5\u8FDE\u63A5"),
2935
+ (0, import_react9.createElement)(
2936
+ "button",
2937
+ {
2938
+ className: "ghost small",
2939
+ disabled: checking,
2940
+ onClick: () => {
2941
+ setChecking(true);
2942
+ void wrap(onCheck).finally(() => setChecking(false));
2943
+ }
2944
+ },
2945
+ checking ? "\u68C0\u67E5\u4E2D\u2026" : "\u68C0\u67E5\u8FDE\u63A5"
2946
+ ),
2934
2947
  (0, import_react9.createElement)("button", { className: "ghost small", onClick: onToggleEdit }, editing ? "\u6536\u8D77" : "\u7F16\u8F91")
2935
2948
  ),
2949
+ checkResult === "" ? null : (0, import_react9.createElement)(
2950
+ "div",
2951
+ {
2952
+ className: "mailharbor-check",
2953
+ style: { color: checkResult.startsWith("\u5931\u8D25") ? "var(--m-danger)" : "var(--m-ok)" }
2954
+ },
2955
+ checkResult
2956
+ ),
2936
2957
  editing ? (0, import_react9.createElement)(
2937
2958
  "div",
2938
2959
  { style: { display: "flex", flexDirection: "column", gap: "10px" } },
@@ -3061,14 +3082,13 @@ function AccountRow({
3061
3082
  "\u767B\u5F55"
3062
3083
  ),
3063
3084
  (0, import_react9.createElement)("button", { className: "ghost small", onClick: () => void wrap(onLogout) }, "\u9000\u51FA\u767B\u5F55")
3064
- ),
3065
- checkResult === "" ? null : (0, import_react9.createElement)("div", { className: "small muted" }, checkResult)
3085
+ )
3066
3086
  ) : null
3067
3087
  );
3068
3088
  }
3069
3089
 
3070
3090
  // src/client/index.tsx
3071
- var VERSION = "0.4.0";
3091
+ var VERSION = "0.4.1";
3072
3092
  var inject = ["slots"];
3073
3093
  var PANEL_ID = "mailharbor";
3074
3094
  var STYLE_ID = "mailharbor-style";