@trycourier/courier-ui-inbox 1.0.12-beta → 1.0.14-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
@@ -1218,7 +1218,7 @@ const _CourierInboxDatastore = class _CourierInboxDatastore {
1218
1218
  return;
1219
1219
  }
1220
1220
  try {
1221
- message.opened = (/* @__PURE__ */ new Date()).toISOString();
1221
+ snapshot.message.opened = (/* @__PURE__ */ new Date()).toISOString();
1222
1222
  this.applyMessageSnapshot(snapshot);
1223
1223
  if (canCallApi) {
1224
1224
  await ((_a = Courier.shared.client) == null ? void 0 : _a.inbox.open({ messageId: message.messageId }));
@@ -1598,15 +1598,19 @@ class CourierInboxListItem extends CourierBaseElement {
1598
1598
  // Touch gestures
1599
1599
  __publicField(this, "_longPressTimeout", null);
1600
1600
  __publicField(this, "_isLongPress", false);
1601
+ // Intersection Observer
1602
+ __publicField(this, "_observer");
1601
1603
  // Callbacks
1602
1604
  __publicField(this, "onItemClick", null);
1603
1605
  __publicField(this, "onItemLongPress", null);
1604
1606
  __publicField(this, "onItemActionClick", null);
1607
+ __publicField(this, "onItemVisible", null);
1605
1608
  this._canClick = canClick;
1606
1609
  this._themeManager = themeManager;
1607
1610
  this._theme = themeManager.getTheme();
1608
1611
  this._isMobile = "ontouchstart" in window;
1609
1612
  this.render();
1613
+ this._setupIntersectionObserver();
1610
1614
  }
1611
1615
  static get id() {
1612
1616
  return "courier-inbox-list-item";
@@ -1652,6 +1656,26 @@ class CourierInboxListItem extends CourierBaseElement {
1652
1656
  this.classList.add("clickable");
1653
1657
  }
1654
1658
  }
1659
+ _setupIntersectionObserver() {
1660
+ if (typeof window === "undefined" || typeof IntersectionObserver === "undefined") {
1661
+ return;
1662
+ }
1663
+ if (this._observer) {
1664
+ this._observer.disconnect();
1665
+ }
1666
+ this._observer = new IntersectionObserver((entries) => {
1667
+ entries.forEach((entry) => {
1668
+ if (entry.intersectionRatio === 1 && this.onItemVisible && this._message) {
1669
+ this.onItemVisible(this._message);
1670
+ }
1671
+ });
1672
+ }, { threshold: 1 });
1673
+ this._observer.observe(this);
1674
+ }
1675
+ onComponentUnmounted() {
1676
+ var _a;
1677
+ (_a = this._observer) == null ? void 0 : _a.disconnect();
1678
+ }
1655
1679
  static getStyles(theme2) {
1656
1680
  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;
1657
1681
  const list = (_a = theme2.inbox) == null ? void 0 : _a.list;
@@ -1824,9 +1848,6 @@ class CourierInboxListItem extends CourierBaseElement {
1824
1848
  }
1825
1849
  });
1826
1850
  }
1827
- setOnLongPress(cb) {
1828
- this.onItemLongPress = cb;
1829
- }
1830
1851
  // Helpers
