@social-mail/social-mail-client 1.2.57 → 1.2.59

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.
@@ -14396,13 +14396,21 @@ System.register(["tslib", "@web-atoms/core/dist/di/DISingleton", "@web-atoms/ent
14396
14396
  if (content) {
14397
14397
  return email.htmlBody = yield content.text();
14398
14398
  }
14399
- const text = yield FetchBuilder.get(email.htmlBodyUrl).responseAsText();
14400
- yield cache.put(cacheKey, new Response(text, {
14401
- headers: {
14402
- "cache-control": "public, max-age=86000"
14399
+ return yield this.run(() => __awaiter(this, void 0, void 0, function* () {
14400
+ for (let i = 0; i < 3; i++) {
14401
+ try {
14402
+ const text = yield FetchBuilder.get(email.htmlBodyUrl).responseAsText();
14403
+ yield cache.put(cacheKey, new Response(text, {
14404
+ headers: {
14405
+ "cache-control": "public, max-age=86000"
14406
+ }
14407
+ }));
14408
+ return email.htmlBody = text;
14409
+ } catch (error) {
14410
+ console.error(error);
14411
+ }
14403
14412
  }
14404
14413
  }));
14405
- return email.htmlBody = text;
14406
14414
  });
14407
14415
  }
14408
14416
  };
@@ -14735,10 +14743,10 @@ System.register(["@web-atoms/core/dist/core/EventScope"], function (_export, _co
14735
14743
 
14736
14744
  AmdLoader.instance.setup("@social-mail/social-mail-client/dist/common/events/CommonEvents");
14737
14745
 
14738
- System.register(["tslib", "@web-atoms/core/dist/di/DISingleton", "@web-atoms/core/dist/di/Inject", "../../../../services/EntityService", "../../../../model/model", "../../../../common/Sql", "@web-atoms/email-dom/dist/DomToString", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/dist/web/controls/AtomControl", "@web-atoms/core/dist/web/core/AtomUI", "@web-atoms/date-time/dist/DateTime", "../../../../common/events/CommonEvents", "../../../../services/BusyProgress"], function (_export, _context) {
14746
+ System.register(["tslib", "@web-atoms/core/dist/di/DISingleton", "@web-atoms/core/dist/di/Inject", "../../../../services/EntityService", "../../../../model/model", "../../../../common/Sql", "@web-atoms/email-dom/dist/DomToString", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/dist/web/controls/AtomControl", "@web-atoms/core/dist/web/core/AtomUI", "@web-atoms/date-time/dist/DateTime", "../../../../common/events/CommonEvents", "../../../../services/BusyProgress", "../../../../services/email/EmailContentDownloader"], function (_export, _context) {
14739
14747
  "use strict";
14740
14748
 
14741
- var __awaiter, __decorate, __metadata, DISingleton, Inject, EntityService, Email, EmailRecipient, MailboxContactEmail, MailboxEmail, Sql, DomToString, XNode, AtomControl, descendentElementIterator, DateTime, CommonEvents, BusyProgress, renderMail, downloadEmailContent, ConversationService;
14749
+ var __awaiter, __decorate, __metadata, DISingleton, Inject, EntityService, Email, EmailRecipient, MailboxContactEmail, MailboxEmail, Sql, DomToString, XNode, AtomControl, descendentElementIterator, DateTime, CommonEvents, BusyProgress, EmailContentDownloader, renderMail, downloadEmailContent, ConversationService;
14742
14750
  return {
14743
14751
  setters: [function (_tslib) {
14744
14752
  __awaiter = _tslib.__awaiter;
@@ -14771,6 +14779,8 @@ System.register(["tslib", "@web-atoms/core/dist/di/DISingleton", "@web-atoms/cor
14771
14779
  CommonEvents = _commonEventsCommonEvents.CommonEvents;
14772
14780
  }, function (_servicesBusyProgress) {
14773
14781
  BusyProgress = _servicesBusyProgress.default;
14782
+ }, function (_servicesEmailEmailContentDownloader) {
14783
+ EmailContentDownloader = _servicesEmailEmailContentDownloader.default;
14774
14784
  }],
14775
14785
  execute: function () {
14776
14786
  _export("renderMail", renderMail = AtomControl.registerProperty("data-html", "html", (c, e, value) => {
@@ -14953,7 +14963,7 @@ System.register(["tslib", "@web-atoms/core/dist/di/DISingleton", "@web-atoms/cor
14953
14963
  } of emails.items) {
14954
14964
  (_a = email.htmlBody) !== null && _a !== void 0 ? _a : email.htmlBody = "";
14955
14965
  (_b = email.textBody) !== null && _b !== void 0 ? _b : email.textBody = "";
14956
- tasks.push(downloadEmailContent(this.entityService, email));
14966
+ tasks.push(this.downloadEmailContent(email));
14957
14967
  }
14958
14968
  yield Promise.all(tasks);
14959
14969
  } finally {
@@ -14972,6 +14982,28 @@ System.register(["tslib", "@web-atoms/core/dist/di/DISingleton", "@web-atoms/cor
14972
14982
  CommonEvents.onEmailUnscheduled.dispatchEvent(mce);
14973
14983
  });
14974
14984
  }
14985
+ downloadEmailContent(email) {
14986
+ var _a, _b;
14987
+ return __awaiter(this, void 0, void 0, function* () {
14988
+ if (email.replyCount) {
14989
+ const children = yield this.entityService.query(Email).where({
14990
+ emailID: email.emailID
14991
+ }, p => x => x.emailID === p.emailID && x.engagement !== null).orderByDescending(x => x.emailID).toPagedList({
14992
+ start: 0,
14993
+ size: 4,
14994
+ cacheVersion: "a",
14995
+ cacheSeconds: 900
14996
+ });
14997
+ email.children = (_a = children === null || children === void 0 ? void 0 : children.items) !== null && _a !== void 0 ? _a : [];
14998
+ } else {
14999
+ (_b = email.children) !== null && _b !== void 0 ? _b : email.children = [];
15000
+ }
15001
+ if (!email.originalFileID) {
15002
+ return;
15003
+ }
15004
+ yield this.emailContentDownloader.download(email);
15005
+ });
15006
+ }
14975
15007
  renderText(html) {
14976
15008
  const div = document.createElement("div");
14977
15009
  div.innerHTML = html;
@@ -15010,6 +15042,7 @@ System.register(["tslib", "@web-atoms/core/dist/di/DISingleton", "@web-atoms/cor
15010
15042
  }
15011
15043
  };
15012
15044
  __decorate([Inject, __metadata("design:type", EntityService)], ConversationService.prototype, "entityService", void 0);
15045
+ __decorate([Inject, __metadata("design:type", EmailContentDownloader)], ConversationService.prototype, "emailContentDownloader", void 0);
15013
15046
  ConversationService = __decorate([DISingleton()], ConversationService);
15014
15047
  _export("default", ConversationService);
15015
15048
  }