@bobfrankston/rmfmail 1.2.177 → 1.2.178

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 (56) hide show
  1. package/client/android-bootstrap.bundle.js +112 -0
  2. package/client/android-bootstrap.bundle.js.map +3 -3
  3. package/client/app.bundle.js +71 -7
  4. package/client/app.bundle.js.map +3 -3
  5. package/client/components/alarms.js +88 -11
  6. package/client/components/alarms.js.map +1 -1
  7. package/client/components/alarms.ts +83 -13
  8. package/client/compose/compose.bundle.js +4 -0
  9. package/client/compose/compose.bundle.js.map +2 -2
  10. package/client/lib/api-client.js +6 -0
  11. package/client/lib/api-client.js.map +1 -1
  12. package/client/lib/api-client.ts +9 -0
  13. package/client/lib/mailxapi.js +27 -5
  14. package/package.json +5 -5
  15. package/packages/mailx-imap/package-lock.json +2 -2
  16. package/packages/mailx-imap/package.json +1 -1
  17. package/packages/mailx-service/index.d.ts +5 -0
  18. package/packages/mailx-service/index.d.ts.map +1 -1
  19. package/packages/mailx-service/index.js +22 -1
  20. package/packages/mailx-service/index.js.map +1 -1
  21. package/packages/mailx-service/index.ts +25 -1
  22. package/packages/mailx-service/jsonrpc.js +4 -0
  23. package/packages/mailx-service/jsonrpc.js.map +1 -1
  24. package/packages/mailx-service/jsonrpc.ts +4 -0
  25. package/packages/mailx-service/package.json +1 -1
  26. package/packages/mailx-settings/index.d.ts +8 -1
  27. package/packages/mailx-settings/index.d.ts.map +1 -1
  28. package/packages/mailx-settings/index.js +71 -0
  29. package/packages/mailx-settings/index.js.map +1 -1
  30. package/packages/mailx-settings/index.ts +61 -1
  31. package/packages/mailx-settings/package.json +1 -1
  32. package/packages/mailx-store/package.json +1 -1
  33. package/packages/mailx-store-web/android-bootstrap.js +4 -0
  34. package/packages/mailx-store-web/android-bootstrap.js.map +1 -1
  35. package/packages/mailx-store-web/android-bootstrap.ts +4 -0
  36. package/packages/mailx-store-web/package.json +1 -1
  37. package/packages/mailx-store-web/web-service.d.ts +4 -0
  38. package/packages/mailx-store-web/web-service.d.ts.map +1 -1
  39. package/packages/mailx-store-web/web-service.js +48 -2
  40. package/packages/mailx-store-web/web-service.js.map +1 -1
  41. package/packages/mailx-store-web/web-service.ts +41 -2
  42. package/packages/mailx-types/index.d.ts +2 -0
  43. package/packages/mailx-types/index.d.ts.map +1 -1
  44. package/packages/mailx-types/index.js +3 -0
  45. package/packages/mailx-types/index.js.map +1 -1
  46. package/packages/mailx-types/index.ts +7 -0
  47. package/packages/mailx-types/mailx-api.d.ts +14 -0
  48. package/packages/mailx-types/mailx-api.d.ts.map +1 -1
  49. package/packages/mailx-types/mailx-api.ts +5 -0
  50. package/packages/mailx-types/package.json +1 -1
  51. package/packages/mailx-types/reminder-state.d.ts +42 -0
  52. package/packages/mailx-types/reminder-state.d.ts.map +1 -0
  53. package/packages/mailx-types/reminder-state.js +85 -0
  54. package/packages/mailx-types/reminder-state.js.map +1 -0
  55. package/packages/mailx-types/reminder-state.ts +88 -0
  56. /package/packages/mailx-imap/{node_modules.npmglobalize-stash-69680 → node_modules.npmglobalize-stash-7544}/.package-lock.json +0 -0
