@liveblocks/emails 2.18.2-test1 → 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 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.18.2-test1";
6
+ var PKG_VERSION = "2.18.3";
7
7
  var PKG_FORMAT = "cjs";
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 _core.html`<span data-mention style="${toInlineCSSString(styles.mention)}">${MENTION_CHARACTER}${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _14 => _14.name]), () => ( node.userId))}</span>`;
8140
+ return _core.html`<span data-mention style="${toInlineCSSString(styles.mention)}">${MENTION_CHARACTER}${_optionalChain([user, 'optionalAccess', _14 => _14.name]) ? _core.html`${_optionalChain([user, 'optionalAccess', _15 => _15.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 _core.html`${children2}`;
8146
8146
  }
8147
8147
  if (node.bold) {
8148
8148
  children2 = _core.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 = _core.html`<code style="${toInlineCSSString(styles.code)}">${children2}</code>`;
8158
8158
  }
8159
- return children2;
8159
+ return _core.html`${children2}`;
8160
8160
  }
8161
8161
  }
8162
8162
  }).join("");
@@ -8241,7 +8241,7 @@ var prepareTextMentionNotificationEmailBaseData = async ({
8241
8241
  const roomInfo = options.resolveRoomInfo ? await options.resolveRoomInfo({ roomId }) : void 0;
8242
8242
  const resolvedRoomInfo = {
8243
8243
  ...roomInfo,
8244
- name: _nullishCoalesce(_optionalChain([roomInfo, 'optionalAccess', _15 => _15.name]), () => ( roomId))
8244
+ name: _nullishCoalesce(_optionalChain([roomInfo, 'optionalAccess', _16 => _16.name]), () => ( roomId))
8245
8245
  };
8246
8246
  const data = await extractTextMentionNotificationData({ client, event });
8247
8247
  if (data === null) {
@@ -8407,17 +8407,17 @@ var baseComponents2 = {
8407
8407
  Link: ({ element, href }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { href, target: "_blank", rel: "noopener noreferrer", children: _nullishCoalesce(element.text, () => ( element.url)) }),
8408
8408
  Mention: ({ element, user }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { "data-mention": true, children: [
8409
8409
  MENTION_CHARACTER,
8410
- _nullishCoalesce(_optionalChain([user, 'optionalAccess', _16 => _16.name]), () => ( element.id))
8410
+ _nullishCoalesce(_optionalChain([user, 'optionalAccess', _17 => _17.name]), () => ( element.id))
8411
8411
  ] })
8412
8412
  };
8413
8413
  async function convertCommentBodyAsReact(body, options) {
8414
8414
  const Components = {
8415
8415
  ...baseComponents2,
8416
- ..._optionalChain([options, 'optionalAccess', _17 => _17.components])
8416
+ ..._optionalChain([options, 'optionalAccess', _18 => _18.components])
8417
8417
  };
8418
8418
  const resolvedUsers = await _core.resolveUsersInCommentBody.call(void 0,
8419
8419
  body,
8420
- _optionalChain([options, 'optionalAccess', _18 => _18.resolveUsers])
8420
+ _optionalChain([options, 'optionalAccess', _19 => _19.resolveUsers])
8421
8421
  );
8422
8422
  const blocks = body.content.map((block, index) => {
8423
8423
  switch (block.type) {
@@ -8487,10 +8487,10 @@ var baseStyles2 = {
8487
8487
  }
8488
8488
  };
8489
8489
  async function convertCommentBodyAsHtml(body, options) {
8490
- const styles = { ...baseStyles2, ..._optionalChain([options, 'optionalAccess', _19 => _19.styles]) };
8490
+ const styles = { ...baseStyles2, ..._optionalChain([options, 'optionalAccess', _20 => _20.styles]) };
8491
8491
  const htmlBody = await _core.stringifyCommentBody.call(void 0, body, {
8492
8492
  format: "html",
8493
- resolveUsers: _optionalChain([options, 'optionalAccess', _20 => _20.resolveUsers]),
8493
+ resolveUsers: _optionalChain([options, 'optionalAccess', _21 => _21.resolveUsers]),
8494
8494
  elements: {
8495
8495
  // NOTE: using prettier-ignore to preserve template strings
8496
8496
  paragraph: ({ children }) => (
@@ -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 _core.html`${children}`;
8504
8504
  }
8505
8505
  if (element.bold) {
8506
8506
  children = _core.html`<strong style="${toInlineCSSString(styles.strong)}">${children}</strong>`;
@@ -8514,13 +8514,13 @@ async function convertCommentBodyAsHtml(body, options) {
8514
8514
  if (element.code) {
8515
8515
  children = _core.html`<code style="${toInlineCSSString(styles.code)}">${children}</code>`;
8516
8516
  }
8517
- return children;
8517
+ return _core.html`${children}`;
8518
8518
  },
8519
8519
  link: ({ element, href }) => {
8520
- return _core.html`<a href="${href}" target="_blank" rel="noopener noreferrer" style="${toInlineCSSString(styles.link)}">${_nullishCoalesce(element.text, () => ( element.url))}</a>`;
8520
+ return _core.html`<a href="${href}" target="_blank" rel="noopener noreferrer" style="${toInlineCSSString(styles.link)}">${element.text ? _core.html`${element.text}` : element.url}</a>`;
8521
8521
  },
8522
8522
  mention: ({ element, user }) => {
8523
- return _core.html`<span data-mention style="${toInlineCSSString(styles.mention)}">${MENTION_CHARACTER}${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _21 => _21.name]), () => ( element.id))}</span>`;
8523
+ return _core.html`<span data-mention style="${toInlineCSSString(styles.mention)}">${MENTION_CHARACTER}${_optionalChain([user, 'optionalAccess', _22 => _22.name]) ? _core.html`${_optionalChain([user, 'optionalAccess', _23 => _23.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, { data: inboxNotifications }] = await Promise.all([
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 = _nullishCoalesce(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
  });
@@ -8608,8 +8599,8 @@ var makeCommentEmailBaseData = ({
8608
8599
  roomInfo,
8609
8600
  comment
8610
8601
  }) => {
8611
- const url = _optionalChain([roomInfo, 'optionalAccess', _22 => _22.url]) ? _core.generateCommentUrl.call(void 0, {
8612
- roomUrl: _optionalChain([roomInfo, 'optionalAccess', _23 => _23.url]),
8602
+ const url = _optionalChain([roomInfo, 'optionalAccess', _24 => _24.url]) ? _core.generateCommentUrl.call(void 0, {
8603
+ roomUrl: _optionalChain([roomInfo, 'optionalAccess', _25 => _25.url]),
8613
8604
  commentId: comment.id
8614
8605
  }) : void 0;
8615
8606
  return {
@@ -8631,7 +8622,7 @@ var prepareThreadNotificationEmailBaseData = async ({
8631
8622
  const roomInfo = options.resolveRoomInfo ? await options.resolveRoomInfo({ roomId }) : void 0;
8632
8623
  const resolvedRoomInfo = {
8633
8624
  ...roomInfo,
8634
- name: _nullishCoalesce(_optionalChain([roomInfo, 'optionalAccess', _24 => _24.name]), () => ( roomId))
8625
+ name: _nullishCoalesce(_optionalChain([roomInfo, 'optionalAccess', _26 => _26.name]), () => ( roomId))
8635
8626
  };
8636
8627
  const data = await extractThreadNotificationData({ client, event });
8637
8628
  if (data === null) {