1831
1852
  _getMenuOptions() {
1832
1853
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
@@ -1904,6 +1925,9 @@ class CourierInboxListItem extends CourierBaseElement {
1904
1925
  setOnItemLongPress(cb) {
1905
1926
  this.onItemLongPress = cb;
1906
1927
  }
1928
+ setOnItemVisible(cb) {
1929
+ this.onItemVisible = cb;
1930
+ }
1907
1931
  // Content rendering
1908
1932
  _updateContent() {
1909
1933
  var _a, _b, _c;
@@ -2203,6 +2227,21 @@ class CourierInboxPaginationListItem extends CourierBaseElement {
2203
2227
  }
2204
2228
  }
2205
2229
  registerElement(CourierInboxPaginationListItem);
2230
+ function markAsRead(message) {
2231
+ return CourierInboxDatastore.shared.readMessage({ message });
2232
+ }
2233
+ function markAsUnread(message) {
2234
+ return CourierInboxDatastore.shared.unreadMessage({ message });
2235
+ }
2236
+ function clickMessage(message) {
2237
+ return CourierInboxDatastore.shared.clickMessage({ message });
2238
+ }
2239
+ function archiveMessage(message) {
2240
+ return CourierInboxDatastore.shared.archiveMessage({ message });
2241
+ }
2242
+ function openMessage(message) {
2243
+ return CourierInboxDatastore.shared.openMessage({ message });
2244
+ }
2206
2245
  class CourierInboxList extends CourierBaseElement {
2207
2246
  constructor(props) {
2208
2247
  super();
@@ -2460,6 +2499,7 @@ class CourierInboxList extends CourierBaseElement {
2460
2499
  var _a2;
2461
2500
  return (_a2 = this._onMessageLongPress) == null ? void 0 : _a2.call(this, message2, index);
2462
2501
  });
2502
+ listItem.setOnItemVisible((message2) => this.openVisibleMessage(message2));
2463
2503
  list.appendChild(listItem);
2464
2504
  });
2465
2505
  if (this._canPaginate) {
@@ -2474,6 +2514,12 @@ class CourierInboxList extends CourierBaseElement {
2474
2514
  list.appendChild(paginationItem);
2475
2515
  }
2476
2516
  }
2517
+ async openVisibleMessage(message) {
2518
+ try {
2519
+ await openMessage(message);
2520
+ } catch (error) {
2521
+ }
2522
+ }
2477
2523
  // Factories
2478
2524
  setLoadingStateFactory(factory) {
2479
2525
  this._loadingStateFactory = factory;
@@ -2778,7 +2824,6 @@ class CourierUnreadCountBadge extends CourierBaseElement {
2778
2824
  text-align: center;
2779
2825
  display: none;
2780
2826
  pointer-events: none;
2781
- min-width: 20px;
2782
2827
  }
2783
2828
 
2784
2829
  ${CourierUnreadCountBadge.id} .header {
@@ -3903,6 +3948,7 @@ class CourierInbox extends CourierBaseElement {
3903
3948
  // State
3904
3949
  __publicField(this, "_currentFeed", "inbox");
3905
3950
  // Theming
3951
+ // Theme manager instance for handling theming logic
3906
3952
  __publicField(this, "_themeManager");
3907
3953
  // Components
3908
3954
  __publicField(this, "_inboxStyle");
@@ -3929,15 +3975,32 @@ class CourierInbox extends CourierBaseElement {
3929
3975
  static get id() {
3930
3976
  return "courier-inbox";
3931
3977
  }
3978
+ /** Returns the current feed type. */
3979
+ get currentFeed() {
3980
+ return this._currentFeed;
3981
+ }
3982
+ /** Returns the current theme object. */
3932
3983
  get theme() {
3933
3984
  return this._themeManager.getTheme();
3934
3985
  }
3986
+ /**
3987
+ * Set the light theme for the inbox.
3988
+ * @param theme The light theme object to set.
3989
+ */
3935
3990
  setLightTheme(theme2) {
3936
3991
  this._themeManager.setLightTheme(theme2);
3937
3992
  }
3993
+ /**
3994
+ * Set the dark theme for the inbox.
3995
+ * @param theme The dark theme object to set.
3996
+ */
3938
3997
  setDarkTheme(theme2) {
3939
3998
  this._themeManager.setDarkTheme(theme2);
3940
3999
  }
4000
+ /**
4001
+ * Set the theme mode (light/dark/system).
4002
+ * @param mode The theme mode to set.
4003
+ */
3941
4004
  setMode(mode) {
3942
4005
  this._themeManager.setMode(mode);
3943
4006
  }
@@ -4095,49 +4158,95 @@ class CourierInbox extends CourierBaseElement {
4095
4158
  }
4096
4159
  `;
4097
4160
  }
4161
+ /**
4162
+ * Sets a custom header factory for the inbox.
4163
+ * @param factory - A function that returns an HTMLElement to render as the header.
4164
+ */
4098
4165
  setHeader(factory) {
4099
4166
  this._headerFactory = factory;
4100
4167
  this.updateHeader();
4101
4168
  }
4169
+ /**
4170
+ * Removes the custom header factory from the inbox, reverting to the default header.
4171
+ */
4102
4172
  removeHeader() {
4103
4173
  this._headerFactory = null;
4104
4174
  this.updateHeader();
4105
4175
  }
4176
+ /**
4177
+ * Sets a custom loading state factory for the inbox list.
4178
+ * @param factory - A function that returns an HTMLElement to render as the loading state.
4179
+ */
4106
4180
  setLoadingState(factory) {
4107
4181
  var _a;
4108
4182
  (_a = this._list) == null ? void 0 : _a.setLoadingStateFactory(factory);
4109
4183
  }
4184
+ /**
4185
+ * Sets a custom empty state factory for the inbox list.
4186
+ * @param factory - A function that returns an HTMLElement to render as the empty state.
4187
+ */
4110
4188
  setEmptyState(factory) {
4111
4189
  var _a;
4112
4190
  (_a = this._list) == null ? void 0 : _a.setEmptyStateFactory(factory);
4113
4191
  }
4192
+ /**
4193
+ * Sets a custom error state factory for the inbox list.
4194
+ * @param factory - A function that returns an HTMLElement to render as the error state.
4195
+ */
4114
4196
  setErrorState(factory) {
4115
4197
  var _a;
4116
4198
  (_a = this._list) == null ? void 0 : _a.setErrorStateFactory(factory);
4117
4199
  }
4200
+ /**
4201
+ * Sets a custom list item factory for the inbox list.
4202
+ * @param factory - A function that returns an HTMLElement to render as a list item.
4203
+ */
4118
4204
  setListItem(factory) {
4119
4205
  var _a;
4120
4206
  (_a = this._list) == null ? void 0 : _a.setListItemFactory(factory);
4121
4207
  }
4208
+ /**
4209
+ * Sets a custom pagination item factory for the inbox list.
4210
+ * @param factory - A function that returns an HTMLElement to render as a pagination item.
4211
+ */
4122
4212
  setPaginationItem(factory) {
4123
4213
  var _a;
4124
4214
  (_a = this._list) == null ? void 0 : _a.setPaginationItemFactory(factory);
4125
4215
  }
4216
+ /**
4217
+ * Registers a handler for message click events.
4218
+ * @param handler - A function to be called when a message is clicked.
4219
+ */
4126
4220
  onMessageClick(handler) {
4127
4221
  var _a;
4128
4222
  this._onMessageClick = handler;
4129
4223
  (_a = this._list) == null ? void 0 : _a.setCanClickListItems(handler !== void 0);
4130
4224
  }
4225
+ /**
4226
+ * Registers a handler for message action click events.
4227
+ * @param handler - A function to be called when a message action is clicked.
4228
+ */
4131
4229
  onMessageActionClick(handler) {
4132
4230
  this._onMessageActionClick = handler;
4133
4231
  }
4232
+ /**
4233
+ * Registers a handler for message long press events.
4234
+ * @param handler - A function to be called when a message is long-pressed.
4235
+ */
4134
4236
  onMessageLongPress(handler) {
4135
4237
  var _a;
4136
4238
  this._onMessageLongPress = handler;
4137
4239
  (_a = this._list) == null ? void 0 : _a.setCanLongPressListItems(handler !== void 0);
4138
4240
  }
4241
+ /**
4242
+ * Sets the feed type for the inbox (e.g., "inbox" or "archive").
4243
+ * @param feedType - The feed type to display.
4244
+ */
4139
4245
  setFeedType(feedType) {
4140
4246
  var _a;
4247
+ if (this._currentFeed === feedType) {
4248
+ return;
4249
+ }
4141
4250
  this._currentFeed = feedType;
4142
4251
  (_a = this._list) == null ? void 0 : _a.setFeedType(feedType);
4143
4252
  this.updateHeader();
@@ -4169,6 +4278,9 @@ class CourierInbox extends CourierBaseElement {
4169
4278
  await CourierInboxDatastore.shared.load(props);
4170
4279
  await CourierInboxDatastore.shared.listenForUpdates();
4171
4280
  }
4281
+ /**
4282
+ * Forces a reload of the inbox data, bypassing the cache.
4283
+ */
4172
4284
  refresh() {
4173
4285
  this.load({
4174
4286
  canUseCache: false
@@ -4318,10 +4430,10 @@ class CourierInboxPopupMenu extends CourierBaseElement {
4318
4430
  __publicField(this, "_width", "440px");
4319
4431
  __publicField(this, "_height", "440px");
4320
4432
  __publicField(this, "_popupAlignment", "top-left");
4321
- __publicField(this, "_top", "40px");
4322
- __publicField(this, "_right", "0");
4323
- __publicField(this, "_bottom", "40px");
4324
- __publicField(this, "_left", "0");
4433
+ __publicField(this, "_top");
4434
+ __publicField(this, "_right");
4435
+ __publicField(this, "_bottom");
4436
+ __publicField(this, "_left");
4325
4437
  // Theming
4326
4438
  __publicField(this, "_themeManager", new CourierInboxThemeManager(defaultLightTheme));
4327
4439
  // Components
@@ -4329,10 +4441,6 @@ class CourierInboxPopupMenu extends CourierBaseElement {
4329
4441
  __publicField(this, "_popup");
4330
4442
  __publicField(this, "_inbox");
4331
4443
  __publicField(this, "_style");
4332
- // Inbox Handlers
4333
- __publicField(this, "_onMessageClick");
4334
- __publicField(this, "_onMessageActionClick");
4335
- __publicField(this, "_onMessageLongPress");
4336
4444
  // Listeners
4337
4445
  __publicField(this, "_datastoreListener");
4338
4446
  // Factories
@@ -4357,15 +4465,33 @@ class CourierInboxPopupMenu extends CourierBaseElement {
4357
4465
  static get id() {
4358
4466
  return "courier-inbox-popup-menu";
4359
4467
  }
4468
+ /** Returns the current theme object. */
4360
4469
  get theme() {
4361
4470
  return this._themeManager.getTheme();
4362
4471
  }
4472
+ /** Returns the current feed type. */
4473
+ get currentFeed() {
4474
+ var _a;
4475
+ return ((_a = this._inbox) == null ? void 0 : _a.currentFeed) ?? "inbox";
4476
+ }
4477
+ /**
4478
+ * Set the light theme for the popup menu.
4479
+ * @param theme The light theme object to set.
4480
+ */
4363
4481
  setLightTheme(theme2) {
4364
4482
  this._themeManager.setLightTheme(theme2);
4365
4483
  }
4484
+ /**
4485
+ * Set the dark theme for the popup menu.
4486
+ * @param theme The dark theme object to set.
4487
+ */
4366
4488
  setDarkTheme(theme2) {
4367
4489
  this._themeManager.setDarkTheme(theme2);
4368
4490
  }
4491
+ /**
4492
+ * Set the theme mode (light/dark/system).
4493
+ * @param mode The theme mode to set.
4494
+ */
4369
4495
  setMode(mode) {
4370
4496
  this._themeManager.setMode(mode);
4371
4497
  }
@@ -4380,26 +4506,6 @@ class CourierInboxPopupMenu extends CourierBaseElement {
4380
4506
  this._popup.className = "popup";
4381
4507
  this._inbox = new CourierInbox(this._themeManager);
4382
4508
  this._inbox.setAttribute("height", "100%");
4383
- if (this._inbox) {
4384
- this._inbox.onMessageClick((props) => {
4385
- if (this._onMessageClick) {
4386
- this._onMessageClick(props);
4387
- }
4388
- this.closePopup();
4389
- });
4390
- this._inbox.onMessageActionClick((props) => {
4391
- if (this._onMessageActionClick) {
4392
- this._onMessageActionClick(props);
4393
- }
4394
- this.closePopup();
4395
- });
4396
- this._inbox.onMessageLongPress((props) => {
4397
- if (this._onMessageLongPress) {
4398
- this._onMessageLongPress(props);
4399
- }
4400
- this.closePopup();
4401
- });
4402
- }
4403
4509
  this.refreshTheme();
4404
4510
  this.appendChild(this._triggerButton);
4405
4511
  this.appendChild(this._popup);
@@ -4508,17 +4614,51 @@ class CourierInboxPopupMenu extends CourierBaseElement {
4508
4614
  break;
4509
4615
  }
4510
4616
  }
4617
+ /**
4618
+ * Called when the unread count changes.
4619
+ * @param _ The new unread count (unused).
4620
+ */
4511
4621
  onUnreadCountChange(_) {
4512
4622
  this.render();
4513
4623
  }
4624
+ /**
4625
+ * Set a handler for message click events.
4626
+ * @param handler The function to call when a message is clicked.
4627
+ */
4514
4628
  onMessageClick(handler) {
4515
- this._onMessageClick = handler;
4629
+ var _a;
4630
+ (_a = this._inbox) == null ? void 0 : _a.onMessageClick((props) => {
4631
+ if (handler) {
4632
+ handler(props);
4633
+ }
4634
+ this.closePopup();
4635
+ });
4516
4636
  }
4637
+ /**
4638
+ * Set a handler for message action click events.
4639
+ * @param handler The function to call when a message action is clicked.
4640
+ */
4517
4641
  onMessageActionClick(handler) {
4518
- this._onMessageActionClick = handler;
4642
+ var _a;
4643
+ (_a = this._inbox) == null ? void 0 : _a.onMessageActionClick((props) => {
4644
+ if (handler) {
4645
+ handler(props);
4646
+ }
4647
+ this.closePopup();
4648
+ });
4519
4649
  }
4650
+ /**
4651
+ * Set a handler for message long press events.
4652
+ * @param handler The function to call when a message is long pressed.
4653
+ */
4520
4654
  onMessageLongPress(handler) {
4521
- this._onMessageLongPress = handler;
4655
+ var _a;
4656
+ (_a = this._inbox) == null ? void 0 : _a.onMessageLongPress((props) => {
4657
+ if (handler) {
4658
+ handler(props);
4659
+ }
4660
+ this.closePopup();
4661
+ });
4522
4662
  }
4523
4663
  isValidPosition(value) {
4524
4664
  const validPositions = [
@@ -4544,39 +4684,39 @@ class CourierInboxPopupMenu extends CourierBaseElement {
4544
4684
  this._popup.style.transform = "";
4545
4685
  switch (this._popupAlignment) {
4546
4686
  case "top-right":
4547
- this._popup.style.top = this._top;
4548
- this._popup.style.right = this._right;
4687
+ this._popup.style.top = this._top ?? "40px";
4688
+ this._popup.style.right = this._right ?? "0px";
4549
4689
  break;
4550
4690
  case "top-left":
4551
- this._popup.style.top = this._top;
4552
- this._popup.style.left = this._left;
4691
+ this._popup.style.top = this._top ?? "40px";
4692
+ this._popup.style.left = this._left ?? "0px";
4553
4693
  break;
4554
4694
  case "top-center":
4555
- this._popup.style.top = this._top;
4695
+ this._popup.style.top = this._top ?? "40px";
4556
4696
  this._popup.style.left = "50%";
4557
4697
  this._popup.style.transform = "translateX(-50%)";
4558
4698
  break;
4559
4699
  case "bottom-right":
4560
- this._popup.style.bottom = this._bottom;
4561
- this._popup.style.right = this._right;
4700
+ this._popup.style.bottom = this._bottom ?? "40px";
4701
+ this._popup.style.right = this._right ?? "0px";
4562
4702
  break;
4563
4703
  case "bottom-left":
4564
- this._popup.style.bottom = this._bottom;
4565
- this._popup.style.left = this._left;
4704
+ this._popup.style.bottom = this._bottom ?? "40px";
4705
+ this._popup.style.left = this._left ?? "0px";
4566
4706
  break;
4567
4707
  case "bottom-center":
4568
- this._popup.style.bottom = this._bottom;
4708
+ this._popup.style.bottom = this._bottom ?? "40px";
4569
4709
  this._popup.style.left = "50%";
4570
4710
  this._popup.style.transform = "translateX(-50%)";
4571
4711
  break;
4572
4712
  case "center-right":
4573
4713
  this._popup.style.top = "50%";
4574
- this._popup.style.right = this._right;
4714
+ this._popup.style.right = this._right ?? "40px";
4575
4715
  this._popup.style.transform = "translateY(-50%)";
4576
4716
  break;
4577
4717
  case "center-left":
4578
4718
  this._popup.style.top = "50%";
4579
- this._popup.style.left = this._left;
4719
+ this._popup.style.left = this._left ?? "40px";
4580
4720
  this._popup.style.transform = "translateY(-50%)";
4581
4721
  break;
4582
4722
  case "center-center":
@@ -4586,21 +4726,37 @@ class CourierInboxPopupMenu extends CourierBaseElement {
4586
4726
  break;
4587
4727
  }
4588
4728
  }
4729
+ /**
4730
+ * Toggle the popup menu open/closed.
4731
+ * @param event The click event that triggered the toggle.
4732
+ */
4589
4733
  togglePopup(event) {
4590
4734
  event.stopPropagation();
4591
4735
  if (!this._popup) return;
4592
4736
  const isVisible = this._popup.style.display === "block";
4593
4737
  this._popup.style.display = isVisible ? "none" : "block";
4594
4738
  }
4739
+ /**
4740
+ * Close the popup menu.
4741
+ */
4595
4742
  closePopup() {
4596
4743
  if (!this._popup) return;
4597
4744
  this._popup.style.display = "none";
4598
4745
  }
4746
+ /**
4747
+ * Set the content of the popup inbox.
4748
+ * @param element The HTMLElement to set as the content.
4749
+ */
4599
4750
  setContent(element) {
4600
4751
  if (!this._inbox) return;
4601
4752
  this._inbox.innerHTML = "";
4602
4753
  this._inbox.appendChild(element);
4603
4754
  }
4755
+ /**
4756
+ * Set the size of the popup menu.
4757
+ * @param width The width to set.
4758
+ * @param height The height to set.
4759
+ */
4604
4760
  setSize(width, height) {
4605
4761
  this._width = width;
4606
4762
  this._height = height;
@@ -4608,6 +4764,10 @@ class CourierInboxPopupMenu extends CourierBaseElement {
4608
4764
  this._popup.style.width = width;
4609
4765
  this._popup.style.height = height;
4610
4766
  }
4767
+ /**
4768
+ * Set the popup alignment/position.
4769
+ * @param position The alignment/position to set.
4770
+ */
4611
4771
  setPosition(position) {
4612
4772
  var _a, _b;
4613
4773
  if (this.isValidPosition(position)) {
@@ -4617,39 +4777,74 @@ class CourierInboxPopupMenu extends CourierBaseElement {
4617
4777
  (_b = (_a = Courier.shared.client) == null ? void 0 : _a.options.logger) == null ? void 0 : _b.error(`Invalid position: ${position}`);
4618
4778
  }
4619
4779
  }
4780
+ /**
4781
+ * Set the feed type for the inbox.
4782
+ * @param feedType The feed type to set.
4783
+ */
4620
4784
  setFeedType(feedType) {
4621
4785
  var _a;
4622
4786
  (_a = this._inbox) == null ? void 0 : _a.setFeedType(feedType);
4623
4787
  }
4624
4788
  // Factory methods
4789
+ /**
4790
+ * Set a custom header factory for the inbox.
4791
+ * @param factory The factory function for the header.
4792
+ */
4625
4793
  setHeader(factory) {
4626
4794
  var _a;
4627
4795
  (_a = this._inbox) == null ? void 0 : _a.setHeader(factory);
4628
4796
  }
4797
+ /**
4798
+ * Remove the custom header from the inbox.
4799
+ */
4629
4800
  removeHeader() {
4630
4801
  var _a;
4631
4802
  (_a = this._inbox) == null ? void 0 : _a.removeHeader();
4632
4803
  }
4804
+ /**
4805
+ * Set a custom loading state factory for the inbox.
4806
+ * @param factory The factory function for the loading state.
4807
+ */
4633
4808
  setLoadingState(factory) {
4634
4809
  var _a;
4635
4810
  (_a = this._inbox) == null ? void 0 : _a.setLoadingState(factory);
4636
4811
  }
4812
+ /**
4813
+ * Set a custom empty state factory for the inbox.
4814
+ * @param factory The factory function for the empty state.
4815
+ */
4637
4816
  setEmptyState(factory) {
4638
4817
  var _a;
4639
4818
  (_a = this._inbox) == null ? void 0 : _a.setEmptyState(factory);
4640
4819
  }
4820
+ /**
4821
+ * Set a custom error state factory for the inbox.
4822
+ * @param factory The factory function for the error state.
4823
+ */
4641
4824
  setErrorState(factory) {
4642
4825
  var _a;
4643
4826
  (_a = this._inbox) == null ? void 0 : _a.setErrorState(factory);
4644
4827
  }
4828
+ /**
4829
+ * Set a custom list item factory for the inbox.
4830
+ * @param factory The factory function for the list item.
4831
+ */
4645
4832
  setListItem(factory) {
4646
4833
  var _a;
4647
4834
  (_a = this._inbox) == null ? void 0 : _a.setListItem(factory);
4648
4835
  }
4836
+ /**
4837
+ * Set a custom pagination item factory for the inbox.
4838
+ * @param factory The factory function for the pagination item.
4839
+ */
4649
4840
  setPaginationItem(factory) {
4650
4841
  var _a;
4651
4842
  (_a = this._inbox) == null ? void 0 : _a.setPaginationItem(factory);
4652
4843
  }
4844
+ /**
4845
+ * Set a custom menu button factory for the popup trigger.
4846
+ * @param factory The factory function for the menu button.
4847
+ */
4653
4848
  setMenuButton(factory) {
4654
4849
  this._popupMenuButtonFactory = factory;
4655
4850
  this.render();
@@ -4671,21 +4866,6 @@ class CourierInboxPopupMenu extends CourierBaseElement {
4671
4866
  }
4672
4867
  }
4673
4868
  registerElement(CourierInboxPopupMenu);
4674
- function markAsRead(message) {
4675
- return CourierInboxDatastore.shared.readMessage({ message });
4676
- }
4677
- function markAsUnread(message) {
4678
- return CourierInboxDatastore.shared.unreadMessage({ message });
4679
- }
4680
- function clickMessage(message) {
4681
- return CourierInboxDatastore.shared.clickMessage({ message });
4682
- }
4683
- function archiveMessage(message) {
4684
- return CourierInboxDatastore.shared.archiveMessage({ message });
4685
- }
4686
- function openMessage(message) {
4687
- return CourierInboxDatastore.shared.openMessage({ message });
4688
- }
4689
4869
  class CourierInboxDatastoreEvents {
4690
4870
  onDataSetChange(_, __) {
4691
4871
  }