@zaclinley/dsh-mailharbor 0.13.1 → 0.14.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.
- package/CHANGELOG.md +12 -0
- package/lib/client.js +23 -18
- package/lib/client.js.map +2 -2
- package/lib/index.js +83 -8
- package/lib/index.js.map +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a39b9dc: Mirror drafts to the server's Drafts mailbox.
|
|
8
|
+
|
|
9
|
+
- Explicit save and closing the composer append the draft to IMAP Drafts with
|
|
10
|
+
`\Draft`, replacing the previous mirrored copy.
|
|
11
|
+
- Discarding or sending a draft deletes its server copy as well.
|
|
12
|
+
- The mirror is best-effort: offline saves stay local and the composer explains
|
|
13
|
+
why the server copy is missing.
|
|
14
|
+
|
|
3
15
|
## 0.13.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/lib/client.js
CHANGED
|
@@ -122,9 +122,9 @@ var api = {
|
|
|
122
122
|
),
|
|
123
123
|
attachmentUrl: (params) => new URL(`attachment${query(params)}`, BASE).href,
|
|
124
124
|
drafts: (accountId) => request(`drafts${query({ accountId: accountId ?? null })}`),
|
|
125
|
-
saveDraft: (accountId, draft) => request(`drafts${query({ accountId: accountId ?? null })}`, {
|
|
125
|
+
saveDraft: (accountId, draft, options = {}) => request(`drafts${query({ accountId: accountId ?? null })}`, {
|
|
126
126
|
method: "POST",
|
|
127
|
-
body: JSON.stringify(draft)
|
|
127
|
+
body: JSON.stringify({ ...draft, ...options.remote === true ? { remote: true } : {} })
|
|
128
128
|
}),
|
|
129
129
|
deleteDraft: (id, accountId) => request(`drafts/${encodeURIComponent(id)}${query({ accountId: accountId ?? null })}`, {
|
|
130
130
|
method: "DELETE"
|
|
@@ -1573,23 +1573,28 @@ function Composer({
|
|
|
1573
1573
|
setDirty((value) => value + 1);
|
|
1574
1574
|
setHasBody((editor.current?.innerHTML ?? "").trim() !== "");
|
|
1575
1575
|
};
|
|
1576
|
-
const saveNow = async () => {
|
|
1576
|
+
const saveNow = async (remote = false) => {
|
|
1577
1577
|
if (to.trim() === "" && subject.trim() === "" && html().trim() === "") return false;
|
|
1578
1578
|
try {
|
|
1579
|
-
const { draft } = await api.saveDraft(
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1579
|
+
const { draft, syncError } = await api.saveDraft(
|
|
1580
|
+
account.id,
|
|
1581
|
+
{
|
|
1582
|
+
...draftId === void 0 ? {} : { id: draftId },
|
|
1583
|
+
to,
|
|
1584
|
+
cc,
|
|
1585
|
+
bcc,
|
|
1586
|
+
subject,
|
|
1587
|
+
html: html(),
|
|
1588
|
+
attachments,
|
|
1589
|
+
...initial.inReplyTo === void 0 ? {} : { inReplyTo: initial.inReplyTo },
|
|
1590
|
+
...initial.references === void 0 ? {} : { references: initial.references }
|
|
1591
|
+
},
|
|
1592
|
+
{ remote }
|
|
1593
|
+
);
|
|
1590
1594
|
setDraftId(draft.id);
|
|
1591
1595
|
setSavedAt(/* @__PURE__ */ new Date());
|
|
1592
1596
|
setDirty(0);
|
|
1597
|
+
if (syncError !== void 0) setError(`\u5DF2\u5B58\u5230\u672C\u5730\uFF0C\u670D\u52A1\u5668\u540C\u6B65\u5931\u8D25\uFF1A${syncError}`);
|
|
1593
1598
|
return true;
|
|
1594
1599
|
} catch {
|
|
1595
1600
|
return false;
|
|
@@ -1607,7 +1612,7 @@ function Composer({
|
|
|
1607
1612
|
const close = () => {
|
|
1608
1613
|
if (closing.current) return;
|
|
1609
1614
|
closing.current = true;
|
|
1610
|
-
void saveNow().finally(() => {
|
|
1615
|
+
void saveNow(true).finally(() => {
|
|
1611
1616
|
setDirty(0);
|
|
1612
1617
|
closing.current = false;
|
|
1613
1618
|
onClose();
|
|
@@ -1694,9 +1699,9 @@ function Composer({
|
|
|
1694
1699
|
const saveDraft = async () => {
|
|
1695
1700
|
setBusy(true);
|
|
1696
1701
|
setError("");
|
|
1697
|
-
const ok = await saveNow();
|
|
1702
|
+
const ok = await saveNow(true);
|
|
1698
1703
|
setBusy(false);
|
|
1699
|
-
if (ok) onSent("\u8349\u7A3F\u5DF2\u4FDD\u5B58");
|
|
1704
|
+
if (ok) onSent("\u8349\u7A3F\u5DF2\u4FDD\u5B58\u5E76\u540C\u6B65\u5230\u670D\u52A1\u5668");
|
|
1700
1705
|
else setError("\u8349\u7A3F\u4FDD\u5B58\u5931\u8D25");
|
|
1701
1706
|
};
|
|
1702
1707
|
const send = async () => {
|
|
@@ -5632,7 +5637,7 @@ function TaskEditor({
|
|
|
5632
5637
|
}
|
|
5633
5638
|
|
|
5634
5639
|
// src/client/index.tsx
|
|
5635
|
-
var VERSION = "0.
|
|
5640
|
+
var VERSION = "0.14.0";
|
|
5636
5641
|
var inject = ["slots"];
|
|
5637
5642
|
var PANEL_ID = "mailharbor";
|
|
5638
5643
|
var TASKS_PANEL_ID = "mailharbor-tasks";
|