@liveblocks/emails 2.21.0-emails2 → 2.21.0-emails3
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 +67 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -78
- package/dist/index.d.ts +5 -78
- package/dist/index.js +67 -65
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@ var _core = require('@liveblocks/core');
|
|
|
3
3
|
|
|
4
4
|
// src/version.ts
|
|
5
5
|
var PKG_NAME = "@liveblocks/emails";
|
|
6
|
-
var PKG_VERSION = "2.21.0-
|
|
6
|
+
var PKG_VERSION = "2.21.0-emails3";
|
|
7
7
|
var PKG_FORMAT = "cjs";
|
|
8
8
|
|
|
9
9
|
// ../../node_modules/lib0/map.js
|
|
@@ -8500,7 +8500,7 @@ var extractThreadNotificationData = async ({
|
|
|
8500
8500
|
comments: unreadComments
|
|
8501
8501
|
};
|
|
8502
8502
|
};
|
|
8503
|
-
async function prepareThreadNotificationEmail(client, event, options) {
|
|
8503
|
+
async function prepareThreadNotificationEmail(client, event, options, elements, callerName) {
|
|
8504
8504
|
const data = await extractThreadNotificationData({ client, event });
|
|
8505
8505
|
if (data === null) {
|
|
8506
8506
|
return null;
|
|
@@ -8512,7 +8512,7 @@ async function prepareThreadNotificationEmail(client, event, options) {
|
|
|
8512
8512
|
};
|
|
8513
8513
|
const batchUsersResolver = createBatchUsersResolver({
|
|
8514
8514
|
resolveUsers: options.resolveUsers,
|
|
8515
|
-
callerName
|
|
8515
|
+
callerName
|
|
8516
8516
|
});
|
|
8517
8517
|
switch (data.type) {
|
|
8518
8518
|
case "unreadMention": {
|
|
@@ -8523,7 +8523,7 @@ async function prepareThreadNotificationEmail(client, event, options) {
|
|
|
8523
8523
|
});
|
|
8524
8524
|
const commentBodyPromise = convertCommentBody(comment.body, {
|
|
8525
8525
|
resolveUsers: batchUsersResolver.resolveUsers,
|
|
8526
|
-
elements
|
|
8526
|
+
elements
|
|
8527
8527
|
});
|
|
8528
8528
|
await batchUsersResolver.resolve();
|
|
8529
8529
|
const [authorsInfo, commentBody] = await Promise.all([
|
|
@@ -8561,7 +8561,7 @@ async function prepareThreadNotificationEmail(client, event, options) {
|
|
|
8561
8561
|
const commentBodiesPromises = comments.map(
|
|
8562
8562
|
(c) => convertCommentBody(c.body, {
|
|
8563
8563
|
resolveUsers: batchUsersResolver.resolveUsers,
|
|
8564
|
-
elements
|
|
8564
|
+
elements
|
|
8565
8565
|
})
|
|
8566
8566
|
);
|
|
8567
8567
|
await batchUsersResolver.resolve();
|
|
@@ -8623,40 +8623,41 @@ async function prepareThreadNotificationEmailAsHtml(client, event, options = {})
|
|
|
8623
8623
|
event,
|
|
8624
8624
|
{
|
|
8625
8625
|
resolveUsers: options.resolveUsers,
|
|
8626
|
-
resolveRoomInfo: options.resolveRoomInfo
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
},
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
}
|
|
8638
|
-
if (element.bold) {
|
|
8639
|
-
children = _core.html`<strong style="${toInlineCSSString(styles.strong)}">${children}</strong>`;
|
|
8640
|
-
}
|
|
8641
|
-
if (element.italic) {
|
|
8642
|
-
children = _core.html`<em>${children}</em>`;
|
|
8643
|
-
}
|
|
8644
|
-
if (element.strikethrough) {
|
|
8645
|
-
children = _core.html`<s>${children}</s>`;
|
|
8646
|
-
}
|
|
8647
|
-
if (element.code) {
|
|
8648
|
-
children = _core.html`<code style="${toInlineCSSString(styles.code)}">${children}</code>`;
|
|
8649
|
-
}
|
|
8626
|
+
resolveRoomInfo: options.resolveRoomInfo
|
|
8627
|
+
},
|
|
8628
|
+
{
|
|
8629
|
+
container: ({ children }) => children.join("\n"),
|
|
8630
|
+
paragraph: ({ children }) => {
|
|
8631
|
+
const unsafe = children.join("");
|
|
8632
|
+
return unsafe ? _core.html`<p style="${toInlineCSSString(styles.paragraph)}">${_core.htmlSafe.call(void 0, unsafe)}</p>` : unsafe;
|
|
8633
|
+
},
|
|
8634
|
+
text: ({ element }) => {
|
|
8635
|
+
let children = element.text;
|
|
8636
|
+
if (!children) {
|
|
8650
8637
|
return _core.html`${children}`;
|
|
8651
|
-
},
|
|
8652
|
-
link: ({ element, href }) => {
|
|
8653
|
-
return _core.html`<a href="${href}" target="_blank" rel="noopener noreferrer" style="${toInlineCSSString(styles.link)}">${element.text ? _core.html`${element.text}` : element.url}</a>`;
|
|
8654
|
-
},
|
|
8655
|
-
mention: ({ element, user }) => {
|
|
8656
|
-
return _core.html`<span data-mention style="${toInlineCSSString(styles.mention)}">${MENTION_CHARACTER}${_optionalChain([user, 'optionalAccess', _24 => _24.name]) ? _core.html`${_optionalChain([user, 'optionalAccess', _25 => _25.name])}` : element.id}</span>`;
|
|
8657
8638
|
}
|
|
8639
|
+
if (element.bold) {
|
|
8640
|
+
children = _core.html`<strong style="${toInlineCSSString(styles.strong)}">${children}</strong>`;
|
|
8641
|
+
}
|
|
8642
|
+
if (element.italic) {
|
|
8643
|
+
children = _core.html`<em>${children}</em>`;
|
|
8644
|
+
}
|
|
8645
|
+
if (element.strikethrough) {
|
|
8646
|
+
children = _core.html`<s>${children}</s>`;
|
|
8647
|
+
}
|
|
8648
|
+
if (element.code) {
|
|
8649
|
+
children = _core.html`<code style="${toInlineCSSString(styles.code)}">${children}</code>`;
|
|
8650
|
+
}
|
|
8651
|
+
return _core.html`${children}`;
|
|
8652
|
+
},
|
|
8653
|
+
link: ({ element, href }) => {
|
|
8654
|
+
return _core.html`<a href="${href}" target="_blank" rel="noopener noreferrer" style="${toInlineCSSString(styles.link)}">${element.text ? _core.html`${element.text}` : element.url}</a>`;
|
|
8655
|
+
},
|
|
8656
|
+
mention: ({ element, user }) => {
|
|
8657
|
+
return _core.html`<span data-mention style="${toInlineCSSString(styles.mention)}">${MENTION_CHARACTER}${_optionalChain([user, 'optionalAccess', _24 => _24.name]) ? _core.html`${_optionalChain([user, 'optionalAccess', _25 => _25.name])}` : element.id}</span>`;
|
|
8658
8658
|
}
|
|
8659
|
-
}
|
|
8659
|
+
},
|
|
8660
|
+
"prepareThreadNotificationEmailAsHtml"
|
|
8660
8661
|
);
|
|
8661
8662
|
if (data === null) {
|
|
8662
8663
|
return null;
|
|
@@ -8711,35 +8712,36 @@ async function prepareThreadNotificationEmailAsReact(client, event, options = {}
|
|
|
8711
8712
|
event,
|
|
8712
8713
|
{
|
|
8713
8714
|
resolveUsers: options.resolveUsers,
|
|
8714
|
-
resolveRoomInfo: options.resolveRoomInfo
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
}
|
|
8715
|
+
resolveRoomInfo: options.resolveRoomInfo
|
|
8716
|
+
},
|
|
8717
|
+
{
|
|
8718
|
+
container: ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Components.Container, { children }, "lb-comment-body-container"),
|
|
8719
|
+
paragraph: ({ children }, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Components.Paragraph, { children }, `lb-comment-body-paragraph-${index}`),
|
|
8720
|
+
text: ({ element }, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
8721
|
+
Components.Text,
|
|
8722
|
+
{
|
|
8723
|
+
element
|
|
8724
|
+
},
|
|
8725
|
+
`lb-comment-body-text-${index}`
|
|
8726
|
+
),
|
|
8727
|
+
link: ({ element, href }, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
8728
|
+
Components.Link,
|
|
8729
|
+
{
|
|
8730
|
+
element,
|
|
8731
|
+
href
|
|
8732
|
+
},
|
|
8733
|
+
`lb-comment-body-link-${index}`
|
|
8734
|
+
),
|
|
8735
|
+
mention: ({ element, user }, index) => element.id ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
8736
|
+
Components.Mention,
|
|
8737
|
+
{
|
|
8738
|
+
element,
|
|
8739
|
+
user
|
|
8740
|
+
},
|
|
8741
|
+
`lb-comment-body-mention-${index}`
|
|
8742
|
+
) : null
|
|
8743
|
+
},
|
|
8744
|
+
"prepareThreadNotificationEmailAsReact"
|
|
8743
8745
|
);
|
|
8744
8746
|
if (data === null) {
|
|
8745
8747
|
return null;
|