@social-mail/social-mail-client 1.2.87 → 1.2.88

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 (41) hide show
  1. package/dist/admin/AdminAppIndex.pack.js +123 -43
  2. package/dist/admin/AdminAppIndex.pack.js.map +1 -1
  3. package/dist/admin/AdminAppIndex.pack.min.js +7 -7
  4. package/dist/admin/AdminAppIndex.pack.min.js.map +1 -1
  5. package/dist/common/controls/html/InlineHtmlEditorWithToolbar.d.ts +3 -0
  6. package/dist/common/controls/html/InlineHtmlEditorWithToolbar.d.ts.map +1 -1
  7. package/dist/common/controls/html/InlineHtmlEditorWithToolbar.js +15 -1
  8. package/dist/common/controls/html/InlineHtmlEditorWithToolbar.js.map +1 -1
  9. package/dist/public/channel/ChannelView.pack.js +10 -2
  10. package/dist/public/channel/ChannelView.pack.js.map +1 -1
  11. package/dist/public/channel/ChannelView.pack.min.js +1 -1
  12. package/dist/public/channel/ChannelView.pack.min.js.map +1 -1
  13. package/dist/services/files/LocalFileService.js +1 -1
  14. package/dist/services/files/LocalFileService.js.map +1 -1
  15. package/dist/tsconfig.tsbuildinfo +1 -1
  16. package/dist/web/AppIndex.pack.js +123 -43
  17. package/dist/web/AppIndex.pack.js.map +1 -1
  18. package/dist/web/AppIndex.pack.min.js +7 -7
  19. package/dist/web/AppIndex.pack.min.js.map +1 -1
  20. package/dist/web/page/mails/ComposeMailPage.d.ts.map +1 -1
  21. package/dist/web/page/mails/ComposeMailPage.js +5 -2
  22. package/dist/web/page/mails/ComposeMailPage.js.map +1 -1
  23. package/dist/web/page/mails/mini-compose/MiniComposeBox.d.ts +9 -2
  24. package/dist/web/page/mails/mini-compose/MiniComposeBox.d.ts.map +1 -1
  25. package/dist/web/page/mails/mini-compose/MiniComposeBox.js +89 -32
  26. package/dist/web/page/mails/mini-compose/MiniComposeBox.js.map +1 -1
  27. package/dist/web/page/mails/service/ConversationService.d.ts.map +1 -1
  28. package/dist/web/page/mails/service/ConversationService.js +10 -2
  29. package/dist/web/page/mails/service/ConversationService.js.map +1 -1
  30. package/node_modules/@web-atoms/web-controls/dist/html-editor/InlineHtmlEditor.d.ts.map +1 -1
  31. package/node_modules/@web-atoms/web-controls/dist/html-editor/InlineHtmlEditor.js +3 -5
  32. package/node_modules/@web-atoms/web-controls/dist/html-editor/InlineHtmlEditor.js.map +1 -1
  33. package/node_modules/@web-atoms/web-controls/dist/tsconfig.tsbuildinfo +1 -1
  34. package/node_modules/@web-atoms/web-controls/package.json +1 -1
  35. package/node_modules/@web-atoms/web-controls/src/html-editor/InlineHtmlEditor.tsx +3 -9
  36. package/package.json +2 -2
  37. package/src/common/controls/html/InlineHtmlEditorWithToolbar.tsx +18 -2
  38. package/src/services/files/LocalFileService.tsx +1 -1
  39. package/src/web/page/mails/ComposeMailPage.tsx +3 -0
  40. package/src/web/page/mails/mini-compose/MiniComposeBox.tsx +79 -18
  41. package/src/web/page/mails/service/ConversationService.tsx +10 -2
