@liveblocks/emails 2.21.0-emails1 → 2.21.0-emails2

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.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { BaseUserMeta, DU, ResolveUsersArgs, Awaitable, DRI, CommentBodyText, CommentBodyLink, CommentBodyMention } from '@liveblocks/core';
1
+ import { BaseUserMeta, DU, ResolveUsersArgs, Awaitable, DRI, CommentBodyParagraph, CommentBodyText, CommentBodyLink, CommentBodyMention } from '@liveblocks/core';
2
2
  export { ResolveUsersArgs } from '@liveblocks/core';
3
3
  import { ReactNode, ComponentType } from 'react';
4
4
  import { Properties } from 'csstype';
@@ -209,6 +209,75 @@ type TextMentionNotificationEmailDataAsHtml = TextMentionNotificationEmailData<B
209
209
  */
210
210
  declare function prepareTextMentionNotificationEmailAsHtml(client: Liveblocks, event: TextMentionNotificationEvent, options?: PrepareTextMentionNotificationEmailAsHtmlOptions<BaseUserMeta>): Promise<TextMentionNotificationEmailDataAsHtml | null>;
211
211
 
212
+ type CommentBodyContainerElementArgs<T> = {
213
+ /**
214
+ * The blocks of the comment body
215
+ */
216
+ children: T[];
217
+ };
218
+ type CommentBodyParagraphElementArgs<T> = {
219
+ /**
220
+ * The paragraph element.
221
+ */
222
+ element: CommentBodyParagraph;
223
+ /**
224
+ * The text content of the paragraph.
225
+ */
226
+ children: T[];
227
+ };
228
+ type CommentBodyTextElementArgs = {
229
+ /**
230
+ * The text element.
231
+ */
232
+ element: CommentBodyText;
233
+ };
234
+ type CommentBodyLinkElementArgs = {
235
+ /**
236
+ * The link element.
237
+ */
238
+ element: CommentBodyLink;
239
+ /**
240
+ * The absolute URL of the link.
241
+ */
242
+ href: string;
243
+ };
244
+ type CommentBodyMentionElementArgs<U extends BaseUserMeta = DU> = {
245
+ /**
246
+ * The mention element.
247
+ */
248
+ element: CommentBodyMention;
249
+ /**
250
+ * The mention's user info, if the `resolvedUsers` option was provided.
251
+ */
252
+ user?: U["info"];
253
+ };
254
+ /**
255
+ * Protocol:
256
+ * Comment body elements to be converted to a custom format `T`
257
+ */
258
+ type ConvertCommentBodyElements<T, U extends BaseUserMeta = DU> = {
259
+ /**
260
+ * The container element used to display comment body blocks.
261
+ */
262
+ container: (args: CommentBodyContainerElementArgs<T>) => T;
263
+ /**
264
+ * The paragraph element used to display paragraphs.
265
+ */
266
+ paragraph: (args: CommentBodyParagraphElementArgs<T>, index: number) => T;
267
+ /**
268
+ * The text element used to display text elements.
269
+ */
270
+ text: (args: CommentBodyTextElementArgs, index: number) => T;
271
+ /**
272
+ * The link element used to display links.
273
+ */
274
+ link: (args: CommentBodyLinkElementArgs, index: number) => T;
275
+ /**
276
+ * The mention element used to display mentions.
277
+ */
278
+ mention: (args: CommentBodyMentionElementArgs<U>, index: number) => T;
279
+ };
280
+
212
281
  type CommentEmailData<BodyType, U extends BaseUserMeta = DU> = {
213
282
  id: string;
214
283
  threadId: string;
@@ -235,6 +304,20 @@ type CommentEmailAsReactData<U extends BaseUserMeta = DU> = CommentEmailData<Rea
235
304
  /** @deprecated Use `body` property instead. */
236
305
  reactBody: ReactNode;
237
306
  };
307
+ type PrepareThreadNotificationEmailOptions<BodyType, U extends BaseUserMeta = DU> = {
308
+ /**
309
+ * A function that returns room info from room IDs.
310
+ */
311
+ resolveRoomInfo?: (args: ResolveRoomInfoArgs) => Awaitable<DRI | undefined>;
312
+ /**
313
+ * A function that returns info from user IDs.
314
+ */
315
+ resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>;
316
+ /**
317
+ * Comments body elements customizations.
318
+ */
319
+ elements: ConvertCommentBodyElements<BodyType, U>;
320
+ };
238
321
  /**
239
322
  * The styles used to customize the html elements in the resulting html safe string.
240
323
  * Each styles has priority over the base styles inherited.
@@ -358,10 +441,6 @@ type ConvertCommentBodyAsReactComponents<U extends BaseUserMeta = DU> = {
358
441
  Mention: ComponentType<CommentBodyMentionComponentProps<U>>;
359
442
  };
360
443
  type PrepareThreadNotificationEmailAsReactOptions<BodyType, U extends BaseUserMeta = DU> = Omit<PrepareThreadNotificationEmailOptions<BodyType, U>, "elements"> & {
361
- /**
362
- * A function that returns info from user IDs.
363
- */
364
- resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>;
365
444
  /**
366
445
  * The components used to customize the resulting React nodes inside a comment body.
367
446
  * Each components has priority over the base components inherited internally defined.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BaseUserMeta, DU, ResolveUsersArgs, Awaitable, DRI, CommentBodyText, CommentBodyLink, CommentBodyMention } from '@liveblocks/core';
1
+ import { BaseUserMeta, DU, ResolveUsersArgs, Awaitable, DRI, CommentBodyParagraph, CommentBodyText, CommentBodyLink, CommentBodyMention } from '@liveblocks/core';
2
2
  export { ResolveUsersArgs } from '@liveblocks/core';
3
3
  import { ReactNode, ComponentType } from 'react';
4
4
  import { Properties } from 'csstype';
@@ -209,6 +209,75 @@ type TextMentionNotificationEmailDataAsHtml = TextMentionNotificationEmailData<B
209
209
  */
