@trycourier/courier-ui-inbox 2.2.1 → 2.4.0

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.mjs CHANGED
@@ -79,6 +79,91 @@ function getMessageTime(message) {
79
79
  }
80
80
  return `${Math.floor(diffInSeconds / 31536e3)}y`;
81
81
  }
82
+ function escapeHtml(text) {
83
+ const map = {
84
+ "&": "&",
85
+ "<": "&lt;",
86
+ ">": "&gt;",
87
+ '"': "&quot;",
88
+ "'": "&#039;"
89
+ };
90
+ return String(text).replace(/[&<>"']/g, (c) => map[c] ?? c);
91
+ }
92
+ function escapeAttr(value) {
93
+ return escapeHtml(value).replace(/\n/g, " ");
94
+ }
95
+ function looksLikeHtml(str) {
96
+ if (!str || typeof str !== "string") return false;
97
+ return /<[a-z][\s\S]*>/i.test(str);
98
+ }
99
+ const LINK_ATTRS = ' class="courier-inbox-subtitle-link" style="cursor: pointer;"';
100
+ function linkifyPlainText(text) {
101
+ if (typeof text !== "string" || !text) return "";
102
+ const combinedRegex = /\[([^\]]*)\]\((https?:\/\/[^\s)]+)\)|(https?:\/\/[^\s<>"']+)/gi;
103
+ const parts = [];
104
+ let lastIndex = 0;
105
+ let match;
106
+ combinedRegex.lastIndex = 0;
107
+ while ((match = combinedRegex.exec(text)) !== null) {
108
+ parts.push(escapeHtml(text.slice(lastIndex, match.index)));
109
+ const mdText = match[1];
110
+ const mdUrl = match[2];
111
+ const bareUrl = match[3];
112
+ if (mdUrl !== void 0) {
113
+ const safeUrl = escapeAttr(mdUrl);
114
+ const safeText = escapeHtml(mdText ?? mdUrl);
115
+ parts.push(`<a href="${safeUrl}" target="_blank" rel="noopener noreferrer"${LINK_ATTRS}>${safeText}</a>`);
116
+ } else if (bareUrl !== void 0) {
117
+ const safeUrl = escapeAttr(bareUrl);
118
+ parts.push(`<a href="${safeUrl}" target="_blank" rel="noopener noreferrer"${LINK_ATTRS}>${escapeHtml(bareUrl)}</a>`);
119
+ }
120
+ lastIndex = match.index + match[0].length;
121
+ }
122
+ parts.push(escapeHtml(text.slice(lastIndex)));
123
+ return parts.join("");
124
+ }
125
+ function normalizePreviewHtml(html) {
126
+ let out = html;
127
+ out = out.replace(
128
+ /href\s*=\s*["']?\[[^\]]*\]\s*\(\s*(https?:\/\/[^\s)]+)\s*\)/gi,
129
+ (_, url) => `href="${url}"`
130
+ );
131
+ out = out.replace(/target\s*=\s*["']?\+?blank["']?/gi, 'target="_blank"');
132
+ out = out.replace(/rel\s*=\s*["']?noopener\s+no\s*referrer["']?/gi, 'rel="noopener noreferrer"');
133
+ out = out.replace(/rel\s*=\s*["']?noopener\s*noreferrer["']?/gi, 'rel="noopener noreferrer"');
134
+ out = out.replace(/rel\s*=\s*["']?noopener["']?/gi, 'rel="noopener noreferrer"');
135
+ return out;
136
+ }
137
+ function sanitizeHtmlForInbox(html) {
138
+ if (typeof html !== "string") return "";
139
+ if (!html.trim()) return "";
140
+ const normalized = normalizePreviewHtml(html);
141
+ try {
142
+ let walk = function(node) {
143
+ if (node.nodeType === Node.TEXT_NODE) {
144
+ return escapeHtml(node.textContent ?? "");
145
+ }
146
+ if (node.nodeType !== Node.ELEMENT_NODE) return "";
147
+ const el = node;
148
+ const tagName = el.tagName.toUpperCase();
149
+ if (tagName === "A") {
150
+ const href = el.getAttribute("href") ?? "";
151
+ if (/^https?:\/\//i.test(href)) {
152
+ const safeHref = escapeAttr(href);
153
+ const inner = Array.from(el.childNodes).map(walk).join("");
154
+ return `<a href="${safeHref}" target="_blank" rel="noopener noreferrer" class="courier-inbox-subtitle-link" style="cursor: pointer;">${inner}</a>`;
155
+ }
156
+ }
157
+ return Array.from(el.childNodes).map(walk).join("");
158
+ };
159
+ const parser = typeof DOMParser !== "undefined" ? new DOMParser() : null;
160
+ if (!parser) return escapeHtml(html);
161
+ const doc = parser.parseFromString(normalized, "text/html");
162
+ return Array.from(doc.body.childNodes).map(walk).join("");
163
+ } catch {
164
+ return escapeHtml(normalized);
165
+ }
166
+ }
82
167
  class CourierInboxListItemMenu extends CourierBaseElement {
83
168
  constructor(theme) {
84
169
  super();
@@ -1219,6 +1304,7 @@ class CourierInboxListItem extends CourierBaseElement {
1219
1304
  if (this._menu && (this._menu.contains(e.target) || e.composedPath().includes(this._menu))) {
1220
1305
  return;
1221
1306
  }
1307
+ if (e.target instanceof HTMLAnchorElement) return;
1222
1308
  if (this._message && this.onItemClick && !(e.target instanceof CourierIcon) && !this._isLongPress) {
1223
1309
  this.onItemClick(this._message);
1224
1310
  }
@@ -1250,7 +1336,7 @@ class CourierInboxListItem extends CourierBaseElement {
1250
1336
  (_a = this._observer) == null ? void 0 : _a.disconnect();
1251
1337
  }
1252
1338
  static getStyles(theme) {
1253
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
1339
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q;
1254
1340
  const list = (_a = theme.inbox) == null ? void 0 : _a.list;
1255
1341
  return `
1256
1342
  ${CourierInboxListItem.id} {
@@ -1344,17 +1430,43 @@ class CourierInboxListItem extends CourierBaseElement {
1344
1430
  color: ${((_o = (_n = list == null ? void 0 : list.item) == null ? void 0 : _n.title) == null ? void 0 : _o.color) ?? "red"};
1345
1431
  margin-bottom: 4px;
1346
1432
  }
1433
+ ${CourierInboxListItem.id} .title a,
1434
+ ${CourierInboxListItem.id} .title .courier-inbox-subtitle-link {
1435
+ --courier-inbox-subtitle-link-color: ${((_q = (_p = list == null ? void 0 : list.item) == null ? void 0 : _p.subtitleLink) == null ? void 0 : _q.color) ?? "#2563EB"};
1436
+ --courier-inbox-subtitle-link-decoration: ${((_s = (_r = list == null ? void 0 : list.item) == null ? void 0 : _r.subtitleLink) == null ? void 0 : _s.textDecoration) ?? "underline"};
1437
+ color: var(--courier-inbox-subtitle-link-color);
1438
+ text-decoration: var(--courier-inbox-subtitle-link-decoration);
1439
+ cursor: pointer;
1440
+ }
1441
+ ${CourierInboxListItem.id} .title a:hover,
1442
+ ${CourierInboxListItem.id} .title .courier-inbox-subtitle-link:hover {
1443
+ color: ${((_u = (_t = list == null ? void 0 : list.item) == null ? void 0 : _t.subtitleLink) == null ? void 0 : _u.hoverColor) ?? ((_w = (_v = list == null ? void 0 : list.item) == null ? void 0 : _v.subtitleLink) == null ? void 0 : _w.color) ?? "#2563EB"};
1444
+ }
1347
1445
 
1348
1446
  ${CourierInboxListItem.id} .subtitle {
1349
- font-family: ${((_q = (_p = list == null ? void 0 : list.item) == null ? void 0 : _p.subtitle) == null ? void 0 : _q.family) ?? "inherit"};
1350
- font-size: ${((_s = (_r = list == null ? void 0 : list.item) == null ? void 0 : _r.subtitle) == null ? void 0 : _s.size) ?? "14px"};
1351
- color: ${((_u = (_t = list == null ? void 0 : list.item) == null ? void 0 : _t.subtitle) == null ? void 0 : _u.color) ?? "red"};
1447
+ font-family: ${((_y = (_x = list == null ? void 0 : list.item) == null ? void 0 : _x.subtitle) == null ? void 0 : _y.family) ?? "inherit"};
1448
+ font-size: ${((_A = (_z = list == null ? void 0 : list.item) == null ? void 0 : _z.subtitle) == null ? void 0 : _A.size) ?? "14px"};
1449
+ color: ${((_C = (_B = list == null ? void 0 : list.item) == null ? void 0 : _B.subtitle) == null ? void 0 : _C.color) ?? "red"};
1450
+ }
1451
+
1452
+ ${CourierInboxListItem.id} .subtitle a,
1453
+ ${CourierInboxListItem.id} .subtitle .courier-inbox-subtitle-link {
1454
+ --courier-inbox-subtitle-link-color: ${((_E = (_D = list == null ? void 0 : list.item) == null ? void 0 : _D.subtitleLink) == null ? void 0 : _E.color) ?? "#2563EB"};
1455
+ --courier-inbox-subtitle-link-decoration: ${((_G = (_F = list == null ? void 0 : list.item) == null ? void 0 : _F.subtitleLink) == null ? void 0 : _G.textDecoration) ?? "underline"};
1456
+ color: var(--courier-inbox-subtitle-link-color);
1457
+ text-decoration: var(--courier-inbox-subtitle-link-decoration);
1458
+ cursor: pointer;
1459
+ }
1460
+
1461
+ ${CourierInboxListItem.id} .subtitle a:hover,
1462
+ ${CourierInboxListItem.id} .subtitle .courier-inbox-subtitle-link:hover {
1463
+ color: ${((_I = (_H = list == null ? void 0 : list.item) == null ? void 0 : _H.subtitleLink) == null ? void 0 : _I.hoverColor) ?? ((_K = (_J = list == null ? void 0 : list.item) == null ? void 0 : _J.subtitleLink) == null ? void 0 : _K.color) ?? "#2563EB"};
1352
1464
  }
1353
1465
 
1354
1466
  ${CourierInboxListItem.id} .time {
1355
- font-family: ${((_w = (_v = list == null ? void 0 : list.item) == null ? void 0 : _v.time) == null ? void 0 : _w.family) ?? "inherit"};
1356
- font-size: ${((_y = (_x = list == null ? void 0 : list.item) == null ? void 0 : _x.time) == null ? void 0 : _y.size) ?? "14px"};
1357
- color: ${((_A = (_z = list == null ? void 0 : list.item) == null ? void 0 : _z.time) == null ? void 0 : _A.color) ?? "red"};
1467
+ font-family: ${((_M = (_L = list == null ? void 0 : list.item) == null ? void 0 : _L.time) == null ? void 0 : _M.family) ?? "inherit"};
1468
+ font-size: ${((_O = (_N = list == null ? void 0 : list.item) == null ? void 0 : _N.time) == null ? void 0 : _O.size) ?? "14px"};
1469
+ color: ${((_Q = (_P = list == null ? void 0 : list.item) == null ? void 0 : _P.time) == null ? void 0 : _Q.color) ?? "red"};
1358
1470
  text-align: right;
1359
1471
  white-space: nowrap;
1360
1472
  }
@@ -1552,10 +1664,23 @@ class CourierInboxListItem extends CourierBaseElement {
1552
1664
  }
1553
1665
  this.classList.toggle("unread", !this._message.read);
1554
1666
  if (this._titleElement) {
1555
- this._titleElement.textContent = this._message.title || "Untitled Message";
1667
+ const titleText = this._message.title || "Untitled Message";
1668
+ if (looksLikeHtml(titleText)) {
1669
+ this._titleElement.innerHTML = sanitizeHtmlForInbox(titleText);
1670
+ } else {
1671
+ this._titleElement.innerHTML = sanitizeHtmlForInbox(linkifyPlainText(titleText));
1672
+ }
1556
1673
  }
1557
1674
  if (this._subtitleElement) {
1558
- this._subtitleElement.textContent = this._message.preview || this._message.body || "";
1675
+ const body = this._message.body ?? "";
1676
+ const preview = this._message.preview ?? "";
1677
+ const preferBodyWithHtml = body && looksLikeHtml(body);
1678
+ const subtitleText = preferBodyWithHtml ? body : preview || body || "";
1679
+ if (looksLikeHtml(subtitleText)) {
1680
+ this._subtitleElement.innerHTML = sanitizeHtmlForInbox(subtitleText);
1681
+ } else {
1682
+ this._subtitleElement.innerHTML = sanitizeHtmlForInbox(linkifyPlainText(subtitleText));
1683
+ }
1559
1684
  }
1560
1685
  if (this._timeElement) {
1561
1686
  this._timeElement.textContent = getMessageTime(this._message);
@@ -3652,6 +3777,11 @@ const defaultLightTheme = {
3652
3777
  family: void 0,
3653
3778
  size: "14px"
3654
3779
  },
3780
+ subtitleLink: {
3781
+ color: CourierColors.blue[500],
3782
+ textDecoration: "underline",
3783
+ hoverColor: CourierColors.blue[400]
3784
+ },
3655
3785
  time: {
3656
3786
  color: CourierColors.gray[600],
3657
3787
  family: void 0,
@@ -3990,6 +4120,11 @@ const defaultDarkTheme = {
3990
4120
  family: void 0,
3991
4121
  size: "14px"
3992
4122
  },
4123
+ subtitleLink: {
4124
+ color: CourierColors.blue[500],
4125
+ textDecoration: "underline",
4126
+ hoverColor: CourierColors.blue[400]
4127
+ },
3993
4128
  time: {
3994
4129
  color: CourierColors.gray[500],
3995
4130
  family: void 0,
@@ -4067,7 +4202,7 @@ const defaultDarkTheme = {
4067
4202
  }
4068
4203
  };
4069
4204
  const mergeTheme = (mode, theme) => {
4070
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua, _Va, _Wa, _Xa, _Ya, _Za, __a, _$a, _ab, _bb, _cb, _db, _eb, _fb, _gb, _hb, _ib, _jb, _kb, _lb, _mb, _nb, _ob, _pb, _qb, _rb, _sb, _tb, _ub, _vb, _wb, _xb, _yb, _zb, _Ab, _Bb, _Cb, _Db, _Eb, _Fb, _Gb, _Hb, _Ib, _Jb, _Kb, _Lb, _Mb, _Nb, _Ob, _Pb, _Qb, _Rb, _Sb, _Tb, _Ub, _Vb, _Wb, _Xb, _Yb, _Zb, __b, _$b, _ac, _bc, _cc, _dc, _ec, _fc, _gc, _hc, _ic, _jc, _kc, _lc, _mc, _nc, _oc, _pc, _qc, _rc, _sc, _tc, _uc, _vc, _wc, _xc, _yc, _zc, _Ac, _Bc, _Cc, _Dc, _Ec, _Fc, _Gc, _Hc, _Ic, _Jc, _Kc, _Lc, _Mc, _Nc, _Oc, _Pc, _Qc, _Rc, _Sc, _Tc, _Uc, _Vc, _Wc, _Xc, _Yc, _Zc, __c, _$c, _ad, _bd, _cd, _dd, _ed, _fd, _gd, _hd, _id, _jd, _kd, _ld, _md, _nd, _od, _pd, _qd, _rd, _sd, _td, _ud, _vd, _wd, _xd, _yd, _zd, _Ad, _Bd, _Cd, _Dd, _Ed, _Fd, _Gd, _Hd, _Id, _Jd, _Kd, _Ld, _Md, _Nd, _Od, _Pd, _Qd, _Rd, _Sd, _Td, _Ud, _Vd, _Wd, _Xd, _Yd, _Zd, __d, _$d, _ae, _be, _ce, _de, _ee, _fe, _ge, _he, _ie, _je, _ke, _le, _me, _ne, _oe, _pe, _qe, _re, _se, _te, _ue, _ve, _we, _xe, _ye, _ze, _Ae, _Be, _Ce, _De, _Ee, _Fe, _Ge, _He, _Ie, _Je, _Ke, _Le, _Me, _Ne, _Oe, _Pe, _Qe, _Re, _Se, _Te, _Ue, _Ve, _We, _Xe, _Ye, _Ze, __e, _$e, _af, _bf, _cf, _df, _ef, _ff, _gf, _hf, _if, _jf, _kf, _lf, _mf, _nf, _of, _pf, _qf, _rf, _sf, _tf, _uf, _vf, _wf, _xf, _yf, _zf, _Af, _Bf, _Cf, _Df, _Ef, _Ff, _Gf, _Hf, _If, _Jf, _Kf, _Lf, _Mf, _Nf, _Of, _Pf, _Qf, _Rf, _Sf, _Tf, _Uf, _Vf, _Wf, _Xf, _Yf, _Zf, __f, _$f, _ag, _bg, _cg, _dg, _eg, _fg, _gg, _hg, _ig, _jg, _kg, _lg, _mg, _ng, _og, _pg, _qg, _rg, _sg, _tg, _ug, _vg, _wg, _xg, _yg, _zg, _Ag, _Bg, _Cg, _Dg, _Eg, _Fg, _Gg, _Hg, _Ig, _Jg, _Kg, _Lg, _Mg, _Ng, _Og, _Pg, _Qg, _Rg, _Sg, _Tg, _Ug, _Vg, _Wg, _Xg, _Yg, _Zg, __g, _$g, _ah, _bh, _ch, _dh, _eh, _fh, _gh, _hh, _ih, _jh, _kh, _lh, _mh, _nh, _oh, _ph, _qh, _rh, _sh, _th, _uh, _vh, _wh, _xh, _yh, _zh, _Ah, _Bh, _Ch, _Dh, _Eh, _Fh, _Gh, _Hh, _Ih, _Jh, _Kh, _Lh, _Mh, _Nh, _Oh, _Ph, _Qh, _Rh, _Sh, _Th;
4205
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua, _Va, _Wa, _Xa, _Ya, _Za, __a, _$a, _ab, _bb, _cb, _db, _eb, _fb, _gb, _hb, _ib, _jb, _kb, _lb, _mb, _nb, _ob, _pb, _qb, _rb, _sb, _tb, _ub, _vb, _wb, _xb, _yb, _zb, _Ab, _Bb, _Cb, _Db, _Eb, _Fb, _Gb, _Hb, _Ib, _Jb, _Kb, _Lb, _Mb, _Nb, _Ob, _Pb, _Qb, _Rb, _Sb, _Tb, _Ub, _Vb, _Wb, _Xb, _Yb, _Zb, __b, _$b, _ac, _bc, _cc, _dc, _ec, _fc, _gc, _hc, _ic, _jc, _kc, _lc, _mc, _nc, _oc, _pc, _qc, _rc, _sc, _tc, _uc, _vc, _wc, _xc, _yc, _zc, _Ac, _Bc, _Cc, _Dc, _Ec, _Fc, _Gc, _Hc, _Ic, _Jc, _Kc, _Lc, _Mc, _Nc, _Oc, _Pc, _Qc, _Rc, _Sc, _Tc, _Uc, _Vc, _Wc, _Xc, _Yc, _Zc, __c, _$c, _ad, _bd, _cd, _dd, _ed, _fd, _gd, _hd, _id, _jd, _kd, _ld, _md, _nd, _od, _pd, _qd, _rd, _sd, _td, _ud, _vd, _wd, _xd, _yd, _zd, _Ad, _Bd, _Cd, _Dd, _Ed, _Fd, _Gd, _Hd, _Id, _Jd, _Kd, _Ld, _Md, _Nd, _Od, _Pd, _Qd, _Rd, _Sd, _Td, _Ud, _Vd, _Wd, _Xd, _Yd, _Zd, __d, _$d, _ae, _be, _ce, _de, _ee, _fe, _ge, _he, _ie, _je, _ke, _le, _me, _ne, _oe, _pe, _qe, _re, _se, _te, _ue, _ve, _we, _xe, _ye, _ze, _Ae, _Be, _Ce, _De, _Ee, _Fe, _Ge, _He, _Ie, _Je, _Ke, _Le, _Me, _Ne, _Oe, _Pe, _Qe, _Re, _Se, _Te, _Ue, _Ve, _We, _Xe, _Ye, _Ze, __e, _$e, _af, _bf, _cf, _df, _ef, _ff, _gf, _hf, _if, _jf, _kf, _lf, _mf, _nf, _of, _pf, _qf, _rf, _sf, _tf, _uf, _vf, _wf, _xf, _yf, _zf, _Af, _Bf, _Cf, _Df, _Ef, _Ff, _Gf, _Hf, _If, _Jf, _Kf, _Lf, _Mf, _Nf, _Of, _Pf, _Qf, _Rf, _Sf, _Tf, _Uf, _Vf, _Wf, _Xf, _Yf, _Zf, __f, _$f, _ag, _bg, _cg, _dg, _eg, _fg, _gg, _hg, _ig, _jg, _kg, _lg, _mg, _ng, _og, _pg, _qg, _rg, _sg, _tg, _ug, _vg, _wg, _xg, _yg, _zg, _Ag, _Bg, _Cg, _Dg, _Eg, _Fg, _Gg, _Hg, _Ig, _Jg, _Kg, _Lg, _Mg, _Ng, _Og, _Pg, _Qg, _Rg, _Sg, _Tg, _Ug, _Vg, _Wg, _Xg, _Yg, _Zg, __g, _$g, _ah, _bh, _ch, _dh, _eh, _fh, _gh, _hh, _ih, _jh, _kh, _lh, _mh, _nh, _oh, _ph, _qh, _rh, _sh, _th, _uh, _vh, _wh, _xh, _yh, _zh, _Ah, _Bh, _Ch, _Dh, _Eh, _Fh, _Gh, _Hh, _Ih, _Jh, _Kh, _Lh, _Mh, _Nh, _Oh, _Ph, _Qh, _Rh, _Sh, _Th, _Uh, _Vh, _Wh, _Xh, _Yh, _Zh;
4071
4206
  const defaultTheme = mode === "light" ? defaultLightTheme : defaultDarkTheme;
4072
4207
  return {
4073
4208
  popup: {
@@ -4279,85 +4414,89 @@ const mergeTheme = (mode, theme) => {
4279
4414
  ...(_Gf = (_Ff = (_Ef = defaultTheme.inbox) == null ? void 0 : _Ef.list) == null ? void 0 : _Ff.item) == null ? void 0 : _Gf.subtitle,
4280
4415
  ...(_Jf = (_If = (_Hf = theme.inbox) == null ? void 0 : _Hf.list) == null ? void 0 : _If.item) == null ? void 0 : _Jf.subtitle
4281
4416
  },
4417
+ subtitleLink: {
4418
+ ...(_Mf = (_Lf = (_Kf = defaultTheme.inbox) == null ? void 0 : _Kf.list) == null ? void 0 : _Lf.item) == null ? void 0 : _Mf.subtitleLink,
4419
+ ...(_Pf = (_Of = (_Nf = theme.inbox) == null ? void 0 : _Nf.list) == null ? void 0 : _Of.item) == null ? void 0 : _Pf.subtitleLink
4420
+ },
4282
4421
  time: {
4283
- ...(_Mf = (_Lf = (_Kf = defaultTheme.inbox) == null ? void 0 : _Kf.list) == null ? void 0 : _Lf.item) == null ? void 0 : _Mf.time,
4284
- ...(_Pf = (_Of = (_Nf = theme.inbox) == null ? void 0 : _Nf.list) == null ? void 0 : _Of.item) == null ? void 0 : _Pf.time
4422
+ ...(_Sf = (_Rf = (_Qf = defaultTheme.inbox) == null ? void 0 : _Qf.list) == null ? void 0 : _Rf.item) == null ? void 0 : _Sf.time,
4423
+ ...(_Vf = (_Uf = (_Tf = theme.inbox) == null ? void 0 : _Tf.list) == null ? void 0 : _Uf.item) == null ? void 0 : _Vf.time
4285
4424
  },
4286
4425
  menu: {
4287
- ...(_Sf = (_Rf = (_Qf = defaultTheme.inbox) == null ? void 0 : _Qf.list) == null ? void 0 : _Rf.item) == null ? void 0 : _Sf.menu,
4288
- ...(_Vf = (_Uf = (_Tf = theme.inbox) == null ? void 0 : _Tf.list) == null ? void 0 : _Uf.item) == null ? void 0 : _Vf.menu,
4426
+ ...(_Yf = (_Xf = (_Wf = defaultTheme.inbox) == null ? void 0 : _Wf.list) == null ? void 0 : _Xf.item) == null ? void 0 : _Yf.menu,
4427
+ ...(_$f = (__f = (_Zf = theme.inbox) == null ? void 0 : _Zf.list) == null ? void 0 : __f.item) == null ? void 0 : _$f.menu,
4289
4428
  animation: {
4290
- ...(_Zf = (_Yf = (_Xf = (_Wf = defaultTheme.inbox) == null ? void 0 : _Wf.list) == null ? void 0 : _Xf.item) == null ? void 0 : _Yf.menu) == null ? void 0 : _Zf.animation,
4291
- ...(_bg = (_ag = (_$f = (__f = theme.inbox) == null ? void 0 : __f.list) == null ? void 0 : _$f.item) == null ? void 0 : _ag.menu) == null ? void 0 : _bg.animation
4429
+ ...(_dg = (_cg = (_bg = (_ag = defaultTheme.inbox) == null ? void 0 : _ag.list) == null ? void 0 : _bg.item) == null ? void 0 : _cg.menu) == null ? void 0 : _dg.animation,
4430
+ ...(_hg = (_gg = (_fg = (_eg = theme.inbox) == null ? void 0 : _eg.list) == null ? void 0 : _fg.item) == null ? void 0 : _gg.menu) == null ? void 0 : _hg.animation
4292
4431
  },
4293
4432
  item: {
4294
- ...(_fg = (_eg = (_dg = (_cg = defaultTheme.inbox) == null ? void 0 : _cg.list) == null ? void 0 : _dg.item) == null ? void 0 : _eg.menu) == null ? void 0 : _fg.item,
4295
- ...(_jg = (_ig = (_hg = (_gg = theme.inbox) == null ? void 0 : _gg.list) == null ? void 0 : _hg.item) == null ? void 0 : _ig.menu) == null ? void 0 : _jg.item,
4433
+ ...(_lg = (_kg = (_jg = (_ig = defaultTheme.inbox) == null ? void 0 : _ig.list) == null ? void 0 : _jg.item) == null ? void 0 : _kg.menu) == null ? void 0 : _lg.item,
4434
+ ...(_pg = (_og = (_ng = (_mg = theme.inbox) == null ? void 0 : _mg.list) == null ? void 0 : _ng.item) == null ? void 0 : _og.menu) == null ? void 0 : _pg.item,
4296
4435
  read: {
4297
- ...(_og = (_ng = (_mg = (_lg = (_kg = defaultTheme.inbox) == null ? void 0 : _kg.list) == null ? void 0 : _lg.item) == null ? void 0 : _mg.menu) == null ? void 0 : _ng.item) == null ? void 0 : _og.read,
4298
- ...(_tg = (_sg = (_rg = (_qg = (_pg = theme.inbox) == null ? void 0 : _pg.list) == null ? void 0 : _qg.item) == null ? void 0 : _rg.menu) == null ? void 0 : _sg.item) == null ? void 0 : _tg.read
4436
+ ...(_ug = (_tg = (_sg = (_rg = (_qg = defaultTheme.inbox) == null ? void 0 : _qg.list) == null ? void 0 : _rg.item) == null ? void 0 : _sg.menu) == null ? void 0 : _tg.item) == null ? void 0 : _ug.read,
4437
+ ...(_zg = (_yg = (_xg = (_wg = (_vg = theme.inbox) == null ? void 0 : _vg.list) == null ? void 0 : _wg.item) == null ? void 0 : _xg.menu) == null ? void 0 : _yg.item) == null ? void 0 : _zg.read
4299
4438
  },
4300
4439
  unread: {
4301
- ...(_yg = (_xg = (_wg = (_vg = (_ug = defaultTheme.inbox) == null ? void 0 : _ug.list) == null ? void 0 : _vg.item) == null ? void 0 : _wg.menu) == null ? void 0 : _xg.item) == null ? void 0 : _yg.unread,
4302
- ...(_Dg = (_Cg = (_Bg = (_Ag = (_zg = theme.inbox) == null ? void 0 : _zg.list) == null ? void 0 : _Ag.item) == null ? void 0 : _Bg.menu) == null ? void 0 : _Cg.item) == null ? void 0 : _Dg.unread
4440
+ ...(_Eg = (_Dg = (_Cg = (_Bg = (_Ag = defaultTheme.inbox) == null ? void 0 : _Ag.list) == null ? void 0 : _Bg.item) == null ? void 0 : _Cg.menu) == null ? void 0 : _Dg.item) == null ? void 0 : _Eg.unread,
4441
+ ...(_Jg = (_Ig = (_Hg = (_Gg = (_Fg = theme.inbox) == null ? void 0 : _Fg.list) == null ? void 0 : _Gg.item) == null ? void 0 : _Hg.menu) == null ? void 0 : _Ig.item) == null ? void 0 : _Jg.unread
4303
4442
  },
4304
4443
  archive: {
4305
- ...(_Ig = (_Hg = (_Gg = (_Fg = (_Eg = defaultTheme.inbox) == null ? void 0 : _Eg.list) == null ? void 0 : _Fg.item) == null ? void 0 : _Gg.menu) == null ? void 0 : _Hg.item) == null ? void 0 : _Ig.archive,
4306
- ...(_Ng = (_Mg = (_Lg = (_Kg = (_Jg = theme.inbox) == null ? void 0 : _Jg.list) == null ? void 0 : _Kg.item) == null ? void 0 : _Lg.menu) == null ? void 0 : _Mg.item) == null ? void 0 : _Ng.archive
4444
+ ...(_Og = (_Ng = (_Mg = (_Lg = (_Kg = defaultTheme.inbox) == null ? void 0 : _Kg.list) == null ? void 0 : _Lg.item) == null ? void 0 : _Mg.menu) == null ? void 0 : _Ng.item) == null ? void 0 : _Og.archive,
4445
+ ...(_Tg = (_Sg = (_Rg = (_Qg = (_Pg = theme.inbox) == null ? void 0 : _Pg.list) == null ? void 0 : _Qg.item) == null ? void 0 : _Rg.menu) == null ? void 0 : _Sg.item) == null ? void 0 : _Tg.archive
4307
4446
  },
4308
4447
  unarchive: {
4309
- ...(_Sg = (_Rg = (_Qg = (_Pg = (_Og = defaultTheme.inbox) == null ? void 0 : _Og.list) == null ? void 0 : _Pg.item) == null ? void 0 : _Qg.menu) == null ? void 0 : _Rg.item) == null ? void 0 : _Sg.unarchive,
4310
- ...(_Xg = (_Wg = (_Vg = (_Ug = (_Tg = theme.inbox) == null ? void 0 : _Tg.list) == null ? void 0 : _Ug.item) == null ? void 0 : _Vg.menu) == null ? void 0 : _Wg.item) == null ? void 0 : _Xg.unarchive
4448
+ ...(_Yg = (_Xg = (_Wg = (_Vg = (_Ug = defaultTheme.inbox) == null ? void 0 : _Ug.list) == null ? void 0 : _Vg.item) == null ? void 0 : _Wg.menu) == null ? void 0 : _Xg.item) == null ? void 0 : _Yg.unarchive,
4449
+ ...(_bh = (_ah = (_$g = (__g = (_Zg = theme.inbox) == null ? void 0 : _Zg.list) == null ? void 0 : __g.item) == null ? void 0 : _$g.menu) == null ? void 0 : _ah.item) == null ? void 0 : _bh.unarchive
4311
4450
  }
4312
4451
  }
4313
4452
  }
4314
4453
  }
4315
4454
  },
4316
4455
  loading: {
4317
- ...(_Yg = defaultTheme.inbox) == null ? void 0 : _Yg.loading,
4318
- ...(_Zg = theme.inbox) == null ? void 0 : _Zg.loading,
4456
+ ...(_ch = defaultTheme.inbox) == null ? void 0 : _ch.loading,
4457
+ ...(_dh = theme.inbox) == null ? void 0 : _dh.loading,
4319
4458
  animation: {
4320
- ...(_$g = (__g = defaultTheme.inbox) == null ? void 0 : __g.loading) == null ? void 0 : _$g.animation,
4321
- ...(_bh = (_ah = theme.inbox) == null ? void 0 : _ah.loading) == null ? void 0 : _bh.animation
4459
+ ...(_fh = (_eh = defaultTheme.inbox) == null ? void 0 : _eh.loading) == null ? void 0 : _fh.animation,
4460
+ ...(_hh = (_gh = theme.inbox) == null ? void 0 : _gh.loading) == null ? void 0 : _hh.animation
4322
4461
  }
4323
4462
  },
4324
4463
  empty: {
4325
- ...(_ch = defaultTheme.inbox) == null ? void 0 : _ch.empty,
4326
- ...(_dh = theme.inbox) == null ? void 0 : _dh.empty,
4464
+ ...(_ih = defaultTheme.inbox) == null ? void 0 : _ih.empty,
4465
+ ...(_jh = theme.inbox) == null ? void 0 : _jh.empty,
4327
4466
  title: {
4328
- ...(_fh = (_eh = defaultTheme.inbox) == null ? void 0 : _eh.empty) == null ? void 0 : _fh.title,
4329
- ...(_hh = (_gh = theme.inbox) == null ? void 0 : _gh.empty) == null ? void 0 : _hh.title,
4467
+ ...(_lh = (_kh = defaultTheme.inbox) == null ? void 0 : _kh.empty) == null ? void 0 : _lh.title,
4468
+ ...(_nh = (_mh = theme.inbox) == null ? void 0 : _mh.empty) == null ? void 0 : _nh.title,
4330
4469
  font: {
4331
- ...(_kh = (_jh = (_ih = defaultTheme.inbox) == null ? void 0 : _ih.empty) == null ? void 0 : _jh.title) == null ? void 0 : _kh.font,
4332
- ...(_nh = (_mh = (_lh = theme.inbox) == null ? void 0 : _lh.empty) == null ? void 0 : _mh.title) == null ? void 0 : _nh.font
4470
+ ...(_qh = (_ph = (_oh = defaultTheme.inbox) == null ? void 0 : _oh.empty) == null ? void 0 : _ph.title) == null ? void 0 : _qh.font,
4471
+ ...(_th = (_sh = (_rh = theme.inbox) == null ? void 0 : _rh.empty) == null ? void 0 : _sh.title) == null ? void 0 : _th.font
4333
4472
  }
4334
4473
  },
4335
4474
  button: {
4336
- ...(_ph = (_oh = defaultTheme.inbox) == null ? void 0 : _oh.empty) == null ? void 0 : _ph.button,
4337
- ...(_rh = (_qh = theme.inbox) == null ? void 0 : _qh.empty) == null ? void 0 : _rh.button,
4475
+ ...(_vh = (_uh = defaultTheme.inbox) == null ? void 0 : _uh.empty) == null ? void 0 : _vh.button,
4476
+ ...(_xh = (_wh = theme.inbox) == null ? void 0 : _wh.empty) == null ? void 0 : _xh.button,
4338
4477
  font: {
4339
- ...(_uh = (_th = (_sh = defaultTheme.inbox) == null ? void 0 : _sh.empty) == null ? void 0 : _th.button) == null ? void 0 : _uh.font,
4340
- ...(_xh = (_wh = (_vh = theme.inbox) == null ? void 0 : _vh.empty) == null ? void 0 : _wh.button) == null ? void 0 : _xh.font
4478
+ ...(_Ah = (_zh = (_yh = defaultTheme.inbox) == null ? void 0 : _yh.empty) == null ? void 0 : _zh.button) == null ? void 0 : _Ah.font,
4479
+ ...(_Dh = (_Ch = (_Bh = theme.inbox) == null ? void 0 : _Bh.empty) == null ? void 0 : _Ch.button) == null ? void 0 : _Dh.font
4341
4480
  }
4342
4481
  }
4343
4482
  },
4344
4483
  error: {
4345
- ...(_yh = defaultTheme.inbox) == null ? void 0 : _yh.error,
4346
- ...(_zh = theme.inbox) == null ? void 0 : _zh.error,
4484
+ ...(_Eh = defaultTheme.inbox) == null ? void 0 : _Eh.error,
4485
+ ...(_Fh = theme.inbox) == null ? void 0 : _Fh.error,
4347
4486
  title: {
4348
- ...(_Bh = (_Ah = defaultTheme.inbox) == null ? void 0 : _Ah.error) == null ? void 0 : _Bh.title,
4349
- ...(_Dh = (_Ch = theme.inbox) == null ? void 0 : _Ch.error) == null ? void 0 : _Dh.title,
4487
+ ...(_Hh = (_Gh = defaultTheme.inbox) == null ? void 0 : _Gh.error) == null ? void 0 : _Hh.title,
4488
+ ...(_Jh = (_Ih = theme.inbox) == null ? void 0 : _Ih.error) == null ? void 0 : _Jh.title,
4350
4489
  font: {
4351
- ...(_Gh = (_Fh = (_Eh = defaultTheme.inbox) == null ? void 0 : _Eh.error) == null ? void 0 : _Fh.title) == null ? void 0 : _Gh.font,
4352
- ...(_Jh = (_Ih = (_Hh = theme.inbox) == null ? void 0 : _Hh.error) == null ? void 0 : _Ih.title) == null ? void 0 : _Jh.font
4490
+ ...(_Mh = (_Lh = (_Kh = defaultTheme.inbox) == null ? void 0 : _Kh.error) == null ? void 0 : _Lh.title) == null ? void 0 : _Mh.font,
4491
+ ...(_Ph = (_Oh = (_Nh = theme.inbox) == null ? void 0 : _Nh.error) == null ? void 0 : _Oh.title) == null ? void 0 : _Ph.font
4353
4492
  }
4354
4493
  },
4355
4494
  button: {
4356
- ...(_Lh = (_Kh = defaultTheme.inbox) == null ? void 0 : _Kh.error) == null ? void 0 : _Lh.button,
4357
- ...(_Nh = (_Mh = theme.inbox) == null ? void 0 : _Mh.error) == null ? void 0 : _Nh.button,
4495
+ ...(_Rh = (_Qh = defaultTheme.inbox) == null ? void 0 : _Qh.error) == null ? void 0 : _Rh.button,
4496
+ ...(_Th = (_Sh = theme.inbox) == null ? void 0 : _Sh.error) == null ? void 0 : _Th.button,
4358
4497
  font: {
4359
- ...(_Qh = (_Ph = (_Oh = defaultTheme.inbox) == null ? void 0 : _Oh.error) == null ? void 0 : _Ph.button) == null ? void 0 : _Qh.font,
4360
- ...(_Th = (_Sh = (_Rh = theme.inbox) == null ? void 0 : _Rh.error) == null ? void 0 : _Sh.button) == null ? void 0 : _Th.font
4498
+ ...(_Wh = (_Vh = (_Uh = defaultTheme.inbox) == null ? void 0 : _Uh.error) == null ? void 0 : _Vh.button) == null ? void 0 : _Wh.font,
4499
+ ...(_Zh = (_Yh = (_Xh = theme.inbox) == null ? void 0 : _Xh.error) == null ? void 0 : _Yh.button) == null ? void 0 : _Zh.font
4361
4500
  }
4362
4501
  }
4363
4502
  }
@@ -4592,9 +4731,12 @@ class CourierInbox extends CourierBaseElement {
4592
4731
  this.refreshTheme();
4593
4732
  }
4594
4733
  setupAuthListener() {
4595
- this._authListener = Courier.shared.addAuthenticationListener(async ({ userId }) => {
4734
+ this._authListener = Courier.shared.addAuthenticationListener(({ userId }) => {
4596
4735
  if (userId) {
4597
- await this.refresh();
4736
+ this.refresh().catch((err) => {
4737
+ var _a, _b, _c;
4738
+ (_c = (_b = (_a = Courier.shared.client) == null ? void 0 : _a.options.logger) == null ? void 0 : _b.warn) == null ? void 0 : _c.call(_b, "Inbox refresh failed after sign-in", err);
4739
+ });
4598
4740
  }
4599
4741
  });
4600
4742
  }
@@ -5788,7 +5930,7 @@ class CourierInboxDatastoreEvents {
5788
5930
  }
5789
5931
  }
5790
5932
  Courier.shared.courierUserAgentName = "courier-ui-inbox";
5791
- Courier.shared.courierUserAgentVersion = "2.2.1";
5933
+ Courier.shared.courierUserAgentVersion = "2.4.0";
5792
5934
  export {
5793
5935
  Courier2 as Courier,
5794
5936
  CourierInbox,