@@ -83,6 +83,7 @@ __export(api_client_exports, {
83
83
  logClientEvent: () => logClientEvent,
84
84
  markAsSpamMessages: () => markAsSpamMessages,
85
85
  markFolderRead: () => markFolderRead,
86
+ mergeReminderState: () => mergeReminderState,
86
87
  moveFolderToTrash: () => moveFolderToTrash,
87
88
  moveMessage: () => moveMessage,
88
89
  moveMessages: () => moveMessages,
@@ -616,6 +617,9 @@ function closeWordEdit(editId) {
616
617
  function showReminderPopup(opts) {
617
618
  return ipc().showReminderPopup?.(opts) ?? Promise.resolve({ button: "", reason: "no host" });
618
619
  }
620
+ function mergeReminderState(patch) {
621
+ return ipc().mergeReminderState?.(patch) ?? Promise.resolve(null);
622
+ }
619
623
  function consumePendingMailto() {
620
624
  return ipc().consumePendingMailto?.() ?? Promise.resolve(null);
621
625
  }
@@ -942,6 +946,16 @@ var init_groups = __esm({
942
946
  }
943
947
  });
944
948
 
949
+ // packages/mailx-types/reminder-state.js
950
+ var DISMISSED_RETENTION_MS, SNOOZED_RETENTION_MS;
951
+ var init_reminder_state = __esm({
952
+ "packages/mailx-types/reminder-state.js"() {
953
+ "use strict";
954
+ DISMISSED_RETENTION_MS = 30 * 864e5;
955
+ SNOOZED_RETENTION_MS = 7 * 864e5;
956
+ }
957
+ });
958
+
945
959
  // packages/mailx-types/index.js
946
960
  function _has(msg, flag) {
947
961
  return !!msg.flags && msg.flags.includes(flag);
@@ -960,6 +974,7 @@ var init_mailx_types = __esm({
960
974
  init_contact_rules();
961
975
  init_contacts_config();
962
976
  init_groups();
977
+ init_reminder_state();
963
978
  _SEEN = "\\Seen";
964
979
  _FLAGGED = "\\Flagged";
965
980
  _DRAFT = "\\Draft";
@@ -6089,6 +6104,48 @@ function pruneState(now) {
6089
6104
  }
6090
6105
  if (changed)
6091
6106
  saveSnoozed(snoozed);
6107
+ const dismissed = loadDismissed();
6108
+ let dChanged = false;
6109
+ for (const [uuid, at] of Object.entries(dismissed)) {
6110
+ if (typeof at === "number" && at < now - 30 * 864e5) {
6111
+ delete dismissed[uuid];
6112
+ dChanged = true;
6113
+ }
6114
+ }
6115
+ if (dChanged)
6116
+ saveDismissed(dismissed);
6117
+ }
6118
+ async function syncReminderState(force = false) {
6119
+ const now = Date.now();
6120
+ if (!force && now - _lastStateSync < STATE_SYNC_MIN_MS)
6121
+ return false;
6122
+ _lastStateSync = now;
6123
+ try {
6124
+ const merged = await mergeReminderState({
6125
+ dismissed: loadDismissed(),
6126
+ // `true` legacy values are normalized service-side
6127
+ snoozed: loadSnoozed()
6128
+ });
6129
+ if (!merged)
6130
+ return false;
6131
+ const dm = loadDismissed();
6132
+ for (const [k, v] of Object.entries(merged.dismissed)) {
6133
+ const cur = dm[k];
6134
+ if (cur === void 0 || cur === true || v > cur)
6135
+ dm[k] = v;
6136
+ }
6137
+ saveDismissed(dm);
6138
+ const sn = loadSnoozed();
6139
+ for (const [k, v] of Object.entries(merged.snoozed)) {
6140
+ if (!sn[k] || v > sn[k])
6141
+ sn[k] = v;
6142
+ }
6143
+ saveSnoozed(sn);
6144
+ return true;
6145
+ } catch (e) {
6146
+ alog("state sync failed", { err: e?.message || String(e) });
6147
+ return false;
6148
+ }
6092
6149
  }
6093
6150
  function occKey(uuid, ms) {
6094
6151
  return `${uuid}:${ms}`;
@@ -6141,7 +6198,7 @@ async function collectDueAlarms(now) {
6141
6198
  continue;
6142
6199
  const k = `${occBaseKey}@${offsetMs}`;
6143
6200
  if (!dismissed[k]) {
6144
- dismissed[k] = true;
6201
+ dismissed[k] = Date.now();
6145
6202
  touched = true;
6146
6203
  }
6147
6204
  }
@@ -6407,7 +6464,7 @@ async function firePopupForItem(item) {
6407
6464
  case "closed":
6408
6465
  {
6409
6466
  const m = loadDismissed();
6410
- m[item.uuid] = true;
6467
+ m[item.uuid] = Date.now();
6411
6468
  saveDismissed(m);
6412
6469
  alog("dismiss saved", { key: item.uuid, via: r.button });
6413
6470
  }
@@ -6415,7 +6472,7 @@ async function firePopupForItem(item) {
6415
6472
  case "Delete":
6416
6473
  {
6417
6474
  const m = loadDismissed();
6418
- m[item.uuid] = true;
6475
+ m[item.uuid] = Date.now();
6419
6476
  saveDismissed(m);
6420
6477
  }
6421
6478
  firedThisSession.delete(item.uuid);
@@ -6425,7 +6482,7 @@ async function firePopupForItem(item) {
6425
6482
  alog("unknown popup result", { button: r.button, form: r.form });
6426
6483
  {
6427
6484
  const m = loadDismissed();
6428
- m[item.uuid] = true;
6485
+ m[item.uuid] = Date.now();
6429
6486
  saveDismissed(m);
6430
6487
  }
6431
6488
  break;
@@ -6434,11 +6491,12 @@ async function firePopupForItem(item) {
6434
6491
  alog("action handler threw \u2014 forcing Dismiss", { key: item.uuid, err: e?.message || String(e) });
6435
6492
  try {
6436
6493
  const m = loadDismissed();
6437
- m[item.uuid] = true;
6494
+ m[item.uuid] = Date.now();
6438
6495
  saveDismissed(m);
6439
6496
  } catch {
6440
6497
  }
6441
6498
  }
6499
+ void syncReminderState(true);
6442
6500
  }
6443
6501
  function snoozeItem(item, minutes) {
6444
6502
  const now = Date.now();
@@ -6453,7 +6511,10 @@ async function pollAlarms() {
6453
6511
  return;
6454
6512
  const now = Date.now();
6455
6513
  pruneState(now);
6456
- const due = await collectDueAlarms(now);
6514
+ let due = await collectDueAlarms(now);
6515
+ if (due.length > 0 && await syncReminderState()) {
6516
+ due = await collectDueAlarms(now);
6517
+ }
6457
6518
  const fresh = due.filter((d) => !firedThisSession.has(d.uuid) && !openPopups.has(d.uuid));
6458
6519
  if (fresh.length === 0)
6459
6520
  return;
@@ -6467,6 +6528,7 @@ function startAlarmPoller() {
6467
6528
  if (window.__mailxAlarmPollerRunning)
6468
6529
  return;
6469
6530
  window.__mailxAlarmPollerRunning = true;
6531
+ void syncReminderState(true);
6470
6532
  setTimeout(() => {
6471
6533
  pollAlarms().catch(() => {
6472
6534
  });
@@ -6481,7 +6543,7 @@ function startAlarmPoller() {
6481
6543
  });
6482
6544
  });
6483
6545
  }
6484
- var DISMISSED_KEY, SNOOZED_KEY, LOOKBACK_MS, LOOKAHEAD_MS, POLL_INTERVAL_MS, _soundCache, _lastSoundAt, firedThisSession, openPopups;
6546
+ var DISMISSED_KEY, SNOOZED_KEY, LOOKBACK_MS, LOOKAHEAD_MS, POLL_INTERVAL_MS, _soundCache, _lastSoundAt, _lastStateSync, STATE_SYNC_MIN_MS, firedThisSession, openPopups;
6485
6547
  var init_alarms = __esm({
6486
6548
  "client/components/alarms.js"() {
6487
6549
  "use strict";
@@ -6493,6 +6555,8 @@ var init_alarms = __esm({
6493
6555
  POLL_INTERVAL_MS = 3e4;
6494
6556
  _soundCache = null;
6495
6557
  _lastSoundAt = 0;
6558
+ _lastStateSync = 0;
6559
+ STATE_SYNC_MIN_MS = 6e4;
6496
6560
  firedThisSession = /* @__PURE__ */ new Set();
6497
6561
  openPopups = /* @__PURE__ */ new Set();
6498
6562
  }