@liveblocks/emails 3.9.2-tiptap3 → 3.9.2
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 +56 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +39 -54
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
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 = "3.9.2
|
|
6
|
+
var PKG_VERSION = "3.9.2";
|
|
7
7
|
var PKG_FORMAT = "cjs";
|
|
8
8
|
|
|
9
9
|
// src/text-mention-notification.tsx
|
|
@@ -1091,12 +1091,9 @@ var iterateDeletedStructs = (transaction, ds, f) => ds.clients.forEach((deletes,
|
|
|
1091
1091
|
/** @type {Array<GC|Item>} */
|
|
1092
1092
|
transaction.doc.store.clients.get(clientid)
|
|
1093
1093
|
);
|
|
1094
|
-
|
|
1095
|
-
const
|
|
1096
|
-
|
|
1097
|
-
for (let i = 0, del = deletes[i]; i < deletes.length && del.clock < clockState; del = deletes[++i]) {
|
|
1098
|
-
iterateStructs(transaction, structs, del.clock, del.len, f);
|
|
1099
|
-
}
|
|
1094
|
+
for (let i = 0; i < deletes.length; i++) {
|
|
1095
|
+
const del = deletes[i];
|
|
1096
|
+
iterateStructs(transaction, structs, del.clock, del.len, f);
|
|
1100
1097
|
}
|
|
1101
1098
|
});
|
|
1102
1099
|
var findIndexDS = (dis, clock) => {
|
|
@@ -2135,13 +2132,13 @@ var integrateStructs = (transaction, store, clientsStructRefs) => {
|
|
|
2135
2132
|
const addStackToRestSS = () => {
|
|
2136
2133
|
for (const item of stack) {
|
|
2137
2134
|
const client = item.id.client;
|
|
2138
|
-
const
|
|
2139
|
-
if (
|
|
2140
|
-
|
|
2141
|
-
restStructs.clients.set(client,
|
|
2135
|
+
const unapplicableItems = clientsStructRefs.get(client);
|
|
2136
|
+
if (unapplicableItems) {
|
|
2137
|
+
unapplicableItems.i--;
|
|
2138
|
+
restStructs.clients.set(client, unapplicableItems.refs.slice(unapplicableItems.i));
|
|
2142
2139
|
clientsStructRefs.delete(client);
|
|
2143
|
-
|
|
2144
|
-
|
|
2140
|
+
unapplicableItems.i = 0;
|
|
2141
|
+
unapplicableItems.refs = [];
|
|
2145
2142
|
} else {
|
|
2146
2143
|
restStructs.clients.set(client, [item]);
|
|
2147
2144
|
}
|
|
@@ -3650,8 +3647,6 @@ var typeMapSet = (transaction, parent, key, value) => {
|
|
|
3650
3647
|
case Boolean:
|
|
3651
3648
|
case Array:
|
|
3652
3649
|
case String:
|
|
3653
|
-
case Date:
|
|
3654
|
-
case BigInt:
|
|
3655
3650
|
content = new ContentAny([value]);
|
|
3656
3651
|
break;
|
|
3657
3652
|
case Uint8Array:
|
|
@@ -4917,7 +4912,7 @@ var YText = class _YText extends AbstractType {
|
|
|
4917
4912
|
/**
|
|
4918
4913
|
* Apply a {@link Delta} on this shared YText type.
|
|
4919
4914
|
*
|
|
4920
|
-
* @param {
|
|
4915
|
+
* @param {any} delta The changes to apply on this element.
|
|
4921
4916
|
* @param {object} opts
|
|
4922
4917
|
* @param {boolean} [opts.sanitize] Sanitize input delta. Removes ending newlines if set to true.
|
|
4923
4918
|
*
|
|
@@ -5264,9 +5259,8 @@ var YXmlTreeWalker = class {
|
|
|
5264
5259
|
n = type._start;
|
|
5265
5260
|
} else {
|
|
5266
5261
|
while (n !== null) {
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
n = nxt;
|
|
5262
|
+
if (n.right !== null) {
|
|
5263
|
+
n = n.right;
|
|
5270
5264
|
break;
|
|
5271
5265
|
} else if (n.parent === this._root) {
|
|
5272
5266
|
n = null;
|
|
@@ -5806,7 +5800,7 @@ var YXmlEvent = class extends YEvent {
|
|
|
5806
5800
|
* @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created.
|
|
5807
5801
|
* @param {Set<string|null>} subs The set of changed attributes. `null` is included if the
|
|
5808
5802
|
* child list changed.
|
|
5809
|
-
* @param {Transaction} transaction The transaction instance with
|
|
5803
|
+
* @param {Transaction} transaction The transaction instance with wich the
|
|
5810
5804
|
* change was created.
|
|
5811
5805
|
*/
|
|
5812
5806
|
constructor(target, subs, transaction) {
|
|
@@ -6016,7 +6010,7 @@ var AbstractStruct = class {
|
|
|
6016
6010
|
* This method is already assuming that `this.id.clock + this.length === this.id.clock`.
|
|
6017
6011
|
* Also this method does *not* remove right from StructStore!
|
|
6018
6012
|
* @param {AbstractStruct} right
|
|
6019
|
-
* @return {boolean}
|
|
6013
|
+
* @return {boolean} wether this merged with right
|
|
6020
6014
|
*/
|
|
6021
6015
|
mergeWith(right) {
|
|
6022
6016
|
return false;
|
|
@@ -7030,7 +7024,8 @@ var Item = class _Item extends AbstractStruct {
|
|
|
7030
7024
|
if (this.left && this.left.constructor === _Item) {
|
|
7031
7025
|
this.parent = this.left.parent;
|
|
7032
7026
|
this.parentSub = this.left.parentSub;
|
|
7033
|
-
}
|
|
7027
|
+
}
|
|
7028
|
+
if (this.right && this.right.constructor === _Item) {
|
|
7034
7029
|
this.parent = this.right.parent;
|
|
7035
7030
|
this.parentSub = this.right.parentSub;
|
|
7036
7031
|
}
|
|
@@ -7810,41 +7805,33 @@ function toInlineCSSString(styles) {
|
|
|
7810
7805
|
// src/tiptap-editor.ts
|
|
7811
7806
|
|
|
7812
7807
|
|
|
7813
|
-
// ../../node_modules/y-prosemirror/src/plugins/sync-plugin.js
|
|
7814
|
-
var hashedMarkNameRegex = /(.*)(--[a-zA-Z0-9+/=]{8})$/;
|
|
7815
|
-
var yattr2markname = (attrName) => _nullishCoalesce(_optionalChain([hashedMarkNameRegex, 'access', _7 => _7.exec, 'call', _8 => _8(attrName), 'optionalAccess', _9 => _9[1]]), () => ( attrName));
|
|
7816
|
-
|
|
7817
7808
|
// ../../node_modules/y-prosemirror/src/lib.js
|
|
7818
7809
|
function yXmlFragmentToProsemirrorJSON(xmlFragment) {
|
|
7819
7810
|
const items = xmlFragment.toArray();
|
|
7820
|
-
|
|
7811
|
+
function serialize(item) {
|
|
7821
7812
|
let response;
|
|
7822
|
-
if (item
|
|
7813
|
+
if (!item.nodeName) {
|
|
7823
7814
|
const delta = item.toDelta();
|
|
7824
|
-
response = delta.map(
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
}
|
|
7841
|
-
return mark;
|
|
7842
|
-
});
|
|
7843
|
-
}
|
|
7844
|
-
return text;
|
|
7815
|
+
response = delta.map((d) => {
|
|
7816
|
+
const text = {
|
|
7817
|
+
type: "text",
|
|
7818
|
+
text: d.insert
|
|
7819
|
+
};
|
|
7820
|
+
if (d.attributes) {
|
|
7821
|
+
text.marks = Object.keys(d.attributes).map((type) => {
|
|
7822
|
+
const attrs = d.attributes[type];
|
|
7823
|
+
const mark = {
|
|
7824
|
+
type
|
|
7825
|
+
};
|
|
7826
|
+
if (Object.keys(attrs)) {
|
|
7827
|
+
mark.attrs = attrs;
|
|
7828
|
+
}
|
|
7829
|
+
return mark;
|
|
7830
|
+
});
|
|
7845
7831
|
}
|
|
7846
|
-
|
|
7847
|
-
|
|
7832
|
+
return text;
|
|
7833
|
+
});
|
|
7834
|
+
} else {
|
|
7848
7835
|
response = {
|
|
7849
7836
|
type: item.nodeName
|
|
7850
7837
|
};
|
|
@@ -7856,11 +7843,9 @@ function yXmlFragmentToProsemirrorJSON(xmlFragment) {
|
|
|
7856
7843
|
if (children.length) {
|
|
7857
7844
|
response.content = children.map(serialize).flat();
|
|
7858
7845
|
}
|
|
7859
|
-
} else {
|
|
7860
|
-
unexpectedCase();
|
|
7861
7846
|
}
|
|
7862
7847
|
return response;
|
|
7863
|
-
}
|
|
7848
|
+
}
|
|
7864
7849
|
return {
|
|
7865
7850
|
type: "doc",
|
|
7866
7851
|
content: items.map(serialize)
|
|
@@ -8167,8 +8152,8 @@ var resolveMentionsInLiveblocksTextEditorNodes = async (nodes, resolveUsers, res
|
|
|
8167
8152
|
async function convertTextMentionContent(nodes, options) {
|
|
8168
8153
|
const { users: resolvedUsers, groups: resolvedGroupsInfo } = await resolveMentionsInLiveblocksTextEditorNodes(
|
|
8169
8154
|
nodes,
|
|
8170
|
-
_optionalChain([options, 'optionalAccess',
|
|
8171
|
-
_optionalChain([options, 'optionalAccess',
|
|
8155
|
+
_optionalChain([options, 'optionalAccess', _7 => _7.resolveUsers]),
|
|
8156
|
+
_optionalChain([options, 'optionalAccess', _8 => _8.resolveGroupsInfo])
|
|
8172
8157
|
);
|
|
8173
8158
|
const blocks = nodes.map((node, index) => {
|
|
8174
8159
|
switch (node.type) {
|
|
@@ -8271,7 +8256,7 @@ async function prepareTextMentionNotificationEmail(client, event, options, eleme
|
|
|
8271
8256
|
const roomInfo = options.resolveRoomInfo ? await options.resolveRoomInfo({ roomId: event.data.roomId }) : void 0;
|
|
8272
8257
|
const resolvedRoomInfo = {
|
|
8273
8258
|
...roomInfo,
|
|
8274
|
-
name: _nullishCoalesce(_optionalChain([roomInfo, 'optionalAccess',
|
|
8259
|
+
name: _nullishCoalesce(_optionalChain([roomInfo, 'optionalAccess', _9 => _9.name]), () => ( event.data.roomId))
|
|
8275
8260
|
};
|
|
8276
8261
|
const batchUsersResolver = createBatchUsersResolver({
|
|
8277
8262
|
resolveUsers: options.resolveUsers,
|
|
@@ -8334,7 +8319,7 @@ var baseComponents = {
|
|
|
8334
8319
|
Container: ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children }),
|
|
8335
8320
|
Mention: ({ element, user, group }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { "data-mention": true, children: [
|
|
8336
8321
|
_core.MENTION_CHARACTER,
|
|
8337
|
-
_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
8322
|
+
_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _10 => _10.name]), () => ( _optionalChain([group, 'optionalAccess', _11 => _11.name]))), () => ( element.id))
|
|
8338
8323
|
] }),
|
|
8339
8324
|
Text: ({ element }) => {
|
|
8340
8325
|
let children = element.text;
|
|
@@ -8416,7 +8401,7 @@ async function prepareTextMentionNotificationEmailAsHtml(client, event, options
|
|
|
8416
8401
|
return content.join("\n");
|
|
8417
8402
|
},
|
|
8418
8403
|
mention: ({ node, user, group }) => {
|
|
8419
|
-
return _core.html`<span data-mention style="${toInlineCSSString(styles.mention)}">${_core.MENTION_CHARACTER}${_optionalChain([user, 'optionalAccess',
|
|
8404
|
+
return _core.html`<span data-mention style="${toInlineCSSString(styles.mention)}">${_core.MENTION_CHARACTER}${_optionalChain([user, 'optionalAccess', _12 => _12.name]) ? _core.html`${_optionalChain([user, 'optionalAccess', _13 => _13.name])}` : _optionalChain([group, 'optionalAccess', _14 => _14.name]) ? _core.html`${_optionalChain([group, 'optionalAccess', _15 => _15.name])}` : node.id}</span>`;
|
|
8420
8405
|
},
|
|
8421
8406
|
text: ({ node }) => {
|
|
8422
8407
|
let children = node.text;
|
|
@@ -8466,8 +8451,8 @@ async function prepareTextMentionNotificationEmailAsHtml(client, event, options
|
|
|
8466
8451
|
async function convertCommentBody(body, options) {
|
|
8467
8452
|
const { users: resolvedUsers, groups: resolvedGroupsInfo } = await _core.resolveMentionsInCommentBody.call(void 0,
|
|
8468
8453
|
body,
|
|
8469
|
-
_optionalChain([options, 'optionalAccess',
|
|
8470
|
-
_optionalChain([options, 'optionalAccess',
|
|
8454
|
+
_optionalChain([options, 'optionalAccess', _16 => _16.resolveUsers]),
|
|
8455
|
+
_optionalChain([options, 'optionalAccess', _17 => _17.resolveGroupsInfo])
|
|
8471
8456
|
);
|
|
8472
8457
|
const blocks = body.content.map((block, index) => {
|
|
8473
8458
|
switch (block.type) {
|
|
@@ -8591,12 +8576,12 @@ var getLastUnreadCommentWithMention = ({
|
|
|
8591
8576
|
if (mention.kind === "user" && mention.id === mentionedUserId) {
|
|
8592
8577
|
return comment;
|
|
8593
8578
|
}
|
|
8594
|
-
if (mention.kind === "group" && _optionalChain([mention, 'access',
|
|
8579
|
+
if (mention.kind === "group" && _optionalChain([mention, 'access', _18 => _18.userIds, 'optionalAccess', _19 => _19.includes, 'call', _20 => _20(mentionedUserId)])) {
|
|
8595
8580
|
return comment;
|
|
8596
8581
|
}
|
|
8597
8582
|
if (mention.kind === "group" && mention.userIds === void 0) {
|
|
8598
8583
|
const group = groups.get(mention.id);
|
|
8599
|
-
if (_optionalChain([group, 'optionalAccess',
|
|
8584
|
+
if (_optionalChain([group, 'optionalAccess', _21 => _21.members, 'access', _22 => _22.some, 'call', _23 => _23((member) => member.id === mentionedUserId)])) {
|
|
8600
8585
|
return comment;
|
|
8601
8586
|
}
|
|
8602
8587
|
}
|
|
@@ -8654,7 +8639,7 @@ async function prepareThreadNotificationEmail(client, event, options, elements,
|
|
|
8654
8639
|
const roomInfo = options.resolveRoomInfo ? await options.resolveRoomInfo({ roomId: event.data.roomId }) : void 0;
|
|
8655
8640
|
const resolvedRoomInfo = {
|
|
8656
8641
|
...roomInfo,
|
|
8657
|
-
name: _nullishCoalesce(_optionalChain([roomInfo, 'optionalAccess',
|
|
8642
|
+
name: _nullishCoalesce(_optionalChain([roomInfo, 'optionalAccess', _24 => _24.name]), () => ( event.data.roomId))
|
|
8658
8643
|
};
|
|
8659
8644
|
const batchUsersResolver = createBatchUsersResolver({
|
|
8660
8645
|
resolveUsers: options.resolveUsers,
|
|
@@ -8685,8 +8670,8 @@ async function prepareThreadNotificationEmail(client, event, options, elements,
|
|
|
8685
8670
|
authorsIds,
|
|
8686
8671
|
authorsInfo
|
|
8687
8672
|
);
|
|
8688
|
-
const url = _optionalChain([roomInfo, 'optionalAccess',
|
|
8689
|
-
roomUrl: _optionalChain([roomInfo, 'optionalAccess',
|
|
8673
|
+
const url = _optionalChain([roomInfo, 'optionalAccess', _25 => _25.url]) ? generateCommentUrl({
|
|
8674
|
+
roomUrl: _optionalChain([roomInfo, 'optionalAccess', _26 => _26.url]),
|
|
8690
8675
|
commentId: comment.id
|
|
8691
8676
|
}) : void 0;
|
|
8692
8677
|
return {
|
|
@@ -8733,7 +8718,7 @@ async function prepareThreadNotificationEmail(client, event, options, elements,
|
|
|
8733
8718
|
);
|
|
8734
8719
|
const commentBody = commentBodies[index];
|
|
8735
8720
|
const url = generateCommentUrl({
|
|
8736
|
-
roomUrl: _optionalChain([roomInfo, 'optionalAccess',
|
|
8721
|
+
roomUrl: _optionalChain([roomInfo, 'optionalAccess', _27 => _27.url]),
|
|
8737
8722
|
commentId: comment.id
|
|
8738
8723
|
});
|
|
8739
8724
|
return {
|
|
@@ -8775,7 +8760,7 @@ var baseStyles2 = {
|
|
|
8775
8760
|
}
|
|
8776
8761
|
};
|
|
8777
8762
|
async function prepareThreadNotificationEmailAsHtml(client, event, options = {}) {
|
|
8778
|
-
const styles = { ...baseStyles2, ..._optionalChain([options, 'optionalAccess',
|
|
8763
|
+
const styles = { ...baseStyles2, ..._optionalChain([options, 'optionalAccess', _28 => _28.styles]) };
|
|
8779
8764
|
const data = await prepareThreadNotificationEmail(
|
|
8780
8765
|
client,
|
|
8781
8766
|
event,
|
|
@@ -8813,7 +8798,7 @@ async function prepareThreadNotificationEmailAsHtml(client, event, options = {})
|
|
|
8813
8798
|
return _core.html`<a href="${href}" target="_blank" rel="noopener noreferrer" style="${toInlineCSSString(styles.link)}">${element.text ? _core.html`${element.text}` : element.url}</a>`;
|
|
8814
8799
|
},
|
|
8815
8800
|
mention: ({ element, user, group }) => {
|
|
8816
|
-
return _core.html`<span data-mention style="${toInlineCSSString(styles.mention)}">${_core.MENTION_CHARACTER}${_optionalChain([user, 'optionalAccess',
|
|
8801
|
+
return _core.html`<span data-mention style="${toInlineCSSString(styles.mention)}">${_core.MENTION_CHARACTER}${_optionalChain([user, 'optionalAccess', _29 => _29.name]) ? _core.html`${_optionalChain([user, 'optionalAccess', _30 => _30.name])}` : _optionalChain([group, 'optionalAccess', _31 => _31.name]) ? _core.html`${_optionalChain([group, 'optionalAccess', _32 => _32.name])}` : element.id}</span>`;
|
|
8817
8802
|
}
|
|
8818
8803
|
},
|
|
8819
8804
|
"prepareThreadNotificationEmailAsHtml"
|
|
@@ -8845,11 +8830,11 @@ var baseComponents2 = {
|
|
|
8845
8830
|
Link: ({ element, href }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { href, target: "_blank", rel: "noopener noreferrer", children: _nullishCoalesce(element.text, () => ( element.url)) }),
|
|
8846
8831
|
Mention: ({ element, user, group }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { "data-mention": true, children: [
|
|
8847
8832
|
_core.MENTION_CHARACTER,
|
|
8848
|
-
_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
8833
|
+
_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _33 => _33.name]), () => ( _optionalChain([group, 'optionalAccess', _34 => _34.name]))), () => ( element.id))
|
|
8849
8834
|
] })
|
|
8850
8835
|
};
|
|
8851
8836
|
async function prepareThreadNotificationEmailAsReact(client, event, options = {}) {
|
|
8852
|
-
const Components = { ...baseComponents2, ..._optionalChain([options, 'optionalAccess',
|
|
8837
|
+
const Components = { ...baseComponents2, ..._optionalChain([options, 'optionalAccess', _35 => _35.components]) };
|
|
8853
8838
|
const data = await prepareThreadNotificationEmail(
|
|
8854
8839
|
client,
|
|
8855
8840
|
event,
|