@liveblocks/emails 2.19.0 → 2.21.0-emails1
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 +198 -259
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +111 -120
- package/dist/index.d.ts +111 -120
- package/dist/index.js +199 -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,66 @@ 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
|
+
/**
|
|
239
|
+
* The styles used to customize the html elements in the resulting html safe string.
|
|
240
|
+
* Each styles has priority over the base styles inherited.
|
|
241
|
+
*/
|
|
242
|
+
type ConvertCommentBodyAsHtmlStyles = {
|
|
331
243
|
/**
|
|
332
|
-
*
|
|
244
|
+
* The default inline CSS styles used to display paragraphs.
|
|
333
245
|
*/
|
|
334
|
-
|
|
246
|
+
paragraph: CSSProperties;
|
|
247
|
+
/**
|
|
248
|
+
* The default inline CSS styles used to display text `<strong />` elements.
|
|
249
|
+
*/
|
|
250
|
+
strong: CSSProperties;
|
|
251
|
+
/**
|
|
252
|
+
* The default inline CSS styles used to display text `<code />` elements.
|
|
253
|
+
*/
|
|
254
|
+
code: CSSProperties;
|
|
255
|
+
/**
|
|
256
|
+
* The default inline CSS styles used to display links.
|
|
257
|
+
*/
|
|
258
|
+
mention: CSSProperties;
|
|
259
|
+
/**
|
|
260
|
+
* The default inline CSS styles used to display mentions.
|
|
261
|
+
*/
|
|
262
|
+
link: CSSProperties;
|
|
263
|
+
};
|
|
264
|
+
type PrepareThreadNotificationEmailAsHtmlOptions<BodyType, U extends BaseUserMeta = DU> = Omit<PrepareThreadNotificationEmailOptions<BodyType, U>, "elements"> & {
|
|
335
265
|
/**
|
|
336
266
|
* The styles used to customize the html elements in the resulting html safe string inside a comment body.
|
|
337
267
|
* Each styles has priority over the base styles inherited.
|
|
338
268
|
*/
|
|
339
269
|
styles?: Partial<ConvertCommentBodyAsHtmlStyles>;
|
|
340
270
|
};
|
|
341
|
-
type ThreadNotificationEmailDataAsHtml = ThreadNotificationEmailData<
|
|
271
|
+
type ThreadNotificationEmailDataAsHtml<U extends BaseUserMeta = DU> = ThreadNotificationEmailData<string, U, CommentEmailAsHtmlData<U>>;
|
|
342
272
|
/**
|
|
343
273
|
* Prepares data from a `ThreadNotificationEvent` and convert comment bodies as an html safe string.
|
|
344
274
|
*
|
|
@@ -365,8 +295,69 @@ type ThreadNotificationEmailDataAsHtml = ThreadNotificationEmailData<BaseUserMet
|
|
|
365
295
|
* )
|
|
366
296
|
*
|
|
367
297
|
*/
|
|
368
|
-
declare function prepareThreadNotificationEmailAsHtml(client: Liveblocks, event: ThreadNotificationEvent, options?: PrepareThreadNotificationEmailAsHtmlOptions<BaseUserMeta>): Promise<ThreadNotificationEmailDataAsHtml | null>;
|
|
369
|
-
type
|
|
298
|
+
declare function prepareThreadNotificationEmailAsHtml(client: Liveblocks, event: ThreadNotificationEvent, options?: PrepareThreadNotificationEmailAsHtmlOptions<string, BaseUserMeta>): Promise<ThreadNotificationEmailDataAsHtml | null>;
|
|
299
|
+
type CommentBodyContainerComponentProps = {
|
|
300
|
+
/**
|
|
301
|
+
* The blocks of the comment body
|
|
302
|
+
*/
|
|
303
|
+
children: ReactNode;
|
|
304
|
+
};
|
|
305
|
+
type CommentBodyParagraphComponentProps = {
|
|
306
|
+
/**
|
|
307
|
+
* The text content of the paragraph.
|
|
308
|
+
*/
|
|
309
|
+
children: ReactNode;
|
|
310
|
+
};
|
|
311
|
+
type CommentBodyTextComponentProps = {
|
|
312
|
+
/**
|
|
313
|
+
* The text element.
|
|
314
|
+
*/
|
|
315
|
+
element: CommentBodyText;
|
|
316
|
+
};
|
|
317
|
+
type CommentBodyLinkComponentProps = {
|
|
318
|
+
/**
|
|
319
|
+
* The link element.
|
|
320
|
+
*/
|
|
321
|
+
element: CommentBodyLink;
|
|
322
|
+
/**
|
|
323
|
+
* The absolute URL of the link.
|
|
324
|
+
*/
|
|
325
|
+
href: string;
|
|
326
|
+
};
|
|
327
|
+
type CommentBodyMentionComponentProps<U extends BaseUserMeta = DU> = {
|
|
328
|
+
/**
|
|
329
|
+
* The mention element.
|
|
330
|
+
*/
|
|
331
|
+
element: CommentBodyMention;
|
|
332
|
+
/**
|
|
333
|
+
* The mention's user info, if the `resolvedUsers` option was provided.
|
|
334
|
+
*/
|
|
335
|
+
user?: U["info"];
|
|
336
|
+
};
|
|
337
|
+
type ConvertCommentBodyAsReactComponents<U extends BaseUserMeta = DU> = {
|
|
338
|
+
/**
|
|
339
|
+
*
|
|
340
|
+
* The component used to act as a container to wrap comment body blocks,
|
|
341
|
+
*/
|
|
342
|
+
Container: ComponentType<CommentBodyContainerComponentProps>;
|
|
343
|
+
/**
|
|
344
|
+
* The component used to display paragraphs.
|
|
345
|
+
*/
|
|
346
|
+
Paragraph: ComponentType<CommentBodyParagraphComponentProps>;
|
|
347
|
+
/**
|
|
348
|
+
* The component used to display text elements.
|
|
349
|
+
*/
|
|
350
|
+
Text: ComponentType<CommentBodyTextComponentProps>;
|
|
351
|
+
/**
|
|
352
|
+
* The component used to display links.
|
|
353
|
+
*/
|
|
354
|
+
Link: ComponentType<CommentBodyLinkComponentProps>;
|
|
355
|
+
/**
|
|
356
|
+
* The component used to display mentions.
|
|
357
|
+
*/
|
|
358
|
+
Mention: ComponentType<CommentBodyMentionComponentProps<U>>;
|
|
359
|
+
};
|
|
360
|
+
type PrepareThreadNotificationEmailAsReactOptions<BodyType, U extends BaseUserMeta = DU> = Omit<PrepareThreadNotificationEmailOptions<BodyType, U>, "elements"> & {
|
|
370
361
|
/**
|
|
371
362
|
* A function that returns info from user IDs.
|
|
372
363
|
*/
|
|
@@ -377,7 +368,7 @@ type PrepareThreadNotificationEmailAsReactOptions<U extends BaseUserMeta = DU> =
|
|
|
377
368
|
*/
|
|
378
369
|
components?: Partial<ConvertCommentBodyAsReactComponents<U>>;
|
|
379
370
|
};
|
|
380
|
-
type ThreadNotificationEmailDataAsReact = ThreadNotificationEmailData<
|
|
371
|
+
type ThreadNotificationEmailDataAsReact<U extends BaseUserMeta = DU> = ThreadNotificationEmailData<ReactNode, U, CommentEmailAsReactData<U>>;
|
|
381
372
|
/**
|
|
382
373
|
* Prepares data from a `ThreadNotificationEvent` and convert comment bodies as React nodes.
|
|
383
374
|
*
|
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,66 @@ 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
|
+
/**
|
|
239
|
+
* The styles used to customize the html elements in the resulting html safe string.
|
|
240
|
+
* Each styles has priority over the base styles inherited.
|
|
241
|
+
*/
|
|
242
|
+
type ConvertCommentBodyAsHtmlStyles = {
|
|
331
243
|
/**
|
|
332
|
-
*
|
|
244
|
+
* The default inline CSS styles used to display paragraphs.
|
|
333
245
|
*/
|
|
334
|
-
|
|
246
|
+
paragraph: CSSProperties;
|
|
247
|
+
/**
|
|
248
|
+
* The default inline CSS styles used to display text `<strong />` elements.
|
|
249
|
+
*/
|
|
250
|
+
strong: CSSProperties;
|
|
251
|
+
/**
|
|
252
|
+
* The default inline CSS styles used to display text `<code />` elements.
|
|
253
|
+
*/
|
|
254
|
+
code: CSSProperties;
|
|
255
|
+
/**
|
|
256
|
+
* The default inline CSS styles used to display links.
|
|
257
|
+
*/
|
|
258
|
+
mention: CSSProperties;
|
|
259
|
+
/**
|
|
260
|
+
* The default inline CSS styles used to display mentions.
|
|
261
|
+
*/
|
|
262
|
+
link: CSSProperties;
|
|
263
|
+
};
|
|
264
|
+
type PrepareThreadNotificationEmailAsHtmlOptions<BodyType, U extends BaseUserMeta = DU> = Omit<PrepareThreadNotificationEmailOptions<BodyType, U>, "elements"> & {
|
|
335
265
|
/**
|
|
336
266
|
* The styles used to customize the html elements in the resulting html safe string inside a comment body.
|
|
337
267
|
* Each styles has priority over the base styles inherited.
|
|
338
268
|
*/
|
|
339
269
|
styles?: Partial<ConvertCommentBodyAsHtmlStyles>;
|
|
340
270
|
};
|
|
341
|
-
type ThreadNotificationEmailDataAsHtml = ThreadNotificationEmailData<
|
|
271
|
+
type ThreadNotificationEmailDataAsHtml<U extends BaseUserMeta = DU> = ThreadNotificationEmailData<string, U, CommentEmailAsHtmlData<U>>;
|
|
342
272
|
/**
|
|
343
273
|
* Prepares data from a `ThreadNotificationEvent` and convert comment bodies as an html safe string.
|
|
344
274
|
*
|
|
@@ -365,8 +295,69 @@ type ThreadNotificationEmailDataAsHtml = ThreadNotificationEmailData<BaseUserMet
|
|
|
365
295
|
* )
|
|
366
296
|
*
|
|
367
297
|
*/
|
|
368
|
-
declare function prepareThreadNotificationEmailAsHtml(client: Liveblocks, event: ThreadNotificationEvent, options?: PrepareThreadNotificationEmailAsHtmlOptions<BaseUserMeta>): Promise<ThreadNotificationEmailDataAsHtml | null>;
|
|
369
|
-
type
|
|
298
|
+
declare function prepareThreadNotificationEmailAsHtml(client: Liveblocks, event: ThreadNotificationEvent, options?: PrepareThreadNotificationEmailAsHtmlOptions<string, BaseUserMeta>): Promise<ThreadNotificationEmailDataAsHtml | null>;
|
|
299
|
+
type CommentBodyContainerComponentProps = {
|
|
300
|
+
/**
|
|
301
|
+
* The blocks of the comment body
|
|
302
|
+
*/
|
|
303
|
+
children: ReactNode;
|
|
304
|
+
};
|
|
305
|
+
type CommentBodyParagraphComponentProps = {
|
|
306
|
+
/**
|
|
307
|
+
* The text content of the paragraph.
|
|
308
|
+
*/
|
|
309
|
+
children: ReactNode;
|
|
310
|
+
};
|
|
311
|
+
type CommentBodyTextComponentProps = {
|
|
312
|
+
/**
|
|
313
|
+
* The text element.
|
|
314
|
+
*/
|
|
315
|
+
element: CommentBodyText;
|
|
316
|
+
};
|
|
317
|
+
type CommentBodyLinkComponentProps = {
|
|
318
|
+
/**
|
|
319
|
+
* The link element.
|
|
320
|
+
*/
|
|
321
|
+
element: CommentBodyLink;
|
|
322
|
+
/**
|
|
323
|
+
* The absolute URL of the link.
|
|
324
|
+
*/
|
|
325
|
+
href: string;
|
|
326
|
+
};
|
|
327
|
+
type CommentBodyMentionComponentProps<U extends BaseUserMeta = DU> = {
|
|
328
|
+
/**
|
|
329
|
+
* The mention element.
|
|
330
|
+
*/
|
|
331
|
+
element: CommentBodyMention;
|
|
332
|
+
/**
|
|
333
|
+
* The mention's user info, if the `resolvedUsers` option was provided.
|
|
334
|
+
*/
|
|
335
|
+
user?: U["info"];
|
|
336
|
+
};
|
|
337
|
+
type ConvertCommentBodyAsReactComponents<U extends BaseUserMeta = DU> = {
|
|
338
|
+
/**
|
|
339
|
+
*
|
|
340
|
+
* The component used to act as a container to wrap comment body blocks,
|
|
341
|
+
*/
|
|
342
|
+
Container: ComponentType<CommentBodyContainerComponentProps>;
|
|
343
|
+
/**
|
|
344
|
+
* The component used to display paragraphs.
|
|
345
|
+
*/
|
|
346
|
+
Paragraph: ComponentType<CommentBodyParagraphComponentProps>;
|
|
347
|
+
/**
|
|
348
|
+
* The component used to display text elements.
|
|
349
|
+
*/
|
|
350
|
+
Text: ComponentType<CommentBodyTextComponentProps>;
|
|
351
|
+
/**
|
|
352
|
+
* The component used to display links.
|
|
353
|
+
*/
|
|
354
|
+
Link: ComponentType<CommentBodyLinkComponentProps>;
|
|
355
|
+
/**
|
|
356
|
+
* The component used to display mentions.
|
|
357
|
+
*/
|
|
358
|
+
Mention: ComponentType<CommentBodyMentionComponentProps<U>>;
|
|
359
|
+
};
|
|
360
|
+
type PrepareThreadNotificationEmailAsReactOptions<BodyType, U extends BaseUserMeta = DU> = Omit<PrepareThreadNotificationEmailOptions<BodyType, U>, "elements"> & {
|
|
370
361
|
/**
|
|
371
362
|
* A function that returns info from user IDs.
|
|
372
363
|
*/
|
|
@@ -377,7 +368,7 @@ type PrepareThreadNotificationEmailAsReactOptions<U extends BaseUserMeta = DU> =
|
|
|
377
368
|
*/
|
|
378
369
|
components?: Partial<ConvertCommentBodyAsReactComponents<U>>;
|
|
379
370
|
};
|
|
380
|
-
type ThreadNotificationEmailDataAsReact = ThreadNotificationEmailData<
|
|
371
|
+
type ThreadNotificationEmailDataAsReact<U extends BaseUserMeta = DU> = ThreadNotificationEmailData<ReactNode, U, CommentEmailAsReactData<U>>;
|
|
381
372
|
/**
|
|
382
373
|
* Prepares data from a `ThreadNotificationEvent` and convert comment bodies as React nodes.
|
|
383
374
|
*
|