@trycourier/courier-ui-inbox 1.0.9-beta → 1.0.11-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.mjs CHANGED
@@ -157,29 +157,35 @@ const baseButtonStyles = {
157
157
  fontSize: "14px"
158
158
  };
159
159
  const CourierButtonVariants = {
160
- primary: (mode) => ({
161
- ...baseButtonStyles,
162
- backgroundColor: theme[mode].colors.primary,
163
- textColor: theme[mode].colors.secondary,
164
- fontWeight: "500",
165
- shadow: "none"
166
- }),
167
- secondary: (mode) => ({
168
- ...baseButtonStyles,
169
- backgroundColor: theme[mode].colors.secondary,
170
- textColor: theme[mode].colors.primary,
171
- fontWeight: "500",
172
- border: `1px solid ${theme[mode].colors.border}`,
173
- shadow: mode === "light" ? "0px 1px 2px 0px rgba(0, 0, 0, 0.06)" : "0px 1px 2px 0px rgba(255, 255, 255, 0.1)"
174
- }),
175
- tertiary: (mode) => ({
176
- ...baseButtonStyles,
177
- backgroundColor: theme[mode].colors.border,
178
- textColor: theme[mode].colors.primary,
179
- fontWeight: "500",
180
- border: "none",
181
- shadow: "none"
182
- })
160
+ primary: (mode) => {
161
+ return {
162
+ ...baseButtonStyles,
163
+ backgroundColor: theme[mode].colors.primary,
164
+ textColor: theme[mode].colors.secondary,
165
+ fontWeight: "500",
166
+ shadow: "none"
167
+ };
168
+ },
169
+ secondary: (mode) => {
170
+ return {
171
+ ...baseButtonStyles,
172
+ backgroundColor: theme[mode].colors.secondary,
173
+ textColor: theme[mode].colors.primary,
174
+ fontWeight: "500",
175
+ border: `1px solid ${theme[mode].colors.border}`,
176
+ shadow: mode === "light" ? "0px 1px 2px 0px rgba(0, 0, 0, 0.06)" : "0px 1px 2px 0px rgba(255, 255, 255, 0.1)"
177
+ };
178
+ },
179
+ tertiary: (mode) => {
180
+ return {
181
+ ...baseButtonStyles,
182
+ backgroundColor: theme[mode].colors.border,
183
+ textColor: theme[mode].colors.primary,
184
+ fontWeight: "500",
185
+ border: "none",
186
+ shadow: "none"
187
+ };
188
+ }
183
189
  };
