@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.
@@ -7317,17 +7317,35 @@ async function openCompose(mode, overrideMsg, overrideAccountId) {
7317
7317
  } catch (e) {
7318
7318
  console.error("[compose] sessionStorage.setItem failed:", e?.message || e);
7319
7319
  }
7320
+ const composeKey = "init-" + Math.random().toString(36).slice(2, 10);
7321
+ window.__mailxComposeInits = window.__mailxComposeInits || {};
7322
+ window.__mailxComposeInits[composeKey] = init;
7323
+ try {
7324
+ frame.dataset.composeKey = composeKey;
7325
+ } catch {
7326
+ }
7320
7327
  const post = () => {
7321
7328
  try {
7322
- frame?.contentWindow?.postMessage({ type: "compose-init", init }, "*");
7323
- } catch {
7329
+ frame?.contentWindow?.postMessage({ type: "compose-init", init, composeKey }, "*");
7330
+ } catch (e) {
7331
+ logClientEvent("compose-post-failed", { err: e?.message || String(e) });
7324
7332
  }
7325
7333
  };
7334
+ logClientEvent("compose-handoff", { hasFrame: !!frame, hasContentWindow: !!frame?.contentWindow, composeKey, bodyBytes: initJson.length });
7326
7335
  post();
7327
7336
  try {
7328
- frame?.addEventListener("load", post, { once: true });
7337
+ frame?.addEventListener("load", () => {
7338
+ logClientEvent("compose-iframe-loaded", { composeKey });
7339
+ post();
7340
+ });
7329
7341
  } catch {
7330
7342
  }
7343
+ let attempts = 0;
7344
+ const heartbeat = setInterval(() => {
7345
+ attempts++;
7346
+ post();
7347
+ if (attempts >= 30) clearInterval(heartbeat);
7348
+ }, 100);
7331
7349
  }
7332
7350
  function showComposeOverlay(title = "Compose") {
7333
7351
  const wrapper = document.createElement("div");