@social-mail/social-mail-client 1.2.397 → 1.2.399

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.
@@ -26928,6 +26928,22 @@ System.register(["tslib", "@web-atoms/core/dist/di/DISingleton", "@web-atoms/cor
26928
26928
  mailboxID
26929
26929
  }, p => x => x.mailboxID === p.mailboxID && x.emailAddressID === null).firstOrDefault();
26930
26930
  mb.notify = !!notify;
26931
+ mb.folders.remove(x => !x.count);
26932
+ const index = x => {
26933
+ switch (x.tag.name.toLocaleLowerCase()) {
26934
+ case "contacts":
26935
+ return 1;
26936
+ case "new":
26937
+ return 2;
26938
+ case "spam":
26939
+ return 3;
26940
+ case "blocked":
26941
+ return 4;
26942
+ }
26943
+ return 100;
26944
+ };
26945
+ mb.folders.sort((a, b) => index(a) - index(b));
26946
+ mb.folders[0].main = true;
26931
26947
  return mb;
26932
26948
  });
26933
26949
  }
@@ -44269,23 +44285,21 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
44269
44285
  _export("default", MailsPage = class MailsPage extends MasterDetailPage {
44270
44286
  constructor() {
44271
44287
  super(...arguments);
44288
+ this.folders = [];
44272
44289
  this.mails = [];
44273
44290
  this.search = "";
44274
44291
  this.selectedThread = null;
44275
44292
  this.previousThread = null;
44276
44293
  this.version = 1;
44277
44294
  this.conversationType = "all";
44278
- this.folderID = null;
44279
- this.nonContactFolderIDs = [];
44295
+ this.folder = null;
44280
44296
  }
44281
44297
  init() {
44282
44298
  var _a;
44283
44299
  return __awaiter(this, void 0, void 0, function* () {
44284
44300
  const mailboxID = this.parameters.id;
44285
44301
  const mailbox = this.currentMailbox = yield this.mailService.mailbox(mailboxID);
44286
- const contactFolderID = mailbox.folders.find(x => /contacts/i.test(x.tag.name)).tagID;
44287
- this.folderID = contactFolderID;
44288
- this.nonContactFolderIDs = mailbox.folders.filter(x => x.tagID !== contactFolderID).map(x => x.tagID);
44302
+ this.folder = mailbox.folders[0];
44289
44303
  if (mailbox.isExternal) {
44290
44304
  const es = this.resolve(EntityService);
44291
44305
  es.invoke(Mailbox, "fetch", mailbox).catch(console.error);
@@ -44321,11 +44335,10 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
44321
44335
  class: "blocked-bar"
44322
44336
  }, XNode.create(ToggleButtonBar, {
44323
44337
  items: mailbox.folders,
44324
- labelPath: x => toSentenceCase(x.tag.name),
44325
- valuePath: x => x.tagID,
44326
- value: Bind.sourceTwoWays(this, x => x.source.folderID)
44338
+ labelPath: x => x.main ? toSentenceCase(x.tag.name) : `${toSentenceCase(x.tag.name)} (${x.count})`,
44339
+ selectedItem: Bind.sourceTwoWays(this, x => x.source.folder)
44327
44340
  }), XNode.create(ToggleButtonBar, {
44328
- "style-display": Bind.oneWay(() => !this.nonContactFolderIDs.includes(this.folderID)),
44341
+ "style-display": Bind.oneWay(() => this.folder.main),
44329
44342
  items: conversationTypes,
44330
44343
  itemRenderer: item => XNode.create("div", {
44331
44344
  "data-item-type": "toggle-button",
@@ -44353,7 +44366,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/InjectProperty", "@web-atom
44353
44366
  conversationType: this.conversationType,
44354
44367
  mailboxID: this.currentMailbox.mailboxID,
44355
44368
  version: this.version,
44356
- folderID: this.folderID,
44369
+ folderID: this.folder.tagID,
44357
44370
  cancelToken
44358
44371
  })), {
44359
44372
  itemRenderer: item => {