184
190
  class CourierButton extends CourierSystemThemeElement {
185
191
  constructor(props) {
@@ -206,32 +212,33 @@ class CourierButton extends CourierSystemThemeElement {
206
212
  return "courier-button";
207
213
  }
208
214
  getStyles(props) {
215
+ const mode = props.mode === "system" ? this.currentSystemTheme : props.mode;
209
216
  const defaultTextColor = () => {
210
- const secondary = CourierButtonVariants.secondary(this.currentSystemTheme);
217
+ const secondary = CourierButtonVariants.secondary(mode);
211
218
  return secondary.textColor;
212
219
  };
213
220
  const defaultBackgroundColor = () => {
214
- const secondary = CourierButtonVariants.secondary(this.currentSystemTheme);
221
+ const secondary = CourierButtonVariants.secondary(mode);
215
222
  return secondary.backgroundColor;
216
223
  };
217
224
  const defaultBorder = () => {
218
- const secondary = CourierButtonVariants.secondary(this.currentSystemTheme);
225
+ const secondary = CourierButtonVariants.secondary(mode);
219
226
  return secondary.border;
220
227
  };
221
228
  const defaultShadow = () => {
222
- const secondary = CourierButtonVariants.secondary(this.currentSystemTheme);
229
+ const secondary = CourierButtonVariants.secondary(mode);
223
230
  return secondary.shadow;
224
231
  };
225
232
  const defaultBorderRadius = () => {
226
- const secondary = CourierButtonVariants.secondary(this.currentSystemTheme);
233
+ const secondary = CourierButtonVariants.secondary(mode);
227
234
  return secondary.borderRadius;
228
235
  };
229
236
  const defaultFontSize = () => {
230
- const secondary = CourierButtonVariants.secondary(this.currentSystemTheme);
237
+ const secondary = CourierButtonVariants.secondary(mode);
231
238
  return secondary.fontSize;
232
239
  };
233
240
  const defaultFontWeight = () => {
234
- const secondary = CourierButtonVariants.secondary(this.currentSystemTheme);
241
+ const secondary = CourierButtonVariants.secondary(mode);
235
242
  return secondary.fontWeight;
236
243
  };
237
244
  return `
@@ -1571,9 +1578,10 @@ const _CourierInboxDatastore = class _CourierInboxDatastore {
1571
1578
  __publicField(_CourierInboxDatastore, "instance");
1572
1579
  let CourierInboxDatastore = _CourierInboxDatastore;
1573
1580
  class CourierInboxListItem extends CourierBaseElement {
1574
- constructor(theme2) {
1581
+ constructor(themeManager) {
1575
1582
  super();
1576
1583
  // State
1584
+ __publicField(this, "_themeManager");
1577
1585
  __publicField(this, "_theme");
1578
1586
  __publicField(this, "_message", null);
1579
1587
  __publicField(this, "_feedType", "inbox");
@@ -1592,7 +1600,8 @@ class CourierInboxListItem extends CourierBaseElement {
1592
1600
  __publicField(this, "onItemClick", null);
1593
1601
  __publicField(this, "onItemLongPress", null);
1594
1602
  __publicField(this, "onItemActionClick", null);
1595
- this._theme = theme2;
1603
+ this._themeManager = themeManager;
1604
+ this._theme = themeManager.getTheme();
1596
1605
  this._isMobile = "ontouchstart" in window;
1597
1606
  this.render();
1598
1607
  }
@@ -1916,6 +1925,7 @@ class CourierInboxListItem extends CourierBaseElement {
1916
1925
  this._message.actions.forEach((action) => {
1917
1926
  var _a2, _b2, _c2, _d, _e;
1918
1927
  const actionButton = new CourierButton({
1928
+ mode: this._themeManager.mode,
1919
1929
  text: action.content,
1920
1930
  variant: "secondary",
1921
1931
  backgroundColor: actionsTheme == null ? void 0 : actionsTheme.backgroundColor,
@@ -2210,6 +2220,8 @@ class CourierInboxList extends CourierBaseElement {
2210
2220
  __publicField(this, "_listStyles");
2211
2221
  __publicField(this, "_listItemStyles");
2212
2222
  __publicField(this, "_listItemMenuStyles");
2223
+ __publicField(this, "_errorContainer");
2224
+ __publicField(this, "_emptyContainer");
2213
2225
  this._onRefresh = props.onRefresh;
2214
2226
  this._onPaginationTrigger = props.onPaginationTrigger;
2215
2227
  this._onMessageClick = props.onMessageClick;
@@ -2312,10 +2324,75 @@ class CourierInboxList extends CourierBaseElement {
2312
2324
  handleRefresh() {
2313
2325
  this._onRefresh();
2314
2326
  }
2327
+ refreshInfoStateThemes() {
2328
+ var _a, _b;
2329
+ (_a = this._emptyContainer) == null ? void 0 : _a.updateStyles(this.errorProps);
2330
+ (_b = this._emptyContainer) == null ? void 0 : _b.updateStyles(this.emptyProps);
2331
+ }
2332
+ get errorProps() {
2333
+ 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;
2334
+ const error = (_a = this.theme.inbox) == null ? void 0 : _a.error;
2335
+ const themeMode = this._themeSubscription.manager.mode;
2336
+ return {
2337
+ title: {
2338
+ text: ((_b = error == null ? void 0 : error.title) == null ? void 0 : _b.text) ?? ((_c = this._error) == null ? void 0 : _c.message),
2339
+ textColor: (_e = (_d = error == null ? void 0 : error.title) == null ? void 0 : _d.font) == null ? void 0 : _e.color,
2340
+ fontFamily: (_g = (_f = error == null ? void 0 : error.title) == null ? void 0 : _f.font) == null ? void 0 : _g.family,
2341
+ fontSize: (_i = (_h = error == null ? void 0 : error.title) == null ? void 0 : _h.font) == null ? void 0 : _i.size,
2342
+ fontWeight: (_k = (_j = error == null ? void 0 : error.title) == null ? void 0 : _j.font) == null ? void 0 : _k.weight
2343
+ },
2344
+ button: {
2345
+ mode: themeMode,
2346
+ text: (_l = error == null ? void 0 : error.button) == null ? void 0 : _l.text,
2347
+ backgroundColor: (_m = error == null ? void 0 : error.button) == null ? void 0 : _m.backgroundColor,
2348
+ hoverBackgroundColor: (_n = error == null ? void 0 : error.button) == null ? void 0 : _n.hoverBackgroundColor,
2349
+ activeBackgroundColor: (_o = error == null ? void 0 : error.button) == null ? void 0 : _o.activeBackgroundColor,
2350
+ textColor: (_q = (_p = error == null ? void 0 : error.button) == null ? void 0 : _p.font) == null ? void 0 : _q.color,
2351
+ fontFamily: (_s = (_r = error == null ? void 0 : error.button) == null ? void 0 : _r.font) == null ? void 0 : _s.family,
2352
+ fontSize: (_u = (_t = error == null ? void 0 : error.button) == null ? void 0 : _t.font) == null ? void 0 : _u.size,
2353
+ fontWeight: (_w = (_v = error == null ? void 0 : error.button) == null ? void 0 : _v.font) == null ? void 0 : _w.weight,
2354
+ shadow: (_x = error == null ? void 0 : error.button) == null ? void 0 : _x.shadow,
2355
+ border: (_y = error == null ? void 0 : error.button) == null ? void 0 : _y.border,
2356
+ borderRadius: (_z = error == null ? void 0 : error.button) == null ? void 0 : _z.borderRadius,
2357
+ onClick: () => this.handleRetry()
2358
+ }
2359
+ };
2360
+ }
2361
+ get emptyProps() {
2362
+ 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;
2363
+ const empty = (_a = this.theme.inbox) == null ? void 0 : _a.empty;
2364
+ const themeMode = this._themeSubscription.manager.mode;
2365
+ return {
2366
+ title: {
2367
+ text: ((_b = empty == null ? void 0 : empty.title) == null ? void 0 : _b.text) ?? `No ${this._feedType} messages yet`,
2368
+ textColor: (_d = (_c = empty == null ? void 0 : empty.title) == null ? void 0 : _c.font) == null ? void 0 : _d.color,
2369
+ fontFamily: (_f = (_e = empty == null ? void 0 : empty.title) == null ? void 0 : _e.font) == null ? void 0 : _f.family,
2370
+ fontSize: (_h = (_g = empty == null ? void 0 : empty.title) == null ? void 0 : _g.font) == null ? void 0 : _h.size,
2371
+ fontWeight: (_j = (_i = empty == null ? void 0 : empty.title) == null ? void 0 : _i.font) == null ? void 0 : _j.weight
2372
+ },
2373
+ button: {
2374
+ mode: themeMode,
2375
+ text: (_k = empty == null ? void 0 : empty.button) == null ? void 0 : _k.text,
2376
+ backgroundColor: (_l = empty == null ? void 0 : empty.button) == null ? void 0 : _l.backgroundColor,
2377
+ hoverBackgroundColor: (_m = empty == null ? void 0 : empty.button) == null ? void 0 : _m.hoverBackgroundColor,
2378
+ activeBackgroundColor: (_n = empty == null ? void 0 : empty.button) == null ? void 0 : _n.activeBackgroundColor,
2379
+ textColor: (_p = (_o = empty == null ? void 0 : empty.button) == null ? void 0 : _o.font) == null ? void 0 : _p.color,
2380
+ fontFamily: (_r = (_q = empty == null ? void 0 : empty.button) == null ? void 0 : _q.font) == null ? void 0 : _r.family,
2381
+ fontSize: (_t = (_s = empty == null ? void 0 : empty.button) == null ? void 0 : _s.font) == null ? void 0 : _t.size,
2382
+ fontWeight: (_v = (_u = empty == null ? void 0 : empty.button) == null ? void 0 : _u.font) == null ? void 0 : _v.weight,
2383
+ shadow: (_w = empty == null ? void 0 : empty.button) == null ? void 0 : _w.shadow,
2384
+ border: (_x = empty == null ? void 0 : empty.button) == null ? void 0 : _x.border,
2385
+ borderRadius: (_y = empty == null ? void 0 : empty.button) == null ? void 0 : _y.borderRadius,
2386
+ onClick: () => this.handleRefresh()
2387
+ }
2388
+ };
2389
+ }
2315
2390
  render() {
2316
- 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, __, _$;
2391
+ var _a, _b, _c, _d;
2317
2392
  while (this.firstChild) {
2318
2393
  this.removeChild(this.firstChild);
2394
+ this._errorContainer = void 0;
2395
+ this._emptyContainer = void 0;
2319
2396
  }
2320
2397
  if (this._listStyles) {
2321
2398
  this._listStyles.textContent = CourierInboxList.getStyles(this.theme);
@@ -2327,67 +2404,21 @@ class CourierInboxList extends CourierBaseElement {
2327
2404
  this._listItemMenuStyles.textContent = CourierInboxListItemMenu.getStyles(this.theme);
2328
2405
  }
2329
2406
  if (this._error) {
2330
- const error = (_a = this.theme.inbox) == null ? void 0 : _a.error;
2331
- const errorElement = new CourierInfoState({
2332
- title: {
2333
- text: ((_b = error == null ? void 0 : error.title) == null ? void 0 : _b.text) ?? this._error.message,
2334
- textColor: (_d = (_c = error == null ? void 0 : error.title) == null ? void 0 : _c.font) == null ? void 0 : _d.color,
2335
- fontFamily: (_f = (_e = error == null ? void 0 : error.title) == null ? void 0 : _e.font) == null ? void 0 : _f.family,
2336
- fontSize: (_h = (_g = error == null ? void 0 : error.title) == null ? void 0 : _g.font) == null ? void 0 : _h.size,
2337
- fontWeight: (_j = (_i = error == null ? void 0 : error.title) == null ? void 0 : _i.font) == null ? void 0 : _j.weight
2338
- },
2339
- button: {
2340
- text: (_k = error == null ? void 0 : error.button) == null ? void 0 : _k.text,
2341
- backgroundColor: (_l = error == null ? void 0 : error.button) == null ? void 0 : _l.backgroundColor,
2342
- hoverBackgroundColor: (_m = error == null ? void 0 : error.button) == null ? void 0 : _m.hoverBackgroundColor,
2343
- activeBackgroundColor: (_n = error == null ? void 0 : error.button) == null ? void 0 : _n.activeBackgroundColor,
2344
- textColor: (_p = (_o = error == null ? void 0 : error.button) == null ? void 0 : _o.font) == null ? void 0 : _p.color,
2345
- fontFamily: (_r = (_q = error == null ? void 0 : error.button) == null ? void 0 : _q.font) == null ? void 0 : _r.family,
2346
- fontSize: (_t = (_s = error == null ? void 0 : error.button) == null ? void 0 : _s.font) == null ? void 0 : _t.size,
2347
- fontWeight: (_v = (_u = error == null ? void 0 : error.button) == null ? void 0 : _u.font) == null ? void 0 : _v.weight,
2348
- shadow: (_w = error == null ? void 0 : error.button) == null ? void 0 : _w.shadow,
2349
- border: (_x = error == null ? void 0 : error.button) == null ? void 0 : _x.border,
2350
- borderRadius: (_y = error == null ? void 0 : error.button) == null ? void 0 : _y.borderRadius,
2351
- onClick: () => this.handleRetry()
2352
- }
2353
- });
2354
- errorElement.build((_z = this._errorStateFactory) == null ? void 0 : _z.call(this, { feedType: this._feedType, error: this._error }));
2355
- this.appendChild(errorElement);
2407
+ this._errorContainer = new CourierInfoState(this.errorProps);
2408
+ this._errorContainer.build((_a = this._errorStateFactory) == null ? void 0 : _a.call(this, { feedType: this._feedType, error: this._error }));
2409
+ this.appendChild(this._errorContainer);
2356
2410
  return;
2357
2411
  }
2358
2412
  if (this._isLoading) {
2359
2413
  const loadingElement = new CourierInboxSkeletonList(this.theme);
2360
- loadingElement.build((_A = this._loadingStateFactory) == null ? void 0 : _A.call(this, { feedType: this._feedType }));
2414
+ loadingElement.build((_b = this._loadingStateFactory) == null ? void 0 : _b.call(this, { feedType: this._feedType }));
2361
2415
  this.appendChild(loadingElement);
2362
2416
  return;
2363
2417
  }
2364
2418
  if (this._messages.length === 0) {
2365
- const empty = (_B = this.theme.inbox) == null ? void 0 : _B.empty;
2366
- const emptyElement = new CourierInfoState({
2367
- title: {
2368
- text: ((_C = empty == null ? void 0 : empty.title) == null ? void 0 : _C.text) ?? `No ${this._feedType} messages yet`,
2369
- textColor: (_E = (_D = empty == null ? void 0 : empty.title) == null ? void 0 : _D.font) == null ? void 0 : _E.color,
2370
- fontFamily: (_G = (_F = empty == null ? void 0 : empty.title) == null ? void 0 : _F.font) == null ? void 0 : _G.family,
2371
- fontSize: (_I = (_H = empty == null ? void 0 : empty.title) == null ? void 0 : _H.font) == null ? void 0 : _I.size,
2372
- fontWeight: (_K = (_J = empty == null ? void 0 : empty.title) == null ? void 0 : _J.font) == null ? void 0 : _K.weight
2373
- },
2374
- button: {
2375
- text: (_L = empty == null ? void 0 : empty.button) == null ? void 0 : _L.text,
2376
- backgroundColor: (_M = empty == null ? void 0 : empty.button) == null ? void 0 : _M.backgroundColor,
2377
- hoverBackgroundColor: (_N = empty == null ? void 0 : empty.button) == null ? void 0 : _N.hoverBackgroundColor,
2378
- activeBackgroundColor: (_O = empty == null ? void 0 : empty.button) == null ? void 0 : _O.activeBackgroundColor,
2379
- textColor: (_Q = (_P = empty == null ? void 0 : empty.button) == null ? void 0 : _P.font) == null ? void 0 : _Q.color,
2380
- fontFamily: (_S = (_R = empty == null ? void 0 : empty.button) == null ? void 0 : _R.font) == null ? void 0 : _S.family,
2381
- fontSize: (_U = (_T = empty == null ? void 0 : empty.button) == null ? void 0 : _T.font) == null ? void 0 : _U.size,
2382
- fontWeight: (_W = (_V = empty == null ? void 0 : empty.button) == null ? void 0 : _V.font) == null ? void 0 : _W.weight,
2383
- shadow: (_X = empty == null ? void 0 : empty.button) == null ? void 0 : _X.shadow,
2384
- border: (_Y = empty == null ? void 0 : empty.button) == null ? void 0 : _Y.border,
2385
- borderRadius: (_Z = empty == null ? void 0 : empty.button) == null ? void 0 : _Z.borderRadius,
2386
- onClick: () => this.handleRefresh()
2387
- }
2388
- });
2389
- emptyElement.build((__ = this._emptyStateFactory) == null ? void 0 : __.call(this, { feedType: this._feedType }));
2390
- this.appendChild(emptyElement);
2419
+ this._emptyContainer = new CourierInfoState(this.emptyProps);
2420
+ this._emptyContainer.build((_c = this._emptyStateFactory) == null ? void 0 : _c.call(this, { feedType: this._feedType }));
2421
+ this.appendChild(this._emptyContainer);
2391
2422
  return;
2392
2423
  }
2393
2424
  const list = document.createElement("ul");
@@ -2397,7 +2428,7 @@ class CourierInboxList extends CourierBaseElement {
2397
2428
  list.appendChild(this._listItemFactory({ message, index }));
2398
2429
  return;
2399
2430
  }
2400
- const listItem = new CourierInboxListItem(this.theme);
2431
+ const listItem = new CourierInboxListItem(this._themeSubscription.manager);
2401
2432
  listItem.setMessage(message, this._feedType);
2402
2433
  listItem.setOnItemClick((message2) => {
2403
2434
  var _a2;
@@ -2416,7 +2447,7 @@ class CourierInboxList extends CourierBaseElement {
2416
2447
  if (this._canPaginate) {
2417
2448
  const paginationItem = new CourierInboxPaginationListItem({
2418
2449
  theme: this.theme,
2419
- customItem: (_$ = this._paginationItemFactory) == null ? void 0 : _$.call(this, { feedType: this._feedType }),
2450
+ customItem: (_d = this._paginationItemFactory) == null ? void 0 : _d.call(this, { feedType: this._feedType }),
2420
2451
  onPaginationTrigger: () => {
2421
2452
  var _a2;
2422
2453
  return (_a2 = this._onPaginationTrigger) == null ? void 0 : _a2.call(this, this._feedType);
@@ -3821,6 +3852,9 @@ class CourierInboxThemeManager {
3821
3852
  this._userMode = mode;
3822
3853
  this.updateTheme();
3823
3854
  }
3855
+ get mode() {
3856
+ return this._userMode;
3857
+ }
3824
3858
  /**
3825
3859
  * Subscribe to theme changes
3826
3860
  * @param {Function} callback - Function to run when the theme changes
@@ -4026,6 +4060,8 @@ class CourierInbox extends CourierBaseElement {
4026
4060
  (_d = this._unreadIndicatorStyle) == null ? void 0 : _d.remove();
4027
4061
  }
4028
4062
  refreshTheme() {
4063
+ var _a;
4064
+ (_a = this._list) == null ? void 0 : _a.refreshInfoStateThemes();
4029
4065
  if (this._inboxStyle) {
4030
4066
  this._inboxStyle.textContent = this.getStyles();
4031
4067
  }
@@ -4274,6 +4310,10 @@ class CourierInboxPopupMenu extends CourierBaseElement {
4274
4310
  __publicField(this, "_popup");
4275
4311
  __publicField(this, "_inbox");
4276
4312
  __publicField(this, "_style");
4313
+ // Inbox Handlers
4314
+ __publicField(this, "_onMessageClick");
4315
+ __publicField(this, "_onMessageActionClick");
4316
+ __publicField(this, "_onMessageLongPress");
4277
4317
  // Listeners
4278
4318
  __publicField(this, "_datastoreListener");
4279
4319
  // Factories
@@ -4321,6 +4361,26 @@ class CourierInboxPopupMenu extends CourierBaseElement {
4321
4361
  this._popup.className = "popup";
4322
4362
  this._inbox = new CourierInbox(this._themeManager);
4323
4363
  this._inbox.setAttribute("height", "100%");
4364
+ if (this._inbox) {
4365
+ this._inbox.onMessageClick((props) => {
4366
+ if (this._onMessageClick) {
4367
+ this._onMessageClick(props);
4368
+ }
4369
+ this.closePopup();
4370
+ });
4371
+ this._inbox.onMessageActionClick((props) => {
4372
+ if (this._onMessageActionClick) {
4373
+ this._onMessageActionClick(props);
4374
+ }
4375
+ this.closePopup();
4376
+ });
4377
+ this._inbox.onMessageLongPress((props) => {
4378
+ if (this._onMessageLongPress) {
4379
+ this._onMessageLongPress(props);
4380
+ }
4381
+ this.closePopup();
4382
+ });
4383
+ }
4324
4384
  this.refreshTheme();
4325
4385
  this.appendChild(this._triggerButton);
4326
4386
  this.appendChild(this._popup);
@@ -4433,16 +4493,13 @@ class CourierInboxPopupMenu extends CourierBaseElement {
4433
4493
  this.render();
4434
4494
  }
4435
4495
  onMessageClick(handler) {
4436
- var _a;
4437
- (_a = this._inbox) == null ? void 0 : _a.onMessageClick(handler);
4496
+ this._onMessageClick = handler;
4438
4497
  }
4439
4498
  onMessageActionClick(handler) {
4440
- var _a;
4441
- (_a = this._inbox) == null ? void 0 : _a.onMessageActionClick(handler);
4499
+ this._onMessageActionClick = handler;
4442
4500
  }
4443
4501
  onMessageLongPress(handler) {
4444
- var _a;
4445
- (_a = this._inbox) == null ? void 0 : _a.onMessageLongPress(handler);
4502
+ this._onMessageLongPress = handler;
4446
4503
  }
4447
4504
  isValidPosition(value) {
4448
4505
  const validPositions = [
@@ -4516,6 +4573,10 @@ class CourierInboxPopupMenu extends CourierBaseElement {
4516
4573
  const isVisible = this._popup.style.display === "block";
4517
4574
  this._popup.style.display = isVisible ? "none" : "block";
4518
4575
  }
4576
+ closePopup() {
4577
+ if (!this._popup) return;
4578
+ this._popup.style.display = "none";
4579
+ }
4519
4580
  setContent(element) {
4520
4581
  if (!this._inbox) return;
4521
4582
  this._inbox.innerHTML = "";