@trycourier/courier-ui-inbox 1.0.0-beta → 1.0.2-beta

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.
package/dist/index.es.js CHANGED
@@ -217,7 +217,7 @@ class ie extends HTMLElement {
217
217
  }
218
218
  }
219
219
  customElements.get("courier-icon") || customElements.define("courier-icon", ie);
220
- class Pe extends HTMLElement {
220
+ class De extends HTMLElement {
221
221
  constructor() {
222
222
  super(), L(this, "link");
223
223
  const i = this.attachShadow({ mode: "open" });
@@ -341,7 +341,7 @@ class Pe extends HTMLElement {
341
341
  i ? this.link.style.setProperty("--courier-link-font-size", i) : this.link.style.removeProperty("--courier-link-font-size");
342
342
  }
343
343
  }
344
- L(Pe, "observedAttributes", [
344
+ L(De, "observedAttributes", [
345
345
  "href",
346
346
  "variant",
347
347
  "disabled",
@@ -352,7 +352,7 @@ L(Pe, "observedAttributes", [
352
352
  "font-family",
353
353
  "font-size"
354
354
  ]);
355
- customElements.get("courier-link") || customElements.define("courier-link", Pe);
355
+ customElements.get("courier-link") || customElements.define("courier-link", De);
356
356
  class Le extends bo {
357
357
  constructor() {
358
358
  super(), L(this, "shadow"), this.shadow = this.attachShadow({ mode: "open" });
@@ -376,7 +376,7 @@ class Le extends bo {
376
376
  `, i;
377
377
  }
378
378
  }
379
- class Me extends Le {
379
+ class Ee extends Le {
380
380
  constructor(i) {
381
381
  super(), L(this, "_props"), L(this, "_title"), L(this, "_button"), L(this, "_style"), L(this, "_buttonClickCallback", null), this._props = i;
382
382
  }
@@ -427,7 +427,7 @@ class Me extends Le {
427
427
  this._buttonClickCallback = i;
428
428
  }
429
429
  }
430
- customElements.get("courier-info-state") || customElements.define("courier-info-state", Me);
430
+ customElements.get("courier-info-state") || customElements.define("courier-info-state", Ee);
431
431
  class Se extends HTMLElement {
432
432
  constructor(i, e, t, s, o, n, h, d) {
433
433
  super(), L(this, "_backgroundColor"), L(this, "_hoverBackgroundColor"), L(this, "_activeBackgroundColor"), L(this, "_borderRadius"), L(this, "_height"), L(this, "_width"), L(this, "_style"), L(this, "_button"), L(this, "_icon"), this._borderRadius = n, this._backgroundColor = t, this._hoverBackgroundColor = s, this._activeBackgroundColor = o, this._height = h, this._width = d;
@@ -497,14 +497,14 @@ class Se extends HTMLElement {
497
497
  }
498
498
  }
499
499
  customElements.get("courier-icon-button") || customElements.define("courier-icon-button", Se);
500
- const Po = [
500
+ const Do = [
501
501
  { name: "courier-button", class: Ie },
502
502
  { name: "courier-icon", class: ie },
503
- { name: "courier-link", class: Pe },
504
- { name: "courier-info-state", class: Me },
503
+ { name: "courier-link", class: De },
504
+ { name: "courier-info-state", class: Ee },
505
505
  { name: "courier-icon-button", class: Se }
506
506
  ];
507
- Po.forEach(({ name: g, class: i }) => {
507
+ Do.forEach(({ name: g, class: i }) => {
508
508
  customElements.get(g) || customElements.define(g, i);
509
509
  });
510
510
  const te = class te {
@@ -604,22 +604,25 @@ const te = class te {
604
604
  let b;
605
605
  switch (_.messageId && (b = this.getMessage({ messageId: _.messageId })), _.event) {
606
606
  case "mark-all-read":
607
- this.readAllMessages();
607
+ this.readAllMessages({ canCallApi: !1 });
608
608
  break;
609
609
  case "read":
610
- b && this.readMessage(b, !1);
610
+ b && this.readMessage({ message: b, canCallApi: !1 });
611
611
  break;
612
612
  case "unread":
613
- b && this.unreadMessage(b, !1);
613
+ b && this.unreadMessage({ message: b, canCallApi: !1 });
614
614
  break;
615
615
  case "opened":
616
- b && this.openMessage(b, !1);
616
+ b && this.openMessage({ message: b, canCallApi: !1 });
617
617
  break;
618
618
  case "archive":
619
- b && this.archiveMessage(b, !1);
619
+ b && this.archiveMessage({ message: b, canCallApi: !1 });
620
+ break;
621
+ case "archive-read":
622
+ this.archiveReadMessages({ canCallApi: !1 });
620
623
  break;
621
624
  case "click":
622
- b && this.clickMessage(b, !1);
625
+ b && this.clickMessage({ message: b, canCallApi: !1 });
623
626
  break;
624
627
  case "unopened":
625
628
  case "unarchive":
@@ -635,7 +638,7 @@ const te = class te {
635
638
  return ((e = this._inboxDataSet) == null ? void 0 : e.messages.find((s) => s.messageId === i.messageId)) ?? ((t = this._archiveDataSet) == null ? void 0 : t.messages.find((s) => s.messageId === i.messageId));
636
639
  }
637
640
  async fetchNextPageOfMessages(i) {
638
- var e, t, s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, E, M, I, T, $, D;
641
+ var e, t, s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M, E, I, T, P, $;
639
642
  switch (i.feedType) {
640
643
  case "inbox":
641
644
  if (this.isPaginatingInbox)
@@ -669,12 +672,12 @@ const te = class te {
669
672
  startCursor: this._archiveDataSet.paginationCursor
670
673
  })), B = {
671
674
  messages: ((k = (v = y == null ? void 0 : y.data) == null ? void 0 : v.messages) == null ? void 0 : k.nodes) ?? [],
672
- canPaginate: ((E = (S = (w = y == null ? void 0 : y.data) == null ? void 0 : w.messages) == null ? void 0 : S.pageInfo) == null ? void 0 : E.hasNextPage) ?? !1,
673
- paginationCursor: ((T = (I = (M = y == null ? void 0 : y.data) == null ? void 0 : M.messages) == null ? void 0 : I.pageInfo) == null ? void 0 : T.startCursor) ?? null
675
+ canPaginate: ((M = (S = (w = y == null ? void 0 : y.data) == null ? void 0 : w.messages) == null ? void 0 : S.pageInfo) == null ? void 0 : M.hasNextPage) ?? !1,
676
+ paginationCursor: ((T = (I = (E = y == null ? void 0 : y.data) == null ? void 0 : E.messages) == null ? void 0 : I.pageInfo) == null ? void 0 : T.startCursor) ?? null
674
677
  };
675
678
  return this.addPage(B, "archive"), B;
676
679
  } catch (y) {
677
- return (D = ($ = C.shared.client) == null ? void 0 : $.options.logger) == null || D.error("Error fetching next page of archived messages:", y), null;
680
+ return ($ = (P = C.shared.client) == null ? void 0 : P.options.logger) == null || $.error("Error fetching next page of archived messages:", y), null;
678
681
  } finally {
679
682
  this.isPaginatingArchive = !1;
680
683
  }
@@ -686,7 +689,7 @@ const te = class te {
686
689
  for (const [t, s] of Object.entries(e))
687
690
  s !== void 0 && this.updateMessage(i, s, t);
688
691
  }
689
- async readMessage(i, e = !0) {
692
+ async readMessage({ message: i, canCallApi: e = !0 }) {
690
693
  var o, n, h, d;
691
694
  if (!C.shared.client)
692
695
  return;
@@ -703,7 +706,7 @@ const te = class te {
703
706
  this.applyLocalMessageChange(t, s), (d = (h = C.shared.client) == null ? void 0 : h.options.logger) == null || d.error("Error reading message:", c);
704
707
  }
705
708
  }
706
- async unreadMessage(i, e = !0) {
709
+ async unreadMessage({ message: i, canCallApi: e = !0 }) {
707
710
  var o, n, h, d;
708
711
  if (!C.shared.client)
709
712
  return;
@@ -720,7 +723,7 @@ const te = class te {
720
723
  this.applyLocalMessageChange(t, s), (d = (h = C.shared.client) == null ? void 0 : h.options.logger) == null || d.error("Error unreading message:", c);
721
724
  }
722
725
  }
723
- async openMessage(i, e = !0) {
726
+ async openMessage({ message: i, canCallApi: e = !0 }) {
724
727
  var o, n, h, d;
725
728
  if (!C.shared.client)
726
729
  return;
@@ -735,7 +738,7 @@ const te = class te {
735
738
  this.applyLocalMessageChange(t, s), (d = (h = C.shared.client) == null ? void 0 : h.options.logger) == null || d.error("Error opening message:", c);
736
739
  }
737
740
  }
738
- async clickMessage(i, e = !0) {
741
+ async clickMessage({ message: i, canCallApi: e = !0 }) {
739
742
  var t, s, o, n;
740
743
  if (C.shared.client)
741
744
  try {
@@ -747,7 +750,7 @@ const te = class te {
747
750
  (n = (o = C.shared.client) == null ? void 0 : o.options.logger) == null || n.error("Error clicking message:", h);
748
751
  }
749
752
  }
750
- async archiveMessage(i, e = !0) {
753
+ async archiveMessage({ message: i, canCallApi: e = !0 }) {
751
754
  var o, n;
752
755
  if (!C.shared.client)
753
756
  return;
@@ -763,7 +766,33 @@ const te = class te {
763
766
  this.addMessage(t, s, "inbox"), i.archived = void 0, this.removeMessage(i, s, "archive");
764
767
  }
765
768
  }
766
- async readAllMessages(i = !0) {
769
+ async archiveReadMessages({ canCallApi: i = !0 } = {}) {
770
+ var s;
771
+ if (!C.shared.client)
772
+ return;
773
+ const e = this._inboxDataSet, t = this._archiveDataSet;
774
+ try {
775
+ (s = this._inboxDataSet) == null || s.messages.forEach((o) => {
776
+ var h, d;
777
+ if (!o.read)
778
+ return;
779
+ const n = (h = this._inboxDataSet) == null ? void 0 : h.messages.findIndex((c) => c.messageId === o.messageId);
780
+ if (n !== void 0 && (this.removeMessage(o, n, "inbox"), (d = this._archiveDataSet) != null && d.messages)) {
781
+ const c = this.findInsertIndex(o, this._archiveDataSet.messages);
782
+ o.archived = (/* @__PURE__ */ new Date()).toISOString(), this.addMessage(o, c, "archive");
783
+ }
784
+ }), this._dataStoreListeners.forEach((o) => {
785
+ var n, h, d, c;
786
+ this._inboxDataSet && ((h = (n = o.events).onDataSetChange) == null || h.call(n, this._inboxDataSet, "inbox")), this._archiveDataSet && ((c = (d = o.events).onDataSetChange) == null || c.call(d, this._archiveDataSet, "archive"));
787
+ }), i && await C.shared.client.inbox.archiveRead();
788
+ } catch (o) {
789
+ console.error("Error archiving read messages:", o), this._inboxDataSet && e && (this._inboxDataSet.messages = e.messages), this._archiveDataSet && t && (this._archiveDataSet.messages = t.messages), this._dataStoreListeners.forEach((n) => {
790
+ var h, d, c, u;
791
+ this._inboxDataSet && ((d = (h = n.events).onDataSetChange) == null || d.call(h, this._inboxDataSet, "inbox")), this._archiveDataSet && ((u = (c = n.events).onDataSetChange) == null || u.call(c, this._archiveDataSet, "archive"));
792
+ });
793
+ }
794
+ }
795
+ async readAllMessages({ canCallApi: i = !0 } = {}) {
767
796
  var o, n, h, d;
768
797
  if (!C.shared.client)
769
798
  return;
@@ -857,21 +886,21 @@ const te = class te {
857
886
  a(te, "instance");
858
887
  let A = te;
859
888
  function zo(g) {
860
- return A.shared.readMessage(g);
889
+ return A.shared.readMessage({ message: g });
861
890
  }
862
891
  function Oo(g) {
863
- return A.shared.unreadMessage(g);
892
+ return A.shared.unreadMessage({ message: g });
864
893
  }
865
894
  function No(g) {
866
- return A.shared.clickMessage(g);
895
+ return A.shared.clickMessage({ message: g });
867
896
  }
868
897
  function Uo(g) {
869
- return A.shared.archiveMessage(g);
898
+ return A.shared.archiveMessage({ message: g });
870
899
  }
871
900
  function Vo(g) {
872
- return A.shared.openMessage(g);
901
+ return A.shared.openMessage({ message: g });
873
902
  }
874
- function $o(g) {
903
+ function Po(g) {
875
904
  if (!g.created) return "Now";
876
905
  const i = /* @__PURE__ */ new Date(), e = new Date(g.created), t = Math.floor((i.getTime() - e.getTime()) / 1e3);
877
906
  return t < 60 ? `${t}s` : t < 3600 ? `${Math.floor(t / 60)}m` : t < 86400 ? `${Math.floor(t / 3600)}h` : t < 604800 ? `${Math.floor(t / 86400)}d` : t < 31536e3 ? `${Math.floor(t / 604800)}w` : `${Math.floor(t / 31536e3)}y`;
@@ -1021,7 +1050,7 @@ class xo extends HTMLElement {
1021
1050
  }
1022
1051
  // Helpers
1023
1052
  _getMenuOptions() {
1024
- var s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, E, M, I;
1053
+ var s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M, E, I;
1025
1054
  const e = (h = (n = (o = (s = this._theme.inbox) == null ? void 0 : s.list) == null ? void 0 : o.item) == null ? void 0 : n.menu) == null ? void 0 : h.item;
1026
1055
  let t = [];
1027
1056
  return (d = this._message) != null && d.archived || t.push({
@@ -1031,16 +1060,16 @@ class xo extends HTMLElement {
1031
1060
  color: (x = this._message) != null && x.read ? (_ = e == null ? void 0 : e.unread) == null ? void 0 : _.color : ((b = e == null ? void 0 : e.read) == null ? void 0 : b.color) ?? "red"
1032
1061
  },
1033
1062
  onClick: () => {
1034
- this._message && (this._message.read ? A.shared.unreadMessage(this._message) : A.shared.readMessage(this._message));
1063
+ this._message && (this._message.read ? A.shared.unreadMessage({ message: this._message }) : A.shared.readMessage({ message: this._message }));
1035
1064
  }
1036
1065
  }), t.push({
1037
1066
  id: (v = this._message) != null && v.archived ? "unarchive" : "archive",
1038
1067
  icon: {
1039
1068
  svg: (k = this._message) != null && k.archived ? (w = e == null ? void 0 : e.unarchive) == null ? void 0 : w.svg : (S = e == null ? void 0 : e.archive) == null ? void 0 : S.svg,
1040
- color: (E = this._message) != null && E.archived ? (M = e == null ? void 0 : e.unarchive) == null ? void 0 : M.color : ((I = e == null ? void 0 : e.archive) == null ? void 0 : I.color) ?? "red"
1069
+ color: (M = this._message) != null && M.archived ? (E = e == null ? void 0 : e.unarchive) == null ? void 0 : E.color : ((I = e == null ? void 0 : e.archive) == null ? void 0 : I.color) ?? "red"
1041
1070
  },
1042
1071
  onClick: () => {
1043
- this._message && (this._message.archived ? alert("unarchive") : A.shared.archiveMessage(this._message));
1072
+ this._message && (this._message.archived ? alert("unarchive") : A.shared.archiveMessage({ message: this._message }));
1044
1073
  }
1045
1074
  }), t;
1046
1075
  }
@@ -1215,7 +1244,7 @@ class xo extends HTMLElement {
1215
1244
  this._titleElement.textContent = "", this._subtitleElement.textContent = "";
1216
1245
  return;
1217
1246
  }
1218
- this.classList.toggle("unread", !this._message.read && this._feedType !== "archive"), this._titleElement.textContent = this._message.title || "Untitled Message", this._subtitleElement.textContent = this._message.preview || this._message.body || "", this._timeElement.textContent = $o(this._message), this._menu.setOptions(this._getMenuOptions());
1247
+ this.classList.toggle("unread", !this._message.read && this._feedType !== "archive"), this._titleElement.textContent = this._message.title || "Untitled Message", this._subtitleElement.textContent = this._message.preview || this._message.body || "", this._timeElement.textContent = Po(this._message), this._menu.setOptions(this._getMenuOptions());
1219
1248
  const e = ((s = this._message) == null ? void 0 : s.actions) && this._message.actions.length > 0;
1220
1249
  this._actionsContainer.style.display = e ? "flex" : "none";
1221
1250
  const t = (h = (n = (o = this._theme.inbox) == null ? void 0 : o.list) == null ? void 0 : n.item) == null ? void 0 : h.actions;
@@ -1251,7 +1280,7 @@ class fo extends HTMLElement {
1251
1280
  this._shadow = this.attachShadow({ mode: "open" });
1252
1281
  const s = document.createElement("style");
1253
1282
  s.textContent = this.getStyles(t), this._shadow.appendChild(s);
1254
- const o = new Ee(e, 35), n = new Ee(e, 100), h = new Ee(e, 82);
1283
+ const o = new Me(e, 35), n = new Me(e, 100), h = new Me(e, 82);
1255
1284
  this._shadow.appendChild(o), this._shadow.appendChild(n), this._shadow.appendChild(h);
1256
1285
  }
1257
1286
  getStyles(e) {
@@ -1269,7 +1298,7 @@ class fo extends HTMLElement {
1269
1298
  }
1270
1299
  }
1271
1300
  customElements.get("courier-inbox-skeleton-list-item") || customElements.define("courier-inbox-skeleton-list-item", fo);
1272
- class Ee extends HTMLElement {
1301
+ class Me extends HTMLElement {
1273
1302
  constructor(e, t) {
1274
1303
  super();
1275
1304
  a(this, "_shadow");
@@ -1280,7 +1309,7 @@ class Ee extends HTMLElement {
1280
1309
  o.className = "skeleton-item", this._shadow.appendChild(o);
1281
1310
  }
1282
1311
  getStyles(e, t) {
1283
- var m, p, x, _, b, v, k, w, S, E, M, I;
1312
+ var m, p, x, _, b, v, k, w, S, M, E, I;
1284
1313
  const s = ((x = (p = (m = e.inbox) == null ? void 0 : m.loading) == null ? void 0 : p.animation) == null ? void 0 : x.barColor) ?? "#000", o = s.length === 4 ? `#${s[1]}${s[1]}${s[2]}${s[2]}${s[3]}${s[3]}` : s, n = parseInt(o.slice(1, 3), 16), h = parseInt(o.slice(3, 5), 16), d = parseInt(o.slice(5, 7), 16), c = `rgba(${n}, ${h}, ${d}, 0.8)`, u = `rgba(${n}, ${h}, ${d}, 0.4)`;
1285
1314
  return `
1286
1315
  :host {
@@ -1302,7 +1331,7 @@ class Ee extends HTMLElement {
1302
1331
  );
1303
1332
  background-size: 200% 100%;
1304
1333
  animation: shimmer ${((S = (w = (k = e.inbox) == null ? void 0 : k.loading) == null ? void 0 : w.animation) == null ? void 0 : S.duration) ?? "2s"} ease-in-out infinite;
1305
- border-radius: ${((I = (M = (E = e.inbox) == null ? void 0 : E.loading) == null ? void 0 : M.animation) == null ? void 0 : I.barBorderRadius) ?? "14px"};
1334
+ border-radius: ${((I = (E = (M = e.inbox) == null ? void 0 : M.loading) == null ? void 0 : E.animation) == null ? void 0 : I.barBorderRadius) ?? "14px"};
1306
1335
  }
1307
1336
 
1308
1337
  @keyframes shimmer {
@@ -1316,8 +1345,8 @@ class Ee extends HTMLElement {
1316
1345
  `;
1317
1346
  }
1318
1347
  }
1319
- customElements.get("courier-skeleton-animated-row") || customElements.define("courier-skeleton-animated-row", Ee);
1320
- class $e extends Le {
1348
+ customElements.get("courier-skeleton-animated-row") || customElements.define("courier-skeleton-animated-row", Me);
1349
+ class Pe extends Le {
1321
1350
  constructor(e) {
1322
1351
  super();
1323
1352
  a(this, "_theme");
@@ -1364,7 +1393,7 @@ class $e extends Le {
1364
1393
  `;
1365
1394
  }
1366
1395
  }
1367
- customElements.get("courier-inbox-skeleton-list") || customElements.define("courier-inbox-skeleton-list", $e);
1396
+ customElements.get("courier-inbox-skeleton-list") || customElements.define("courier-inbox-skeleton-list", Pe);
1368
1397
  class Co extends HTMLElement {
1369
1398
  constructor(e) {
1370
1399
  super();
@@ -1380,7 +1409,7 @@ class Co extends HTMLElement {
1380
1409
  t.appendChild(this.customItem);
1381
1410
  else {
1382
1411
  const o = document.createElement("div");
1383
- o.className = "skeleton-container", this.skeletonLoadingList = new $e(e.theme), this.skeletonLoadingList.build(void 0), o.appendChild(this.skeletonLoadingList), t.appendChild(o);
1412
+ o.className = "skeleton-container", this.skeletonLoadingList = new Pe(e.theme), this.skeletonLoadingList.build(void 0), o.appendChild(this.skeletonLoadingList), t.appendChild(o);
1384
1413
  }
1385
1414
  this.observer = new IntersectionObserver((o) => {
1386
1415
  o.forEach((n) => {
@@ -1498,11 +1527,11 @@ class vo extends HTMLElement {
1498
1527
  this._onRefresh();
1499
1528
  }
1500
1529
  render() {
1501
- var s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, E, M, I, T, $, D, y, B, F, H, R, z, O, N, U, V, Z, J, q, X, Y, j, se, oe, ne, re, ae, he, ce, le, de, ue, pe, ge, me, be, _e, xe, fe, Ce, ve, ye;
1530
+ var s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M, E, I, T, P, $, y, B, F, H, R, z, O, N, U, V, Z, J, q, X, Y, j, se, oe, ne, re, ae, he, ce, le, de, ue, pe, ge, me, be, _e, xe, fe, Ce, ve, ye;
1502
1531
  this.reset();
1503
1532
  const e = this._themeSubscription.manager.getTheme();
1504
1533
  if (this._error) {
1505
- const l = (s = e.inbox) == null ? void 0 : s.error, P = new Me({
1534
+ const l = (s = e.inbox) == null ? void 0 : s.error, D = new Ee({
1506
1535
  title: {
1507
1536
  text: ((o = l == null ? void 0 : l.title) == null ? void 0 : o.text) ?? this._error.message,
1508
1537
  textColor: (h = (n = l == null ? void 0 : l.title) == null ? void 0 : n.font) == null ? void 0 : h.color,
@@ -1516,24 +1545,24 @@ class vo extends HTMLElement {
1516
1545
  hoverBackgroundColor: (v = l == null ? void 0 : l.button) == null ? void 0 : v.hoverBackgroundColor,
1517
1546
  activeBackgroundColor: (k = l == null ? void 0 : l.button) == null ? void 0 : k.activeBackgroundColor,
1518
1547
  textColor: (S = (w = l == null ? void 0 : l.button) == null ? void 0 : w.font) == null ? void 0 : S.color,
1519
- fontFamily: (M = (E = l == null ? void 0 : l.button) == null ? void 0 : E.font) == null ? void 0 : M.family,
1548
+ fontFamily: (E = (M = l == null ? void 0 : l.button) == null ? void 0 : M.font) == null ? void 0 : E.family,
1520
1549
  fontSize: (T = (I = l == null ? void 0 : l.button) == null ? void 0 : I.font) == null ? void 0 : T.size,
1521
- fontWeight: (D = ($ = l == null ? void 0 : l.button) == null ? void 0 : $.font) == null ? void 0 : D.weight,
1550
+ fontWeight: ($ = (P = l == null ? void 0 : l.button) == null ? void 0 : P.font) == null ? void 0 : $.weight,
1522
1551
  shadow: (y = l == null ? void 0 : l.button) == null ? void 0 : y.shadow,
1523
1552
  border: (B = l == null ? void 0 : l.button) == null ? void 0 : B.border,
1524
1553
  borderRadius: (F = l == null ? void 0 : l.button) == null ? void 0 : F.borderRadius
1525
1554
  }
1526
1555
  });
1527
- P.build((H = this._errorStateFactory) == null ? void 0 : H.call(this, { feedType: this._feedType, error: this._error })), P.setButtonClickCallback(() => this.handleRetry()), (R = this.shadowRoot) == null || R.appendChild(P);
1556
+ D.build((H = this._errorStateFactory) == null ? void 0 : H.call(this, { feedType: this._feedType, error: this._error })), D.setButtonClickCallback(() => this.handleRetry()), (R = this.shadowRoot) == null || R.appendChild(D);
1528
1557
  return;
1529
1558
  }
1530
1559
  if (this._isLoading) {
1531
- const l = new $e(e);
1560
+ const l = new Pe(e);
1532
1561
  l.build((z = this._loadingStateFactory) == null ? void 0 : z.call(this, { feedType: this._feedType })), (O = this.shadowRoot) == null || O.appendChild(l);
1533
1562
  return;
1534
1563
  }
1535
1564
  if (this._messages.length === 0) {
1536
- const l = (N = e.inbox) == null ? void 0 : N.empty, P = new Me({
1565
+ const l = (N = e.inbox) == null ? void 0 : N.empty, D = new Ee({
1537
1566
  title: {
1538
1567
  text: ((U = l == null ? void 0 : l.title) == null ? void 0 : U.text) ?? `No ${this._feedType} messages yet`,
1539
1568
  textColor: (Z = (V = l == null ? void 0 : l.title) == null ? void 0 : V.font) == null ? void 0 : Z.color,
@@ -1555,33 +1584,33 @@ class vo extends HTMLElement {
1555
1584
  borderRadius: (xe = l == null ? void 0 : l.button) == null ? void 0 : xe.borderRadius
1556
1585
  }
1557
1586
  });
1558
- P.build((fe = this._emptyStateFactory) == null ? void 0 : fe.call(this, { feedType: this._feedType })), P.setButtonClickCallback(() => this.handleRefresh()), (Ce = this.shadowRoot) == null || Ce.appendChild(P);
1587
+ D.build((fe = this._emptyStateFactory) == null ? void 0 : fe.call(this, { feedType: this._feedType })), D.setButtonClickCallback(() => this.handleRefresh()), (Ce = this.shadowRoot) == null || Ce.appendChild(D);
1559
1588
  return;
1560
1589
  }
1561
1590
  const t = document.createElement("ul");
1562
- if ((ve = this.shadowRoot) == null || ve.appendChild(t), this._messages.forEach((l, P) => {
1591
+ if ((ve = this.shadowRoot) == null || ve.appendChild(t), this._messages.forEach((l, D) => {
1563
1592
  if (this._listItemFactory) {
1564
- t.appendChild(this._listItemFactory({ message: l, index: P }));
1593
+ t.appendChild(this._listItemFactory({ message: l, index: D }));
1565
1594
  return;
1566
1595
  }
1567
1596
  const K = new xo(e);
1568
1597
  K.setMessage(l, this._feedType), K.setOnItemClick((Q) => {
1569
1598
  var W;
1570
- return (W = this._onMessageClick) == null ? void 0 : W.call(this, Q, P);
1599
+ return (W = this._onMessageClick) == null ? void 0 : W.call(this, Q, D);
1571
1600
  }), K.setOnItemActionClick((Q, W) => {
1572
1601
  var ke;
1573
- return (ke = this._onMessageActionClick) == null ? void 0 : ke.call(this, Q, W, P);
1602
+ return (ke = this._onMessageActionClick) == null ? void 0 : ke.call(this, Q, W, D);
1574
1603
  }), K.setOnItemLongPress((Q) => {
1575
1604
  var W;
1576
- return (W = this._onMessageLongPress) == null ? void 0 : W.call(this, Q, P);
1605
+ return (W = this._onMessageLongPress) == null ? void 0 : W.call(this, Q, D);
1577
1606
  }), t.appendChild(K);
1578
1607
  }), this._canPaginate) {
1579
1608
  const l = new Co({
1580
1609
  theme: e,
1581
1610
  customItem: (ye = this._paginationItemFactory) == null ? void 0 : ye.call(this, { feedType: this._feedType }),
1582
1611
  onPaginationTrigger: () => {
1583
- var P;
1584
- return (P = this._onPaginationTrigger) == null ? void 0 : P.call(this, this._feedType);
1612
+ var D;
1613
+ return (D = this._onPaginationTrigger) == null ? void 0 : D.call(this, this._feedType);
1585
1614
  }
1586
1615
  });
1587
1616
  t.appendChild(l);
@@ -1633,7 +1662,7 @@ class yo extends HTMLElement {
1633
1662
  s.className = "spacer", this._selectionIcon = new ie(f.check), this._content.appendChild(this._itemIcon), this._content.appendChild(this._title), this._content.appendChild(s), e.selectable && this._content.appendChild(this._selectionIcon), t.appendChild(this._style), t.appendChild(this._content), this._selectionIcon.style.display = this._isSelected ? "block" : "none", this.refreshTheme();
1634
1663
  }
1635
1664
  getStyles() {
1636
- var t, s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, E, M, I, T, $, D, y, B, F, H, R, z, O, N, U, V, Z;
1665
+ var t, s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M, E, I, T, P, $, y, B, F, H, R, z, O, N, U, V, Z;
1637
1666
  const e = this._themeManager.getTheme();
1638
1667
  return `
1639
1668
  :host {
@@ -1665,8 +1694,8 @@ class yo extends HTMLElement {
1665
1694
  p {
1666
1695
  margin: 0;
1667
1696
  font-family: ${((w = (k = (v = (b = (_ = (x = e.inbox) == null ? void 0 : x.header) == null ? void 0 : _.menus) == null ? void 0 : b.popup) == null ? void 0 : v.list) == null ? void 0 : k.font) == null ? void 0 : w.family) ?? "inherit"};
1668
- font-weight: ${(($ = (T = (I = (M = (E = (S = e.inbox) == null ? void 0 : S.header) == null ? void 0 : E.menus) == null ? void 0 : M.popup) == null ? void 0 : I.list) == null ? void 0 : T.font) == null ? void 0 : $.weight) ?? "inherit"};
1669
- font-size: ${((R = (H = (F = (B = (y = (D = e.inbox) == null ? void 0 : D.header) == null ? void 0 : y.menus) == null ? void 0 : B.popup) == null ? void 0 : F.list) == null ? void 0 : H.font) == null ? void 0 : R.size) ?? "14px"};
1697
+ font-weight: ${((P = (T = (I = (E = (M = (S = e.inbox) == null ? void 0 : S.header) == null ? void 0 : M.menus) == null ? void 0 : E.popup) == null ? void 0 : I.list) == null ? void 0 : T.font) == null ? void 0 : P.weight) ?? "inherit"};
1698
+ font-size: ${((R = (H = (F = (B = (y = ($ = e.inbox) == null ? void 0 : $.header) == null ? void 0 : y.menus) == null ? void 0 : B.popup) == null ? void 0 : F.list) == null ? void 0 : H.font) == null ? void 0 : R.size) ?? "14px"};
1670
1699
  color: ${((Z = (V = (U = (N = (O = (z = e.inbox) == null ? void 0 : z.header) == null ? void 0 : O.menus) == null ? void 0 : N.popup) == null ? void 0 : U.list) == null ? void 0 : V.font) == null ? void 0 : Z.color) ?? "red"};
1671
1700
  white-space: nowrap;
1672
1701
  }
@@ -1704,7 +1733,7 @@ class Be extends HTMLElement {
1704
1733
  }), this.refreshTheme();
1705
1734
  }
1706
1735
  getStyles() {
1707
- var t, s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, E, M, I, T;
1736
+ var t, s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M, E, I, T;
1708
1737
  const e = this._themeSubscription.manager.getTheme();
1709
1738
  return `
1710
1739
  :host {
@@ -1728,7 +1757,7 @@ class Be extends HTMLElement {
1728
1757
  }
1729
1758
 
1730
1759
  courier-inbox-filter-menu-item {
1731
- border-bottom: ${((T = (I = (M = (E = (S = e.inbox) == null ? void 0 : S.header) == null ? void 0 : E.menus) == null ? void 0 : M.popup) == null ? void 0 : I.list) == null ? void 0 : T.divider) ?? "none"};
1760
+ border-bottom: ${((T = (I = (E = (M = (S = e.inbox) == null ? void 0 : S.header) == null ? void 0 : M.menus) == null ? void 0 : E.popup) == null ? void 0 : I.list) == null ? void 0 : T.divider) ?? "none"};
1732
1761
  }
1733
1762
 
1734
1763
  courier-inbox-filter-menu-item:last-child {
@@ -1777,7 +1806,7 @@ class Be extends HTMLElement {
1777
1806
  }
1778
1807
  }
1779
1808
  customElements.get("courier-inbox-option-menu") || customElements.define("courier-inbox-option-menu", Be);
1780
- class De extends HTMLElement {
1809
+ class $e extends HTMLElement {
1781
1810
  constructor(e) {
1782
1811
  super();
1783
1812
  // Theme
@@ -1827,7 +1856,7 @@ class De extends HTMLElement {
1827
1856
  this._themeSubscription.unsubscribe();
1828
1857
  }
1829
1858
  }
1830
- customElements.get("courier-unread-count-badge") || customElements.define("courier-unread-count-badge", De);
1859
+ customElements.get("courier-unread-count-badge") || customElements.define("courier-unread-count-badge", $e);
1831
1860
  class ko extends HTMLElement {
1832
1861
  constructor(e, t) {
1833
1862
  super();
@@ -1844,7 +1873,7 @@ class ko extends HTMLElement {
1844
1873
  a(this, "_style");
1845
1874
  this._option = t;
1846
1875
  const s = this.attachShadow({ mode: "open" });
1847
- this._style = document.createElement("style"), this._container = document.createElement("div"), this._container.className = "title-section", this._iconElement = new ie(void 0, this._option.icon.svg), this._titleElement = document.createElement("h2"), this._unreadBadge = new De({
1876
+ this._style = document.createElement("style"), this._container = document.createElement("div"), this._container.className = "title-section", this._iconElement = new ie(void 0, this._option.icon.svg), this._titleElement = document.createElement("h2"), this._unreadBadge = new $e({
1848
1877
  themeBus: e,
1849
1878
  location: "header"
1850
1879
  }), this._container.appendChild(this._iconElement), this._container.appendChild(this._titleElement), this._container.appendChild(this._unreadBadge), s.appendChild(this._style), s.appendChild(this._container), this._themeSubscription = e.subscribe((o) => {
@@ -1887,14 +1916,14 @@ class ko extends HTMLElement {
1887
1916
  this._option = e, this._feedType = t, this._unreadBadge.setCount(s), this.updateFilter();
1888
1917
  }
1889
1918
  updateFilter() {
1890
- var t, s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, E, M, I, T, $, D, y, B, F, H, R;
1919
+ var t, s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M, E, I, T, P, $, y, B, F, H, R;
1891
1920
  const e = this._themeSubscription.manager.getTheme();
1892
1921
  switch (this._feedType) {
1893
1922
  case "inbox":
1894
1923
  this._titleElement.textContent = ((n = (o = (s = (t = e.inbox) == null ? void 0 : t.header) == null ? void 0 : s.filters) == null ? void 0 : o.inbox) == null ? void 0 : n.text) ?? "Inbox", this._iconElement.updateSVG(((m = (u = (c = (d = (h = e.inbox) == null ? void 0 : h.header) == null ? void 0 : d.filters) == null ? void 0 : c.inbox) == null ? void 0 : u.icon) == null ? void 0 : m.svg) ?? f.inbox), this._iconElement.updateColor(((v = (b = (_ = (x = (p = e.inbox) == null ? void 0 : p.header) == null ? void 0 : x.filters) == null ? void 0 : _.inbox) == null ? void 0 : b.icon) == null ? void 0 : v.color) ?? "red");
1895
1924
  break;
1896
1925
  case "archive":
1897
- this._titleElement.textContent = ((E = (S = (w = (k = e.inbox) == null ? void 0 : k.header) == null ? void 0 : w.filters) == null ? void 0 : S.archive) == null ? void 0 : E.text) ?? "Archive", this._iconElement.updateSVG(((D = ($ = (T = (I = (M = e.inbox) == null ? void 0 : M.header) == null ? void 0 : I.filters) == null ? void 0 : T.archive) == null ? void 0 : $.icon) == null ? void 0 : D.svg) ?? f.archive), this._iconElement.updateColor(((R = (H = (F = (B = (y = e.inbox) == null ? void 0 : y.header) == null ? void 0 : B.filters) == null ? void 0 : F.archive) == null ? void 0 : H.icon) == null ? void 0 : R.color) ?? "red");
1926
+ this._titleElement.textContent = ((M = (S = (w = (k = e.inbox) == null ? void 0 : k.header) == null ? void 0 : w.filters) == null ? void 0 : S.archive) == null ? void 0 : M.text) ?? "Archive", this._iconElement.updateSVG((($ = (P = (T = (I = (E = e.inbox) == null ? void 0 : E.header) == null ? void 0 : I.filters) == null ? void 0 : T.archive) == null ? void 0 : P.icon) == null ? void 0 : $.svg) ?? f.archive), this._iconElement.updateColor(((R = (H = (F = (B = (y = e.inbox) == null ? void 0 : y.header) == null ? void 0 : B.filters) == null ? void 0 : F.archive) == null ? void 0 : H.icon) == null ? void 0 : R.color) ?? "red");
1898
1927
  break;
1899
1928
  }
1900
1929
  }
@@ -1925,7 +1954,7 @@ class wo extends Le {
1925
1954
  }
1926
1955
  // Menu options
1927
1956
  getFilterOptions() {
1928
- var s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, E, M, I, T, $, D, y, B, F, H, R, z, O, N, U, V, Z, J, q, X, Y;
1957
+ var s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M, E, I, T, P, $, y, B, F, H, R, z, O, N, U, V, Z, J, q, X, Y;
1929
1958
  const e = this._themeSubscription.manager.getTheme(), t = (n = (o = (s = e.inbox) == null ? void 0 : s.header) == null ? void 0 : o.menus) == null ? void 0 : n.filters;
1930
1959
  return [
1931
1960
  {
@@ -1937,7 +1966,7 @@ class wo extends Le {
1937
1966
  },
1938
1967
  selectionIcon: {
1939
1968
  color: ((k = (v = (b = (_ = (x = (p = e.inbox) == null ? void 0 : p.header) == null ? void 0 : x.menus) == null ? void 0 : _.popup) == null ? void 0 : b.list) == null ? void 0 : v.selectionIcon) == null ? void 0 : k.color) ?? "red",
1940
- svg: ((T = (I = (M = (E = (S = (w = e.inbox) == null ? void 0 : w.header) == null ? void 0 : S.menus) == null ? void 0 : E.popup) == null ? void 0 : M.list) == null ? void 0 : I.selectionIcon) == null ? void 0 : T.svg) ?? f.check
1969
+ svg: ((T = (I = (E = (M = (S = (w = e.inbox) == null ? void 0 : w.header) == null ? void 0 : S.menus) == null ? void 0 : M.popup) == null ? void 0 : E.list) == null ? void 0 : I.selectionIcon) == null ? void 0 : T.svg) ?? f.check
1941
1970
  },
1942
1971
  onClick: (j) => {
1943
1972
  this.handleOptionMenuItemClick("inbox", j);
@@ -1945,9 +1974,9 @@ class wo extends Le {
1945
1974
  },
1946
1975
  {
1947
1976
  id: "archive",
1948
- text: (($ = t == null ? void 0 : t.archive) == null ? void 0 : $.text) ?? "Archive",
1977
+ text: ((P = t == null ? void 0 : t.archive) == null ? void 0 : P.text) ?? "Archive",
1949
1978
  icon: {
1950
- color: ((y = (D = t == null ? void 0 : t.archive) == null ? void 0 : D.icon) == null ? void 0 : y.color) ?? "red",
1979
+ color: ((y = ($ = t == null ? void 0 : t.archive) == null ? void 0 : $.icon) == null ? void 0 : y.color) ?? "red",
1951
1980
  svg: ((F = (B = t == null ? void 0 : t.archive) == null ? void 0 : B.icon) == null ? void 0 : F.svg) ?? f.archive
1952
1981
  },
1953
1982
  selectionIcon: {
@@ -1961,7 +1990,7 @@ class wo extends Le {
1961
1990
  ];
1962
1991
  }
1963
1992
  getActionOptions() {
1964
- var s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, E, M;
1993
+ var s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M, E;
1965
1994
  const t = (n = (o = (s = this._themeSubscription.manager.getTheme().inbox) == null ? void 0 : s.header) == null ? void 0 : o.menus) == null ? void 0 : n.actions;
1966
1995
  return [
1967
1996
  {
@@ -1973,7 +2002,7 @@ class wo extends Le {
1973
2002
  },
1974
2003
  selectionIcon: null,
1975
2004
  onClick: (I) => {
1976
- A.shared.readAllMessages();
2005
+ A.shared.readAllMessages({ canCallApi: !0 });
1977
2006
  }
1978
2007
  },
1979
2008
  {
@@ -1994,11 +2023,11 @@ class wo extends Le {
1994
2023
  text: ((k = t == null ? void 0 : t.archiveRead) == null ? void 0 : k.text) ?? "Archive Read",
1995
2024
  icon: {
1996
2025
  color: ((S = (w = t == null ? void 0 : t.archiveRead) == null ? void 0 : w.icon) == null ? void 0 : S.color) ?? "red",
1997
- svg: ((M = (E = t == null ? void 0 : t.archiveRead) == null ? void 0 : E.icon) == null ? void 0 : M.svg) ?? f.archive
2026
+ svg: ((E = (M = t == null ? void 0 : t.archiveRead) == null ? void 0 : M.icon) == null ? void 0 : E.svg) ?? f.archive
1998
2027
  },
1999
2028
  selectionIcon: null,
2000
2029
  onClick: (I) => {
2001
- alert("TODO: Archive read messages");
2030
+ A.shared.archiveReadMessages({ canCallApi: !0 });
2002
2031
  }
2003
2032
  }
2004
2033
  ];
@@ -2581,8 +2610,8 @@ const we = {
2581
2610
  }
2582
2611
  }
2583
2612
  }
2584
- }, Do = (g, i) => {
2585
- var t, s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, E, M, I, T, $, D, y, B, F, H, R, z, O, N, U, V, Z, J, q, X, Y, j, se, oe, ne, re, ae, he, ce, le, de, ue, pe, ge, me, be, _e, xe, fe, Ce, ve, ye, l, P, K, Q, W, ke, Fe, He, Re, ze, Oe, Ne, Ue, Ve, Ze, We, je, Ge, Je, qe, Xe, Ye, Ke, Qe, et, tt, it, st, ot, nt, rt, at, ht, ct, lt, dt, ut, pt, gt, mt, bt, _t, xt, ft, Ct, vt, yt, kt, wt, St, Et, Mt, It, Lt, Tt, Bt, At, Pt, $t, Dt, Ft, Ht, Rt, zt, Ot, Nt, Ut, Vt, Zt, Wt, jt, Gt, Jt, qt, Xt, Yt, Kt, Qt, ei, ti, ii, si, oi, ni, ri, ai, hi, ci, li, di, ui, pi, gi, mi, bi, _i, xi, fi, Ci, vi, yi, ki, wi, Si, Ei, Mi, Ii, Li, Ti, Bi, Ai, Pi, $i, Di, Fi, Hi, Ri, zi, Oi, Ni, Ui, Vi, Zi, Wi, ji, Gi, Ji, qi, Xi, Yi, Ki, Qi, es, ts, is, ss, os, ns, rs, as, hs, cs, ls, ds, us, ps, gs, ms, bs, _s, xs, fs, Cs, vs, ys, ks, ws, Ss, Es, Ms, Is, Ls, Ts, Bs, As, Ps, $s, Ds, Fs, Hs, Rs, zs, Os, Ns, Us, Vs, Zs, Ws, js, Gs, Js, qs, Xs, Ys, Ks, Qs, eo, to, io, so, oo, no, ro, ao, ho, co, lo, uo, po;
2613
+ }, $o = (g, i) => {
2614
+ var t, s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M, E, I, T, P, $, y, B, F, H, R, z, O, N, U, V, Z, J, q, X, Y, j, se, oe, ne, re, ae, he, ce, le, de, ue, pe, ge, me, be, _e, xe, fe, Ce, ve, ye, l, D, K, Q, W, ke, Fe, He, Re, ze, Oe, Ne, Ue, Ve, Ze, We, je, Ge, Je, qe, Xe, Ye, Ke, Qe, et, tt, it, st, ot, nt, rt, at, ht, ct, lt, dt, ut, pt, gt, mt, bt, _t, xt, ft, Ct, vt, yt, kt, wt, St, Mt, Et, It, Lt, Tt, Bt, At, Dt, Pt, $t, Ft, Ht, Rt, zt, Ot, Nt, Ut, Vt, Zt, Wt, jt, Gt, Jt, qt, Xt, Yt, Kt, Qt, ei, ti, ii, si, oi, ni, ri, ai, hi, ci, li, di, ui, pi, gi, mi, bi, _i, xi, fi, Ci, vi, yi, ki, wi, Si, Mi, Ei, Ii, Li, Ti, Bi, Ai, Di, Pi, $i, Fi, Hi, Ri, zi, Oi, Ni, Ui, Vi, Zi, Wi, ji, Gi, Ji, qi, Xi, Yi, Ki, Qi, es, ts, is, ss, os, ns, rs, as, hs, cs, ls, ds, us, ps, gs, ms, bs, _s, xs, fs, Cs, vs, ys, ks, ws, Ss, Ms, Es, Is, Ls, Ts, Bs, As, Ds, Ps, $s, Fs, Hs, Rs, zs, Os, Ns, Us, Vs, Zs, Ws, js, Gs, Js, qs, Xs, Ys, Ks, Qs, eo, to, io, so, oo, no, ro, ao, ho, co, lo, uo, po;
2586
2615
  const e = g === "light" ? we : Ae;
2587
2616
  return {
2588
2617
  popup: {
@@ -2609,10 +2638,10 @@ const we = {
2609
2638
  ...(v = i.inbox) == null ? void 0 : v.header,
2610
2639
  filters: {
2611
2640
  ...(w = (k = e.inbox) == null ? void 0 : k.header) == null ? void 0 : w.filters,
2612
- ...(E = (S = i.inbox) == null ? void 0 : S.header) == null ? void 0 : E.filters,
2641
+ ...(M = (S = i.inbox) == null ? void 0 : S.header) == null ? void 0 : M.filters,
2613
2642
  inbox: {
2614
- ...(T = (I = (M = e.inbox) == null ? void 0 : M.header) == null ? void 0 : I.filters) == null ? void 0 : T.inbox,
2615
- ...(y = (D = ($ = i.inbox) == null ? void 0 : $.header) == null ? void 0 : D.filters) == null ? void 0 : y.inbox,
2643
+ ...(T = (I = (E = e.inbox) == null ? void 0 : E.header) == null ? void 0 : I.filters) == null ? void 0 : T.inbox,
2644
+ ...(y = ($ = (P = i.inbox) == null ? void 0 : P.header) == null ? void 0 : $.filters) == null ? void 0 : y.inbox,
2616
2645
  icon: {
2617
2646
  ...(R = (H = (F = (B = e.inbox) == null ? void 0 : B.header) == null ? void 0 : F.filters) == null ? void 0 : H.inbox) == null ? void 0 : R.icon,
2618
2647
  ...(U = (N = (O = (z = i.inbox) == null ? void 0 : z.header) == null ? void 0 : O.filters) == null ? void 0 : N.inbox) == null ? void 0 : U.icon
@@ -2636,7 +2665,7 @@ const we = {
2636
2665
  ...(fe = (xe = i.inbox) == null ? void 0 : xe.header) == null ? void 0 : fe.menus,
2637
2666
  popup: {
2638
2667
  ...(ye = (ve = (Ce = e.inbox) == null ? void 0 : Ce.header) == null ? void 0 : ve.menus) == null ? void 0 : ye.popup,
2639
- ...(K = (P = (l = i.inbox) == null ? void 0 : l.header) == null ? void 0 : P.menus) == null ? void 0 : K.popup,
2668
+ ...(K = (D = (l = i.inbox) == null ? void 0 : l.header) == null ? void 0 : D.menus) == null ? void 0 : K.popup,
2640
2669
  list: {
2641
2670
  ...(Fe = (ke = (W = (Q = e.inbox) == null ? void 0 : Q.header) == null ? void 0 : W.menus) == null ? void 0 : ke.popup) == null ? void 0 : Fe.list,
2642
2671
  ...(Oe = (ze = (Re = (He = i.inbox) == null ? void 0 : He.header) == null ? void 0 : Re.menus) == null ? void 0 : ze.popup) == null ? void 0 : Oe.list,
@@ -2658,12 +2687,12 @@ const we = {
2658
2687
  ...(Ct = (ft = (xt = (_t = i.inbox) == null ? void 0 : _t.header) == null ? void 0 : xt.menus) == null ? void 0 : ft.filters) == null ? void 0 : Ct.inbox,
2659
2688
  icon: {
2660
2689
  ...(St = (wt = (kt = (yt = (vt = e.inbox) == null ? void 0 : vt.header) == null ? void 0 : yt.menus) == null ? void 0 : kt.filters) == null ? void 0 : wt.inbox) == null ? void 0 : St.icon,
2661
- ...(Tt = (Lt = (It = (Mt = (Et = i.inbox) == null ? void 0 : Et.header) == null ? void 0 : Mt.menus) == null ? void 0 : It.filters) == null ? void 0 : Lt.inbox) == null ? void 0 : Tt.icon
2690
+ ...(Tt = (Lt = (It = (Et = (Mt = i.inbox) == null ? void 0 : Mt.header) == null ? void 0 : Et.menus) == null ? void 0 : It.filters) == null ? void 0 : Lt.inbox) == null ? void 0 : Tt.icon
2662
2691
  }
2663
2692
  },
2664
2693
  archive: {
2665
- ...($t = (Pt = (At = (Bt = e.inbox) == null ? void 0 : Bt.header) == null ? void 0 : At.menus) == null ? void 0 : Pt.filters) == null ? void 0 : $t.archive,
2666
- ...(Rt = (Ht = (Ft = (Dt = i.inbox) == null ? void 0 : Dt.header) == null ? void 0 : Ft.menus) == null ? void 0 : Ht.filters) == null ? void 0 : Rt.archive,
2694
+ ...(Pt = (Dt = (At = (Bt = e.inbox) == null ? void 0 : Bt.header) == null ? void 0 : At.menus) == null ? void 0 : Dt.filters) == null ? void 0 : Pt.archive,
2695
+ ...(Rt = (Ht = (Ft = ($t = i.inbox) == null ? void 0 : $t.header) == null ? void 0 : Ft.menus) == null ? void 0 : Ht.filters) == null ? void 0 : Rt.archive,
2667
2696
  icon: {
2668
2697
  ...(Vt = (Ut = (Nt = (Ot = (zt = e.inbox) == null ? void 0 : zt.header) == null ? void 0 : Ot.menus) == null ? void 0 : Nt.filters) == null ? void 0 : Ut.archive) == null ? void 0 : Vt.icon,
2669
2698
  ...(Jt = (Gt = (jt = (Wt = (Zt = i.inbox) == null ? void 0 : Zt.header) == null ? void 0 : Wt.menus) == null ? void 0 : jt.filters) == null ? void 0 : Gt.archive) == null ? void 0 : Jt.icon
@@ -2683,10 +2712,10 @@ const we = {
2683
2712
  },
2684
2713
  archiveAll: {
2685
2714
  ...(yi = (vi = (Ci = (fi = e.inbox) == null ? void 0 : fi.header) == null ? void 0 : Ci.menus) == null ? void 0 : vi.actions) == null ? void 0 : yi.archiveAll,
2686
- ...(Ei = (Si = (wi = (ki = i.inbox) == null ? void 0 : ki.header) == null ? void 0 : wi.menus) == null ? void 0 : Si.actions) == null ? void 0 : Ei.archiveAll,
2715
+ ...(Mi = (Si = (wi = (ki = i.inbox) == null ? void 0 : ki.header) == null ? void 0 : wi.menus) == null ? void 0 : Si.actions) == null ? void 0 : Mi.archiveAll,
2687
2716
  icon: {
2688
- ...(Bi = (Ti = (Li = (Ii = (Mi = e.inbox) == null ? void 0 : Mi.header) == null ? void 0 : Ii.menus) == null ? void 0 : Li.actions) == null ? void 0 : Ti.archiveAll) == null ? void 0 : Bi.icon,
2689
- ...(Fi = (Di = ($i = (Pi = (Ai = i.inbox) == null ? void 0 : Ai.header) == null ? void 0 : Pi.menus) == null ? void 0 : $i.actions) == null ? void 0 : Di.archiveAll) == null ? void 0 : Fi.icon
2717
+ ...(Bi = (Ti = (Li = (Ii = (Ei = e.inbox) == null ? void 0 : Ei.header) == null ? void 0 : Ii.menus) == null ? void 0 : Li.actions) == null ? void 0 : Ti.archiveAll) == null ? void 0 : Bi.icon,
2718
+ ...(Fi = ($i = (Pi = (Di = (Ai = i.inbox) == null ? void 0 : Ai.header) == null ? void 0 : Di.menus) == null ? void 0 : Pi.actions) == null ? void 0 : $i.archiveAll) == null ? void 0 : Fi.icon
2690
2719
  }
2691
2720
  },
2692
2721
  archiveRead: {
@@ -2714,10 +2743,10 @@ const we = {
2714
2743
  ...(Cs = (fs = (xs = (_s = i.inbox) == null ? void 0 : _s.list) == null ? void 0 : xs.item) == null ? void 0 : fs.menu) == null ? void 0 : Cs.item,
2715
2744
  read: {
2716
2745
  ...(Ss = (ws = (ks = (ys = (vs = e.inbox) == null ? void 0 : vs.list) == null ? void 0 : ys.item) == null ? void 0 : ks.menu) == null ? void 0 : ws.item) == null ? void 0 : Ss.read,
2717
- ...(Ts = (Ls = (Is = (Ms = (Es = i.inbox) == null ? void 0 : Es.list) == null ? void 0 : Ms.item) == null ? void 0 : Is.menu) == null ? void 0 : Ls.item) == null ? void 0 : Ts.read
2746
+ ...(Ts = (Ls = (Is = (Es = (Ms = i.inbox) == null ? void 0 : Ms.list) == null ? void 0 : Es.item) == null ? void 0 : Is.menu) == null ? void 0 : Ls.item) == null ? void 0 : Ts.read
2718
2747
  },
2719
2748
  unread: {
2720
- ...(Ds = ($s = (Ps = (As = (Bs = e.inbox) == null ? void 0 : Bs.list) == null ? void 0 : As.item) == null ? void 0 : Ps.menu) == null ? void 0 : $s.item) == null ? void 0 : Ds.unread,
2749
+ ...($s = (Ps = (Ds = (As = (Bs = e.inbox) == null ? void 0 : Bs.list) == null ? void 0 : As.item) == null ? void 0 : Ds.menu) == null ? void 0 : Ps.item) == null ? void 0 : $s.unread,
2721
2750
  ...(Os = (zs = (Rs = (Hs = (Fs = i.inbox) == null ? void 0 : Fs.list) == null ? void 0 : Hs.item) == null ? void 0 : Rs.menu) == null ? void 0 : zs.item) == null ? void 0 : Os.unread
2722
2751
  },
2723
2752
  archive: {
@@ -2747,7 +2776,7 @@ const we = {
2747
2776
  }
2748
2777
  };
2749
2778
  };
2750
- class Eo {
2779
+ class Mo {
2751
2780
  constructor(i) {
2752
2781
  // Event IDs
2753
2782
  a(this, "THEME_CHANGE_EVENT", "courier_inbox_theme_change");
@@ -2787,7 +2816,7 @@ class Eo {
2787
2816
  * Update the theme
2788
2817
  */
2789
2818
  updateTheme() {
2790
- const i = this._userMode === "system" ? this._systemMode : this._userMode, e = i === "light" ? this._lightTheme : this._darkTheme, t = Do(i, e);
2819
+ const i = this._userMode === "system" ? this._systemMode : this._userMode, e = i === "light" ? this._lightTheme : this._darkTheme, t = $o(i, e);
2791
2820
  this.setTheme(t);
2792
2821
  }
2793
2822
  /**
@@ -2831,7 +2860,7 @@ class Eo {
2831
2860
  this._systemThemeCleanup && this._systemThemeCleanup(), this._subscriptions.forEach((i) => i.unsubscribe()), this._subscriptions = [];
2832
2861
  }
2833
2862
  }
2834
- class Mo extends HTMLElement {
2863
+ class Eo extends HTMLElement {
2835
2864
  constructor(e) {
2836
2865
  var t;
2837
2866
  super();
@@ -2859,7 +2888,7 @@ class Mo extends HTMLElement {
2859
2888
  feedType: this._currentFeed,
2860
2889
  height: "768px"
2861
2890
  });
2862
- this._shadow = this.attachShadow({ mode: "open" }), this._themeManager = e ?? new Eo(we), this._header = new wo({
2891
+ this._shadow = this.attachShadow({ mode: "open" }), this._themeManager = e ?? new Mo(we), this._header = new wo({
2863
2892
  themeManager: this._themeManager,
2864
2893
  onFeedTypeChange: (s) => {
2865
2894
  this.setFeedType(s);
@@ -2881,7 +2910,7 @@ class Mo extends HTMLElement {
2881
2910
  },
2882
2911
  onMessageClick: (s, o) => {
2883
2912
  var n;
2884
- A.shared.clickMessage(s), this.dispatchEvent(new CustomEvent("message-click", {
2913
+ A.shared.clickMessage({ message: s }), this.dispatchEvent(new CustomEvent("message-click", {
2885
2914
  detail: { message: s, index: o },
2886
2915
  bubbles: !0,
2887
2916
  composed: !0
@@ -3087,7 +3116,7 @@ class Mo extends HTMLElement {
3087
3116
  }
3088
3117
  }
3089
3118
  }
3090
- customElements.get("courier-inbox") || customElements.define("courier-inbox", Mo);
3119
+ customElements.get("courier-inbox") || customElements.define("courier-inbox", Eo);
3091
3120
  class Io extends Le {
3092
3121
  constructor(e) {
3093
3122
  super();
@@ -3102,7 +3131,7 @@ class Io extends Le {
3102
3131
  });
3103
3132
  }
3104
3133
  defaultElement() {
3105
- this._container = document.createElement("div"), this._container.className = "menu-button-container", this._triggerButton = new Se(f.inbox), this._unreadCountBadge = new De({
3134
+ this._container = document.createElement("div"), this._container.className = "menu-button-container", this._triggerButton = new Se(f.inbox), this._unreadCountBadge = new $e({
3106
3135
  themeBus: this._themeSubscription.manager,
3107
3136
  location: "button"
3108
3137
  }), this._unreadCountBadge.id = "unread-badge";
@@ -3129,9 +3158,9 @@ class Io extends Le {
3129
3158
  (t = this._unreadCountBadge) == null || t.setCount(e), this.updateTheme();
3130
3159
  }
3131
3160
  updateTheme() {
3132
- var t, s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, E;
3161
+ var t, s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M;
3133
3162
  const e = this._themeSubscription.manager.getTheme();
3134
- (n = this._triggerButton) == null || n.updateIconColor(((o = (s = (t = e == null ? void 0 : e.popup) == null ? void 0 : t.button) == null ? void 0 : s.icon) == null ? void 0 : o.color) ?? r.black[500]), (u = this._triggerButton) == null || u.updateIconSVG(((c = (d = (h = e == null ? void 0 : e.popup) == null ? void 0 : h.button) == null ? void 0 : d.icon) == null ? void 0 : c.svg) ?? f.inbox), (x = this._triggerButton) == null || x.updateBackgroundColor(((p = (m = e == null ? void 0 : e.popup) == null ? void 0 : m.button) == null ? void 0 : p.backgroundColor) ?? "transparent"), (v = this._triggerButton) == null || v.updateHoverBackgroundColor(((b = (_ = e == null ? void 0 : e.popup) == null ? void 0 : _.button) == null ? void 0 : b.hoverBackgroundColor) ?? r.black[50010]), (S = this._triggerButton) == null || S.updateActiveBackgroundColor(((w = (k = e == null ? void 0 : e.popup) == null ? void 0 : k.button) == null ? void 0 : w.activeBackgroundColor) ?? r.black[50020]), (E = this._unreadCountBadge) == null || E.refreshTheme("button");
3163
+ (n = this._triggerButton) == null || n.updateIconColor(((o = (s = (t = e == null ? void 0 : e.popup) == null ? void 0 : t.button) == null ? void 0 : s.icon) == null ? void 0 : o.color) ?? r.black[500]), (u = this._triggerButton) == null || u.updateIconSVG(((c = (d = (h = e == null ? void 0 : e.popup) == null ? void 0 : h.button) == null ? void 0 : d.icon) == null ? void 0 : c.svg) ?? f.inbox), (x = this._triggerButton) == null || x.updateBackgroundColor(((p = (m = e == null ? void 0 : e.popup) == null ? void 0 : m.button) == null ? void 0 : p.backgroundColor) ?? "transparent"), (v = this._triggerButton) == null || v.updateHoverBackgroundColor(((b = (_ = e == null ? void 0 : e.popup) == null ? void 0 : _.button) == null ? void 0 : b.hoverBackgroundColor) ?? r.black[50010]), (S = this._triggerButton) == null || S.updateActiveBackgroundColor(((w = (k = e == null ? void 0 : e.popup) == null ? void 0 : k.button) == null ? void 0 : w.activeBackgroundColor) ?? r.black[50020]), (M = this._unreadCountBadge) == null || M.refreshTheme("button");
3135
3164
  }
3136
3165
  disconnectedCallback() {
3137
3166
  this._themeSubscription.unsubscribe();
@@ -3150,7 +3179,7 @@ class Fo extends HTMLElement {
3150
3179
  a(this, "_bottom", "40px");
3151
3180
  a(this, "_left", "0");
3152
3181
  // Theming
3153
- a(this, "_themeManager", new Eo(we));
3182
+ a(this, "_themeManager", new Mo(we));
3154
3183
  // Components
3155
3184
  a(this, "_triggerButton");
3156
3185
  a(this, "_popup");
@@ -3161,7 +3190,7 @@ class Fo extends HTMLElement {
3161
3190
  // Factories
3162
3191
  a(this, "_popupMenuButtonFactory");
3163
3192
  const e = this.attachShadow({ mode: "open" });
3164
- this._triggerButton = new Io(this._themeManager), this._triggerButton.build(void 0), this._popup = document.createElement("div"), this._popup.className = "popup", this._inbox = new Mo(this._themeManager), this._inbox.setAttribute("height", "100%"), this._style = document.createElement("style"), this.refreshTheme(), e.appendChild(this._style), e.appendChild(this._triggerButton), e.appendChild(this._popup), this._popup.appendChild(this._inbox), this._triggerButton.addEventListener("click", this.togglePopup.bind(this)), document.addEventListener("click", this.handleOutsideClick.bind(this)), this.updatePopupPosition(), this._datastoreListener = new So(this), A.shared.addDataStoreListener(this._datastoreListener), this._themeManager.subscribe((t) => {
3193
+ this._triggerButton = new Io(this._themeManager), this._triggerButton.build(void 0), this._popup = document.createElement("div"), this._popup.className = "popup", this._inbox = new Eo(this._themeManager), this._inbox.setAttribute("height", "100%"), this._style = document.createElement("style"), this.refreshTheme(), e.appendChild(this._style), e.appendChild(this._triggerButton), e.appendChild(this._popup), this._popup.appendChild(this._inbox), this._triggerButton.addEventListener("click", this.togglePopup.bind(this)), document.addEventListener("click", this.handleOutsideClick.bind(this)), this.updatePopupPosition(), this._datastoreListener = new So(this), A.shared.addDataStoreListener(this._datastoreListener), this._themeManager.subscribe((t) => {
3165
3194
  this.refreshTheme();
3166
3195
  });
3167
3196
  }
@@ -3390,21 +3419,21 @@ class Zo {
3390
3419
  }
3391
3420
  }
3392
3421
  export {
3393
- Mo as CourierInbox,
3422
+ Eo as CourierInbox,
3394
3423
  So as CourierInboxDataStoreListener,
3395
3424
  A as CourierInboxDatastore,
3396
3425
  Zo as CourierInboxDatastoreEvents,
3397
3426
  wo as CourierInboxHeader,
3398
3427
  Fo as CourierInboxMenu,
3399
- Eo as CourierInboxThemeManager,
3428
+ Mo as CourierInboxThemeManager,
3400
3429
  xo as CourierListItem,
3401
3430
  Uo as archiveMessage,
3402
3431
  No as clickMessage,
3403
3432
  Ae as defaultDarkTheme,
3404
3433
  we as defaultLightTheme,
3405
- $o as getMessageTime,
3434
+ Po as getMessageTime,
3406
3435
  zo as markAsRead,
3407
3436
  Oo as markAsUnread,
3408
- Do as mergeTheme,
3437
+ $o as mergeTheme,
3409
3438
  Vo as openMessage
3410
3439
  };