@trycourier/courier-ui-inbox 1.0.16 → 1.0.17
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/datastore/datastore.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1210,6 +1210,7 @@ const _CourierInboxDatastore = class _CourierInboxDatastore {
|
|
|
1210
1210
|
if (!this.canMutate()) {
|
|
1211
1211
|
return;
|
|
1212
1212
|
}
|
|
1213
|
+
const datastoreSnapshot = this.getDatastoreSnapshot(this.unreadCount, this._inboxDataSet, this._archiveDataSet);
|
|
1213
1214
|
const snapshot = this.getMessageSnapshot(message);
|
|
1214
1215
|
if (snapshot.inboxIndex === void 0 && snapshot.archiveIndex === void 0) {
|
|
1215
1216
|
return;
|
|
@@ -1224,8 +1225,8 @@ const _CourierInboxDatastore = class _CourierInboxDatastore {
|
|
|
1224
1225
|
await ((_a = Courier.shared.client) == null ? void 0 : _a.inbox.open({ messageId: message.messageId }));
|
|
1225
1226
|
}
|
|
1226
1227
|
} catch (error) {
|
|
1227
|
-
this.applyMessageSnapshot(snapshot);
|
|
1228
1228
|
(_c = (_b = Courier.shared.client) == null ? void 0 : _b.options.logger) == null ? void 0 : _c.error("Error opening message:", error);
|
|
1229
|
+
this.applyDatastoreSnapshot(datastoreSnapshot);
|
|
1229
1230
|
}
|
|
1230
1231
|
}
|
|
1231
1232
|
async clickMessage({ message, canCallApi = true }) {
|
|
@@ -1518,20 +1519,12 @@ const _CourierInboxDatastore = class _CourierInboxDatastore {
|
|
|
1518
1519
|
/**
|
|
1519
1520
|
* Update a message in the data store
|
|
1520
1521
|
* @param message - The message to update
|
|
1521
|
-
* @param index - The index of the message
|
|
1522
|
+
* @param index - The index of the message in its respective data set
|
|
1522
1523
|
* @param feedType - The feed type of the message
|
|
1523
1524
|
*/
|
|
1524
1525
|
updateMessage(message, index, feedType) {
|
|
1525
1526
|
switch (feedType) {
|
|
1526
1527
|
case "inbox":
|
|
1527
|
-
if (this._unreadCount !== void 0 && !message.archived) {
|
|
1528
|
-
if (message.read) {
|
|
1529
|
-
this._unreadCount = Math.max(0, this._unreadCount - 1);
|
|
1530
|
-
}
|
|
1531
|
-
if (!message.read) {
|
|
1532
|
-
this._unreadCount = this._unreadCount + 1;
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
1528
|
if (this._inboxDataSet) {
|
|
1536
1529
|
this._inboxDataSet.messages[index] = message;
|
|
1537
1530
|
}
|