210
210
  declare function prepareTextMentionNotificationEmailAsHtml(client: Liveblocks, event: TextMentionNotificationEvent, options?: PrepareTextMentionNotificationEmailAsHtmlOptions<BaseUserMeta>): Promise<TextMentionNotificationEmailDataAsHtml | null>;
211
211
 
212
+ type CommentBodyContainerElementArgs<T> = {
213
+ /**
214
+ * The blocks of the comment body
215
+ */
216
+ children: T[];
217
+ };
218
+ type CommentBodyParagraphElementArgs<T> = {
219
+ /**
220
+ * The paragraph element.
221
+ */
222
+ element: CommentBodyParagraph;
223
+ /**
224
+ * The text content of the paragraph.
225
+ */
226
+ children: T[];
227
+ };
228
+ type CommentBodyTextElementArgs = {
229
+ /**
230
+ * The text element.
231
+ */
232
+ element: CommentBodyText;
233
+ };
234
+ type CommentBodyLinkElementArgs = {
235
+ /**
236
+ * The link element.
237
+ */
238
+ element: CommentBodyLink;
239
+ /**
240
+ * The absolute URL of the link.
241
+ */
242
+ href: string;
243
+ };
244
+ type CommentBodyMentionElementArgs<U extends BaseUserMeta = DU> = {
245
+ /**
246
+ * The mention element.
247
+ */
248
+ element: CommentBodyMention;
249
+ /**
250
+ * The mention's user info, if the `resolvedUsers` option was provided.
251
+ */
252
+ user?: U["info"];
253
+ };
254
+ /**
255
+ * Protocol:
256
+ * Comment body elements to be converted to a custom format `T`
257
+ */
258
+ type ConvertCommentBodyElements<T, U extends BaseUserMeta = DU> = {
259
+ /**
260
+ * The container element used to display comment body blocks.
261
+ */
262
+ container: (args: CommentBodyContainerElementArgs<T>) => T;
263
+ /**
264
+ * The paragraph element used to display paragraphs.
265
+ */
266
+ paragraph: (args: CommentBodyParagraphElementArgs<T>, index: number) => T;
267
+ /**
268
+ * The text element used to display text elements.
269
+ */
270
+ text: (args: CommentBodyTextElementArgs, index: number) => T;
271
+ /**
272
+ * The link element used to display links.
273
+ */
274
+ link: (args: CommentBodyLinkElementArgs, index: number) => T;
275
+ /**
276
+ * The mention element used to display mentions.
277
+ */
278
+ mention: (args: CommentBodyMentionElementArgs<U>, index: number) => T;
279
+ };
280
+
212
281
  type CommentEmailData<BodyType, U extends BaseUserMeta = DU> = {
213
282
  id: string;
214
283
  threadId: string;
@@ -235,6 +304,20 @@ type CommentEmailAsReactData<U extends BaseUserMeta = DU> = CommentEmailData<Rea
235
304
  /** @deprecated Use `body` property instead. */
236
305
  reactBody: ReactNode;
237
306
  };
307
+ type PrepareThreadNotificationEmailOptions<BodyType, U extends BaseUserMeta = DU> = {
308
+ /**
309
+ * A function that returns room info from room IDs.
310
+ */
311
+ resolveRoomInfo?: (args: ResolveRoomInfoArgs) => Awaitable<DRI | undefined>;
312
+ /**
313
+ * A function that returns info from user IDs.
314
+ */
315
+ resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>;
316
+ /**
317
+ * Comments body elements customizations.
318
+ */
319
+ elements: ConvertCommentBodyElements<BodyType, U>;
320
+ };
238
321
  /**
239
322
  * The styles used to customize the html elements in the resulting html safe string.
240
323
  * Each styles has priority over the base styles inherited.
@@ -358,10 +441,6 @@ type ConvertCommentBodyAsReactComponents<U extends BaseUserMeta = DU> = {
358
441
  Mention: ComponentType<CommentBodyMentionComponentProps<U>>;
359
442
  };
360
443
  type PrepareThreadNotificationEmailAsReactOptions<BodyType, U extends BaseUserMeta = DU> = Omit<PrepareThreadNotificationEmailOptions<BodyType, U>, "elements"> & {
361
- /**
362
- * A function that returns info from user IDs.
363
- */
364
- resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>;
365
444
  /**
366
445
  * The components used to customize the resulting React nodes inside a comment body.
367
446
  * Each components has priority over the base components inherited internally defined.
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 = "2.21.0-emails1";
6
+ var PKG_VERSION = "2.21.0-emails2";
7
7
  var PKG_FORMAT = "esm";
8
8
 
9
9
  // ../../node_modules/lib0/map.js