@liveblocks/emails 2.21.0 → 2.22.0
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 +200 -259
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +116 -119
- package/dist/index.d.ts +116 -119
- package/dist/index.js +201 -260
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,100 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseUserMeta, DU, ResolveUsersArgs, Awaitable, DRI, 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';
|
|
5
5
|
import { Liveblocks, TextMentionNotificationEvent, ThreadNotificationEvent } from '@liveblocks/node';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* CSS properties object.
|
|
9
|
-
* Type alias for DX purposes.
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
type CSSProperties = Properties;
|
|
13
|
-
|
|
14
|
-
type CommentBodyContainerComponentProps = {
|
|
15
|
-
/**
|
|
16
|
-
* The blocks of the comment body
|
|
17
|
-
*/
|
|
18
|
-
children: ReactNode;
|
|
19
|
-
};
|
|
20
|
-
type CommentBodyParagraphComponentProps = {
|
|
21
|
-
/**
|
|
22
|
-
* The text content of the paragraph.
|
|
23
|
-
*/
|
|
24
|
-
children: ReactNode;
|
|
25
|
-
};
|
|
26
|
-
type CommentBodyTextComponentProps = {
|
|
27
|
-
/**
|
|
28
|
-
* The text element.
|
|
29
|
-
*/
|
|
30
|
-
element: CommentBodyText;
|
|
31
|
-
};
|
|
32
|
-
type CommentBodyLinkComponentProps = {
|
|
33
|
-
/**
|
|
34
|
-
* The link element.
|
|
35
|
-
*/
|
|
36
|
-
element: CommentBodyLink;
|
|
37
|
-
/**
|
|
38
|
-
* The absolute URL of the link.
|
|
39
|
-
*/
|
|
40
|
-
href: string;
|
|
41
|
-
};
|
|
42
|
-
type CommentBodyMentionComponentProps<U extends BaseUserMeta = DU> = {
|
|
43
|
-
/**
|
|
44
|
-
* The mention element.
|
|
45
|
-
*/
|
|
46
|
-
element: CommentBodyMention;
|
|
47
|
-
/**
|
|
48
|
-
* The mention's user info, if the `resolvedUsers` option was provided.
|
|
49
|
-
*/
|
|
50
|
-
user?: U["info"];
|
|
51
|
-
};
|
|
52
|
-
type ConvertCommentBodyAsReactComponents<U extends BaseUserMeta = DU> = {
|
|
53
|
-
/**
|
|
54
|
-
*
|
|
55
|
-
* The component used to act as a container to wrap comment body blocks,
|
|
56
|
-
*/
|
|
57
|
-
Container: ComponentType<CommentBodyContainerComponentProps>;
|
|
58
|
-
/**
|
|
59
|
-
* The component used to display paragraphs.
|
|
60
|
-
*/
|
|
61
|
-
Paragraph: ComponentType<CommentBodyParagraphComponentProps>;
|
|
62
|
-
/**
|
|
63
|
-
* The component used to display text elements.
|
|
64
|
-
*/
|
|
65
|
-
Text: ComponentType<CommentBodyTextComponentProps>;
|
|
66
|
-
/**
|
|
67
|
-
* The component used to display links.
|
|
68
|
-
*/
|
|
69
|
-
Link: ComponentType<CommentBodyLinkComponentProps>;
|
|
70
|
-
/**
|
|
71
|
-
* The component used to display mentions.
|
|
72
|
-
*/
|
|
73
|
-
Mention: ComponentType<CommentBodyMentionComponentProps<U>>;
|
|
74
|
-
};
|
|
75
|
-
type ConvertCommentBodyAsHtmlStyles = {
|
|
76
|
-
/**
|
|
77
|
-
* The default inline CSS styles used to display paragraphs.
|
|
78
|
-
*/
|
|
79
|
-
paragraph: CSSProperties;
|
|
80
|
-
/**
|
|
81
|
-
* The default inline CSS styles used to display text `<strong />` elements.
|
|
82
|
-
*/
|
|
83
|
-
strong: CSSProperties;
|
|
84
|
-
/**
|
|
85
|
-
* The default inline CSS styles used to display text `<code />` elements.
|
|
86
|
-
*/
|
|
87
|
-
code: CSSProperties;
|
|
88
|
-
/**
|
|
89
|
-
* The default inline CSS styles used to display links.
|
|
90
|
-
*/
|
|
91
|
-
mention: CSSProperties;
|
|
92
|
-
/**
|
|
93
|
-
* The default inline CSS styles used to display mentions.
|
|
94
|
-
*/
|
|
95
|
-
link: CSSProperties;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
7
|
type ResolveRoomInfoArgs = {
|
|
99
8
|
/**
|
|
100
9
|
* The ID of the room to resolve
|
|
@@ -102,6 +11,13 @@ type ResolveRoomInfoArgs = {
|
|
|
102
11
|
roomId: string;
|
|
103
12
|
};
|
|
104
13
|
|
|
14
|
+
/**
|
|
15
|
+
* CSS properties object.
|
|
16
|
+
* Type alias for DX purposes.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
type CSSProperties = Properties;
|
|
20
|
+
|
|
105
21
|
/**
|
|
106
22
|
* Liveblocks Text Editor
|
|
107
23
|
*
|
|
@@ -293,52 +209,76 @@ type TextMentionNotificationEmailDataAsHtml = TextMentionNotificationEmailData<B
|
|
|
293
209
|
*/
|
|
294
210
|
declare function prepareTextMentionNotificationEmailAsHtml(client: Liveblocks, event: TextMentionNotificationEvent, options?: PrepareTextMentionNotificationEmailAsHtmlOptions<BaseUserMeta>): Promise<TextMentionNotificationEmailDataAsHtml | null>;
|
|
295
211
|
|
|
296
|
-
type
|
|
212
|
+
type CommentEmailData<BodyType, U extends BaseUserMeta = DU> = {
|
|
297
213
|
id: string;
|
|
298
214
|
threadId: string;
|
|
299
215
|
roomId: string;
|
|
300
|
-
userId: string;
|
|
301
216
|
createdAt: Date;
|
|
302
217
|
url?: string;
|
|
303
|
-
rawBody: CommentBody;
|
|
304
|
-
};
|
|
305
|
-
type PrepareThreadNotificationEmailBaseDataOptions = {
|
|
306
|
-
/**
|
|
307
|
-
* A function that returns room info from room IDs.
|
|
308
|
-
*/
|
|
309
|
-
resolveRoomInfo?: (args: ResolveRoomInfoArgs) => Awaitable<DRI | undefined>;
|
|
310
|
-
};
|
|
311
|
-
type CommentEmailAsHtmlData<U extends BaseUserMeta = DU> = Omit<CommentEmailBaseData, "userId" | "rawBody"> & {
|
|
312
218
|
author: U;
|
|
313
|
-
|
|
219
|
+
body: BodyType;
|
|
314
220
|
};
|
|
315
|
-
type
|
|
316
|
-
author: U;
|
|
317
|
-
reactBody: ReactNode;
|
|
318
|
-
};
|
|
319
|
-
type ThreadNotificationEmailUnreadRepliesData<U extends BaseUserMeta, C extends CommentEmailAsHtmlData<U> | CommentEmailAsReactData<U>> = {
|
|
221
|
+
type ThreadNotificationEmailData<BodyType, U extends BaseUserMeta = DU, C extends CommentEmailData<BodyType, U> = CommentEmailData<BodyType, U>> = ({
|
|
320
222
|
type: "unreadReplies";
|
|
321
223
|
comments: C[];
|
|
322
|
-
}
|
|
323
|
-
type ThreadNotificationEmailUnreadMentionsData<U extends BaseUserMeta, C extends CommentEmailAsHtmlData<U> | CommentEmailAsReactData<U>> = {
|
|
224
|
+
} | {
|
|
324
225
|
type: "unreadMention";
|
|
325
226
|
comment: C;
|
|
326
|
-
}
|
|
327
|
-
type ThreadNotificationEmailData<U extends BaseUserMeta, C extends CommentEmailAsHtmlData<U> | CommentEmailAsReactData<U>> = (ThreadNotificationEmailUnreadRepliesData<U, C> | ThreadNotificationEmailUnreadMentionsData<U, C>) & {
|
|
227
|
+
}) & {
|
|
328
228
|
roomInfo: DRI;
|
|
329
229
|
};
|
|
330
|
-
type
|
|
230
|
+
type CommentEmailAsHtmlData<U extends BaseUserMeta = DU> = CommentEmailData<string, U> & {
|
|
231
|
+
/** @deprecated Use `body` property instead. */
|
|
232
|
+
htmlBody: string;
|
|
233
|
+
};
|
|
234
|
+
type CommentEmailAsReactData<U extends BaseUserMeta = DU> = CommentEmailData<ReactNode, U> & {
|
|
235
|
+
/** @deprecated Use `body` property instead. */
|
|
236
|
+
reactBody: ReactNode;
|
|
237
|
+
};
|
|
238
|
+
type PrepareThreadNotificationEmailOptions<U extends BaseUserMeta = DU> = {
|
|
239
|
+
/**
|
|
240
|
+
* A function that returns room info from room IDs.
|
|
241
|
+
*/
|
|
242
|
+
resolveRoomInfo?: (args: ResolveRoomInfoArgs) => Awaitable<DRI | undefined>;
|
|
331
243
|
/**
|
|
332
244
|
* A function that returns info from user IDs.
|
|
333
245
|
*/
|
|
334
246
|
resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>;
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* The styles used to customize the html elements in the resulting html safe string.
|
|
250
|
+
* Each styles has priority over the base styles inherited.
|
|
251
|
+
*/
|
|
252
|
+
type ConvertCommentBodyAsHtmlStyles = {
|
|
253
|
+
/**
|
|
254
|
+
* The default inline CSS styles used to display paragraphs.
|
|
255
|
+
*/
|
|
256
|
+
paragraph: CSSProperties;
|
|
257
|
+
/**
|
|
258
|
+
* The default inline CSS styles used to display text `<strong />` elements.
|
|
259
|
+
*/
|
|
260
|
+
strong: CSSProperties;
|
|
261
|
+
/**
|
|
262
|
+
* The default inline CSS styles used to display text `<code />` elements.
|
|
263
|
+
*/
|
|
264
|
+
code: CSSProperties;
|
|
265
|
+
/**
|
|
266
|
+
* The default inline CSS styles used to display links.
|
|
267
|
+
*/
|
|
268
|
+
mention: CSSProperties;
|
|
269
|
+
/**
|
|
270
|
+
* The default inline CSS styles used to display mentions.
|
|
271
|
+
*/
|
|
272
|
+
link: CSSProperties;
|
|
273
|
+
};
|
|
274
|
+
type PrepareThreadNotificationEmailAsHtmlOptions<U extends BaseUserMeta = DU> = PrepareThreadNotificationEmailOptions<U> & {
|
|
335
275
|
/**
|
|
336
276
|
* The styles used to customize the html elements in the resulting html safe string inside a comment body.
|
|
337
277
|
* Each styles has priority over the base styles inherited.
|
|
338
278
|
*/
|
|
339
279
|
styles?: Partial<ConvertCommentBodyAsHtmlStyles>;
|
|
340
280
|
};
|
|
341
|
-
type ThreadNotificationEmailDataAsHtml = ThreadNotificationEmailData<
|
|
281
|
+
type ThreadNotificationEmailDataAsHtml<U extends BaseUserMeta = DU> = ThreadNotificationEmailData<string, U, CommentEmailAsHtmlData<U>>;
|
|
342
282
|
/**
|
|
343
283
|
* Prepares data from a `ThreadNotificationEvent` and convert comment bodies as an html safe string.
|
|
344
284
|
*
|
|
@@ -366,18 +306,75 @@ type ThreadNotificationEmailDataAsHtml = ThreadNotificationEmailData<BaseUserMet
|
|
|
366
306
|
*
|
|
367
307
|
*/
|
|
368
308
|
declare function prepareThreadNotificationEmailAsHtml(client: Liveblocks, event: ThreadNotificationEvent, options?: PrepareThreadNotificationEmailAsHtmlOptions<BaseUserMeta>): Promise<ThreadNotificationEmailDataAsHtml | null>;
|
|
369
|
-
type
|
|
309
|
+
type CommentBodyContainerComponentProps = {
|
|
370
310
|
/**
|
|
371
|
-
*
|
|
311
|
+
* The blocks of the comment body
|
|
372
312
|
*/
|
|
373
|
-
|
|
313
|
+
children: ReactNode;
|
|
314
|
+
};
|
|
315
|
+
type CommentBodyParagraphComponentProps = {
|
|
316
|
+
/**
|
|
317
|
+
* The text content of the paragraph.
|
|
318
|
+
*/
|
|
319
|
+
children: ReactNode;
|
|
320
|
+
};
|
|
321
|
+
type CommentBodyTextComponentProps = {
|
|
322
|
+
/**
|
|
323
|
+
* The text element.
|
|
324
|
+
*/
|
|
325
|
+
element: CommentBodyText;
|
|
326
|
+
};
|
|
327
|
+
type CommentBodyLinkComponentProps = {
|
|
328
|
+
/**
|
|
329
|
+
* The link element.
|
|
330
|
+
*/
|
|
331
|
+
element: CommentBodyLink;
|
|
332
|
+
/**
|
|
333
|
+
* The absolute URL of the link.
|
|
334
|
+
*/
|
|
335
|
+
href: string;
|
|
336
|
+
};
|
|
337
|
+
type CommentBodyMentionComponentProps<U extends BaseUserMeta = DU> = {
|
|
338
|
+
/**
|
|
339
|
+
* The mention element.
|
|
340
|
+
*/
|
|
341
|
+
element: CommentBodyMention;
|
|
342
|
+
/**
|
|
343
|
+
* The mention's user info, if the `resolvedUsers` option was provided.
|
|
344
|
+
*/
|
|
345
|
+
user?: U["info"];
|
|
346
|
+
};
|
|
347
|
+
type ConvertCommentBodyAsReactComponents<U extends BaseUserMeta = DU> = {
|
|
348
|
+
/**
|
|
349
|
+
*
|
|
350
|
+
* The component used to act as a container to wrap comment body blocks,
|
|
351
|
+
*/
|
|
352
|
+
Container: ComponentType<CommentBodyContainerComponentProps>;
|
|
353
|
+
/**
|
|
354
|
+
* The component used to display paragraphs.
|
|
355
|
+
*/
|
|
356
|
+
Paragraph: ComponentType<CommentBodyParagraphComponentProps>;
|
|
357
|
+
/**
|
|
358
|
+
* The component used to display text elements.
|
|
359
|
+
*/
|
|
360
|
+
Text: ComponentType<CommentBodyTextComponentProps>;
|
|
361
|
+
/**
|
|
362
|
+
* The component used to display links.
|
|
363
|
+
*/
|
|
364
|
+
Link: ComponentType<CommentBodyLinkComponentProps>;
|
|
365
|
+
/**
|
|
366
|
+
* The component used to display mentions.
|
|
367
|
+
*/
|
|
368
|
+
Mention: ComponentType<CommentBodyMentionComponentProps<U>>;
|
|
369
|
+
};
|
|
370
|
+
type PrepareThreadNotificationEmailAsReactOptions<U extends BaseUserMeta = DU> = PrepareThreadNotificationEmailOptions<U> & {
|
|
374
371
|
/**
|
|
375
372
|
* The components used to customize the resulting React nodes inside a comment body.
|
|
376
373
|
* Each components has priority over the base components inherited internally defined.
|
|
377
374
|
*/
|
|
378
375
|
components?: Partial<ConvertCommentBodyAsReactComponents<U>>;
|
|
379
376
|
};
|
|
380
|
-
type ThreadNotificationEmailDataAsReact = ThreadNotificationEmailData<
|
|
377
|
+
type ThreadNotificationEmailDataAsReact<U extends BaseUserMeta = DU> = ThreadNotificationEmailData<ReactNode, U, CommentEmailAsReactData<U>>;
|
|
381
378
|
/**
|
|
382
379
|
* Prepares data from a `ThreadNotificationEvent` and convert comment bodies as React nodes.
|
|
383
380
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,100 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseUserMeta, DU, ResolveUsersArgs, Awaitable, DRI, 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';
|
|
5
5
|
import { Liveblocks, TextMentionNotificationEvent, ThreadNotificationEvent } from '@liveblocks/node';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* CSS properties object.
|
|
9
|
-
* Type alias for DX purposes.
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
type CSSProperties = Properties;
|
|
13
|
-
|
|
14
|
-
type CommentBodyContainerComponentProps = {
|
|
15
|
-
/**
|
|
16
|
-
* The blocks of the comment body
|
|
17
|
-
*/
|
|
18
|
-
children: ReactNode;
|
|
19
|
-
};
|
|
20
|
-
type CommentBodyParagraphComponentProps = {
|
|
21
|
-
/**
|
|
22
|
-
* The text content of the paragraph.
|
|
23
|
-
*/
|
|
24
|
-
children: ReactNode;
|
|
25
|
-
};
|
|
26
|
-
type CommentBodyTextComponentProps = {
|
|
27
|
-
/**
|
|
28
|
-
* The text element.
|
|
29
|
-
*/
|
|
30
|
-
element: CommentBodyText;
|
|
31
|
-
};
|
|
32
|
-
type CommentBodyLinkComponentProps = {
|
|
33
|
-
/**
|
|
34
|
-
* The link element.
|
|
35
|
-
*/
|
|
36
|
-
element: CommentBodyLink;
|
|
37
|
-
/**
|
|
38
|
-
* The absolute URL of the link.
|
|
39
|
-
*/
|
|
40
|
-
href: string;
|
|
41
|
-
};
|
|
42
|
-
type CommentBodyMentionComponentProps<U extends BaseUserMeta = DU> = {
|
|
43
|
-
/**
|
|
44
|
-
* The mention element.
|
|
45
|
-
*/
|
|
46
|
-
element: CommentBodyMention;
|
|
47
|
-
/**
|
|
48
|
-
* The mention's user info, if the `resolvedUsers` option was provided.
|
|
49
|
-
*/
|
|
50
|
-
user?: U["info"];
|
|
51
|
-
};
|
|
52
|
-
type ConvertCommentBodyAsReactComponents<U extends BaseUserMeta = DU> = {
|
|
53
|
-
/**
|
|
54
|
-
*
|
|
55
|
-
* The component used to act as a container to wrap comment body blocks,
|
|
56
|
-
*/
|
|
57
|
-
Container: ComponentType<CommentBodyContainerComponentProps>;
|
|
58
|
-
/**
|
|
59
|
-
* The component used to display paragraphs.
|
|
60
|
-
*/
|
|
61
|
-
Paragraph: ComponentType<CommentBodyParagraphComponentProps>;
|
|
62
|
-
/**
|
|
63
|
-
* The component used to display text elements.
|
|
64
|
-
*/
|
|
65
|
-
Text: ComponentType<CommentBodyTextComponentProps>;
|
|
66
|
-
/**
|
|
67
|
-
* The component used to display links.
|
|
68
|
-
*/
|
|
69
|
-
Link: ComponentType<CommentBodyLinkComponentProps>;
|
|
70
|
-
/**
|
|
71
|
-
* The component used to display mentions.
|
|
72
|
-
*/
|
|
73
|
-
Mention: ComponentType<CommentBodyMentionComponentProps<U>>;
|
|
74
|
-
};
|
|
75
|
-
type ConvertCommentBodyAsHtmlStyles = {
|
|
76
|
-
/**
|
|
77
|
-
* The default inline CSS styles used to display paragraphs.
|
|
78
|
-
*/
|
|
79
|
-
paragraph: CSSProperties;
|
|
80
|
-
/**
|
|
81
|
-
* The default inline CSS styles used to display text `<strong />` elements.
|
|
82
|
-
*/
|
|
83
|
-
strong: CSSProperties;
|
|
84
|
-
/**
|
|
85
|
-
* The default inline CSS styles used to display text `<code />` elements.
|
|
86
|
-
*/
|
|
87
|
-
code: CSSProperties;
|
|
88
|
-
/**
|
|
89
|
-
* The default inline CSS styles used to display links.
|
|
90
|
-
*/
|
|
91
|
-
mention: CSSProperties;
|
|
92
|
-
/**
|
|
93
|
-
* The default inline CSS styles used to display mentions.
|
|
94
|
-
*/
|
|
95
|
-
link: CSSProperties;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
7
|
type ResolveRoomInfoArgs = {
|
|
99
8
|
/**
|
|
100
9
|
* The ID of the room to resolve
|
|
@@ -102,6 +11,13 @@ type ResolveRoomInfoArgs = {
|
|
|
102
11
|
roomId: string;
|
|
103
12
|
};
|
|
104
13
|
|
|
14
|
+
/**
|
|
15
|
+
* CSS properties object.
|
|
16
|
+
* Type alias for DX purposes.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
type CSSProperties = Properties;
|
|
20
|
+
|
|
105
21
|
/**
|
|
106
22
|
* Liveblocks Text Editor
|
|
107
23
|
*
|
|
@@ -293,52 +209,76 @@ type TextMentionNotificationEmailDataAsHtml = TextMentionNotificationEmailData<B
|
|
|
293
209
|
*/
|
|
294
210
|
declare function prepareTextMentionNotificationEmailAsHtml(client: Liveblocks, event: TextMentionNotificationEvent, options?: PrepareTextMentionNotificationEmailAsHtmlOptions<BaseUserMeta>): Promise<TextMentionNotificationEmailDataAsHtml | null>;
|
|
295
211
|
|
|
296
|
-
type
|
|
212
|
+
type CommentEmailData<BodyType, U extends BaseUserMeta = DU> = {
|
|
297
213
|
id: string;
|
|
298
214
|
threadId: string;
|
|
299
215
|
roomId: string;
|
|
300
|
-
userId: string;
|
|
301
216
|
createdAt: Date;
|
|
302
217
|
url?: string;
|
|
303
|
-
rawBody: CommentBody;
|
|
304
|
-
};
|
|
305
|
-
type PrepareThreadNotificationEmailBaseDataOptions = {
|
|
306
|
-
/**
|
|
307
|
-
* A function that returns room info from room IDs.
|
|
308
|
-
*/
|
|
309
|
-
resolveRoomInfo?: (args: ResolveRoomInfoArgs) => Awaitable<DRI | undefined>;
|
|
310
|
-
};
|
|
311
|
-
type CommentEmailAsHtmlData<U extends BaseUserMeta = DU> = Omit<CommentEmailBaseData, "userId" | "rawBody"> & {
|
|
312
218
|
author: U;
|
|
313
|
-
|
|
219
|
+
body: BodyType;
|
|
314
220
|
};
|
|
315
|
-
type
|
|
316
|
-
author: U;
|
|
317
|
-
reactBody: ReactNode;
|
|
318
|
-
};
|
|
319
|
-
type ThreadNotificationEmailUnreadRepliesData<U extends BaseUserMeta, C extends CommentEmailAsHtmlData<U> | CommentEmailAsReactData<U>> = {
|
|
221
|
+
type ThreadNotificationEmailData<BodyType, U extends BaseUserMeta = DU, C extends CommentEmailData<BodyType, U> = CommentEmailData<BodyType, U>> = ({
|
|
320
222
|
type: "unreadReplies";
|
|
321
223
|
comments: C[];
|
|
322
|
-
}
|
|
323
|
-
type ThreadNotificationEmailUnreadMentionsData<U extends BaseUserMeta, C extends CommentEmailAsHtmlData<U> | CommentEmailAsReactData<U>> = {
|
|
224
|
+
} | {
|
|
324
225
|
type: "unreadMention";
|
|
325
226
|
comment: C;
|
|
326
|
-
}
|
|
327
|
-
type ThreadNotificationEmailData<U extends BaseUserMeta, C extends CommentEmailAsHtmlData<U> | CommentEmailAsReactData<U>> = (ThreadNotificationEmailUnreadRepliesData<U, C> | ThreadNotificationEmailUnreadMentionsData<U, C>) & {
|
|
227
|
+
}) & {
|
|
328
228
|
roomInfo: DRI;
|
|
329
229
|
};
|
|
330
|
-
type
|
|
230
|
+
type CommentEmailAsHtmlData<U extends BaseUserMeta = DU> = CommentEmailData<string, U> & {
|
|
231
|
+
/** @deprecated Use `body` property instead. */
|
|
232
|
+
htmlBody: string;
|
|
233
|
+
};
|
|
234
|
+
type CommentEmailAsReactData<U extends BaseUserMeta = DU> = CommentEmailData<ReactNode, U> & {
|
|
235
|
+
/** @deprecated Use `body` property instead. */
|
|
236
|
+
reactBody: ReactNode;
|
|
237
|
+
};
|
|
238
|
+
type PrepareThreadNotificationEmailOptions<U extends BaseUserMeta = DU> = {
|
|
239
|
+
/**
|
|
240
|
+
* A function that returns room info from room IDs.
|
|
241
|
+
*/
|
|
242
|
+
resolveRoomInfo?: (args: ResolveRoomInfoArgs) => Awaitable<DRI | undefined>;
|
|
331
243
|
/**
|
|
332
244
|
* A function that returns info from user IDs.
|
|
333
245
|
*/
|
|
334
246
|
resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>;
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* The styles used to customize the html elements in the resulting html safe string.
|
|
250
|
+
* Each styles has priority over the base styles inherited.
|
|
251
|
+
*/
|
|
252
|
+
type ConvertCommentBodyAsHtmlStyles = {
|
|
253
|
+
/**
|
|
254
|
+
* The default inline CSS styles used to display paragraphs.
|
|
255
|
+
*/
|
|
256
|
+
paragraph: CSSProperties;
|
|
257
|
+
/**
|
|
258
|
+
* The default inline CSS styles used to display text `<strong />` elements.
|
|
259
|
+
*/
|
|
260
|
+
strong: CSSProperties;
|
|
261
|
+
/**
|
|
262
|
+
* The default inline CSS styles used to display text `<code />` elements.
|
|
263
|
+
*/
|
|
264
|
+
code: CSSProperties;
|
|
265
|
+
/**
|
|
266
|
+
* The default inline CSS styles used to display links.
|
|
267
|
+
*/
|
|
268
|
+
mention: CSSProperties;
|
|
269
|
+
/**
|
|
270
|
+
* The default inline CSS styles used to display mentions.
|
|
271
|
+
*/
|
|
272
|
+
link: CSSProperties;
|
|
273
|
+
};
|
|
274
|
+
type PrepareThreadNotificationEmailAsHtmlOptions<U extends BaseUserMeta = DU> = PrepareThreadNotificationEmailOptions<U> & {
|
|
335
275
|
/**
|
|
336
276
|
* The styles used to customize the html elements in the resulting html safe string inside a comment body.
|
|
337
277
|
* Each styles has priority over the base styles inherited.
|
|
338
278
|
*/
|
|
339
279
|
styles?: Partial<ConvertCommentBodyAsHtmlStyles>;
|
|
340
280
|
};
|
|
341
|
-
type ThreadNotificationEmailDataAsHtml = ThreadNotificationEmailData<
|
|
281
|
+
type ThreadNotificationEmailDataAsHtml<U extends BaseUserMeta = DU> = ThreadNotificationEmailData<string, U, CommentEmailAsHtmlData<U>>;
|
|
342
282
|
/**
|
|
343
283
|
* Prepares data from a `ThreadNotificationEvent` and convert comment bodies as an html safe string.
|
|
344
284
|
*
|
|
@@ -366,18 +306,75 @@ type ThreadNotificationEmailDataAsHtml = ThreadNotificationEmailData<BaseUserMet
|
|
|
366
306
|
*
|
|
367
307
|
*/
|
|
368
308
|
declare function prepareThreadNotificationEmailAsHtml(client: Liveblocks, event: ThreadNotificationEvent, options?: PrepareThreadNotificationEmailAsHtmlOptions<BaseUserMeta>): Promise<ThreadNotificationEmailDataAsHtml | null>;
|
|
369
|
-
type
|
|
309
|
+
type CommentBodyContainerComponentProps = {
|
|
370
310
|
/**
|
|
371
|
-
*
|
|
311
|
+
* The blocks of the comment body
|
|
372
312
|
*/
|
|
373
|
-
|
|
313
|
+
children: ReactNode;
|
|
314
|
+
};
|
|
315
|
+
type CommentBodyParagraphComponentProps = {
|
|
316
|
+
/**
|
|
317
|
+
* The text content of the paragraph.
|
|
318
|
+
*/
|
|
319
|
+
children: ReactNode;
|
|
320
|
+
};
|
|
321
|
+
type CommentBodyTextComponentProps = {
|
|
322
|
+
/**
|
|
323
|
+
* The text element.
|
|
324
|
+
*/
|
|
325
|
+
element: CommentBodyText;
|
|
326
|
+
};
|
|
327
|
+
type CommentBodyLinkComponentProps = {
|
|
328
|
+
/**
|
|
329
|
+
* The link element.
|
|
330
|
+
*/
|
|
331
|
+
element: CommentBodyLink;
|
|
332
|
+
/**
|
|
333
|
+
* The absolute URL of the link.
|
|
334
|
+
*/
|
|
335
|
+
href: string;
|
|
336
|
+
};
|
|
337
|
+
type CommentBodyMentionComponentProps<U extends BaseUserMeta = DU> = {
|
|
338
|
+
/**
|
|
339
|
+
* The mention element.
|
|
340
|
+
*/
|
|
341
|
+
element: CommentBodyMention;
|
|
342
|
+
/**
|
|
343
|
+
* The mention's user info, if the `resolvedUsers` option was provided.
|
|
344
|
+
*/
|
|
345
|
+
user?: U["info"];
|
|
346
|
+
};
|
|
347
|
+
type ConvertCommentBodyAsReactComponents<U extends BaseUserMeta = DU> = {
|
|
348
|
+
/**
|
|
349
|
+
*
|
|
350
|
+
* The component used to act as a container to wrap comment body blocks,
|
|
351
|
+
*/
|
|
352
|
+
Container: ComponentType<CommentBodyContainerComponentProps>;
|
|
353
|
+
/**
|
|
354
|
+
* The component used to display paragraphs.
|
|
355
|
+
*/
|
|
356
|
+
Paragraph: ComponentType<CommentBodyParagraphComponentProps>;
|
|
357
|
+
/**
|
|
358
|
+
* The component used to display text elements.
|
|
359
|
+
*/
|
|
360
|
+
Text: ComponentType<CommentBodyTextComponentProps>;
|
|
361
|
+
/**
|
|
362
|
+
* The component used to display links.
|
|
363
|
+
*/
|
|
364
|
+
Link: ComponentType<CommentBodyLinkComponentProps>;
|
|
365
|
+
/**
|
|
366
|
+
* The component used to display mentions.
|
|
367
|
+
*/
|
|
368
|
+
Mention: ComponentType<CommentBodyMentionComponentProps<U>>;
|
|
369
|
+
};
|
|
370
|
+
type PrepareThreadNotificationEmailAsReactOptions<U extends BaseUserMeta = DU> = PrepareThreadNotificationEmailOptions<U> & {
|
|
374
371
|
/**
|
|
375
372
|
* The components used to customize the resulting React nodes inside a comment body.
|
|
376
373
|
* Each components has priority over the base components inherited internally defined.
|
|
377
374
|
*/
|
|
378
375
|
components?: Partial<ConvertCommentBodyAsReactComponents<U>>;
|
|
379
376
|
};
|
|
380
|
-
type ThreadNotificationEmailDataAsReact = ThreadNotificationEmailData<
|
|
377
|
+
type ThreadNotificationEmailDataAsReact<U extends BaseUserMeta = DU> = ThreadNotificationEmailData<ReactNode, U, CommentEmailAsReactData<U>>;
|
|
381
378
|
/**
|
|
382
379
|
* Prepares data from a `ThreadNotificationEvent` and convert comment bodies as React nodes.
|
|
383
380
|
*
|