@liveblocks/emails 2.17.0-usrnotsettings3 → 2.18.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.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +19 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { detectDupes } from "@liveblocks/core";
|
|
|
3
3
|
|
|
4
4
|
// src/version.ts
|
|
5
5
|
var PKG_NAME = "@liveblocks/emails";
|
|
6
|
-
var PKG_VERSION = "2.
|
|
6
|
+
var PKG_VERSION = "2.18.0";
|
|
7
7
|
var PKG_FORMAT = "esm";
|
|
8
8
|
|
|
9
9
|
// ../../node_modules/lib0/map.js
|
|
@@ -7691,10 +7691,7 @@ function createBatchUsersResolver({
|
|
|
7691
7691
|
}
|
|
7692
7692
|
|
|
7693
7693
|
// src/liveblocks-text-editor.tsx
|
|
7694
|
-
import {
|
|
7695
|
-
html,
|
|
7696
|
-
htmlSafe
|
|
7697
|
-
} from "@liveblocks/core";
|
|
7694
|
+
import { html, htmlSafe } from "@liveblocks/core";
|
|
7698
7695
|
|
|
7699
7696
|
// src/lib/constants.ts
|
|
7700
7697
|
var MENTION_CHARACTER = "@";
|
|
@@ -8547,14 +8544,22 @@ function filterCommentsWithBody(comments) {
|
|
|
8547
8544
|
// src/thread-notification.tsx
|
|
8548
8545
|
var getUnreadComments = ({
|
|
8549
8546
|
comments,
|
|
8547
|
+
previousUnreadInboxNotification,
|
|
8550
8548
|
inboxNotification,
|
|
8551
8549
|
userId
|
|
8552
8550
|
}) => {
|
|
8553
8551
|
const commentsWithBody = filterCommentsWithBody(comments);
|
|
8552
|
+
const otherUserComments = commentsWithBody.filter((c) => c.userId !== userId);
|
|
8554
8553
|
const readAt = inboxNotification.readAt;
|
|
8555
|
-
return
|
|
8556
|
-
(
|
|
8557
|
-
|
|
8554
|
+
return otherUserComments.filter((c) => {
|
|
8555
|
+
if (readAt !== null) {
|
|
8556
|
+
return c.createdAt > readAt && c.createdAt <= inboxNotification.notifiedAt;
|
|
8557
|
+
}
|
|
8558
|
+
if (previousUnreadInboxNotification !== null) {
|
|
8559
|
+
return c.createdAt >= previousUnreadInboxNotification.notifiedAt && c.createdAt <= inboxNotification.notifiedAt;
|
|
8560
|
+
}
|
|
8561
|
+
return c.createdAt <= inboxNotification.notifiedAt;
|
|
8562
|
+
});
|
|
8558
8563
|
};
|
|
8559
8564
|
var getLastUnreadCommentWithMention = ({
|
|
8560
8565
|
comments,
|
|
@@ -8570,12 +8575,17 @@ var extractThreadNotificationData = async ({
|
|
|
8570
8575
|
event
|
|
8571
8576
|
}) => {
|
|
8572
8577
|
const { threadId, roomId, userId, inboxNotificationId } = event.data;
|
|
8573
|
-
const [thread, inboxNotification] = await Promise.all([
|
|
8578
|
+
const [thread, inboxNotification, { data: inboxNotifications }] = await Promise.all([
|
|
8574
8579
|
client.getThread({ roomId, threadId }),
|
|
8575
|
-
client.getInboxNotification({ inboxNotificationId, userId })
|
|
8580
|
+
client.getInboxNotification({ inboxNotificationId, userId }),
|
|
8581
|
+
client.getInboxNotifications({ userId, query: { unread: true } })
|
|
8576
8582
|
]);
|
|
8583
|
+
const previousUnreadInboxNotification = inboxNotifications.sort((a, b) => b.notifiedAt.getTime() - a.notifiedAt.getTime()).filter(
|
|
8584
|
+
({ id: id2, kind }) => kind === "thread" && id2 !== inboxNotification.id
|
|
8585
|
+
)[0] ?? null;
|
|
8577
8586
|
const unreadComments = getUnreadComments({
|
|
8578
8587
|
comments: thread.comments,
|
|
8588
|
+
previousUnreadInboxNotification,
|
|
8579
8589
|
inboxNotification,
|
|
8580
8590
|
userId
|
|
8581
8591
|
});
|