@@ -18606,7 +18606,7 @@ System.register(["tslib", "@web-atoms/core/dist/App", "@web-atoms/core/dist/core
18606
18606
  extra = JSON.parse(extra);
18607
18607
  }
18608
18608
  const sha256 = yield this.sha256(file);
18609
- if (extra.parentID) {
18609
+ if (extra === null || extra === void 0 ? void 0 : extra.parentID) {
18610
18610
  const existing = yield this.entityService.query(AppFile, "children", extra.parentID, folder ? folder + "/" + file.name : file.name, sha256).firstOrDefault();
18611
18611
  if (existing) {
18612
18612
  const {
@@ -22411,11 +22411,19 @@ System.register(["tslib", "@web-atoms/core/dist/di/DISingleton", "@web-atoms/cor
22411
22411
  }
22412
22412
  msg.innerHTML = html;
22413
22413
  for (const iterator of descendentElementIterator(msg)) {
22414
- if (iterator.tagName === "IMG") {
22414
+ let cid = iterator.getAttribute("data-content-id");
22415
+ if (cid) {
22416
+ const a = mail.attachments.find(x => x.contentID === cid);
22417
+ if (a) {
22418
+ iterator.setAttribute("src", a.url);
22419
+ continue;
22420
+ }
22421
+ }
22422
+ if (/^(IMG|VIDEO)$/.test(iterator.tagName)) {
22415
22423
  const src = iterator.getAttribute("src");
22416
22424
  if (src) {
22417
22425
  if (src.startsWith("cid:")) {
22418
- const cid = src.substring(4);
22426
+ cid = src.substring(4);
22419
22427
  const a = mail.attachments.find(x => x.contentID === cid);
22420
22428
  if (a) {
22421
22429
  iterator.setAttribute("src", `/api/files/${a.appFileID}/${a.fileContentID}/${a.name}`);
@@ -23075,11 +23083,9 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
23075
23083
  }
23076
23084
  onContentSet() {
23077
23085
  var _a;
23078
- const start = (_a = Array.from(this.editor.querySelectorAll(this.editableSelector))) !== null && _a !== void 0 ? _a : [this.editor.firstElementChild];
23079
- if (start.length) {
23080
- for (const iterator of start) {
23081
- iterator.contentEditable = "true";
23082
- }
23086
+ const start = (_a = Array.from(this.editor.querySelectorAll(this.editableSelector))[0]) !== null && _a !== void 0 ? _a : this.editor.firstElementChild;
23087
+ if (start) {
23088
+ start.contentEditable = "true";
23083
23089
  }
23084
23090
  this.editor.dispatchEvent(new CustomEvent("contentReady", {
23085
23091
  detail: this.editor.innerHTML,
@@ -25571,8 +25577,22 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/web-con
25571
25577
  _export("MailHtmlEditor", MailHtmlEditor = class MailHtmlEditor extends InlineHtmlEditor {
25572
25578
  constructor() {
25573
25579
  super(...arguments);
25580
+ this.files = [];
25581
+ this.attachments = [];
25574
25582
  this.autofocus = false;
25575
25583
  }
25584
+ onContentSet() {
25585
+ super.onContentSet();
25586
+ const files = this.attachments;
25587
+ const items = Array.from(this.editor.querySelectorAll(`*[data-content-id]`));
25588
+ for (const iterator of items) {
25589
+ const file = files.find(x => x.contentID === iterator.getAttribute("data-content-id"));
25590
+ if (!file) {
25591
+ continue;
25592
+ }
25593
+ iterator.setAttribute("src", file.url);
25594
+ }
25595
+ }
25576
25596
  onPasteEvent(e) {
25577
25597
  if (e.clipboardData.files.length) {
25578
25598
  e.preventDefault();
@@ -25598,7 +25618,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/web-con
25598
25618
  super.preCreate();
25599
25619
  this.element.className = css;
25600
25620
  this.sanitizeHtml = node => {
25601
- const images = Array.from(node.querySelectorAll(`img[data-content-id]`));
25621
+ const images = Array.from(node.querySelectorAll(`*[data-content-id]`));
25602
25622
  for (const image of images) {
25603
25623
  image.setAttribute("src", `cid:${image.getAttribute("data-content-id")}`);
25604
25624
  }
@@ -26874,7 +26894,8 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
26874
26894
  `.installGlobal("[data-html-editor=email-editor]");
26875
26895
  _export("default", ComposeMailPage = class ComposeMailPage extends PopupWindowPage {
26876
26896
  init() {
26877
- var _a, _b, _c;
26897
+ var _a, _b, _c, _d;
26898
+ var _e;
26878
26899
  return __awaiter(this, void 0, void 0, function* () {
26879
26900
  if (this.parameters.subject) {
26880
26901
  this.title = "Reply: " + this.parameters.subject;
@@ -26888,6 +26909,7 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
26888
26909
  recipients: [],
26889
26910
  attachments: []
26890
26911
  });
26912
+ (_c = (_e = this.model).attachments) !== null && _c !== void 0 ? _c : _e.attachments = [];
26891
26913
  if (this.parameters.social) {
26892
26914
  const senderName = this.parameters.mailbox.emailAddress.name;
26893
26915
  const senderEmail = this.parameters.mailbox.emailAddress.emailAddress;
@@ -26899,7 +26921,7 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
26899
26921
  if (this.parameters.emailAddress) {
26900
26922
  this.model.recipients.add(EmailRecipient.create({
26901
26923
  emailAddressText: this.parameters.emailAddress,
26902
- emailAddressID: (_c = this.parameters.emailAddressID) !== null && _c !== void 0 ? _c : void 0
26924
+ emailAddressID: (_d = this.parameters.emailAddressID) !== null && _d !== void 0 ? _d : void 0
26903
26925
  }));
26904
26926
  }
26905
26927
  this.renderer = XNode.create("div", null, XNode.create(Form, null, XNode.create(HorizontalFormField, {
@@ -26917,6 +26939,7 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
26917
26939
  "data-html-editor": "email-editor",
26918
26940
  presenter: Bind.presenter(c => this.editor = c),
26919
26941
  content: this.model.htmlBody,
26942
+ attachments: this.model.attachments,
26920
26943
  "style-min-height": "200px"
26921
26944
  }), XNode.create(AtomRepeater, {
26922
26945
  items: this.model.attachments,
@@ -33486,10 +33509,10 @@ System.register(["@web-atoms/core/dist/core/XNode", "@web-atoms/web-controls/dis
33486
33509
 
33487
33510
  AmdLoader.instance.setup("@social-mail/social-mail-client/dist/web/page/mails/mini-compose/Atttach");
33488
33511
 
33489
- System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/dist/style/styled", "@web-atoms/core/dist/web/controls/AtomControl", "../../../../model/model", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dist/view-model/Action", "../../../../common/controls/audio/AudioRecorder", "../service/ConversationService", "@web-atoms/web-controls/dist/basic/AtomRepeater", "@web-atoms/core/dist/core/InjectProperty", "@web-atoms/core/dist/core/AtomBinder", "../../../../common/events/CommonEvents", "../service/MailService", "@web-atoms/date-time/dist/DateTime", "@web-atoms/core/dist/core/sleep", "../../../../common/controls/html/InlineHtmlEditorWithToolbar", "@web-atoms/web-controls/dist/html-editor/AtomHtmlEditor", "@web-atoms/web-controls/dist/html-editor/commands/Align", "@web-atoms/web-controls/dist/html-editor/commands/Bold", "@web-atoms/web-controls/dist/html-editor/commands/Italic", "@web-atoms/web-controls/dist/html-editor/commands/StrikeThrough", "@web-atoms/web-controls/dist/html-editor/commands/Underline", "@web-atoms/web-controls/dist/html-editor/commands/AddLink", "@web-atoms/web-controls/dist/html-editor/commands/Unlink", "@web-atoms/web-controls/dist/html-editor/commands/Separator", "./Insert", "@web-atoms/date-time/dist/TimeSpan", "./Atttach"], function (_export, _context) {
33512
+ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/dist/style/styled", "@web-atoms/core/dist/web/controls/AtomControl", "../../../../model/model", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dist/view-model/Action", "../../../../common/controls/audio/AudioRecorder", "../service/ConversationService", "@web-atoms/web-controls/dist/basic/AtomRepeater", "@web-atoms/core/dist/core/InjectProperty", "../../../../common/events/CommonEvents", "../service/MailService", "@web-atoms/date-time/dist/DateTime", "@web-atoms/core/dist/core/sleep", "../../../../common/controls/html/InlineHtmlEditorWithToolbar", "@web-atoms/web-controls/dist/html-editor/AtomHtmlEditor", "@web-atoms/web-controls/dist/html-editor/commands/Align", "@web-atoms/web-controls/dist/html-editor/commands/Bold", "@web-atoms/web-controls/dist/html-editor/commands/Italic", "@web-atoms/web-controls/dist/html-editor/commands/StrikeThrough", "@web-atoms/web-controls/dist/html-editor/commands/Underline", "@web-atoms/web-controls/dist/html-editor/commands/AddLink", "@web-atoms/web-controls/dist/html-editor/commands/Unlink", "@web-atoms/web-controls/dist/html-editor/commands/Separator", "./Insert", "@web-atoms/date-time/dist/TimeSpan", "./Atttach"], function (_export, _context) {
33490
33513
  "use strict";
33491
33514
 
33492
- var __awaiter, __decorate, __metadata, XNode, styled, AtomControl, AppFile, Email, Bind, Action, AudioRecorder, ConversationService, AtomRepeater, InjectProperty, AtomBinder, CommonEvents, MailService, DateTime, sleep, MailHtmlEditor, Toolbar, Align, Bold, Italic, StrikeThrough, Underline, AddLink, Unlink, Separator, Insert, TimeSpan, Attach, MiniComposeBox, css;
33515
+ var __awaiter, __decorate, __metadata, XNode, styled, AtomControl, AppFile, Email, Bind, Action, AudioRecorder, ConversationService, AtomRepeater, InjectProperty, CommonEvents, MailService, DateTime, sleep, MailHtmlEditor, Toolbar, Align, Bold, Italic, StrikeThrough, Underline, AddLink, Unlink, Separator, Insert, TimeSpan, Attach, MiniComposeBox, css;
33493
33516
  _export("default", void 0);
33494
33517
  return {
33495
33518
  setters: [function (_tslib) {
@@ -33517,8 +33540,6 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
33517
33540
  AtomRepeater = _webAtomsWebControlsDistBasicAtomRepeater.default;
33518
33541
  }, function (_webAtomsCoreDistCoreInjectProperty) {
33519
33542
  InjectProperty = _webAtomsCoreDistCoreInjectProperty.default;
33520
- }, function (_webAtomsCoreDistCoreAtomBinder) {
33521
- AtomBinder = _webAtomsCoreDistCoreAtomBinder.AtomBinder;
33522
33543
  }, function (_commonEventsCommonEvents) {
33523
33544
  CommonEvents = _commonEventsCommonEvents.CommonEvents;
33524
33545
  }, function (_serviceMailService) {
@@ -33632,7 +33653,8 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
33632
33653
  "data-html-editor": "email-editor",
33633
33654
  presenter: Bind.presenter(c => this.editor = c),
33634
33655
  content: this.typedMessage,
33635
- "style-min-height": "50px"
33656
+ "style-min-height": "50px",
33657
+ attachments: Bind.oneWay(() => this.draft.attachments)
33636
33658
  }), XNode.create("i", {
33637
33659
  "data-element": "send",
33638
33660
  class: "fa-solid fa-microphone-lines mic",
@@ -33669,10 +33691,59 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
33669
33691
  extra
33670
33692
  }) {
33671
33693
  return __awaiter(this, void 0, void 0, function* () {
33672
- if (extra.insert) {}
33673
- this.addFiles(...files);
33694
+ if (extra.stream) {
33695
+ yield this.streamFiles({
33696
+ files,
33697
+ extra
33698
+ });
33699
+ return;
33700
+ }
33701
+ const size = files.reduce((pv, cv) => pv + cv.file.size, 0);
33702
+ if (size > 20 * 1024 * 1024) {
33703
+ if (!extra.stream) {
33704
+ throw new Error(`Total size of attachments cannot be more than 20MB.`);
33705
+ }
33706
+ }
33707
+ if (extra.insert) {
33708
+ this.ensureDraft();
33709
+ const firstChild = this.editor.editor.firstElementChild;
33710
+ for (const iterator of files) {
33711
+ if (/^image\//.test(iterator.contentType)) {
33712
+ const af = this.createAppFile(iterator);
33713
+ const img = firstChild.ownerDocument.createElement("img");
33714
+ img.src = iterator.url;
33715
+ img.setAttribute("data-content-id", af.contentID);
33716
+ this.draft.attachments.add(af);
33717
+ firstChild.appendChild(img);
33718
+ const newLine = document.createElement("div");
33719
+ newLine.appendChild(document.createElement("br"));
33720
+ firstChild.appendChild(newLine);
33721
+ continue;
33722
+ }
33723
+ if (/^(video|audio)\//.test(iterator.contentType)) {
33724
+ const af = this.createAppFile(iterator);
33725
+ const img = firstChild.ownerDocument.createElement("video");
33726
+ img.src = iterator.url;
33727
+ img.setAttribute("data-content-id", af.contentID);
33728
+ this.draft.attachments.add(af);
33729
+ firstChild.appendChild(img);
33730
+ const newLine = document.createElement("div");
33731
+ newLine.appendChild(document.createElement("br"));
33732
+ firstChild.appendChild(newLine);
33733
+ continue;
33734
+ }
33735
+ }
33736
+ return;
33737
+ }
33738
+ yield this.addFiles(...files);
33674
33739
  });
33675
33740
  }
33741
+ streamFiles({
33742
+ files,
33743
+ extra
33744
+ }) {
33745
+ return __awaiter(this, void 0, void 0, function* () {});
33746
+ }
33676
33747
  deleteAttachment(file) {
33677
33748
  var _a;
33678
33749
  return __awaiter(this, void 0, void 0, function* () {
@@ -33680,12 +33751,16 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
33680
33751
  (_a = this.draft) === null || _a === void 0 ? void 0 : _a.attachments.remove(file);
33681
33752
  });
33682
33753
  }
33683
- refreshDraft() {
33684
- var _a;
33754
+ recreateDraft() {
33755
+ var _a, _b;
33756
+ var _c;
33685
33757
  return __awaiter(this, void 0, void 0, function* () {
33758
+ this.draft = null;
33686
33759
  (_a = this.draft) !== null && _a !== void 0 ? _a : this.draft = Email.create({
33760
+ subject: "",
33687
33761
  attachments: []
33688
33762
  });
33763
+ (_b = (_c = this.draft).attachments) !== null && _b !== void 0 ? _b : _c.attachments = [];
33689
33764
  });
33690
33765
  }
33691
33766
  onChanged() {
@@ -33743,35 +33818,40 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
33743
33818
  });
33744
33819
  }
33745
33820
  sendAudioMessage() {
33746
- var _a;
33747
33821
  return __awaiter(this, void 0, void 0, function* () {
33748
33822
  const uploadedFile = yield AudioRecorder.show();
33749
- (_a = this.draft) !== null && _a !== void 0 ? _a : this.draft = Email.create({
33750
- attachments: []
33751
- });
33823
+ this.ensureDraft();
33752
33824
  this.draft.mdBody = this.typedMessage;
33753
- this.addFiles(uploadedFile);
33825
+ yield this.addFiles(uploadedFile);
33754
33826
  yield this.save();
33755
33827
  });
33756
33828
  }
33757
33829
  addFiles(...files) {
33758
- var _a;
33759
- var _b;
33760
- const attachments = (_a = (_b = this.draft).attachments) !== null && _a !== void 0 ? _a : _b.attachments = [];
33761
- AtomBinder.refreshValue(this, "draft");
33762
- for (const {
33763
- appFileID,
33764
- url,
33765
- file
33766
- } of files) {
33767
- attachments.add(AppFile.create({
33768
- appFileID,
33769
- contentType: file.type,
33770
- name: file.name,
33771
- contentID: appFileID.toString(36),
33772
- url
33773
- }));
33774
- }
33830
+ return __awaiter(this, void 0, void 0, function* () {
33831
+ this.ensureDraft();
33832
+ const attachments = this.draft.attachments;
33833
+ for (const file of files) {
33834
+ attachments.add(this.createAppFile(file));
33835
+ }
33836
+ });
33837
+ }
33838
+ createAppFile(file) {
33839
+ return AppFile.create({
33840
+ appFileID: file.appFileID,
33841
+ contentType: file.file.type,
33842
+ name: file.file.name,
33843
+ contentID: file.appFileID.toString(36),
33844
+ url: file.url
33845
+ });
33846
+ }
33847
+ ensureDraft() {
33848
+ var _a, _b;
33849
+ var _c;
33850
+ (_a = this.draft) !== null && _a !== void 0 ? _a : this.draft = Email.create({
33851
+ subject: "",
33852
+ attachments: []
33853
+ });
33854
+ (_b = (_c = this.draft).attachments) !== null && _b !== void 0 ? _b : _c.attachments = [];
33775
33855
  }
33776
33856
  save() {
33777
33857
  return __awaiter(this, void 0, void 0, function* () {
@@ -33792,7 +33872,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
33792
33872
  }), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise)], MiniComposeBox.prototype, "deleteAttachment", null);
33793
33873
  __decorate([Action({
33794
33874
  onEvent: CommonEvents.onDraftDeleted
33795
- }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MiniComposeBox.prototype, "refreshDraft", null);
33875
+ }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MiniComposeBox.prototype, "recreateDraft", null);
33796
33876
  __decorate([Action({
33797
33877
  onEvent: "input",
33798
33878
  defer: 500,