@liveblocks/emails 2.14.0-v2encoding → 2.15.0-debug1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  import { CommentBodyText, CommentBodyLink, BaseUserMeta, DU, CommentBodyMention, ResolveUsersArgs, OptionalPromise, DRI, CommentBody } from '@liveblocks/core';
2
2
  export { ResolveUsersArgs } from '@liveblocks/core';
3
- import React from 'react';
3
+ import { ReactNode, ComponentType } from 'react';
4
4
  import { Properties } from 'csstype';
5
5
  import { Liveblocks, TextMentionNotificationEvent, ThreadNotificationEvent } from '@liveblocks/node';
6
6
 
@@ -15,13 +15,13 @@ declare type CommentBodyContainerComponentProps = {
15
15
  /**
16
16
  * The blocks of the comment body
17
17
  */
18
- children: React.ReactNode;
18
+ children: ReactNode;
19
19
  };
20
20
  declare type CommentBodyParagraphComponentProps = {
21
21
  /**
22
22
  * The text content of the paragraph.
23
23
  */
24
- children: React.ReactNode;
24
+ children: ReactNode;
25
25
  };
26
26
  declare type CommentBodyTextComponentProps = {
27
27
  /**
@@ -54,23 +54,23 @@ declare type ConvertCommentBodyAsReactComponents<U extends BaseUserMeta = DU> =
54
54
  *
55
55
  * The component used to act as a container to wrap comment body blocks,
56
56
  */
57
- Container: React.ComponentType<CommentBodyContainerComponentProps>;
57
+ Container: ComponentType<CommentBodyContainerComponentProps>;
58
58
  /**
59
59
  * The component used to display paragraphs.
60
60
  */
61
- Paragraph: React.ComponentType<CommentBodyParagraphComponentProps>;
61
+ Paragraph: ComponentType<CommentBodyParagraphComponentProps>;
62
62
  /**
63
63
  * The component used to display text elements.
64
64
  */
65
- Text: React.ComponentType<CommentBodyTextComponentProps>;
65
+ Text: ComponentType<CommentBodyTextComponentProps>;
66
66
  /**
67
67
  * The component used to display links.
68
68
  */
69
- Link: React.ComponentType<CommentBodyLinkComponentProps>;
69
+ Link: ComponentType<CommentBodyLinkComponentProps>;
70
70
  /**
71
71
  * The component used to display mentions.
72
72
  */
73
- Mention: React.ComponentType<CommentBodyMentionComponentProps<U>>;
73
+ Mention: ComponentType<CommentBodyMentionComponentProps<U>>;
74
74
  };
75
75
  declare type ConvertCommentBodyAsHtmlStyles = {
76
76
  /**
@@ -141,7 +141,7 @@ declare type TextEditorContainerComponentProps = {
141
141
  /**
142
142
  * The nodes of the text editor
143
143
  */
144
- children: React.ReactNode;
144
+ children: ReactNode;
145
145
  };
146
146
  declare type TextEditorMentionComponentProps<U extends BaseUserMeta = DU> = {
147
147
  /**
@@ -164,15 +164,15 @@ declare type ConvertTextEditorNodesAsReactComponents<U extends BaseUserMeta = DU
164
164
  *
165
165
  * The component used to act as a container to wrap text editor nodes,
166
166
  */
167
- Container: React.ComponentType<TextEditorContainerComponentProps>;
167
+ Container: ComponentType<TextEditorContainerComponentProps>;
168
168
  /**
169
169
  * The component used to display mentions.
170
170
  */
171
- Mention: React.ComponentType<TextEditorMentionComponentProps<U>>;
171
+ Mention: ComponentType<TextEditorMentionComponentProps<U>>;
172
172
  /**
173
173
  * The component used to display text nodes.
174
174
  */
175
- Text: React.ComponentType<TextEditorTextComponentProps>;
175
+ Text: ComponentType<TextEditorTextComponentProps>;
176
176
  };
