@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
@@ -18634,11 +18634,19 @@ System.register(["tslib", "@web-atoms/core/dist/di/DISingleton", "@web-atoms/cor
18634
18634
  }
18635
18635
  msg.innerHTML = html;
18636
18636
  for (const iterator of descendentElementIterator(msg)) {
18637
- if (iterator.tagName === "IMG") {
18637
+ let cid = iterator.getAttribute("data-content-id");
18638
+ if (cid) {
18639
+ const a = mail.attachments.find(x => x.contentID === cid);
18640
+ if (a) {
18641
+ iterator.setAttribute("src", a.url);
18642
+ continue;
18643
+ }
18644
+ }
18645
+ if (/^(IMG|VIDEO)$/.test(iterator.tagName)) {
18638
18646
  const src = iterator.getAttribute("src");
18639
18647
  if (src) {
18640
18648
  if (src.startsWith("cid:")) {
18641
- const cid = src.substring(4);
18649
+ cid = src.substring(4);
18642
18650
  const a = mail.attachments.find(x => x.contentID === cid);
18643
18651
  if (a) {
18644
18652
  iterator.setAttribute("src", `/api/files/${a.appFileID}/${a.fileContentID}/${a.name}`);
@@ -19332,11 +19340,9 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
19332
19340
  }
19333
19341
  onContentSet() {
19334
19342
  var _a;
19335
- const start = (_a = Array.from(this.editor.querySelectorAll(this.editableSelector))) !== null && _a !== void 0 ? _a : [this.editor.firstElementChild];
19336
- if (start.length) {
19337
- for (const iterator of start) {
19338
- iterator.contentEditable = "true";
19339
- }
19343
+ const start = (_a = Array.from(this.editor.querySelectorAll(this.editableSelector))[0]) !== null && _a !== void 0 ? _a : this.editor.firstElementChild;
19344
+ if (start) {
19345
+ start.contentEditable = "true";
19340
19346
  }
19341
19347
  this.editor.dispatchEvent(new CustomEvent("contentReady", {
19342
19348
  detail: this.editor.innerHTML,
@@ -22178,7 +22184,7 @@ System.register(["tslib", "@web-atoms/core/dist/App", "@web-atoms/core/dist/core
22178
22184
  extra = JSON.parse(extra);
22179
22185
  }
22180
22186
  const sha256 = yield this.sha256(file);
22181
- if (extra.parentID) {
22187
+ if (extra === null || extra === void 0 ? void 0 : extra.parentID) {
22182
22188
  const existing = yield this.entityService.query(AppFile, "children", extra.parentID, folder ? folder + "/" + file.name : file.name, sha256).firstOrDefault();
22183
22189
  if (existing) {
22184
22190
  const {
@@ -22555,8 +22561,22 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/web-con
22555
22561
  _export("MailHtmlEditor", MailHtmlEditor = class MailHtmlEditor extends InlineHtmlEditor {
22556
22562
  constructor() {
22557
22563
  super(...arguments);
22564
+ this.files = [];
22565
+ this.attachments = [];
22558
22566
  this.autofocus = false;
22559
22567
  }
22568
+ onContentSet() {
22569
+ super.onContentSet();
22570
+ const files = this.attachments;
22571
+ const items = Array.from(this.editor.querySelectorAll(`*[data-content-id]`));
22572
+ for (const iterator of items) {
22573
+ const file = files.find(x => x.contentID === iterator.getAttribute("data-content-id"));
22574
+ if (!file) {
22575
+ continue;
22576
+ }
22577
+ iterator.setAttribute("src", file.url);
22578
+ }
22579
+ }
22560
22580
  onPasteEvent(e) {
22561
22581
  if (e.clipboardData.files.length) {
22562
22582
  e.preventDefault();
@@ -22582,7 +22602,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/web-con
22582
22602
  super.preCreate();
22583
22603
  this.element.className = css;
22584
22604
  this.sanitizeHtml = node => {
22585
- const images = Array.from(node.querySelectorAll(`img[data-content-id]`));
22605
+ const images = Array.from(node.querySelectorAll(`*[data-content-id]`));
22586
22606
  for (const image of images) {
22587
22607
  image.setAttribute("src", `cid:${image.getAttribute("data-content-id")}`);
22588
22608
  }
@@ -23858,7 +23878,8 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
23858
23878
  `.installGlobal("[data-html-editor=email-editor]");
23859
23879
  _export("default", ComposeMailPage = class ComposeMailPage extends PopupWindowPage {
23860
23880
  init() {
23861
- var _a, _b, _c;
23881
+ var _a, _b, _c, _d;
23882
+ var _e;
23862
23883
  return __awaiter(this, void 0, void 0, function* () {
23863
23884
  if (this.parameters.subject) {
23864
23885
  this.title = "Reply: " + this.parameters.subject;
@@ -23872,6 +23893,7 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
23872
23893
  recipients: [],
23873
23894
  attachments: []
23874
23895
  });
23896
+ (_c = (_e = this.model).attachments) !== null && _c !== void 0 ? _c : _e.attachments = [];
23875
23897
  if (this.parameters.social) {
23876
23898
  const senderName = this.parameters.mailbox.emailAddress.name;
23877
23899
  const senderEmail = this.parameters.mailbox.emailAddress.emailAddress;
@@ -23883,7 +23905,7 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
23883
23905
  if (this.parameters.emailAddress) {
23884
23906
  this.model.recipients.add(EmailRecipient.create({
23885
23907
  emailAddressText: this.parameters.emailAddress,
23886
- emailAddressID: (_c = this.parameters.emailAddressID) !== null && _c !== void 0 ? _c : void 0
23908
+ emailAddressID: (_d = this.parameters.emailAddressID) !== null && _d !== void 0 ? _d : void 0
23887
23909
  }));
23888
23910
  }
23889
23911
  this.renderer = XNode.create("div", null, XNode.create(Form, null, XNode.create(HorizontalFormField, {
@@ -23901,6 +23923,7 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
23901
23923
  "data-html-editor": "email-editor",
23902
23924
  presenter: Bind.presenter(c => this.editor = c),
23903
23925
  content: this.model.htmlBody,
23926
+ attachments: this.model.attachments,
23904
23927
  "style-min-height": "200px"
23905
23928
  }), XNode.create(AtomRepeater, {
23906
23929
  items: this.model.attachments,
@@ -26169,10 +26192,10 @@ System.register(["@web-atoms/core/dist/core/XNode", "@web-atoms/web-controls/dis
26169
26192
 
26170
26193
  AmdLoader.instance.setup("@social-mail/social-mail-client/dist/web/page/mails/mini-compose/Atttach");
26171
26194
 
26172
- 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) {
26195
+ 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) {
26173
26196
  "use strict";
26174
26197
 
26175
- 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;
26198
+ 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;
26176
26199
  _export("default", void 0);
26177
26200
  return {
26178
26201
  setters: [function (_tslib) {
@@ -26200,8 +26223,6 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
26200
26223
  AtomRepeater = _webAtomsWebControlsDistBasicAtomRepeater.default;
26201
26224
  }, function (_webAtomsCoreDistCoreInjectProperty) {
26202
26225
  InjectProperty = _webAtomsCoreDistCoreInjectProperty.default;
26203
- }, function (_webAtomsCoreDistCoreAtomBinder) {
26204
- AtomBinder = _webAtomsCoreDistCoreAtomBinder.AtomBinder;
26205
26226
  }, function (_commonEventsCommonEvents) {
26206
26227
  CommonEvents = _commonEventsCommonEvents.CommonEvents;
26207
26228
  }, function (_serviceMailService) {
@@ -26315,7 +26336,8 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
26315
26336
  "data-html-editor": "email-editor",
26316
26337
  presenter: Bind.presenter(c => this.editor = c),
26317
26338
  content: this.typedMessage,
26318
- "style-min-height": "50px"
26339
+ "style-min-height": "50px",
26340
+ attachments: Bind.oneWay(() => this.draft.attachments)
26319
26341
  }), XNode.create("i", {
26320
26342
  "data-element": "send",
26321
26343
  class: "fa-solid fa-microphone-lines mic",
@@ -26352,10 +26374,59 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
26352
26374
  extra
26353
26375
  }) {
26354
26376
  return __awaiter(this, void 0, void 0, function* () {
26355
- if (extra.insert) {}
26356
- this.addFiles(...files);
26377
+ if (extra.stream) {
26378
+ yield this.streamFiles({
26379
+ files,
26380
+ extra
26381
+ });
26382
+ return;
26383
+ }
26384
+ const size = files.reduce((pv, cv) => pv + cv.file.size, 0);
26385
+ if (size > 20 * 1024 * 1024) {
26386
+ if (!extra.stream) {
26387
+ throw new Error(`Total size of attachments cannot be more than 20MB.`);
26388
+ }
26389
+ }
26390
+ if (extra.insert) {
26391
+ this.ensureDraft();
26392
+ const firstChild = this.editor.editor.firstElementChild;
26393
+ for (const iterator of files) {
26394
+ if (/^image\//.test(iterator.contentType)) {
26395
+ const af = this.createAppFile(iterator);
26396
+ const img = firstChild.ownerDocument.createElement("img");
26397
+ img.src = iterator.url;
26398
+ img.setAttribute("data-content-id", af.contentID);
26399
+ this.draft.attachments.add(af);
26400
+ firstChild.appendChild(img);
26401
+ const newLine = document.createElement("div");
26402
+ newLine.appendChild(document.createElement("br"));
26403
+ firstChild.appendChild(newLine);
26404
+ continue;
26405
+ }
26406
+ if (/^(video|audio)\//.test(iterator.contentType)) {
26407
+ const af = this.createAppFile(iterator);
26408
+ const img = firstChild.ownerDocument.createElement("video");
26409
+ img.src = iterator.url;
26410
+ img.setAttribute("data-content-id", af.contentID);
26411
+ this.draft.attachments.add(af);
26412
+ firstChild.appendChild(img);
26413
+ const newLine = document.createElement("div");
26414
+ newLine.appendChild(document.createElement("br"));
26415
+ firstChild.appendChild(newLine);
26416
+ continue;
26417
+ }
26418
+ }
26419
+ return;
26420
+ }
26421
+ yield this.addFiles(...files);
26357
26422
  });
26358
26423
  }
26424
+ streamFiles({
26425
+ files,
26426
+ extra
26427
+ }) {
26428
+ return __awaiter(this, void 0, void 0, function* () {});
26429
+ }
26359
26430
  deleteAttachment(file) {
26360
26431
  var _a;
26361
26432
  return __awaiter(this, void 0, void 0, function* () {
@@ -26363,12 +26434,16 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
26363
26434
  (_a = this.draft) === null || _a === void 0 ? void 0 : _a.attachments.remove(file);
26364
26435
  });
26365
26436
  }
26366
- refreshDraft() {
26367
- var _a;
26437
+ recreateDraft() {
26438
+ var _a, _b;
26439
+ var _c;
26368
26440
  return __awaiter(this, void 0, void 0, function* () {
26441
+ this.draft = null;
26369
26442
  (_a = this.draft) !== null && _a !== void 0 ? _a : this.draft = Email.create({
26443
+ subject: "",
26370
26444
  attachments: []
26371
26445
  });
26446
+ (_b = (_c = this.draft).attachments) !== null && _b !== void 0 ? _b : _c.attachments = [];
26372
26447
  });
26373
26448
  }
26374
26449
  onChanged() {
@@ -26426,35 +26501,40 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
26426
26501
  });
26427
26502
  }
26428
26503
  sendAudioMessage() {
26429
- var _a;
26430
26504
  return __awaiter(this, void 0, void 0, function* () {
26431
26505
  const uploadedFile = yield AudioRecorder.show();
26432
- (_a = this.draft) !== null && _a !== void 0 ? _a : this.draft = Email.create({
26433
- attachments: []
26434
- });
26506
+ this.ensureDraft();
26435
26507
  this.draft.mdBody = this.typedMessage;
26436
- this.addFiles(uploadedFile);
26508
+ yield this.addFiles(uploadedFile);
26437
26509
  yield this.save();
26438
26510
  });
26439
26511
  }
26440
26512
  addFiles(...files) {
26441
- var _a;
26442
- var _b;
26443
- const attachments = (_a = (_b = this.draft).attachments) !== null && _a !== void 0 ? _a : _b.attachments = [];
26444
- AtomBinder.refreshValue(this, "draft");
26445
- for (const {
26446
- appFileID,
26447
- url,
26448
- file
26449
- } of files) {
26450
- attachments.add(AppFile.create({
26451
- appFileID,
26452
- contentType: file.type,
26453
- name: file.name,
26454
- contentID: appFileID.toString(36),
26455
- url
26456
- }));
26457
- }
26513
+ return __awaiter(this, void 0, void 0, function* () {
26514
+ this.ensureDraft();
26515
+ const attachments = this.draft.attachments;
26516
+ for (const file of files) {
26517
+ attachments.add(this.createAppFile(file));
26518
+ }
26519
+ });
26520
+ }
26521
+ createAppFile(file) {
26522
+ return AppFile.create({
26523
+ appFileID: file.appFileID,
26524
+ contentType: file.file.type,
26525
+ name: file.file.name,
26526
+ contentID: file.appFileID.toString(36),
26527
+ url: file.url
26528
+ });
26529
+ }
26530
+ ensureDraft() {
26531
+ var _a, _b;
26532
+ var _c;
26533
+ (_a = this.draft) !== null && _a !== void 0 ? _a : this.draft = Email.create({
26534
+ subject: "",
26535
+ attachments: []
26536
+ });
26537
+ (_b = (_c = this.draft).attachments) !== null && _b !== void 0 ? _b : _c.attachments = [];
26458
26538
  }
26459
26539
  save() {
26460
26540
  return __awaiter(this, void 0, void 0, function* () {
@@ -26475,7 +26555,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
26475
26555
  }), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise)], MiniComposeBox.prototype, "deleteAttachment", null);
26476
26556
  __decorate([Action({
26477
26557
  onEvent: CommonEvents.onDraftDeleted
26478
- }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MiniComposeBox.prototype, "refreshDraft", null);
26558
+ }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MiniComposeBox.prototype, "recreateDraft", null);
26479
26559
  __decorate([Action({
26480
26560
  onEvent: "input",
26481
26561
  defer: 500,