@bobfrankston/rmfmail 1.1.141 → 1.1.142
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/client/app.bundle.js +21 -3
- package/client/app.bundle.js.map +2 -2
- package/client/app.js +28 -3
- package/client/app.js.map +1 -1
- package/client/app.ts +22 -2
- package/client/compose/compose.bundle.js +37 -4
- package/client/compose/compose.bundle.js.map +2 -2
- package/client/compose/compose.js +50 -7
- package/client/compose/compose.js.map +1 -1
- package/client/compose/compose.ts +37 -7
- package/package.json +1 -1
- /package/packages/mailx-imap/{node_modules.npmglobalize-stash-39256 → node_modules.npmglobalize-stash-21212}/.package-lock.json +0 -0
package/client/app.js
CHANGED
|
@@ -994,18 +994,43 @@ async function openCompose(mode, overrideMsg, overrideAccountId) {
|
|
|
994
994
|
catch (e) {
|
|
995
995
|
console.error("[compose] sessionStorage.setItem failed:", e?.message || e);
|
|
996
996
|
}
|
|
997
|
+
// Stash on the parent window so a same-origin iframe can pull it via
|
|
998
|
+
// window.parent (most reliable handoff under WebView2 custom-protocol —
|
|
999
|
+
// sessionStorage and postMessage both fail intermittently). Keyed by
|
|
1000
|
+
// a unique token in the iframe URL so concurrent composes don't crosswire.
|
|
1001
|
+
const composeKey = "init-" + Math.random().toString(36).slice(2, 10);
|
|
1002
|
+
window.__mailxComposeInits = window.__mailxComposeInits || {};
|
|
1003
|
+
window.__mailxComposeInits[composeKey] = init;
|
|
1004
|
+
// Expose the key on the iframe so its IIFE can fetch the right blob.
|
|
1005
|
+
try {
|
|
1006
|
+
frame.dataset.composeKey = composeKey;
|
|
1007
|
+
}
|
|
1008
|
+
catch { /* */ }
|
|
997
1009
|
const post = () => {
|
|
998
1010
|
try {
|
|
999
|
-
frame?.contentWindow?.postMessage({ type: "compose-init", init }, "*");
|
|
1011
|
+
frame?.contentWindow?.postMessage({ type: "compose-init", init, composeKey }, "*");
|
|
1012
|
+
}
|
|
1013
|
+
catch (e) {
|
|
1014
|
+
logClientEvent("compose-post-failed", { err: e?.message || String(e) });
|
|
1000
1015
|
}
|
|
1001
|
-
catch { /* */ }
|
|
1002
1016
|
};
|
|
1017
|
+
logClientEvent("compose-handoff", { hasFrame: !!frame, hasContentWindow: !!frame?.contentWindow, composeKey, bodyBytes: initJson.length });
|
|
1003
1018
|
post();
|
|
1004
1019
|
// Iframe may not be loaded yet — re-post on load so the listener exists.
|
|
1005
1020
|
try {
|
|
1006
|
-
frame?.addEventListener("load",
|
|
1021
|
+
frame?.addEventListener("load", () => { logClientEvent("compose-iframe-loaded", { composeKey }); post(); });
|
|
1007
1022
|
}
|
|
1008
1023
|
catch { /* */ }
|
|
1024
|
+
// And keep posting every 100ms for up to 3s as a defense-in-depth — if
|
|
1025
|
+
// both load and the initial post race the wrong way, the iframe's IIFE
|
|
1026
|
+
// will see the payload on its next tick.
|
|
1027
|
+
let attempts = 0;
|
|
1028
|
+
const heartbeat = setInterval(() => {
|
|
1029
|
+
attempts++;
|
|
1030
|
+
post();
|
|
1031
|
+
if (attempts >= 30)
|
|
1032
|
+
clearInterval(heartbeat);
|
|
1033
|
+
}, 100);
|
|
1009
1034
|
}
|
|
1010
1035
|
function showComposeOverlay(title = "Compose") {
|
|
1011
1036
|
const wrapper = document.createElement("div");
|