177
177
  declare type ConvertTextEditorNodesAsHtmlStyles = {
178
178
  /**
@@ -208,7 +208,7 @@ declare type PrepareTextMentionNotificationEmailBaseDataOptions = {
208
208
  };
209
209
  declare type MentionEmailAsReactData<U extends BaseUserMeta = DU> = Omit<MentionEmailBaseData, "userId" | "textEditorNodes"> & {
210
210
  author: U;
211
- reactContent: React.ReactNode;
211
+ reactContent: ReactNode;
212
212
  };
213
213
  declare type MentionEmailAsHtmlData<U extends BaseUserMeta = DU> = Omit<MentionEmailBaseData, "userId" | "textEditorNodes"> & {
214
214
  author: U;
@@ -314,7 +314,7 @@ declare type CommentEmailAsHtmlData<U extends BaseUserMeta = DU> = Omit<CommentE
314
314
  };
315
315
  declare type CommentEmailAsReactData<U extends BaseUserMeta = DU> = Omit<CommentEmailBaseData, "userId" | "rawBody"> & {
316
316
  author: U;
317
- reactBody: React.ReactNode;
317
+ reactBody: ReactNode;
318
318
  };
319
319
  declare type ThreadNotificationEmailUnreadRepliesData<U extends BaseUserMeta, C extends CommentEmailAsHtmlData<U> | CommentEmailAsReactData<U>> = {
320
320
  type: "unreadReplies";
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { CommentBodyText, CommentBodyLink, BaseUserMeta, DU, CommentBodyMention, ResolveUsersArgs, OptionalPromise, DRI, CommentBody } from '@liveblocks/core';
2
2
  export { ResolveUsersArgs } from '@liveblocks/core';
3
- import React from 'react';
3
+ import { ReactNode, ComponentType } from 'react';
4
4
  import { Properties } from 'csstype';
5
5
  import { Liveblocks, TextMentionNotificationEvent, ThreadNotificationEvent } from '@liveblocks/node';
6
6
 
@@ -15,13 +15,13 @@ declare type CommentBodyContainerComponentProps = {
15
15
  /**
16
16
  * The blocks of the comment body
17
17
  */
18
- children: React.ReactNode;
18
+ children: ReactNode;
19
19
  };
20
20
  declare type CommentBodyParagraphComponentProps = {
21
21
  /**
22
22
  * The text content of the paragraph.
23
23
  */
24
- children: React.ReactNode;
24
+ children: ReactNode;
25
25
  };
26
26
  declare type CommentBodyTextComponentProps = {
27
27
  /**
@@ -54,23 +54,23 @@ declare type ConvertCommentBodyAsReactComponents<U extends BaseUserMeta = DU> =
54
54
  *
55
55
  * The component used to act as a container to wrap comment body blocks,
56
56
  */
57
- Container: React.ComponentType<CommentBodyContainerComponentProps>;
57
+ Container: ComponentType<CommentBodyContainerComponentProps>;
58
58
  /**
59
59
  * The component used to display paragraphs.
60
60
  */
61
- Paragraph: React.ComponentType<CommentBodyParagraphComponentProps>;
61
+ Paragraph: ComponentType<CommentBodyParagraphComponentProps>;
62
62
  /**
63
63
  * The component used to display text elements.
64
64
  */
65
- Text: React.ComponentType<CommentBodyTextComponentProps>;
65
+ Text: ComponentType<CommentBodyTextComponentProps>;
66
66
  /**
67
67
  * The component used to display links.
68
68
  */
69
- Link: React.ComponentType<CommentBodyLinkComponentProps>;
69
+ Link: ComponentType<CommentBodyLinkComponentProps>;
70
70
  /**
71
71
  * The component used to display mentions.
72
72
  */
73
- Mention: React.ComponentType<CommentBodyMentionComponentProps<U>>;
73
+ Mention: ComponentType<CommentBodyMentionComponentProps<U>>;
74
74
  };
75
75
  declare type ConvertCommentBodyAsHtmlStyles = {
76
76
  /**
@@ -141,7 +141,7 @@ declare type TextEditorContainerComponentProps = {
141
141
  /**
142
142
  * The nodes of the text editor
143
143
  */
144
- children: React.ReactNode;
144
+ children: ReactNode;
145
145
  };
