@liveblocks/emails 2.18.2 → 2.18.3
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.js +19 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -19
- 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.18.
|
|
6
|
+
var PKG_VERSION = "2.18.3";
|
|
7
7
|
var PKG_FORMAT = "esm";
|
|
8
8
|
|
|
9
9
|
// ../../node_modules/lib0/map.js
|
|
@@ -8137,12 +8137,12 @@ async function convertTextEditorNodesAsHtml(nodes, options) {
|
|
|
8137
8137
|
switch (node.type) {
|
|
8138
8138
|
case "mention": {
|
|
8139
8139
|
const user = resolvedUsers.get(node.userId);
|
|
8140
|
-
return html`<span data-mention style="${toInlineCSSString(styles.mention)}">${MENTION_CHARACTER}${user?.name
|
|
8140
|
+
return html`<span data-mention style="${toInlineCSSString(styles.mention)}">${MENTION_CHARACTER}${user?.name ? html`${user?.name}` : node.userId}</span>`;
|
|
8141
8141
|
}
|
|
8142
8142
|
case "text": {
|
|
8143
8143
|
let children2 = node.text;
|
|
8144
8144
|
if (!children2) {
|
|
8145
|
-
return children2
|
|
8145
|
+
return html`${children2}`;
|
|
8146
8146
|
}
|
|
8147
8147
|
if (node.bold) {
|
|
8148
8148
|
children2 = html`<strong style="${toInlineCSSString(styles.strong)}">${children2}</strong>`;
|
|
@@ -8156,7 +8156,7 @@ async function convertTextEditorNodesAsHtml(nodes, options) {
|
|
|
8156
8156
|
if (node.code) {
|
|
8157
8157
|
children2 = html`<code style="${toInlineCSSString(styles.code)}">${children2}</code>`;
|
|
8158
8158
|
}
|
|
8159
|
-
return children2
|
|
8159
|
+
return html`${children2}`;
|
|
8160
8160
|
}
|
|
8161
8161
|
}
|
|
8162
8162
|
}).join("");
|
|
@@ -8500,7 +8500,7 @@ async function convertCommentBodyAsHtml(body, options) {
|
|
|
8500
8500
|
text: ({ element }) => {
|
|
8501
8501
|
let children = element.text;
|
|
8502
8502
|
if (!children) {
|
|
8503
|
-
return children
|
|
8503
|
+
return html2`${children}`;
|
|
8504
8504
|
}
|
|
8505
8505
|
if (element.bold) {
|
|
8506
8506
|
children = html2`<strong style="${toInlineCSSString(styles.strong)}">${children}</strong>`;
|
|
@@ -8514,13 +8514,13 @@ async function convertCommentBodyAsHtml(body, options) {
|
|
|
8514
8514
|
if (element.code) {
|
|
8515
8515
|
children = html2`<code style="${toInlineCSSString(styles.code)}">${children}</code>`;
|
|
8516
8516
|
}
|
|
8517
|
-
return children
|
|
8517
|
+
return html2`${children}`;
|
|
8518
8518
|
},
|
|
8519
8519
|
link: ({ element, href }) => {
|
|
8520
|
-
return html2`<a href="${href}" target="_blank" rel="noopener noreferrer" style="${toInlineCSSString(styles.link)}">${element.text
|
|
8520
|
+
return html2`<a href="${href}" target="_blank" rel="noopener noreferrer" style="${toInlineCSSString(styles.link)}">${element.text ? html2`${element.text}` : element.url}</a>`;
|
|
8521
8521
|
},
|
|
8522
8522
|
mention: ({ element, user }) => {
|
|
8523
|
-
return html2`<span data-mention style="${toInlineCSSString(styles.mention)}">${MENTION_CHARACTER}${user?.name
|
|
8523
|
+
return html2`<span data-mention style="${toInlineCSSString(styles.mention)}">${MENTION_CHARACTER}${user?.name ? html2`${user?.name}` : element.id}</span>`;
|
|
8524
8524
|
}
|
|
8525
8525
|
}
|
|
8526
8526
|
});
|
|
@@ -8544,7 +8544,6 @@ function filterCommentsWithBody(comments) {
|
|
|
8544
8544
|
// src/thread-notification.tsx
|
|
8545
8545
|
var getUnreadComments = ({
|
|
8546
8546
|
comments,
|
|
8547
|
-
previousUnreadInboxNotification,
|
|
8548
8547
|
inboxNotification,
|
|
8549
8548
|
userId
|
|
8550
8549
|
}) => {
|
|
@@ -8555,9 +8554,6 @@ var getUnreadComments = ({
|
|
|
8555
8554
|
if (readAt !== null) {
|
|
8556
8555
|
return c.createdAt > readAt && c.createdAt <= inboxNotification.notifiedAt;
|
|
8557
8556
|
}
|
|
8558
|
-
if (previousUnreadInboxNotification !== null) {
|
|
8559
|
-
return c.createdAt >= previousUnreadInboxNotification.notifiedAt && c.createdAt <= inboxNotification.notifiedAt;
|
|
8560
|
-
}
|
|
8561
8557
|
return c.createdAt <= inboxNotification.notifiedAt;
|
|
8562
8558
|
});
|
|
8563
8559
|
};
|
|
@@ -8575,17 +8571,12 @@ var extractThreadNotificationData = async ({
|
|
|
8575
8571
|
event
|
|
8576
8572
|
}) => {
|
|
8577
8573
|
const { threadId, roomId, userId, inboxNotificationId } = event.data;
|
|
8578
|
-
const [thread, inboxNotification
|
|
8574
|
+
const [thread, inboxNotification] = await Promise.all([
|
|
8579
8575
|
client.getThread({ roomId, threadId }),
|
|
8580
|
-
client.getInboxNotification({ inboxNotificationId, userId })
|
|
8581
|
-
client.getInboxNotifications({ userId, query: { unread: true } })
|
|
8576
|
+
client.getInboxNotification({ inboxNotificationId, userId })
|
|
8582
8577
|
]);
|
|
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;
|
|
8586
8578
|
const unreadComments = getUnreadComments({
|
|
8587
8579
|
comments: thread.comments,
|
|
8588
|
-
previousUnreadInboxNotification,
|
|
8589
8580
|
inboxNotification,
|
|
8590
8581
|
userId
|
|
8591
8582
|
});
|