@social-mail/social-mail-client 1.2.262 → 1.2.263

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.
@@ -30140,10 +30140,10 @@ System.register(["@web-atoms/core/dist/core/XNode"], function (_export, _context
30140
30140
 
30141
30141
  AmdLoader.instance.setup("@social-mail/social-mail-client/dist/common/controls/Loader");
30142
30142
 
30143
- 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", "./Attach", "@web-atoms/core/dist/core/types", "@web-atoms/email-dom/dist/DomToString", "../../../../common/controls/email-recipients/EmailLabel", "../../../../common/controls/Loader", "@web-atoms/core/dist/web/core/AtomUI"], function (_export, _context) {
30143
+ 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", "./Attach", "@web-atoms/core/dist/core/types", "@web-atoms/email-dom/dist/DomToString", "../../../../common/controls/email-recipients/EmailLabel", "../../../../common/controls/Loader", "@web-atoms/core/dist/web/core/AtomUI", "@web-atoms/web-controls/dist/basic/TitleEditor"], function (_export, _context) {
30144
30144
  "use strict";
30145
30145
 
30146
- 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, CancelToken, DomToString, EmailLabel, Loader, descendentElementIterator, MiniComposeBox, css, defaultEmailBody;
30146
+ 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, CancelToken, DomToString, EmailLabel, Loader, descendentElementIterator, TitleEditor, MiniComposeBox, css, defaultEmailBody;
30147
30147
  _export("default", void 0);
30148
30148
  return {
30149
30149
  setters: [function (_tslib) {
@@ -30215,6 +30215,8 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
30215
30215
  Loader = _commonControlsLoader.default;
30216
30216
  }, function (_webAtomsCoreDistWebCoreAtomUI) {
30217
30217
  descendentElementIterator = _webAtomsCoreDistWebCoreAtomUI.descendentElementIterator;
30218
+ }, function (_webAtomsWebControlsDistBasicTitleEditor) {
30219
+ TitleEditor = _webAtomsWebControlsDistBasicTitleEditor.default;
30218
30220
  }],
30219
30221
  execute: function () {
30220
30222
  css = styled.css`
@@ -30259,7 +30261,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
30259
30261
  border-color: transparent;
30260
30262
  }
30261
30263
 
30262
- & input.subject {
30264
+ & .subject {
30263
30265
  border-bottom: solid 1px lightgray;
30264
30266
  place-self: stretch;
30265
30267
  margin-left: 5px;
@@ -30269,6 +30271,10 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
30269
30271
  outline: none;
30270
30272
  border: none;
30271
30273
  border-bottom: solid 1px lightgray;
30274
+ & input {
30275
+ border: none;
30276
+ outline: none;
30277
+ }
30272
30278
  }
30273
30279
  `.installLocal();
30274
30280
  defaultEmailBody = `<section style="background-color: white; color: black;">
@@ -30288,20 +30294,19 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
30288
30294
  this.app.runAsync(() => this.init());
30289
30295
  }
30290
30296
  init() {
30291
- var _a, _b, _c, _d, _e;
30292
- var _f;
30297
+ var _a, _b, _c;
30293
30298
  return __awaiter(this, void 0, void 0, function* () {
30294
30299
  this.renderer = XNode.create("div", null, XNode.create(Loader, null));
30295
30300
  yield sleep(100);
30296
- (_a = this.draft) !== null && _a !== void 0 ? _a : this.draft = (_b = yield this.conversationService.getDraft(this.mailboxContact)) === null || _b === void 0 ? void 0 : _b.email;
30297
- if (this.draft) {
30298
- (_c = (_f = this.draft).attachments) !== null && _c !== void 0 ? _c : _f.attachments = [];
30301
+ (_a = this.draft) !== null && _a !== void 0 ? _a : this.draft = null;
30302
+ if (!this.draft) {
30303
+ this.ensureDraft();
30299
30304
  }
30300
- this.typedMessage = ((_d = this.draft) === null || _d === void 0 ? void 0 : _d.htmlBody) ? this.draft.htmlBody : defaultEmailBody;
30305
+ this.typedMessage = ((_b = this.draft) === null || _b === void 0 ? void 0 : _b.htmlBody) ? this.draft.htmlBody : defaultEmailBody;
30301
30306
  this.renderer = XNode.create("div", null, XNode.create(MailHtmlEditor, {
30302
30307
  toolbar: () => XNode.create("div", null, XNode.create(Toolbar, null, XNode.create(Insert, null), XNode.create(Separator, null), XNode.create(Attach, null), XNode.create(Separator, null), XNode.create(Bold, null), XNode.create(Italic, null), XNode.create(Underline, null), XNode.create(StrikeThrough, null), XNode.create(Align, {
30303
30308
  alignment: "above"
30304
- }), XNode.create(Separator, null), XNode.create(AddLink, null), XNode.create(Unlink, null)), XNode.create("input", {
30309
+ }), XNode.create(Separator, null), XNode.create(AddLink, null), XNode.create(Unlink, null)), XNode.create(TitleEditor, {
30305
30310
  class: "subject",
30306
30311
  placeholder: "Subject ... ",
30307
30312
  value: Bind.sourceTwoWays(this, x => x.source.draft.subject)
@@ -30343,7 +30348,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
30343
30348
  }));
30344
30349
  yield sleep(100);
30345
30350
  if (!this.draft.subject) {
30346
- (_e = this.editor.element.querySelector("input.subject")) === null || _e === void 0 ? void 0 : _e.focus();
30351
+ (_c = this.editor.element.querySelector(".subject > input")) === null || _c === void 0 ? void 0 : _c.focus();
30347
30352
  return;
30348
30353
  }
30349
30354
  const editor = this.editor.element.querySelector(`[data-element="editor"]`);
@@ -30569,12 +30574,17 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
30569
30574
  this.draft.dateSent = DateTime.now.add(TimeSpan.fromSeconds(30));
30570
30575
  this.draft.dateUpdated = DateTime.now;
30571
30576
  yield this.mailService.send(this.draft);
30577
+ const saved = this.draft;
30572
30578
  this.draft = Email.create({
30573
30579
  subject: "",
30574
30580
  htmlBody: defaultEmailBody,
30575
30581
  attachments: []
30576
30582
  });
30577
30583
  this.editor.htmlContent = this.draft.htmlBody;
30584
+ this.element.dispatchEvent(new CustomEvent("emailSent", {
30585
+ bubbles: true,
30586
+ detail: saved
30587
+ }));
30578
30588
  });
30579
30589
  }
30580
30590
  sendAudioMessage() {
@@ -33274,18 +33284,24 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
33274
33284
  icon: "fas fa-ban",
33275
33285
  label: "Block Sender"
33276
33286
  })));
33277
- this.footerRenderer = () => XNode.create("div", {
33278
- "data-position": "absolute",
33279
- "style-right": "20px",
33280
- "style-bottom": "5px",
33281
- "data-layout": "row"
33282
- }, XNode.create(AddIconTextButton, {
33283
- "event-click": () => this.startCompose(),
33284
- "data-margin-left": "auto",
33285
- text: "Compose"
33286
- }));
33287
+ this.showComposeButton();
33287
33288
  });
33288
33289
  }
33290
+ showComposeButton(email = null) {
33291
+ if (email) {
33292
+ this.mailsRepeater.items.remove(email);
33293
+ }
33294
+ this.footerRenderer = () => XNode.create("div", {
33295
+ "data-position": "absolute",
33296
+ "style-right": "20px",
33297
+ "style-bottom": "5px",
33298
+ "data-layout": "row"
33299
+ }, XNode.create(AddIconTextButton, {
33300
+ "event-click": () => this.startCompose(),
33301
+ "data-margin-left": "auto",
33302
+ text: "Compose"
33303
+ }));
33304
+ }
33289
33305
  startCompose(thread = null, email = null) {
33290
33306
  this.footerRenderer = () => {
33291
33307
  var _a;
@@ -33353,6 +33369,10 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
33353
33369
  emailAddressID,
33354
33370
  mailboxID
33355
33371
  } = this.parameters;
33372
+ const index = this.mails.findIndex(x => x.emailID === emailID);
33373
+ if (index !== -1) {
33374
+ this.mails.removeAt(index);
33375
+ }
33356
33376
  this.mails.insert(0, MailboxContactEmail.create({
33357
33377
  emailID,
33358
33378
  emailAddressID,
@@ -33473,11 +33493,12 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
33473
33493
  this.mailsRepeater.refreshItem(thread);
33474
33494
  });
33475
33495
  }
33476
- replyEmail({
33477
- email
33478
- }, ce) {
33496
+ replyEmail(mce, ce) {
33479
33497
  var _a, _b;
33480
33498
  return __awaiter(this, void 0, void 0, function* () {
33499
+ const {
33500
+ email
33501
+ } = mce;
33481
33502
  const parse = JSON.parse(email.headers);
33482
33503
  const replyTo = (_a = parse === null || parse === void 0 ? void 0 : parse.replyTo) === null || _a === void 0 ? void 0 : _a[0];
33483
33504
  const emailAddressText = this.parameters.emailAddress.emailAddress.toLocaleLowerCase();
@@ -33486,6 +33507,7 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
33486
33507
  const recipients = [EmailRecipient.create({
33487
33508
  name,
33488
33509
  replyTo,
33510
+ emailAddressID: this.parameters.emailAddressID,
33489
33511
  emailAddressText
33490
33512
  })];
33491
33513
  if (/all/i.test(ce.type)) {
@@ -33504,6 +33526,7 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
33504
33526
  }
33505
33527
  recipients.push(EmailRecipient.create({
33506
33528
  name: rName,
33529
+ emailAddressID,
33507
33530
  emailAddressText: emailAddress
33508
33531
  }));
33509
33532
  }
@@ -33561,6 +33584,9 @@ System.register(["tslib", "@web-atoms/web-controls/dist/mobile-app/MobileApp", "
33561
33584
  }
33562
33585
  });
33563
33586
  __decorate([InjectProperty, __metadata("design:type", ConversationService)], ConversationPage.prototype, "conversationService", void 0);
33587
+ __decorate([Action({
33588
+ onEvent: "emailSent"
33589
+ }), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0)], ConversationPage.prototype, "showComposeButton", null);
33564
33590
  __decorate([Action({
33565
33591
  onEvent: "edit-draft"
33566
33592
  }), __metadata("design:type", Function), __metadata("design:paramtypes", [Object, Object]), __metadata("design:returntype", void 0)], ConversationPage.prototype, "startCompose", null);