146
146
  declare type TextEditorMentionComponentProps<U extends BaseUserMeta = DU> = {
147
147
  /**
@@ -164,15 +164,15 @@ declare type ConvertTextEditorNodesAsReactComponents<U extends BaseUserMeta = DU
164
164
  *
165
165
  * The component used to act as a container to wrap text editor nodes,
166
166
  */
167
- Container: React.ComponentType<TextEditorContainerComponentProps>;
167
+ Container: ComponentType<TextEditorContainerComponentProps>;
168
168
  /**
169
169
  * The component used to display mentions.
170
170
  */
171
- Mention: React.ComponentType<TextEditorMentionComponentProps<U>>;
171
+ Mention: ComponentType<TextEditorMentionComponentProps<U>>;
172
172
  /**
173
173
  * The component used to display text nodes.
174
174
  */
175
- Text: React.ComponentType<TextEditorTextComponentProps>;
175
+ Text: ComponentType<TextEditorTextComponentProps>;
176
176
  };
177
177
  declare type ConvertTextEditorNodesAsHtmlStyles = {
178
178
  /**
@@ -208,7 +208,7 @@ declare type PrepareTextMentionNotificationEmailBaseDataOptions = {
208
208
  };
209
209
  declare type MentionEmailAsReactData<U extends BaseUserMeta = DU> = Omit<MentionEmailBaseData, "userId" | "textEditorNodes"> & {
210
210
  author: U;
211
- reactContent: React.ReactNode;
211
+ reactContent: ReactNode;
212
212
  };
213
213
  declare type MentionEmailAsHtmlData<U extends BaseUserMeta = DU> = Omit<MentionEmailBaseData, "userId" | "textEditorNodes"> & {
214
214
  author: U;
@@ -314,7 +314,7 @@ declare type CommentEmailAsHtmlData<U extends BaseUserMeta = DU> = Omit<CommentE
314
314
  };
315
315
  declare type CommentEmailAsReactData<U extends BaseUserMeta = DU> = Omit<CommentEmailBaseData, "userId" | "rawBody"> & {
316
316
  author: U;
317
- reactBody: React.ReactNode;
317
+ reactBody: ReactNode;
318
318
  };
319
319
  declare type ThreadNotificationEmailUnreadRepliesData<U extends BaseUserMeta, C extends CommentEmailAsHtmlData<U> | CommentEmailAsReactData<U>> = {
320
320
  type: "unreadReplies";
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;// src/index.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;// src/index.ts
2
2
  var _core = require('@liveblocks/core');
3
3
 
4
4
  // src/version.ts
5
5
  var PKG_NAME = "@liveblocks/emails";
6
- var PKG_VERSION = "2.14.0-v2encoding";
6
+ var PKG_VERSION = "2.15.0-debug1";
7
7
  var PKG_FORMAT = "cjs";
8
8
 
9
9
  // ../../node_modules/lib0/map.js
@@ -7691,7 +7691,6 @@ function createBatchUsersResolver({
7691
7691
 
7692
7692
 
7693
7693
 
7694
- var _react = require('react'); var _react2 = _interopRequireDefault(_react);
7695
7694
 
7696
7695
  // src/lib/constants.ts
7697
7696
  var MENTION_CHARACTER = "@";
@@ -7925,6 +7924,7 @@ function findTiptapMentionNodeWithContext({
7925
7924
  }
7926
7925
 
7927
7926
  // src/liveblocks-text-editor.tsx
7927
+ var _jsxruntime = require('react/jsx-runtime');
7928
7928
  var baseLiveblocksTextEditorTextFormat = {
7929
7929
  bold: false,
7930
7930
  italic: false,
@@ -8055,23 +8055,26 @@ var resolveUsersInLiveblocksTextEditorNodes = async (nodes, resolveUsers) => {
8055
8055
  return resolvedUsers;
8056
8056
  };
8057
8057
  var baseComponents = {
8058
- Container: ({ children }) => /* @__PURE__ */ _react2.default.createElement("div", null, children),
8059
- Mention: ({ element, user }) => /* @__PURE__ */ _react2.default.createElement("span", { "data-mention": true }, MENTION_CHARACTER, _nullishCoalesce(_optionalChain([user, 'optionalAccess', _9 => _9.name]), () => ( element.userId))),
8058
+ Container: ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children }),
8059
+ Mention: ({ element, user }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { "data-mention": true, children: [
8060
+ MENTION_CHARACTER,
8061
+ _nullishCoalesce(_optionalChain([user, 'optionalAccess', _9 => _9.name]), () => ( element.userId))
8062
+ ] }),
8060
8063
  Text: ({ element }) => {
8061
8064
  let children = element.text;
8062
8065
  if (element.bold) {
8063
- children = /* @__PURE__ */ _react2.default.createElement("strong", null, children);
8066
+ children = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children });
8064
8067
  }
