@liveblocks/emails 3.1.1 → 3.1.2
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.cjs +33 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -9
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
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 = "3.1.
|
|
6
|
+
var PKG_VERSION = "3.1.2";
|
|
7
7
|
var PKG_FORMAT = "esm";
|
|
8
8
|
|
|
9
9
|
// src/text-mention-notification.tsx
|
|
@@ -8343,7 +8343,7 @@ async function prepareTextMentionNotificationEmailAsHtml(client, event, options
|
|
|
8343
8343
|
|
|
8344
8344
|
// src/thread-notification.tsx
|
|
8345
8345
|
import {
|
|
8346
|
-
|
|
8346
|
+
generateUrl,
|
|
8347
8347
|
getMentionsFromCommentBody,
|
|
8348
8348
|
html as html2,
|
|
8349
8349
|
htmlSafe as htmlSafe2
|
|
@@ -8355,7 +8355,7 @@ import {
|
|
|
8355
8355
|
isCommentBodyMention,
|
|
8356
8356
|
isCommentBodyText,
|
|
8357
8357
|
resolveUsersInCommentBody,
|
|
8358
|
-
|
|
8358
|
+
sanitizeUrl
|
|
8359
8359
|
} from "@liveblocks/core";
|
|
8360
8360
|
async function convertCommentBody(body, options) {
|
|
8361
8361
|
const resolvedUsers = await resolveUsersInCommentBody(
|
|
@@ -8376,9 +8376,20 @@ async function convertCommentBody(body, options) {
|
|
|
8376
8376
|
);
|
|
8377
8377
|
}
|
|
8378
8378
|
if (isCommentBodyLink(inline)) {
|
|
8379
|
-
const href =
|
|
8379
|
+
const href = sanitizeUrl(inline.url);
|
|
8380
|
+
if (href === null) {
|
|
8381
|
+
return options.elements.text(
|
|
8382
|
+
{
|
|
8383
|
+
element: { text: inline.text ?? inline.url }
|
|
8384
|
+
},
|
|
8385
|
+
inlineIndex
|
|
8386
|
+
);
|
|
8387
|
+
}
|
|
8380
8388
|
return options.elements.link(
|
|
8381
|
-
{
|
|
8389
|
+
{
|
|
8390
|
+
element: inline,
|
|
8391
|
+
href
|
|
8392
|
+
},
|
|
8382
8393
|
inlineIndex
|
|
8383
8394
|
);
|
|
8384
8395
|
}
|
|
@@ -8479,6 +8490,15 @@ var extractThreadNotificationData = async ({
|
|
|
8479
8490
|
comments: unreadComments
|
|
8480
8491
|
};
|
|
8481
8492
|
};
|
|
8493
|
+
function generateCommentUrl({
|
|
8494
|
+
roomUrl,
|
|
8495
|
+
commentId
|
|
8496
|
+
}) {
|
|
8497
|
+
if (!roomUrl) {
|
|
8498
|
+
return;
|
|
8499
|
+
}
|
|
8500
|
+
return generateUrl(roomUrl, void 0, commentId);
|
|
8501
|
+
}
|
|
8482
8502
|
async function prepareThreadNotificationEmail(client, event, options, elements, callerName) {
|
|
8483
8503
|
const data = await extractThreadNotificationData({ client, event });
|
|
8484
8504
|
if (data === null) {
|
|
@@ -8510,10 +8530,10 @@ async function prepareThreadNotificationEmail(client, event, options, elements,
|
|
|
8510
8530
|
commentBodyPromise
|
|
8511
8531
|
]);
|
|
8512
8532
|
const authorInfo = authorsInfo.get(comment.userId);
|
|
8513
|
-
const url =
|
|
8533
|
+
const url = generateCommentUrl({
|
|
8514
8534
|
roomUrl: roomInfo?.url,
|
|
8515
8535
|
commentId: comment.id
|
|
8516
|
-
})
|
|
8536
|
+
});
|
|
8517
8537
|
return {
|
|
8518
8538
|
type: "unreadMention",
|
|
8519
8539
|
comment: {
|
|
@@ -8553,10 +8573,10 @@ async function prepareThreadNotificationEmail(client, event, options, elements,
|
|
|
8553
8573
|
comments: comments.map((comment, index) => {
|
|
8554
8574
|
const authorInfo = authorsInfo.get(comment.userId);
|
|
8555
8575
|
const commentBody = commentBodies[index];
|
|
8556
|
-
const url =
|
|
8576
|
+
const url = generateCommentUrl({
|
|
8557
8577
|
roomUrl: roomInfo?.url,
|
|
8558
8578
|
commentId: comment.id
|
|
8559
|
-
})
|
|
8579
|
+
});
|
|
8560
8580
|
return {
|
|
8561
8581
|
id: comment.id,
|
|
8562
8582
|
threadId: comment.threadId,
|