@liveblocks/react 3.13.0-metadata1 → 3.13.0-rc2
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/_private.cjs +7 -7
- package/dist/_private.d.cts +2 -2
- package/dist/_private.d.ts +2 -2
- package/dist/_private.js +1 -1
- package/dist/{chunk-UTYX6TS4.cjs → chunk-26OA537P.cjs} +17 -171
- package/dist/chunk-26OA537P.cjs.map +1 -0
- package/dist/{chunk-43FP2UXY.cjs → chunk-WEWZ7TLA.cjs} +2 -2
- package/dist/chunk-WEWZ7TLA.cjs.map +1 -0
- package/dist/{chunk-5WSMZNJK.js → chunk-XU7FO2TU.js} +2 -2
- package/dist/{chunk-LGJ7R5KY.js → chunk-ZAB3RDMV.js} +18 -172
- package/dist/chunk-ZAB3RDMV.js.map +1 -0
- package/dist/index.cjs +4 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -8
- package/dist/index.js.map +1 -1
- package/dist/{room-N2gjE_Co.d.cts → room-BadENFHi.d.cts} +113 -143
- package/dist/{room-N2gjE_Co.d.ts → room-BadENFHi.d.ts} +113 -143
- package/dist/suspense.cjs +4 -6
- package/dist/suspense.cjs.map +1 -1
- package/dist/suspense.d.cts +1 -1
- package/dist/suspense.d.ts +1 -1
- package/dist/suspense.js +6 -8
- package/dist/suspense.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-43FP2UXY.cjs.map +0 -1
- package/dist/chunk-LGJ7R5KY.js.map +0 -1
- package/dist/chunk-UTYX6TS4.cjs.map +0 -1
- /package/dist/{chunk-5WSMZNJK.js.map → chunk-XU7FO2TU.js.map} +0 -0
package/dist/_private.cjs
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _chunk26OA537Pcjs = require('./chunk-26OA537P.cjs');
|
|
29
29
|
|
|
30
30
|
// src/lib/use-layout-effect.ts
|
|
31
31
|
var _react = require('react');
|
|
@@ -50,7 +50,7 @@ function selectorFor_useGroup(state) {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
function useGroup(groupId) {
|
|
53
|
-
const client =
|
|
53
|
+
const client = _chunk26OA537Pcjs.useClient.call(void 0, );
|
|
54
54
|
const store = client[_core.kInternal].httpClient.groupsStore;
|
|
55
55
|
const getGroupState = _react.useCallback.call(void 0,
|
|
56
56
|
() => store.getItemState(groupId),
|
|
@@ -59,7 +59,7 @@ function useGroup(groupId) {
|
|
|
59
59
|
_react.useEffect.call(void 0, () => {
|
|
60
60
|
void store.enqueue(groupId);
|
|
61
61
|
}, [store, groupId]);
|
|
62
|
-
return
|
|
62
|
+
return _chunk26OA537Pcjs.useSyncExternalStoreWithSelector.call(void 0,
|
|
63
63
|
store.subscribe,
|
|
64
64
|
getGroupState,
|
|
65
65
|
getGroupState,
|
|
@@ -80,8 +80,8 @@ function normalizeMentionSuggestions(suggestions) {
|
|
|
80
80
|
function useMentionSuggestions(roomId, search) {
|
|
81
81
|
const [mentionSuggestions, setMentionSuggestions] = _react.useState.call(void 0, );
|
|
82
82
|
const lastInvokedAt = _react.useRef.call(void 0, );
|
|
83
|
-
const resolveMentionSuggestions =
|
|
84
|
-
const mentionSuggestionsCache =
|
|
83
|
+
const resolveMentionSuggestions = _chunk26OA537Pcjs.useResolveMentionSuggestions.call(void 0, );
|
|
84
|
+
const mentionSuggestionsCache = _chunk26OA537Pcjs.useMentionSuggestionsCache.call(void 0, );
|
|
85
85
|
_react.useEffect.call(void 0, () => {
|
|
86
86
|
if (search === void 0 || !resolveMentionSuggestions) {
|
|
87
87
|
return;
|
|
@@ -136,7 +136,7 @@ function useMentionSuggestions(roomId, search) {
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
function useSyncSource() {
|
|
139
|
-
const client =
|
|
139
|
+
const client = _chunk26OA537Pcjs.useClient.call(void 0, );
|
|
140
140
|
const createSyncSource = client[_core.kInternal].createSyncSource;
|
|
141
141
|
const [syncSource, setSyncSource] = _react.useState.call(void 0, );
|
|
142
142
|
_react.useEffect.call(void 0, () => {
|
|
@@ -176,5 +176,5 @@ function useSyncSource() {
|
|
|
176
176
|
|
|
177
177
|
|
|
178
178
|
|
|
179
|
-
exports.getUmbrellaStoreForClient =
|
|
179
|
+
exports.getUmbrellaStoreForClient = _chunk26OA537Pcjs.getUmbrellaStoreForClient; exports.useAddRoomCommentReaction = _chunk26OA537Pcjs.useAddRoomCommentReaction; exports.useClientOrNull = _chunk26OA537Pcjs.useClientOrNull; exports.useCreateRoomComment = _chunk26OA537Pcjs.useCreateRoomComment; exports.useCreateRoomThread = _chunk26OA537Pcjs.useCreateRoomThread; exports.useCreateTextMention = _chunk26OA537Pcjs.useCreateTextMention; exports.useDeleteRoomComment = _chunk26OA537Pcjs.useDeleteRoomComment; exports.useDeleteRoomThread = _chunk26OA537Pcjs.useDeleteRoomThread; exports.useDeleteTextMention = _chunk26OA537Pcjs.useDeleteTextMention; exports.useEditRoomComment = _chunk26OA537Pcjs.useEditRoomComment; exports.useEditRoomThreadMetadata = _chunk26OA537Pcjs.useEditRoomThreadMetadata; exports.useGroup = useGroup; exports.useLatest = _chunk26OA537Pcjs.useLatest; exports.useLayoutEffect = useLayoutEffect; exports.useMarkRoomThreadAsRead = _chunk26OA537Pcjs.useMarkRoomThreadAsRead; exports.useMarkRoomThreadAsResolved = _chunk26OA537Pcjs.useMarkRoomThreadAsResolved; exports.useMarkRoomThreadAsUnresolved = _chunk26OA537Pcjs.useMarkRoomThreadAsUnresolved; exports.useMentionSuggestions = useMentionSuggestions; exports.useMentionSuggestionsCache = _chunk26OA537Pcjs.useMentionSuggestionsCache; exports.useRemoveRoomCommentReaction = _chunk26OA537Pcjs.useRemoveRoomCommentReaction; exports.useReportTextEditor = _chunk26OA537Pcjs.useReportTextEditor; exports.useResolveMentionSuggestions = _chunk26OA537Pcjs.useResolveMentionSuggestions; exports.useRoomAttachmentUrl = _chunk26OA537Pcjs.useRoomAttachmentUrl; exports.useRoomPermissions = _chunk26OA537Pcjs.useRoomPermissions; exports.useRoomThreadSubscription = _chunk26OA537Pcjs.useRoomThreadSubscription; exports.useSignal = _chunk26OA537Pcjs.useSignal; exports.useSyncExternalStoreWithSelector = _chunk26OA537Pcjs.useSyncExternalStoreWithSelector; exports.useSyncSource = useSyncSource; exports.useYjsProvider = _chunk26OA537Pcjs.useYjsProvider;
|
|
180
180
|
//# sourceMappingURL=_private.cjs.map
|
package/dist/_private.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as GroupAsyncResult } from './room-
|
|
2
|
-
export { g as getUmbrellaStoreForClient, a as useAddRoomCommentReaction, u as useClientOrNull, b as useCreateRoomComment, c as useCreateRoomThread, d as useCreateTextMention, e as useDeleteRoomComment, f as useDeleteRoomThread, h as useDeleteTextMention, i as useEditRoomComment, j as useEditRoomThreadMetadata, k as useMarkRoomThreadAsRead, l as useMarkRoomThreadAsResolved, m as useMarkRoomThreadAsUnresolved, n as useMentionSuggestionsCache, o as useRemoveRoomCommentReaction, p as useReportTextEditor, q as useResolveMentionSuggestions, r as useRoomAttachmentUrl, s as useRoomPermissions, t as useRoomThreadSubscription, v as useYjsProvider } from './room-
|
|
1
|
+
import { G as GroupAsyncResult } from './room-BadENFHi.cjs';
|
|
2
|
+
export { g as getUmbrellaStoreForClient, a as useAddRoomCommentReaction, u as useClientOrNull, b as useCreateRoomComment, c as useCreateRoomThread, d as useCreateTextMention, e as useDeleteRoomComment, f as useDeleteRoomThread, h as useDeleteTextMention, i as useEditRoomComment, j as useEditRoomThreadMetadata, k as useMarkRoomThreadAsRead, l as useMarkRoomThreadAsResolved, m as useMarkRoomThreadAsUnresolved, n as useMentionSuggestionsCache, o as useRemoveRoomCommentReaction, p as useReportTextEditor, q as useResolveMentionSuggestions, r as useRoomAttachmentUrl, s as useRoomPermissions, t as useRoomThreadSubscription, v as useYjsProvider } from './room-BadENFHi.cjs';
|
|
3
3
|
import { MutableRefObject, useEffect } from 'react';
|
|
4
4
|
import { MentionData, ISignal, SyncSource } from '@liveblocks/core';
|
|
5
5
|
import '@liveblocks/client';
|
package/dist/_private.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as GroupAsyncResult } from './room-
|
|
2
|
-
export { g as getUmbrellaStoreForClient, a as useAddRoomCommentReaction, u as useClientOrNull, b as useCreateRoomComment, c as useCreateRoomThread, d as useCreateTextMention, e as useDeleteRoomComment, f as useDeleteRoomThread, h as useDeleteTextMention, i as useEditRoomComment, j as useEditRoomThreadMetadata, k as useMarkRoomThreadAsRead, l as useMarkRoomThreadAsResolved, m as useMarkRoomThreadAsUnresolved, n as useMentionSuggestionsCache, o as useRemoveRoomCommentReaction, p as useReportTextEditor, q as useResolveMentionSuggestions, r as useRoomAttachmentUrl, s as useRoomPermissions, t as useRoomThreadSubscription, v as useYjsProvider } from './room-
|
|
1
|
+
import { G as GroupAsyncResult } from './room-BadENFHi.js';
|
|
2
|
+
export { g as getUmbrellaStoreForClient, a as useAddRoomCommentReaction, u as useClientOrNull, b as useCreateRoomComment, c as useCreateRoomThread, d as useCreateTextMention, e as useDeleteRoomComment, f as useDeleteRoomThread, h as useDeleteTextMention, i as useEditRoomComment, j as useEditRoomThreadMetadata, k as useMarkRoomThreadAsRead, l as useMarkRoomThreadAsResolved, m as useMarkRoomThreadAsUnresolved, n as useMentionSuggestionsCache, o as useRemoveRoomCommentReaction, p as useReportTextEditor, q as useResolveMentionSuggestions, r as useRoomAttachmentUrl, s as useRoomPermissions, t as useRoomThreadSubscription, v as useYjsProvider } from './room-BadENFHi.js';
|
|
3
3
|
import { MutableRefObject, useEffect } from 'react';
|
|
4
4
|
import { MentionData, ISignal, SyncSource } from '@liveblocks/core';
|
|
5
5
|
import '@liveblocks/client';
|
package/dist/_private.js
CHANGED
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
useSignal,
|
|
26
26
|
useSyncExternalStoreWithSelector,
|
|
27
27
|
useYjsProvider
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-ZAB3RDMV.js";
|
|
29
29
|
|
|
30
30
|
// src/lib/use-layout-effect.ts
|
|
31
31
|
import { useEffect, useLayoutEffect as useOriginalLayoutEffect } from "react";
|
|
@@ -330,7 +330,7 @@ function find(it, predicate) {
|
|
|
330
330
|
|
|
331
331
|
|
|
332
332
|
function makeThreadsFilter(query, subscriptions) {
|
|
333
|
-
return (thread) => matchesThreadsQuery(thread, query, subscriptions) &&
|
|
333
|
+
return (thread) => matchesThreadsQuery(thread, query, subscriptions) && matchesMetadata(thread, query);
|
|
334
334
|
}
|
|
335
335
|
function matchesThreadsQuery(thread, q, subscriptions) {
|
|
336
336
|
let subscription = void 0;
|
|
@@ -339,7 +339,7 @@ function matchesThreadsQuery(thread, q, subscriptions) {
|
|
|
339
339
|
}
|
|
340
340
|
return (q.resolved === void 0 || thread.resolved === q.resolved) && (q.subscribed === void 0 || q.subscribed === true && subscription !== void 0 || q.subscribed === false && subscription === void 0);
|
|
341
341
|
}
|
|
342
|
-
function
|
|
342
|
+
function matchesMetadata(thread, q) {
|
|
343
343
|
const metadata = thread.metadata;
|
|
344
344
|
return q.metadata === void 0 || Object.entries(q.metadata).every(
|
|
345
345
|
([key, op]) => (
|
|
@@ -1519,26 +1519,6 @@ var UmbrellaStore = class {
|
|
|
1519
1519
|
(thread) => applyUpsertComment(thread, editedComment)
|
|
1520
1520
|
);
|
|
1521
1521
|
}
|
|
1522
|
-
editCommentMetadata(threadId, commentId, optimisticId, updatedMetadata, updatedAt) {
|
|
1523
|
-
return this.#updateThread(
|
|
1524
|
-
threadId,
|
|
1525
|
-
optimisticId,
|
|
1526
|
-
(thread) => {
|
|
1527
|
-
const comment = thread.comments.find((c) => c.id === commentId);
|
|
1528
|
-
if (comment === void 0) {
|
|
1529
|
-
return thread;
|
|
1530
|
-
}
|
|
1531
|
-
return {
|
|
1532
|
-
...thread,
|
|
1533
|
-
updatedAt,
|
|
1534
|
-
comments: thread.comments.map(
|
|
1535
|
-
(c) => c.id === commentId ? { ...c, metadata: updatedMetadata } : c
|
|
1536
|
-
)
|
|
1537
|
-
};
|
|
1538
|
-
},
|
|
1539
|
-
updatedAt
|
|
1540
|
-
);
|
|
1541
|
-
}
|
|
1542
1522
|
deleteComment(threadId, optimisticId, commentId, deletedAt) {
|
|
1543
1523
|
return this.#updateThread(
|
|
1544
1524
|
threadId,
|
|
@@ -1744,27 +1724,6 @@ function applyOptimisticUpdates_forThreadifications(baseThreadsDB, notifications
|
|
|
1744
1724
|
threadsDB.upsert(applyUpsertComment(thread, optimisticUpdate.comment));
|
|
1745
1725
|
break;
|
|
1746
1726
|
}
|
|
1747
|
-
case "edit-comment-metadata": {
|
|
1748
|
-
const thread = threadsDB.get(optimisticUpdate.threadId);
|
|
1749
|
-
if (thread === void 0) break;
|
|
1750
|
-
if (thread.updatedAt > optimisticUpdate.updatedAt) {
|
|
1751
|
-
break;
|
|
1752
|
-
}
|
|
1753
|
-
const existingComment = thread.comments.find(
|
|
1754
|
-
(c) => c.id === optimisticUpdate.commentId
|
|
1755
|
-
);
|
|
1756
|
-
if (existingComment === void 0) break;
|
|
1757
|
-
threadsDB.upsert(
|
|
1758
|
-
applyUpsertComment(thread, {
|
|
1759
|
-
...existingComment,
|
|
1760
|
-
metadata: {
|
|
1761
|
-
...existingComment.metadata,
|
|
1762
|
-
...optimisticUpdate.metadata
|
|
1763
|
-
}
|
|
1764
|
-
})
|
|
1765
|
-
);
|
|
1766
|
-
break;
|
|
1767
|
-
}
|
|
1768
1727
|
case "delete-comment": {
|
|
1769
1728
|
const thread = threadsDB.get(optimisticUpdate.threadId);
|
|
1770
1729
|
if (thread === void 0) break;
|
|
@@ -1971,20 +1930,7 @@ function applyUpsertComment(thread, comment) {
|
|
|
1971
1930
|
return updatedThread;
|
|
1972
1931
|
}
|
|
1973
1932
|
if (existingComment.deletedAt !== void 0) {
|
|
1974
|
-
|
|
1975
|
-
...existingComment,
|
|
1976
|
-
metadata: {
|
|
1977
|
-
...existingComment.metadata,
|
|
1978
|
-
...comment.metadata
|
|
1979
|
-
}
|
|
1980
|
-
};
|
|
1981
|
-
const updatedComments = thread.comments.map(
|
|
1982
|
-
(c) => c.id === comment.id ? updatedComment : c
|
|
1983
|
-
);
|
|
1984
|
-
return {
|
|
1985
|
-
...thread,
|
|
1986
|
-
comments: updatedComments
|
|
1987
|
-
};
|
|
1933
|
+
return thread;
|
|
1988
1934
|
}
|
|
1989
1935
|
if (existingComment.editedAt === void 0 || comment.editedAt === void 0 || existingComment.editedAt <= comment.editedAt) {
|
|
1990
1936
|
const updatedComments = thread.comments.map(
|
|
@@ -3575,11 +3521,9 @@ function makeRoomContextBundle(client) {
|
|
|
3575
3521
|
useOthersMapped,
|
|
3576
3522
|
useOthersConnectionIds,
|
|
3577
3523
|
useOther,
|
|
3578
|
-
// prettier-ignore
|
|
3579
3524
|
useMutation,
|
|
3580
3525
|
useThreads,
|
|
3581
3526
|
useSearchComments,
|
|
3582
|
-
// prettier-ignore
|
|
3583
3527
|
useCreateThread,
|
|
3584
3528
|
useDeleteThread,
|
|
3585
3529
|
useEditThreadMetadata,
|
|
@@ -3589,7 +3533,6 @@ function makeRoomContextBundle(client) {
|
|
|
3589
3533
|
useUnsubscribeFromThread,
|
|
3590
3534
|
useCreateComment,
|
|
3591
3535
|
useEditComment,
|
|
3592
|
-
useEditCommentMetadata,
|
|
3593
3536
|
useDeleteComment,
|
|
3594
3537
|
useAddReaction,
|
|
3595
3538
|
useRemoveReaction,
|
|
@@ -3624,10 +3567,8 @@ function makeRoomContextBundle(client) {
|
|
|
3624
3567
|
useOthersMapped: useOthersMappedSuspense,
|
|
3625
3568
|
useOthersConnectionIds: useOthersConnectionIdsSuspense,
|
|
3626
3569
|
useOther: useOtherSuspense,
|
|
3627
|
-
// prettier-ignore
|
|
3628
3570
|
useMutation,
|
|
3629
3571
|
useThreads: useThreadsSuspense,
|
|
3630
|
-
// prettier-ignore
|
|
3631
3572
|
useCreateThread,
|
|
3632
3573
|
useDeleteThread,
|
|
3633
3574
|
useEditThreadMetadata,
|
|
@@ -3637,7 +3578,6 @@ function makeRoomContextBundle(client) {
|
|
|
3637
3578
|
useUnsubscribeFromThread,
|
|
3638
3579
|
useCreateComment,
|
|
3639
3580
|
useEditComment,
|
|
3640
|
-
useEditCommentMetadata,
|
|
3641
3581
|
useDeleteComment,
|
|
3642
3582
|
useAddReaction,
|
|
3643
3583
|
useRemoveReaction,
|
|
@@ -3706,7 +3646,8 @@ function RoomProviderInner(props) {
|
|
|
3706
3646
|
{
|
|
3707
3647
|
initialPresence: props.initialPresence,
|
|
3708
3648
|
initialStorage: props.initialStorage,
|
|
3709
|
-
autoConnect: _nullishCoalesce(props.autoConnect, () => ( typeof window !== "undefined"))
|
|
3649
|
+
autoConnect: _nullishCoalesce(props.autoConnect, () => ( typeof window !== "undefined")),
|
|
3650
|
+
engine: props.engine
|
|
3710
3651
|
},
|
|
3711
3652
|
roomId
|
|
3712
3653
|
);
|
|
@@ -3742,7 +3683,6 @@ function RoomProviderInner(props) {
|
|
|
3742
3683
|
case _core.ServerMsgCode.COMMENT_REACTION_ADDED:
|
|
3743
3684
|
case _core.ServerMsgCode.COMMENT_REACTION_REMOVED:
|
|
3744
3685
|
case _core.ServerMsgCode.COMMENT_DELETED:
|
|
3745
|
-
case _core.ServerMsgCode.COMMENT_METADATA_UPDATED:
|
|
3746
3686
|
if (!existingThread) break;
|
|
3747
3687
|
store.updateThreadifications(
|
|
3748
3688
|
[thread],
|
|
@@ -4150,7 +4090,6 @@ function useCreateRoomThread(roomId) {
|
|
|
4150
4090
|
(options) => {
|
|
4151
4091
|
const body = options.body;
|
|
4152
4092
|
const metadata = _nullishCoalesce(options.metadata, () => ( {}));
|
|
4153
|
-
const commentMetadata = _nullishCoalesce(options.commentMetadata, () => ( {}));
|
|
4154
4093
|
const attachments = options.attachments;
|
|
4155
4094
|
const threadId = _core.createThreadId.call(void 0, );
|
|
4156
4095
|
const commentId = _core.createCommentId.call(void 0, );
|
|
@@ -4164,8 +4103,7 @@ function useCreateRoomThread(roomId) {
|
|
|
4164
4103
|
userId: getCurrentUserId(client),
|
|
4165
4104
|
body,
|
|
4166
4105
|
reactions: [],
|
|
4167
|
-
attachments: _nullishCoalesce(attachments, () => ( []))
|
|
4168
|
-
metadata: commentMetadata
|
|
4106
|
+
attachments: _nullishCoalesce(attachments, () => ( []))
|
|
4169
4107
|
};
|
|
4170
4108
|
const newThread = {
|
|
4171
4109
|
id: threadId,
|
|
@@ -4190,7 +4128,6 @@ function useCreateRoomThread(roomId) {
|
|
|
4190
4128
|
commentId,
|
|
4191
4129
|
body,
|
|
4192
4130
|
metadata,
|
|
4193
|
-
commentMetadata,
|
|
4194
4131
|
attachmentIds
|
|
4195
4132
|
}).then(
|
|
4196
4133
|
(thread) => {
|
|
@@ -4204,8 +4141,7 @@ function useCreateRoomThread(roomId) {
|
|
|
4204
4141
|
threadId,
|
|
4205
4142
|
commentId,
|
|
4206
4143
|
body,
|
|
4207
|
-
metadata
|
|
4208
|
-
commentMetadata
|
|
4144
|
+
metadata
|
|
4209
4145
|
},
|
|
4210
4146
|
err
|
|
4211
4147
|
)
|
|
@@ -4288,65 +4224,13 @@ function useEditRoomThreadMetadata(roomId) {
|
|
|
4288
4224
|
[client, roomId]
|
|
4289
4225
|
);
|
|
4290
4226
|
}
|
|
4291
|
-
function useEditCommentMetadata() {
|
|
4292
|
-
return useEditRoomCommentMetadata(useRoom().id);
|
|
4293
|
-
}
|
|
4294
|
-
function useEditRoomCommentMetadata(roomId) {
|
|
4295
|
-
const client = useClient();
|
|
4296
|
-
return _react.useCallback.call(void 0,
|
|
4297
|
-
(options) => {
|
|
4298
|
-
if (!options.metadata) {
|
|
4299
|
-
return;
|
|
4300
|
-
}
|
|
4301
|
-
const threadId = options.threadId;
|
|
4302
|
-
const commentId = options.commentId;
|
|
4303
|
-
const metadata = options.metadata;
|
|
4304
|
-
const updatedAt = /* @__PURE__ */ new Date();
|
|
4305
|
-
const { store, onMutationFailure } = getRoomExtrasForClient(client);
|
|
4306
|
-
const optimisticId = store.optimisticUpdates.add({
|
|
4307
|
-
type: "edit-comment-metadata",
|
|
4308
|
-
threadId,
|
|
4309
|
-
commentId,
|
|
4310
|
-
metadata,
|
|
4311
|
-
updatedAt
|
|
4312
|
-
});
|
|
4313
|
-
client[_core.kInternal].httpClient.editCommentMetadata({ roomId, threadId, commentId, metadata }).then(
|
|
4314
|
-
(updatedMetadata) => (
|
|
4315
|
-
// Replace the optimistic update by the real thing
|
|
4316
|
-
store.editCommentMetadata(
|
|
4317
|
-
threadId,
|
|
4318
|
-
commentId,
|
|
4319
|
-
optimisticId,
|
|
4320
|
-
updatedMetadata,
|
|
4321
|
-
updatedAt
|
|
4322
|
-
)
|
|
4323
|
-
),
|
|
4324
|
-
(err) => onMutationFailure(
|
|
4325
|
-
optimisticId,
|
|
4326
|
-
{
|
|
4327
|
-
type: "EDIT_COMMENT_METADATA_ERROR",
|
|
4328
|
-
roomId,
|
|
4329
|
-
threadId,
|
|
4330
|
-
commentId,
|
|
4331
|
-
metadata
|
|
4332
|
-
},
|
|
4333
|
-
err
|
|
4334
|
-
)
|
|
4335
|
-
);
|
|
4336
|
-
},
|
|
4337
|
-
[client, roomId]
|
|
4338
|
-
);
|
|
4339
|
-
}
|
|
4340
4227
|
function useCreateComment() {
|
|
4341
4228
|
return useCreateRoomComment(useRoom().id);
|
|
4342
4229
|
}
|
|
4343
4230
|
function useCreateRoomComment(roomId) {
|
|
4344
4231
|
const client = useClient();
|
|
4345
4232
|
return _react.useCallback.call(void 0,
|
|
4346
|
-
(
|
|
4347
|
-
const { threadId, body } = options;
|
|
4348
|
-
const metadata = _nullishCoalesce(options.metadata, () => ( {}));
|
|
4349
|
-
const attachments = _nullishCoalesce(options.attachments, () => ( []));
|
|
4233
|
+
({ threadId, body, attachments }) => {
|
|
4350
4234
|
const commentId = _core.createCommentId.call(void 0, );
|
|
4351
4235
|
const createdAt = /* @__PURE__ */ new Date();
|
|
4352
4236
|
const comment = {
|
|
@@ -4358,8 +4242,7 @@ function useCreateRoomComment(roomId) {
|
|
|
4358
4242
|
userId: getCurrentUserId(client),
|
|
4359
4243
|
body,
|
|
4360
4244
|
reactions: [],
|
|
4361
|
-
attachments: _nullishCoalesce(attachments, () => ( []))
|
|
4362
|
-
metadata
|
|
4245
|
+
attachments: _nullishCoalesce(attachments, () => ( []))
|
|
4363
4246
|
};
|
|
4364
4247
|
const { store, onMutationFailure } = getRoomExtrasForClient(client);
|
|
4365
4248
|
const optimisticId = store.optimisticUpdates.add({
|
|
@@ -4367,14 +4250,7 @@ function useCreateRoomComment(roomId) {
|
|
|
4367
4250
|
comment
|
|
4368
4251
|
});
|
|
4369
4252
|
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _57 => _57.map, 'call', _58 => _58((attachment) => attachment.id)]);
|
|
4370
|
-
client[_core.kInternal].httpClient.createComment({
|
|
4371
|
-
roomId,
|
|
4372
|
-
threadId,
|
|
4373
|
-
commentId,
|
|
4374
|
-
body,
|
|
4375
|
-
metadata,
|
|
4376
|
-
attachmentIds
|
|
4377
|
-
}).then(
|
|
4253
|
+
client[_core.kInternal].httpClient.createComment({ roomId, threadId, commentId, body, attachmentIds }).then(
|
|
4378
4254
|
(newComment) => {
|
|
4379
4255
|
store.createComment(newComment, optimisticId);
|
|
4380
4256
|
},
|
|
@@ -4385,8 +4261,7 @@ function useCreateRoomComment(roomId) {
|
|
|
4385
4261
|
roomId,
|
|
4386
4262
|
threadId,
|
|
4387
4263
|
commentId,
|
|
4388
|
-
body
|
|
4389
|
-
metadata
|
|
4264
|
+
body
|
|
4390
4265
|
},
|
|
4391
4266
|
err
|
|
4392
4267
|
)
|
|
@@ -4402,13 +4277,7 @@ function useEditComment() {
|
|
|
4402
4277
|
function useEditRoomComment(roomId) {
|
|
4403
4278
|
const client = useClient();
|
|
4404
4279
|
return _react.useCallback.call(void 0,
|
|
4405
|
-
({
|
|
4406
|
-
threadId,
|
|
4407
|
-
commentId,
|
|
4408
|
-
body,
|
|
4409
|
-
attachments,
|
|
4410
|
-
metadata
|
|
4411
|
-
}) => {
|
|
4280
|
+
({ threadId, commentId, body, attachments }) => {
|
|
4412
4281
|
const editedAt = /* @__PURE__ */ new Date();
|
|
4413
4282
|
const { store, onMutationFailure } = getRoomExtrasForClient(client);
|
|
4414
4283
|
const existing = store.outputs.threads.get().getEvenIfDeleted(threadId);
|
|
@@ -4427,42 +4296,23 @@ function useEditRoomComment(roomId) {
|
|
|
4427
4296
|
);
|
|
4428
4297
|
return;
|
|
4429
4298
|
}
|
|
4430
|
-
const updatedMetadata = metadata !== void 0 ? {
|
|
4431
|
-
...comment.metadata,
|
|
4432
|
-
...metadata
|
|
4433
|
-
} : comment.metadata;
|
|
4434
4299
|
const optimisticId = store.optimisticUpdates.add({
|
|
4435
4300
|
type: "edit-comment",
|
|
4436
4301
|
comment: {
|
|
4437
4302
|
...comment,
|
|
4438
4303
|
editedAt,
|
|
4439
4304
|
body,
|
|
4440
|
-
attachments: _nullishCoalesce(attachments, () => ( []))
|
|
4441
|
-
metadata: updatedMetadata
|
|
4305
|
+
attachments: _nullishCoalesce(attachments, () => ( []))
|
|
4442
4306
|
}
|
|
4443
4307
|
});
|
|
4444
4308
|
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _59 => _59.map, 'call', _60 => _60((attachment) => attachment.id)]);
|
|
4445
|
-
client[_core.kInternal].httpClient.editComment({
|
|
4446
|
-
roomId,
|
|
4447
|
-
threadId,
|
|
4448
|
-
commentId,
|
|
4449
|
-
body,
|
|
4450
|
-
attachmentIds,
|
|
4451
|
-
metadata
|
|
4452
|
-
}).then(
|
|
4309
|
+
client[_core.kInternal].httpClient.editComment({ roomId, threadId, commentId, body, attachmentIds }).then(
|
|
4453
4310
|
(editedComment) => {
|
|
4454
4311
|
store.editComment(threadId, optimisticId, editedComment);
|
|
4455
4312
|
},
|
|
4456
4313
|
(err) => onMutationFailure(
|
|
4457
4314
|
optimisticId,
|
|
4458
|
-
{
|
|
4459
|
-
type: "EDIT_COMMENT_ERROR",
|
|
4460
|
-
roomId,
|
|
4461
|
-
threadId,
|
|
4462
|
-
commentId,
|
|
4463
|
-
body,
|
|
4464
|
-
metadata: updatedMetadata
|
|
4465
|
-
},
|
|
4315
|
+
{ type: "EDIT_COMMENT_ERROR", roomId, threadId, commentId, body },
|
|
4466
4316
|
err
|
|
4467
4317
|
)
|
|
4468
4318
|
);
|
|
@@ -5087,9 +4937,6 @@ var _useMutation = useMutation;
|
|
|
5087
4937
|
var _useCreateThread = useCreateThread;
|
|
5088
4938
|
var _useDeleteThread = useDeleteThread;
|
|
5089
4939
|
var _useEditThreadMetadata = useEditThreadMetadata;
|
|
5090
|
-
var _useCreateComment = useCreateComment;
|
|
5091
|
-
var _useEditComment = useEditComment;
|
|
5092
|
-
var _useEditCommentMetadata = useEditCommentMetadata;
|
|
5093
4940
|
var _useEventListener = useEventListener;
|
|
5094
4941
|
var _useMyPresence = useMyPresence;
|
|
5095
4942
|
var _useOthersMapped = useOthersMapped;
|
|
@@ -5242,6 +5089,5 @@ var _useUpdateMyPresence = useUpdateMyPresence;
|
|
|
5242
5089
|
|
|
5243
5090
|
|
|
5244
5091
|
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
//# sourceMappingURL=chunk-UTYX6TS4.cjs.map
|
|
5092
|
+
exports.ClientContext = ClientContext; exports.useClientOrNull = useClientOrNull; exports.useClient = useClient; exports.RoomContext = RoomContext; exports.useLatest = useLatest; exports.RegisterAiKnowledge = RegisterAiKnowledge; exports.RegisterAiTool = RegisterAiTool; exports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector; exports.useSignal = useSignal; exports.getUmbrellaStoreForClient = getUmbrellaStoreForClient; exports.useCreateAiChat = useCreateAiChat; exports.useDeleteAiChat = useDeleteAiChat; exports.useAiChatStatus = useAiChatStatus; exports.useSendAiMessage = useSendAiMessage; exports.LiveblocksProvider = LiveblocksProvider; exports.createLiveblocksContext = createLiveblocksContext; exports.useInboxNotifications = useInboxNotifications; exports.useInboxNotificationsSuspense = useInboxNotificationsSuspense; exports.useMarkAllInboxNotificationsAsRead = useMarkAllInboxNotificationsAsRead; exports.useMarkInboxNotificationAsRead = useMarkInboxNotificationAsRead; exports.useDeleteAllInboxNotifications = useDeleteAllInboxNotifications; exports.useDeleteInboxNotification = useDeleteInboxNotification; exports.useUnreadInboxNotificationsCount = useUnreadInboxNotificationsCount; exports.useUnreadInboxNotificationsCountSuspense = useUnreadInboxNotificationsCountSuspense; exports.useNotificationSettings = useNotificationSettings; exports.useNotificationSettingsSuspense = useNotificationSettingsSuspense; exports.useUpdateNotificationSettings = useUpdateNotificationSettings; exports.useRoomInfo = useRoomInfo; exports.useRoomInfoSuspense = useRoomInfoSuspense; exports.useGroupInfo = useGroupInfo; exports.useGroupInfoSuspense = useGroupInfoSuspense; exports._useInboxNotificationThread = _useInboxNotificationThread; exports._useUser = _useUser; exports._useUserSuspense = _useUserSuspense; exports._useUserThreads_experimental = _useUserThreads_experimental; exports._useUserThreadsSuspense_experimental = _useUserThreadsSuspense_experimental; exports._useAiChats = _useAiChats; exports._useAiChatsSuspense = _useAiChatsSuspense; exports._useAiChat = _useAiChat; exports._useAiChatSuspense = _useAiChatSuspense; exports._useAiChatMessages = _useAiChatMessages; exports._useAiChatMessagesSuspense = _useAiChatMessagesSuspense; exports._useUrlMetadata = _useUrlMetadata; exports._useUrlMetadataSuspense = _useUrlMetadataSuspense; exports.useSyncStatus = useSyncStatus; exports.useErrorListener = useErrorListener; exports.useStatus = useStatus; exports.useReportTextEditor = useReportTextEditor; exports.useYjsProvider = useYjsProvider; exports.useCreateTextMention = useCreateTextMention; exports.useDeleteTextMention = useDeleteTextMention; exports.useResolveMentionSuggestions = useResolveMentionSuggestions; exports.useMentionSuggestionsCache = useMentionSuggestionsCache; exports.useLostConnectionListener = useLostConnectionListener; exports.useHistory = useHistory; exports.useUndo = useUndo; exports.useRedo = useRedo; exports.useCanUndo = useCanUndo; exports.useCanRedo = useCanRedo; exports.useOthersConnectionIds = useOthersConnectionIds; exports.useCreateRoomThread = useCreateRoomThread; exports.useDeleteRoomThread = useDeleteRoomThread; exports.useEditRoomThreadMetadata = useEditRoomThreadMetadata; exports.useCreateComment = useCreateComment; exports.useCreateRoomComment = useCreateRoomComment; exports.useEditComment = useEditComment; exports.useEditRoomComment = useEditRoomComment; exports.useDeleteComment = useDeleteComment; exports.useDeleteRoomComment = useDeleteRoomComment; exports.useAddRoomCommentReaction = useAddRoomCommentReaction; exports.useRemoveReaction = useRemoveReaction; exports.useRemoveRoomCommentReaction = useRemoveRoomCommentReaction; exports.useMarkThreadAsRead = useMarkThreadAsRead; exports.useMarkRoomThreadAsRead = useMarkRoomThreadAsRead; exports.useMarkThreadAsResolved = useMarkThreadAsResolved; exports.useMarkRoomThreadAsResolved = useMarkRoomThreadAsResolved; exports.useMarkThreadAsUnresolved = useMarkThreadAsUnresolved; exports.useMarkRoomThreadAsUnresolved = useMarkRoomThreadAsUnresolved; exports.useSubscribeToThread = useSubscribeToThread; exports.useUnsubscribeFromThread = useUnsubscribeFromThread; exports.useThreadSubscription = useThreadSubscription; exports.useRoomThreadSubscription = useRoomThreadSubscription; exports.useHistoryVersionData = useHistoryVersionData; exports.useUpdateRoomSubscriptionSettings = useUpdateRoomSubscriptionSettings; exports.useOthersConnectionIdsSuspense = useOthersConnectionIdsSuspense; exports.useAttachmentUrl = useAttachmentUrl; exports.useRoomAttachmentUrl = useRoomAttachmentUrl; exports.useAttachmentUrlSuspense = useAttachmentUrlSuspense; exports.useRoomPermissions = useRoomPermissions; exports.createRoomContext = createRoomContext; exports._RoomProvider = _RoomProvider; exports._useBroadcastEvent = _useBroadcastEvent; exports._useOthersListener = _useOthersListener; exports._useRoom = _useRoom; exports._useIsInsideRoom = _useIsInsideRoom; exports._useAddReaction = _useAddReaction; exports._useMutation = _useMutation; exports._useCreateThread = _useCreateThread; exports._useDeleteThread = _useDeleteThread; exports._useEditThreadMetadata = _useEditThreadMetadata; exports._useEventListener = _useEventListener; exports._useMyPresence = _useMyPresence; exports._useOthersMapped = _useOthersMapped; exports._useOthersMappedSuspense = _useOthersMappedSuspense; exports._useThreads = _useThreads; exports._useSearchComments = _useSearchComments; exports._useThreadsSuspense = _useThreadsSuspense; exports._useRoomSubscriptionSettings = _useRoomSubscriptionSettings; exports._useRoomSubscriptionSettingsSuspense = _useRoomSubscriptionSettingsSuspense; exports._useHistoryVersions = _useHistoryVersions; exports._useHistoryVersionsSuspense = _useHistoryVersionsSuspense; exports._useOther = _useOther; exports._useOthers = _useOthers; exports._useOtherSuspense = _useOtherSuspense; exports._useOthersSuspense = _useOthersSuspense; exports._useStorage = _useStorage; exports._useStorageSuspense = _useStorageSuspense; exports._useSelf = _useSelf; exports._useSelfSuspense = _useSelfSuspense; exports._useStorageRoot = _useStorageRoot; exports._useUpdateMyPresence = _useUpdateMyPresence;
|
|
5093
|
+
//# sourceMappingURL=chunk-26OA537P.cjs.map
|