8065
8068
  if (element.italic) {
8066
- children = /* @__PURE__ */ _react2.default.createElement("em", null, children);
8069
+ children = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "em", { children });
8067
8070
  }
8068
8071
  if (element.strikethrough) {
8069
- children = /* @__PURE__ */ _react2.default.createElement("s", null, children);
8072
+ children = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "s", { children });
8070
8073
  }
8071
8074
  if (element.code) {
8072
- children = /* @__PURE__ */ _react2.default.createElement("code", null, children);
8075
+ children = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "code", { children });
8073
8076
  }
8074
- return /* @__PURE__ */ _react2.default.createElement("span", null, children);
8077
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children });
8075
8078
  }
8076
8079
  };
8077
8080
  async function convertTextEditorNodesAsReact(nodes, options) {
@@ -8086,25 +8089,25 @@ async function convertTextEditorNodesAsReact(nodes, options) {
8086
8089
  const children = nodes.map((node, index) => {
8087
8090
  switch (node.type) {
8088
8091
  case "mention":
8089
- return /* @__PURE__ */ _react2.default.createElement(
8092
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
8090
8093
  Components.Mention,
8091
8094
  {
8092
- key: `lb-text-editor-mention-${index}-${node.userId}`,
8093
8095
  element: node,
8094
8096
  user: resolvedUsers.get(node.userId)
8095
- }
8097
+ },
8098
+ `lb-text-editor-mention-${index}-${node.userId}`
8096
8099
  );
8097
8100
  case "text":
8098
- return /* @__PURE__ */ _react2.default.createElement(
8101
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
8099
8102
  Components.Text,
8100
8103
  {
8101
- key: `lb-text-editor-text-${index}`,
8102
8104
  element: node
8103
- }
8105
+ },
8106
+ `lb-text-editor-text-${index}`
8104
8107
  );
8105
8108
  }
8106
8109
  });
8107
- return /* @__PURE__ */ _react2.default.createElement(Components.Container, { key: "lb-text-editor-container" }, children);
8110
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Components.Container, { children }, "lb-text-editor-container");
8108
8111
  }
8109
8112
  var baseStyles = {
8110
8113
  container: {
@@ -8382,26 +8385,29 @@ async function prepareTextMentionNotificationEmailAsHtml(client, event, options
8382
8385
 
8383
8386
 
8384
8387
  var baseComponents2 = {
8385
- Container: ({ children }) => /* @__PURE__ */ _react2.default.createElement("div", null, children),
8386
- Paragraph: ({ children }) => /* @__PURE__ */ _react2.default.createElement("p", null, children),
8388
+ Container: ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children }),
8389
+ Paragraph: ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children }),
8387
8390
  Text: ({ element }) => {
8388
8391
  let children = element.text;
8389
8392
  if (element.bold) {
8390
- children = /* @__PURE__ */ _react2.default.createElement("strong", null, children);
8393
+ children = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children });
8391
8394
  }
8392
8395
  if (element.italic) {
8393
- children = /* @__PURE__ */ _react2.default.createElement("em", null, children);
8396
+ children = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "em", { children });
8394
8397
  }
8395
8398
  if (element.strikethrough) {
8396
- children = /* @__PURE__ */ _react2.default.createElement("s", null, children);
8399
+ children = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "s", { children });
8397
8400
  }
8398
8401
  if (element.code) {
8399
- children = /* @__PURE__ */ _react2.default.createElement("code", null, children);
8402
+ children = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "code", { children });
8400
8403
  }
8401
- return /* @__PURE__ */ _react2.default.createElement("span", null, children);
8404
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children });
8402
8405
  },
8403
- Link: ({ element, href }) => /* @__PURE__ */ _react2.default.createElement("a", { href, target: "_blank", rel: "noopener noreferrer" }, _nullishCoalesce(element.text, () => ( element.url))),
8404
- Mention: ({ element, user }) => /* @__PURE__ */ _react2.default.createElement("span", { "data-mention": true }, MENTION_CHARACTER, _nullishCoalesce(_optionalChain([user, 'optionalAccess', _16 => _16.name]), () => ( element.id)))
8406
+ Link: ({ element, href }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { href, target: "_blank", rel: "noopener noreferrer", children: _nullishCoalesce(element.text, () => ( element.url)) }),
8407
+ Mention: ({ element, user }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { "data-mention": true, children: [
8408
+ MENTION_CHARACTER,
8409
+ _nullishCoalesce(_optionalChain([user, 'optionalAccess', _16 => _16.name]), () => ( element.id))
8410
+ ] })
8405
8411
  };
8406
8412
  async function convertCommentBodyAsReact(body, options) {
8407
8413
  const Components = {
@@ -8417,38 +8423,38 @@ async function convertCommentBodyAsReact(body, options) {
8417
8423
  case "paragraph": {
8418
8424
  const children = block.children.map((inline, inlineIndex) => {
8419
8425
  if (_core.isCommentBodyMention.call(void 0, inline)) {
8420
- return inline.id ? /* @__PURE__ */ _react2.default.createElement(
8426
+ return inline.id ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
8421
8427
  Components.Mention,
8422
8428
  {
8423
- key: `lb-comment-body-mention-${inlineIndex}`,
8424
8429
  element: inline,
8425
8430
  user: resolvedUsers.get(inline.id)
8426
- }
8431
+ },
8432
+ `lb-comment-body-mention-${inlineIndex}`
8427
8433
  ) : null;
8428
8434
  }
8429
8435
  if (_core.isCommentBodyLink.call(void 0, inline)) {
8430
8436
  const href = _nullishCoalesce(_core.toAbsoluteUrl.call(void 0, inline.url), () => ( inline.url));
8431
- return /* @__PURE__ */ _react2.default.createElement(
8437
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
8432
8438
  Components.Link,
8433
8439
  {
8434
- key: `lb-comment-body-link-${inlineIndex}`,
8435
8440
  element: inline,
8436
8441
  href
8437
- }
8442
+ },
8443
+ `lb-comment-body-link-${inlineIndex}`
8438
8444
  );
8439
8445
  }
8440
8446
  if (_core.isCommentBodyText.call(void 0, inline)) {
8441
- return /* @__PURE__ */ _react2.default.createElement(
8447
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
8442
8448
  Components.Text,
8443
8449
  {
8444
- key: `lb-comment-body-text-${inlineIndex}`,
8445
8450
  element: inline
8446
- }
8451
+ },
8452
+ `lb-comment-body-text-${inlineIndex}`
8447
8453
  );
8448
8454
  }
8449
8455
  return null;
8450
8456
  });
8451
- return /* @__PURE__ */ _react2.default.createElement(Components.Paragraph, { key: `lb-comment-body-paragraph-${index}` }, children);
8457
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Components.Paragraph, { children }, `lb-comment-body-paragraph-${index}`);
8452
8458
  }
8453
8459
  default:
8454
8460
  console.warn(
@@ -8457,7 +8463,7 @@ async function convertCommentBodyAsReact(body, options) {
8457
8463
  return null;
8458
8464
  }
8459
8465
  });
8460
- return /* @__PURE__ */ _react2.default.createElement(Components.Container, { key: "lb-comment-body-container" }, blocks);
8466
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Components.Container, { children: blocks }, "lb-comment-body-container");
8461
8467
  }
8462
8468
  var baseStyles2 = {
8463
8469
  paragraph: {