@liveblocks/react 3.13.0-ack1 → 3.13.0-metadata2
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-ONFO7EAV.js → chunk-DJEC2TEZ.js} +2 -2
- package/dist/{chunk-U3DNN4V2.cjs → chunk-EF7B6QS4.cjs} +2 -2
- package/dist/chunk-EF7B6QS4.cjs.map +1 -0
- package/dist/{chunk-WH55MUS4.cjs → chunk-LLFEY367.cjs} +172 -16
- package/dist/chunk-LLFEY367.cjs.map +1 -0
- package/dist/{chunk-ZDBJCDFH.js → chunk-W4NENJZ5.js} +173 -17
- package/dist/chunk-W4NENJZ5.js.map +1 -0
- package/dist/index.cjs +6 -4
- 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 +8 -6
- package/dist/index.js.map +1 -1
- package/dist/{room-Bff8edwh.d.cts → room-BfuWPyZs.d.cts} +149 -107
- package/dist/{room-Bff8edwh.d.ts → room-BfuWPyZs.d.ts} +149 -107
- package/dist/suspense.cjs +6 -4
- 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 +8 -6
- package/dist/suspense.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-U3DNN4V2.cjs.map +0 -1
- package/dist/chunk-WH55MUS4.cjs.map +0 -1
- package/dist/chunk-ZDBJCDFH.js.map +0 -1
- /package/dist/{chunk-ONFO7EAV.js.map → chunk-DJEC2TEZ.js.map} +0 -0
|
@@ -2,7 +2,7 @@ import * as react from 'react';
|
|
|
2
2
|
import { ComponentType, Context, PropsWithChildren, ReactNode } from 'react';
|
|
3
3
|
import { BaseUserMeta, Client, JsonObject, LsonObject, LiveObject, User, Json, RoomSubscriptionSettings, Room, Status, BroadcastOptions, OthersEvent, LostConnectionEvent, History, BaseMetadata as BaseMetadata$1, ClientOptions, ThreadData as ThreadData$1, CommentData as CommentData$1 } from '@liveblocks/client';
|
|
4
4
|
import * as _liveblocks_core from '@liveblocks/core';
|
|
5
|
-
import { OpaqueClient, OpaqueRoom, AiKnowledgeSource, AiOpaqueToolDefinition, Relax, AiAssistantContentPart, BaseMetadata, QueryMetadata, AsyncResult, DRI, AsyncSuccess, DGI, GroupData, Resolve, CommentBody, CommentAttachment, PartialUnless, Patchable, InboxNotificationData, NotificationSettings, ToImmutable, MessageId, PartialNotificationSettings, AiChatsQuery, AsyncLoading, AsyncError, ThreadData, SearchCommentsResult, HistoryVersion, AiChat, UrlMetadata, Client as Client$1, LiveblocksError, SyncStatus, RoomEventMessage, CommentData, AiUserMessage, WithRequired, AiChatMessage, WithNavigation, MutableSignal, ThreadDataWithDeleteInfo, ThreadDeleteInfo, SubscriptionKey, SubscriptionData, DerivedSignal, DefaultMap, CommentUserReaction, InboxNotificationDeleteInfo, SubscriptionDeleteInfo, RoomSubscriptionSettings as RoomSubscriptionSettings$1, ISignal, Permission, BaseUserMeta as BaseUserMeta$1, DistributiveOmit, DU,
|
|
5
|
+
import { OpaqueClient, OpaqueRoom, AiKnowledgeSource, AiOpaqueToolDefinition, Relax, AiAssistantContentPart, BaseMetadata, QueryMetadata, AsyncResult, DRI, AsyncSuccess, DGI, GroupData, Resolve, CommentBody, CommentAttachment, PartialUnless, Patchable, InboxNotificationData, NotificationSettings, ToImmutable, MessageId, PartialNotificationSettings, AiChatsQuery, AsyncLoading, AsyncError, ThreadData, SearchCommentsResult, HistoryVersion, AiChat, UrlMetadata, Client as Client$1, LiveblocksError, SyncStatus, RoomEventMessage, CommentData, AiUserMessage, WithRequired, AiChatMessage, WithNavigation, MutableSignal, ThreadDataWithDeleteInfo, ThreadDeleteInfo, SubscriptionKey, SubscriptionData, DerivedSignal, DefaultMap, CommentUserReaction, InboxNotificationDeleteInfo, SubscriptionDeleteInfo, RoomSubscriptionSettings as RoomSubscriptionSettings$1, ISignal, Permission, BaseUserMeta as BaseUserMeta$1, DistributiveOmit, DU, DTM, DCM, TextEditorType, IYjsProvider, MentionData, DP, DS, DE } from '@liveblocks/core';
|
|
6
6
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -125,7 +125,7 @@ type UseAiChatsOptions = {
|
|
|
125
125
|
*/
|
|
126
126
|
query?: AiChatsQuery;
|
|
127
127
|
};
|
|
128
|
-
type ThreadsQuery<
|
|
128
|
+
type ThreadsQuery<TM extends BaseMetadata> = {
|
|
129
129
|
/**
|
|
130
130
|
* Whether to only return threads marked as resolved or unresolved. If not provided,
|
|
131
131
|
* all threads will be returned.
|
|
@@ -140,21 +140,21 @@ type ThreadsQuery<M extends BaseMetadata> = {
|
|
|
140
140
|
* The metadata to filter the threads by. If provided, only threads with metadata that matches
|
|
141
141
|
* the provided metadata will be returned. If not provided, all threads will be returned.
|
|
142
142
|
*/
|
|
143
|
-
metadata?: Partial<QueryMetadata<
|
|
143
|
+
metadata?: Partial<QueryMetadata<TM>>;
|
|
144
144
|
};
|
|
145
|
-
type UseUserThreadsOptions<
|
|
145
|
+
type UseUserThreadsOptions<TM extends BaseMetadata> = {
|
|
146
146
|
/**
|
|
147
147
|
* The query (including metadata) to filter the threads by. If provided, only threads
|
|
148
148
|
* that match the query will be returned. If not provided, all threads will be returned.
|
|
149
149
|
*/
|
|
150
|
-
query?: ThreadsQuery<
|
|
150
|
+
query?: ThreadsQuery<TM>;
|
|
151
151
|
};
|
|
152
|
-
type UseThreadsOptions<
|
|
152
|
+
type UseThreadsOptions<TM extends BaseMetadata> = {
|
|
153
153
|
/**
|
|
154
154
|
* The query (including metadata) to filter the threads by. If provided, only threads
|
|
155
155
|
* that match the query will be returned. If not provided, all threads will be returned.
|
|
156
156
|
*/
|
|
157
|
-
query?: ThreadsQuery<
|
|
157
|
+
query?: ThreadsQuery<TM>;
|
|
158
158
|
/**
|
|
159
159
|
* Whether to scroll to a comment on load based on the URL hash. Defaults to `true`.
|
|
160
160
|
*
|
|
@@ -164,11 +164,11 @@ type UseThreadsOptions<M extends BaseMetadata> = {
|
|
|
164
164
|
*/
|
|
165
165
|
scrollOnLoad?: boolean;
|
|
166
166
|
};
|
|
167
|
-
type SearchCommentsQuery<
|
|
167
|
+
type SearchCommentsQuery<TM extends BaseMetadata> = {
|
|
168
168
|
/**
|
|
169
169
|
* (Optional) Metadata to filter the threads by.
|
|
170
170
|
*/
|
|
171
|
-
threadMetadata?: Partial<QueryMetadata<
|
|
171
|
+
threadMetadata?: Partial<QueryMetadata<TM>>;
|
|
172
172
|
/**
|
|
173
173
|
* (Optional) Whether to only return comments from threads marked as resolved or unresolved.
|
|
174
174
|
*/
|
|
@@ -186,8 +186,8 @@ type SearchCommentsQuery<M extends BaseMetadata> = {
|
|
|
186
186
|
*/
|
|
187
187
|
text: string;
|
|
188
188
|
};
|
|
189
|
-
type UseSearchCommentsOptions<
|
|
190
|
-
query: SearchCommentsQuery<
|
|
189
|
+
type UseSearchCommentsOptions<TM extends BaseMetadata> = {
|
|
190
|
+
query: SearchCommentsQuery<TM>;
|
|
191
191
|
};
|
|
192
192
|
type InboxNotificationsQuery = {
|
|
193
193
|
/**
|
|
@@ -215,26 +215,35 @@ type GroupInfoAsyncSuccess = AsyncSuccess<DGI, "info">;
|
|
|
215
215
|
type AttachmentUrlAsyncResult = AsyncResult<string, "url">;
|
|
216
216
|
type AttachmentUrlAsyncSuccess = AsyncSuccess<string, "url">;
|
|
217
217
|
type GroupAsyncResult = AsyncResult<GroupData | undefined, "group">;
|
|
218
|
-
type CreateThreadOptions<
|
|
218
|
+
type CreateThreadOptions<TM extends BaseMetadata, CM extends BaseMetadata> = Resolve<{
|
|
219
219
|
body: CommentBody;
|
|
220
220
|
attachments?: CommentAttachment[];
|
|
221
|
-
} & PartialUnless<
|
|
222
|
-
metadata:
|
|
221
|
+
} & PartialUnless<TM, {
|
|
222
|
+
metadata: TM;
|
|
223
|
+
}> & PartialUnless<CM, {
|
|
224
|
+
commentMetadata: CM;
|
|
223
225
|
}>>;
|
|
224
|
-
type EditThreadMetadataOptions<
|
|
226
|
+
type EditThreadMetadataOptions<TM extends BaseMetadata> = {
|
|
225
227
|
threadId: string;
|
|
226
|
-
metadata: Patchable<
|
|
228
|
+
metadata: Patchable<TM>;
|
|
227
229
|
};
|
|
228
|
-
type CreateCommentOptions = {
|
|
230
|
+
type CreateCommentOptions<CM extends BaseMetadata> = {
|
|
229
231
|
threadId: string;
|
|
230
232
|
body: CommentBody;
|
|
233
|
+
metadata?: CM;
|
|
231
234
|
attachments?: CommentAttachment[];
|
|
232
235
|
};
|
|
233
|
-
type EditCommentOptions = {
|
|
236
|
+
type EditCommentOptions<CM extends BaseMetadata> = {
|
|
234
237
|
threadId: string;
|
|
235
238
|
commentId: string;
|
|
236
239
|
body: CommentBody;
|
|
237
240
|
attachments?: CommentAttachment[];
|
|
241
|
+
metadata?: Patchable<CM>;
|
|
242
|
+
};
|
|
243
|
+
type EditCommentMetadataOptions<CM extends BaseMetadata> = {
|
|
244
|
+
threadId: string;
|
|
245
|
+
commentId: string;
|
|
246
|
+
metadata: Patchable<CM>;
|
|
238
247
|
};
|
|
239
248
|
type DeleteCommentOptions = {
|
|
240
249
|
threadId: string;
|
|
@@ -253,8 +262,8 @@ type PaginationFields = {
|
|
|
253
262
|
};
|
|
254
263
|
type PagedAsyncSuccess<T, F extends string> = Resolve<AsyncSuccess<T, F> & PaginationFields>;
|
|
255
264
|
type PagedAsyncResult<T, F extends string> = Relax<AsyncLoading<F> | AsyncError<F> | PagedAsyncSuccess<T, F>>;
|
|
256
|
-
type ThreadsAsyncSuccess<
|
|
257
|
-
type ThreadsAsyncResult<
|
|
265
|
+
type ThreadsAsyncSuccess<TM extends BaseMetadata, CM extends BaseMetadata> = PagedAsyncSuccess<ThreadData<TM, CM>[], "threads">;
|
|
266
|
+
type ThreadsAsyncResult<TM extends BaseMetadata, CM extends BaseMetadata> = PagedAsyncResult<ThreadData<TM, CM>[], "threads">;
|
|
258
267
|
type SearchCommentsAsyncResult = AsyncResult<Array<SearchCommentsResult>, "results">;
|
|
259
268
|
type InboxNotificationsAsyncSuccess = PagedAsyncSuccess<InboxNotificationData[], "inboxNotifications">;
|
|
260
269
|
type InboxNotificationsAsyncResult = PagedAsyncResult<InboxNotificationData[], "inboxNotifications">;
|
|
@@ -290,6 +299,12 @@ type RoomProviderProps<P extends JsonObject, S extends LsonObject> = Resolve<{
|
|
|
290
299
|
* only on the client side.
|
|
291
300
|
*/
|
|
292
301
|
autoConnect?: boolean;
|
|
302
|
+
/**
|
|
303
|
+
* @private Preferred storage engine version to use when creating the
|
|
304
|
+
* room. Only takes effect if the room doesn't exist yet. Version
|
|
305
|
+
* 2 supports streaming and will become the default in the future.
|
|
306
|
+
*/
|
|
307
|
+
engine?: 1 | 2;
|
|
293
308
|
} & PartialUnless<P, {
|
|
294
309
|
/**
|
|
295
310
|
* The initial Presence to use and announce when you enter the Room. The
|
|
@@ -487,13 +502,13 @@ type SharedContextBundle<U extends BaseUserMeta> = {
|
|
|
487
502
|
/**
|
|
488
503
|
* Properties that are the same in RoomContext and RoomContext["suspense"].
|
|
489
504
|
*/
|
|
490
|
-
type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json,
|
|
505
|
+
type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json, TM extends BaseMetadata, CM extends BaseMetadata> = {
|
|
491
506
|
/**
|
|
492
507
|
* You normally don't need to directly interact with the RoomContext, but
|
|
493
508
|
* it can be necessary if you're building an advanced app where you need to
|
|
494
509
|
* set up a context bridge between two React renderers.
|
|
495
510
|
*/
|
|
496
|
-
RoomContext: Context<Room<P, S, U, E,
|
|
511
|
+
RoomContext: Context<Room<P, S, U, E, TM, CM> | null>;
|
|
497
512
|
/**
|
|
498
513
|
* Makes a Room available in the component hierarchy below.
|
|
499
514
|
* Joins the room when the component is mounted, and automatically leaves
|
|
@@ -506,10 +521,10 @@ type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject, U exten
|
|
|
506
521
|
*/
|
|
507
522
|
useRoom(options?: {
|
|
508
523
|
allowOutsideRoom: false;
|
|
509
|
-
}): Room<P, S, U, E,
|
|
524
|
+
}): Room<P, S, U, E, TM, CM>;
|
|
510
525
|
useRoom(options: {
|
|
511
526
|
allowOutsideRoom: boolean;
|
|
512
|
-
}): Room<P, S, U, E,
|
|
527
|
+
}): Room<P, S, U, E, TM, CM> | null;
|
|
513
528
|
/**
|
|
514
529
|
* Returns the current connection status for the Room, and triggers
|
|
515
530
|
* a re-render whenever it changes. Can be used to render a status badge.
|
|
@@ -780,7 +795,7 @@ type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject, U exten
|
|
|
780
795
|
* const createThread = useCreateThread();
|
|
781
796
|
* createThread({ body: {}, metadata: {} });
|
|
782
797
|
*/
|
|
783
|
-
useCreateThread(): (options: CreateThreadOptions<
|
|
798
|
+
useCreateThread(): (options: CreateThreadOptions<TM, CM>) => ThreadData<TM, CM>;
|
|
784
799
|
/**
|
|
785
800
|
* Returns a function that deletes a thread and its associated comments.
|
|
786
801
|
* Only the thread creator can delete a thread, it will throw otherwise.
|
|
@@ -798,7 +813,7 @@ type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject, U exten
|
|
|
798
813
|
* const editThreadMetadata = useEditThreadMetadata();
|
|
799
814
|
* editThreadMetadata({ threadId: "th_xxx", metadata: {} })
|
|
800
815
|
*/
|
|
801
|
-
useEditThreadMetadata(): (options: EditThreadMetadataOptions<
|
|
816
|
+
useEditThreadMetadata(): (options: EditThreadMetadataOptions<TM>) => void;
|
|
802
817
|
/**
|
|
803
818
|
* Returns a function that marks a thread as resolved.
|
|
804
819
|
*
|
|
@@ -838,15 +853,24 @@ type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject, U exten
|
|
|
838
853
|
* const createComment = useCreateComment();
|
|
839
854
|
* createComment({ threadId: "th_xxx", body: {} });
|
|
840
855
|
*/
|
|
841
|
-
useCreateComment(): (options: CreateCommentOptions) => CommentData
|
|
856
|
+
useCreateComment(): (options: CreateCommentOptions<CM>) => CommentData<CM>;
|
|
842
857
|
/**
|
|
843
|
-
* Returns a function that edits a comment
|
|
858
|
+
* Returns a function that edits a comment.
|
|
844
859
|
*
|
|
845
860
|
* @example
|
|
846
861
|
* const editComment = useEditComment()
|
|
847
862
|
* editComment({ threadId: "th_xxx", commentId: "cm_xxx", body: {} })
|
|
848
863
|
*/
|
|
849
|
-
useEditComment(): (options: EditCommentOptions) => void;
|
|
864
|
+
useEditComment(): (options: EditCommentOptions<CM>) => void;
|
|
865
|
+
/**
|
|
866
|
+
* Returns a function that edits a comment's metadata.
|
|
867
|
+
* To delete an existing metadata property, set its value to `null`.
|
|
868
|
+
*
|
|
869
|
+
* @example
|
|
870
|
+
* const editCommentMetadata = useEditCommentMetadata();
|
|
871
|
+
* editCommentMetadata({ threadId: "th_xxx", commentId: "cm_xxx", metadata: { slackChannelId: "C024BE91L", slackMessageTs: "1700311782.001200" } })
|
|
872
|
+
*/
|
|
873
|
+
useEditCommentMetadata(): (options: EditCommentMetadataOptions<CM>) => void;
|
|
850
874
|
/**
|
|
851
875
|
* Returns a function that deletes a comment.
|
|
852
876
|
* If it is the last non-deleted comment, the thread also gets deleted.
|
|
@@ -898,7 +922,7 @@ type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject, U exten
|
|
|
898
922
|
*/
|
|
899
923
|
useThreadSubscription(threadId: string): ThreadSubscription;
|
|
900
924
|
};
|
|
901
|
-
type RoomContextBundle<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json,
|
|
925
|
+
type RoomContextBundle<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json, TM extends BaseMetadata, CM extends BaseMetadata> = Resolve<RoomContextBundleCommon<P, S, U, E, TM, CM> & SharedContextBundle<U>["classic"] & {
|
|
902
926
|
/**
|
|
903
927
|
* Extract arbitrary data from the Liveblocks Storage state, using an
|
|
904
928
|
* arbitrary selector function.
|
|
@@ -959,14 +983,14 @@ type RoomContextBundle<P extends JsonObject, S extends LsonObject, U extends Bas
|
|
|
959
983
|
* @example
|
|
960
984
|
* const { threads, error, isLoading } = useThreads();
|
|
961
985
|
*/
|
|
962
|
-
useThreads(options?: UseThreadsOptions<
|
|
986
|
+
useThreads(options?: UseThreadsOptions<TM>): ThreadsAsyncResult<TM, CM>;
|
|
963
987
|
/**
|
|
964
988
|
* Returns the result of searching comments by text in the current room. The result includes the id and the plain text content of the matched comments along with the parent thread id of the comment.
|
|
965
989
|
*
|
|
966
990
|
* @example
|
|
967
991
|
* const { results, error, isLoading } = useSearchComments({ query: { text: "hello"} });
|
|
968
992
|
*/
|
|
969
|
-
useSearchComments(options: UseSearchCommentsOptions<
|
|
993
|
+
useSearchComments(options: UseSearchCommentsOptions<TM>): SearchCommentsAsyncResult;
|
|
970
994
|
/**
|
|
971
995
|
* Returns the user's subscription settings for the current room
|
|
972
996
|
* and a function to update them.
|
|
@@ -999,7 +1023,7 @@ type RoomContextBundle<P extends JsonObject, S extends LsonObject, U extends Bas
|
|
|
999
1023
|
* const { data, error, isLoading } = useHistoryVersionData(version.id);
|
|
1000
1024
|
*/
|
|
1001
1025
|
useHistoryVersionData(id: string): HistoryVersionDataAsyncResult;
|
|
1002
|
-
suspense: Resolve<RoomContextBundleCommon<P, S, U, E,
|
|
1026
|
+
suspense: Resolve<RoomContextBundleCommon<P, S, U, E, TM, CM> & SharedContextBundle<U>["suspense"] & {
|
|
1003
1027
|
/**
|
|
1004
1028
|
* Extract arbitrary data from the Liveblocks Storage state, using an
|
|
1005
1029
|
* arbitrary selector function.
|
|
@@ -1054,7 +1078,7 @@ type RoomContextBundle<P extends JsonObject, S extends LsonObject, U extends Bas
|
|
|
1054
1078
|
* @example
|
|
1055
1079
|
* const { threads } = useThreads();
|
|
1056
1080
|
*/
|
|
1057
|
-
useThreads(options?: UseThreadsOptions<
|
|
1081
|
+
useThreads(options?: UseThreadsOptions<TM>): ThreadsAsyncSuccess<TM, CM>;
|
|
1058
1082
|
/**
|
|
1059
1083
|
* (Private beta) Returns a history of versions of the current room.
|
|
1060
1084
|
*
|
|
@@ -1085,7 +1109,7 @@ type RoomContextBundle<P extends JsonObject, S extends LsonObject, U extends Bas
|
|
|
1085
1109
|
/**
|
|
1086
1110
|
* Properties that are the same in LiveblocksContext and LiveblocksContext["suspense"].
|
|
1087
1111
|
*/
|
|
1088
|
-
type LiveblocksContextBundleCommon<
|
|
1112
|
+
type LiveblocksContextBundleCommon<TM extends BaseMetadata, CM extends BaseMetadata> = {
|
|
1089
1113
|
/**
|
|
1090
1114
|
* Makes Liveblocks features outside of rooms (e.g. Notifications) available
|
|
1091
1115
|
* in the component hierarchy below.
|
|
@@ -1138,7 +1162,7 @@ type LiveblocksContextBundleCommon<M extends BaseMetadata> = {
|
|
|
1138
1162
|
* @example
|
|
1139
1163
|
* const thread = useInboxNotificationThread("in_xxx");
|
|
1140
1164
|
*/
|
|
1141
|
-
useInboxNotificationThread(inboxNotificationId: string): ThreadData<
|
|
1165
|
+
useInboxNotificationThread(inboxNotificationId: string): ThreadData<TM, CM>;
|
|
1142
1166
|
/**
|
|
1143
1167
|
* Returns notification settings for the current user.
|
|
1144
1168
|
*
|
|
@@ -1259,7 +1283,7 @@ type LiveblocksContextBundleCommon<M extends BaseMetadata> = {
|
|
|
1259
1283
|
(options: WithRequired<SendAiMessageOptions, "chatId">): AiUserMessage;
|
|
1260
1284
|
};
|
|
1261
1285
|
};
|
|
1262
|
-
type LiveblocksContextBundle<U extends BaseUserMeta,
|
|
1286
|
+
type LiveblocksContextBundle<U extends BaseUserMeta, TM extends BaseMetadata, CM extends BaseMetadata> = Resolve<LiveblocksContextBundleCommon<TM, CM> & SharedContextBundle<U>["classic"] & {
|
|
1263
1287
|
/**
|
|
1264
1288
|
* Returns the inbox notifications for the current user.
|
|
1265
1289
|
*
|
|
@@ -1280,7 +1304,7 @@ type LiveblocksContextBundle<U extends BaseUserMeta, M extends BaseMetadata> = R
|
|
|
1280
1304
|
* This hook is experimental and could be removed or changed at any time!
|
|
1281
1305
|
* Do not use unless explicitly recommended by the Liveblocks team.
|
|
1282
1306
|
*/
|
|
1283
|
-
useUserThreads_experimental(options?: UseUserThreadsOptions<
|
|
1307
|
+
useUserThreads_experimental(options?: UseUserThreadsOptions<TM>): ThreadsAsyncResult<TM, CM>;
|
|
1284
1308
|
/**
|
|
1285
1309
|
* (Private beta) Returns the chats for the current user.
|
|
1286
1310
|
*
|
|
@@ -1332,7 +1356,7 @@ type LiveblocksContextBundle<U extends BaseUserMeta, M extends BaseMetadata> = R
|
|
|
1332
1356
|
* const { metadata, error, isLoading } = useUrlMetadata("https://liveblocks.io");
|
|
1333
1357
|
*/
|
|
1334
1358
|
useUrlMetadata(url: string): UrlMetadataAsyncResult;
|
|
1335
|
-
suspense: Resolve<LiveblocksContextBundleCommon<
|
|
1359
|
+
suspense: Resolve<LiveblocksContextBundleCommon<TM, CM> & SharedContextBundle<U>["suspense"] & {
|
|
1336
1360
|
/**
|
|
1337
1361
|
* Returns the inbox notifications for the current user.
|
|
1338
1362
|
*
|
|
@@ -1363,7 +1387,7 @@ type LiveblocksContextBundle<U extends BaseUserMeta, M extends BaseMetadata> = R
|
|
|
1363
1387
|
* This hook is experimental and could be removed or changed at any time!
|
|
1364
1388
|
* Do not use unless explicitly recommended by the Liveblocks team.
|
|
1365
1389
|
*/
|
|
1366
|
-
useUserThreads_experimental(options?: UseUserThreadsOptions<
|
|
1390
|
+
useUserThreads_experimental(options?: UseUserThreadsOptions<TM>): ThreadsAsyncSuccess<TM, CM>;
|
|
1367
1391
|
/**
|
|
1368
1392
|
* (Private beta) Returns the chats for the current user.
|
|
1369
1393
|
*
|
|
@@ -1418,7 +1442,7 @@ type LiveblocksContextBundle<U extends BaseUserMeta, M extends BaseMetadata> = R
|
|
|
1418
1442
|
}>;
|
|
1419
1443
|
}>;
|
|
1420
1444
|
|
|
1421
|
-
type ReadonlyThreadDB<
|
|
1445
|
+
type ReadonlyThreadDB<TM extends BaseMetadata, CM extends BaseMetadata> = Omit<ThreadDB<TM, CM>, "upsert" | "delete" | "signal">;
|
|
1422
1446
|
/**
|
|
1423
1447
|
* This class implements a lightweight, in-memory, "database" for all Thread
|
|
1424
1448
|
* instances.
|
|
@@ -1436,20 +1460,20 @@ type ReadonlyThreadDB<M extends BaseMetadata> = Omit<ThreadDB<M>, "upsert" | "de
|
|
|
1436
1460
|
* optimistic updates without losing the original thread contents.
|
|
1437
1461
|
*
|
|
1438
1462
|
*/
|
|
1439
|
-
declare class ThreadDB<
|
|
1463
|
+
declare class ThreadDB<TM extends BaseMetadata, CM extends BaseMetadata> {
|
|
1440
1464
|
#private;
|
|
1441
1465
|
readonly signal: MutableSignal<this>;
|
|
1442
1466
|
constructor();
|
|
1443
|
-
clone(): ThreadDB<
|
|
1467
|
+
clone(): ThreadDB<TM, CM>;
|
|
1444
1468
|
/** Returns an existing thread by ID. Will never return a deleted thread. */
|
|
1445
|
-
get(threadId: string): ThreadData<
|
|
1469
|
+
get(threadId: string): ThreadData<TM, CM> | undefined;
|
|
1446
1470
|
/** Returns the (possibly deleted) thread by ID. */
|
|
1447
|
-
getEvenIfDeleted(threadId: string): ThreadDataWithDeleteInfo<
|
|
1471
|
+
getEvenIfDeleted(threadId: string): ThreadDataWithDeleteInfo<TM, CM> | undefined;
|
|
1448
1472
|
/** Adds or updates a thread in the DB. If the newly given thread is a deleted one, it will get deleted. */
|
|
1449
|
-
upsert(thread: ThreadDataWithDeleteInfo<
|
|
1473
|
+
upsert(thread: ThreadDataWithDeleteInfo<TM, CM>): void;
|
|
1450
1474
|
/** Like .upsert(), except it won't update if a thread by this ID already exists. */
|
|
1451
|
-
upsertIfNewer(thread: ThreadDataWithDeleteInfo<
|
|
1452
|
-
applyDelta(newThreads: ThreadData<
|
|
1475
|
+
upsertIfNewer(thread: ThreadDataWithDeleteInfo<TM, CM>): void;
|
|
1476
|
+
applyDelta(newThreads: ThreadData<TM, CM>[], deletedThreads: ThreadDeleteInfo[]): void;
|
|
1453
1477
|
/**
|
|
1454
1478
|
* Marks a thread as deleted. It will no longer pop up in .findMany()
|
|
1455
1479
|
* queries, but it can still be accessed via `.getEvenIfDeleted()`.
|
|
@@ -1468,15 +1492,15 @@ declare class ThreadDB<M extends BaseMetadata> {
|
|
|
1468
1492
|
*
|
|
1469
1493
|
* Subscriptions are needed to filter threads based on the user's subscriptions.
|
|
1470
1494
|
*/
|
|
1471
|
-
findMany(roomId: string | undefined, query: ThreadsQuery<
|
|
1495
|
+
findMany(roomId: string | undefined, query: ThreadsQuery<TM> | undefined, direction: "asc" | "desc", subscriptions: Record<SubscriptionKey, SubscriptionData> | undefined): ThreadData<TM, CM>[];
|
|
1472
1496
|
}
|
|
1473
1497
|
|
|
1474
|
-
type OptimisticUpdate<
|
|
1475
|
-
type CreateThreadOptimisticUpdate<
|
|
1498
|
+
type OptimisticUpdate<TM extends BaseMetadata, CM extends BaseMetadata> = CreateThreadOptimisticUpdate<TM, CM> | DeleteThreadOptimisticUpdate | EditThreadMetadataOptimisticUpdate<TM> | MarkThreadAsResolvedOptimisticUpdate | MarkThreadAsUnresolvedOptimisticUpdate | SubscribeToThreadOptimisticUpdate | UnsubscribeFromThreadOptimisticUpdate | CreateCommentOptimisticUpdate<CM> | EditCommentOptimisticUpdate<CM> | EditCommentMetadataOptimisticUpdate<CM> | DeleteCommentOptimisticUpdate | AddReactionOptimisticUpdate | RemoveReactionOptimisticUpdate | MarkInboxNotificationAsReadOptimisticUpdate | MarkAllInboxNotificationsAsReadOptimisticUpdate | DeleteInboxNotificationOptimisticUpdate | DeleteAllInboxNotificationsOptimisticUpdate | UpdateRoomSubscriptionSettingsOptimisticUpdate | UpdateNotificationSettingsOptimisticUpdate;
|
|
1499
|
+
type CreateThreadOptimisticUpdate<TM extends BaseMetadata, CM extends BaseMetadata> = {
|
|
1476
1500
|
type: "create-thread";
|
|
1477
1501
|
id: string;
|
|
1478
1502
|
roomId: string;
|
|
1479
|
-
thread: ThreadData<
|
|
1503
|
+
thread: ThreadData<TM, CM>;
|
|
1480
1504
|
};
|
|
1481
1505
|
type DeleteThreadOptimisticUpdate = {
|
|
1482
1506
|
type: "delete-thread";
|
|
@@ -1485,11 +1509,11 @@ type DeleteThreadOptimisticUpdate = {
|
|
|
1485
1509
|
threadId: string;
|
|
1486
1510
|
deletedAt: Date;
|
|
1487
1511
|
};
|
|
1488
|
-
type EditThreadMetadataOptimisticUpdate<
|
|
1512
|
+
type EditThreadMetadataOptimisticUpdate<TM extends BaseMetadata> = {
|
|
1489
1513
|
type: "edit-thread-metadata";
|
|
1490
1514
|
id: string;
|
|
1491
1515
|
threadId: string;
|
|
1492
|
-
metadata: Resolve<Patchable<
|
|
1516
|
+
metadata: Resolve<Patchable<TM>>;
|
|
1493
1517
|
updatedAt: Date;
|
|
1494
1518
|
};
|
|
1495
1519
|
type MarkThreadAsResolvedOptimisticUpdate = {
|
|
@@ -1516,15 +1540,23 @@ type UnsubscribeFromThreadOptimisticUpdate = {
|
|
|
1516
1540
|
threadId: string;
|
|
1517
1541
|
unsubscribedAt: Date;
|
|
1518
1542
|
};
|
|
1519
|
-
type CreateCommentOptimisticUpdate = {
|
|
1543
|
+
type CreateCommentOptimisticUpdate<CM extends BaseMetadata> = {
|
|
1520
1544
|
type: "create-comment";
|
|
1521
1545
|
id: string;
|
|
1522
|
-
comment: CommentData
|
|
1546
|
+
comment: CommentData<CM>;
|
|
1523
1547
|
};
|
|
1524
|
-
type EditCommentOptimisticUpdate = {
|
|
1548
|
+
type EditCommentOptimisticUpdate<CM extends BaseMetadata> = {
|
|
1525
1549
|
type: "edit-comment";
|
|
1526
1550
|
id: string;
|
|
1527
|
-
comment: CommentData
|
|
1551
|
+
comment: CommentData<CM>;
|
|
1552
|
+
};
|
|
1553
|
+
type EditCommentMetadataOptimisticUpdate<CM extends BaseMetadata> = {
|
|
1554
|
+
type: "edit-comment-metadata";
|
|
1555
|
+
id: string;
|
|
1556
|
+
threadId: string;
|
|
1557
|
+
commentId: string;
|
|
1558
|
+
metadata: Resolve<Patchable<CM>>;
|
|
1559
|
+
updatedAt: Date;
|
|
1528
1560
|
};
|
|
1529
1561
|
type DeleteCommentOptimisticUpdate = {
|
|
1530
1562
|
type: "delete-comment";
|
|
@@ -1620,14 +1652,14 @@ type NotificationsLUT = Map<string, InboxNotificationData>;
|
|
|
1620
1652
|
*/
|
|
1621
1653
|
type RoomSubscriptionSettingsByRoomId = Record<RoomId, RoomSubscriptionSettings$1>;
|
|
1622
1654
|
type SubscriptionsByKey = Record<SubscriptionKey, SubscriptionData>;
|
|
1623
|
-
type CleanThreadifications<
|
|
1624
|
-
type CleanThreads<
|
|
1655
|
+
type CleanThreadifications<TM extends BaseMetadata, CM extends BaseMetadata> = CleanThreads<TM, CM> & CleanNotifications;
|
|
1656
|
+
type CleanThreads<TM extends BaseMetadata, CM extends BaseMetadata> = {
|
|
1625
1657
|
/**
|
|
1626
1658
|
* Keep track of loading and error status of all the queries made by the client.
|
|
1627
1659
|
* e.g. 'room-abc-{"color":"red"}' - ok
|
|
1628
1660
|
* e.g. 'room-abc-{}' - loading
|
|
1629
1661
|
*/
|
|
1630
|
-
threadsDB: ReadonlyThreadDB<
|
|
1662
|
+
threadsDB: ReadonlyThreadDB<TM, CM>;
|
|
1631
1663
|
};
|
|
1632
1664
|
type CleanNotifications = {
|
|
1633
1665
|
/**
|
|
@@ -1662,7 +1694,7 @@ declare function createStore_forNotifications(): {
|
|
|
1662
1694
|
delete: (inboxNotificationId: string) => void;
|
|
1663
1695
|
applyDelta: (newNotifications: InboxNotificationData[], deletedNotifications: InboxNotificationDeleteInfo[]) => void;
|
|
1664
1696
|
clear: () => void;
|
|
1665
|
-
updateAssociatedNotification: (newComment: CommentData) => void;
|
|
1697
|
+
updateAssociatedNotification: <CM extends BaseMetadata>(newComment: CommentData<CM>) => void;
|
|
1666
1698
|
upsert: (notification: InboxNotificationData) => void;
|
|
1667
1699
|
};
|
|
1668
1700
|
declare function createStore_forUnreadNotificationsCount(): {
|
|
@@ -1671,13 +1703,13 @@ declare function createStore_forUnreadNotificationsCount(): {
|
|
|
1671
1703
|
}>;
|
|
1672
1704
|
update: (queryKey: InboxNotificationsQueryKey, count: number) => void;
|
|
1673
1705
|
};
|
|
1674
|
-
declare function createStore_forSubscriptions(updates: ISignal<readonly OptimisticUpdate<BaseMetadata>[]>, threads: ReadonlyThreadDB<BaseMetadata>): {
|
|
1706
|
+
declare function createStore_forSubscriptions(updates: ISignal<readonly OptimisticUpdate<BaseMetadata, BaseMetadata>[]>, threads: ReadonlyThreadDB<BaseMetadata, BaseMetadata>): {
|
|
1675
1707
|
signal: DerivedSignal<SubscriptionsByKey>;
|
|
1676
1708
|
applyDelta: (newSubscriptions: SubscriptionData[], deletedSubscriptions: SubscriptionDeleteInfo[]) => void;
|
|
1677
1709
|
create: (subscription: SubscriptionData) => void;
|
|
1678
1710
|
delete: (subscriptionKey: SubscriptionKey) => void;
|
|
1679
1711
|
};
|
|
1680
|
-
declare function createStore_forRoomSubscriptionSettings(updates: ISignal<readonly OptimisticUpdate<BaseMetadata>[]>): {
|
|
1712
|
+
declare function createStore_forRoomSubscriptionSettings(updates: ISignal<readonly OptimisticUpdate<BaseMetadata, BaseMetadata>[]>): {
|
|
1681
1713
|
signal: DerivedSignal<RoomSubscriptionSettingsByRoomId>;
|
|
1682
1714
|
update: (roomId: string, settings: RoomSubscriptionSettings$1) => void;
|
|
1683
1715
|
};
|
|
@@ -1717,18 +1749,18 @@ declare function createStore_forPermissionHints(): {
|
|
|
1717
1749
|
* }
|
|
1718
1750
|
* e.g. {} when before the first successful fetch.
|
|
1719
1751
|
*/
|
|
1720
|
-
declare function createStore_forNotificationSettings(updates: ISignal<readonly OptimisticUpdate<BaseMetadata>[]>): {
|
|
1752
|
+
declare function createStore_forNotificationSettings(updates: ISignal<readonly OptimisticUpdate<BaseMetadata, BaseMetadata>[]>): {
|
|
1721
1753
|
signal: DerivedSignal<NotificationSettings>;
|
|
1722
1754
|
update: (settings: NotificationSettings) => void;
|
|
1723
1755
|
};
|
|
1724
|
-
declare function createStore_forOptimistic<
|
|
1725
|
-
signal: ISignal<readonly OptimisticUpdate<
|
|
1726
|
-
add: (optimisticUpdate: DistributiveOmit<OptimisticUpdate<
|
|
1756
|
+
declare function createStore_forOptimistic<TM extends BaseMetadata, CM extends BaseMetadata>(client: Client$1<BaseUserMeta$1, TM, CM>): {
|
|
1757
|
+
signal: ISignal<readonly OptimisticUpdate<TM, CM>[]>;
|
|
1758
|
+
add: (optimisticUpdate: DistributiveOmit<OptimisticUpdate<TM, CM>, "id">) => string;
|
|
1727
1759
|
remove: (optimisticId: string) => void;
|
|
1728
1760
|
};
|
|
1729
|
-
declare class UmbrellaStore<
|
|
1761
|
+
declare class UmbrellaStore<TM extends BaseMetadata, CM extends BaseMetadata> {
|
|
1730
1762
|
#private;
|
|
1731
|
-
readonly threads: ThreadDB<
|
|
1763
|
+
readonly threads: ThreadDB<TM, CM>;
|
|
1732
1764
|
readonly notifications: ReturnType<typeof createStore_forNotifications>;
|
|
1733
1765
|
readonly subscriptions: ReturnType<typeof createStore_forSubscriptions>;
|
|
1734
1766
|
readonly roomSubscriptionSettings: ReturnType<typeof createStore_forRoomSubscriptionSettings>;
|
|
@@ -1737,12 +1769,12 @@ declare class UmbrellaStore<M extends BaseMetadata> {
|
|
|
1737
1769
|
readonly urlsMetadata: ReturnType<typeof createStore_forUrlsMetadata>;
|
|
1738
1770
|
readonly permissionHints: ReturnType<typeof createStore_forPermissionHints>;
|
|
1739
1771
|
readonly notificationSettings: ReturnType<typeof createStore_forNotificationSettings>;
|
|
1740
|
-
readonly optimisticUpdates: ReturnType<typeof createStore_forOptimistic<
|
|
1772
|
+
readonly optimisticUpdates: ReturnType<typeof createStore_forOptimistic<TM, CM>>;
|
|
1741
1773
|
readonly outputs: {
|
|
1742
|
-
readonly threadifications: DerivedSignal<CleanThreadifications<
|
|
1743
|
-
readonly threads: DerivedSignal<ReadonlyThreadDB<
|
|
1744
|
-
readonly loadingRoomThreads: DefaultMap<RoomQueryKey, LoadableResource<ThreadsAsyncResult<
|
|
1745
|
-
readonly loadingUserThreads: DefaultMap<UserQueryKey, LoadableResource<ThreadsAsyncResult<
|
|
1774
|
+
readonly threadifications: DerivedSignal<CleanThreadifications<TM, CM>>;
|
|
1775
|
+
readonly threads: DerivedSignal<ReadonlyThreadDB<TM, CM>>;
|
|
1776
|
+
readonly loadingRoomThreads: DefaultMap<RoomQueryKey, LoadableResource<ThreadsAsyncResult<TM, CM>>>;
|
|
1777
|
+
readonly loadingUserThreads: DefaultMap<UserQueryKey, LoadableResource<ThreadsAsyncResult<TM, CM>>>;
|
|
1746
1778
|
readonly notifications: DerivedSignal<CleanNotifications>;
|
|
1747
1779
|
readonly threadSubscriptions: DerivedSignal<CleanThreadSubscriptions>;
|
|
1748
1780
|
readonly loadingNotifications: DefaultMap<InboxNotificationsQueryKey, LoadableResource<InboxNotificationsAsyncResult>>;
|
|
@@ -1787,9 +1819,9 @@ declare class UmbrellaStore<M extends BaseMetadata> {
|
|
|
1787
1819
|
/**
|
|
1788
1820
|
* Creates an new thread, replacing the corresponding optimistic update.
|
|
1789
1821
|
*/
|
|
1790
|
-
createThread(optimisticId: string, thread: Readonly<ThreadDataWithDeleteInfo<
|
|
1822
|
+
createThread(optimisticId: string, thread: Readonly<ThreadDataWithDeleteInfo<TM, CM>>): void;
|
|
1791
1823
|
patchThread(threadId: string, optimisticId: string | null, patch: {
|
|
1792
|
-
metadata?:
|
|
1824
|
+
metadata?: TM;
|
|
1793
1825
|
resolved?: boolean;
|
|
1794
1826
|
}, updatedAt: Date): void;
|
|
1795
1827
|
addReaction(threadId: string, optimisticId: string | null, commentId: string, reaction: CommentUserReaction, createdAt: Date): void;
|
|
@@ -1807,10 +1839,11 @@ declare class UmbrellaStore<M extends BaseMetadata> {
|
|
|
1807
1839
|
* Creates an existing comment and ensures the associated notification is
|
|
1808
1840
|
* updated correctly, replacing the corresponding optimistic update.
|
|
1809
1841
|
*/
|
|
1810
|
-
createComment(newComment: CommentData
|
|
1811
|
-
editComment(threadId: string, optimisticId: string, editedComment: CommentData): void;
|
|
1842
|
+
createComment(newComment: CommentData<CM>, optimisticId: string): void;
|
|
1843
|
+
editComment(threadId: string, optimisticId: string, editedComment: CommentData<CM>): void;
|
|
1844
|
+
editCommentMetadata(threadId: string, commentId: string, optimisticId: string, updatedMetadata: CM, updatedAt: Date): void;
|
|
1812
1845
|
deleteComment(threadId: string, optimisticId: string, commentId: string, deletedAt: Date): void;
|
|
1813
|
-
updateThreadifications(threads: ThreadData<
|
|
1846
|
+
updateThreadifications(threads: ThreadData<TM, CM>[], notifications: InboxNotificationData[], subscriptions: SubscriptionData[], deletedThreads?: ThreadDeleteInfo[], deletedNotifications?: InboxNotificationDeleteInfo[], deletedSubscriptions?: SubscriptionDeleteInfo[]): void;
|
|
1814
1847
|
/**
|
|
1815
1848
|
* Updates existing subscription settings for a room with a new value,
|
|
1816
1849
|
* replacing the corresponding optimistic update.
|
|
@@ -1838,7 +1871,7 @@ declare class UmbrellaStore<M extends BaseMetadata> {
|
|
|
1838
1871
|
*
|
|
1839
1872
|
* @private
|
|
1840
1873
|
*/
|
|
1841
|
-
declare function getUmbrellaStoreForClient<
|
|
1874
|
+
declare function getUmbrellaStoreForClient<TM extends BaseMetadata$1, CM extends BaseMetadata$1>(client: OpaqueClient): UmbrellaStore<TM, CM>;
|
|
1842
1875
|
/**
|
|
1843
1876
|
* Returns a function that creates an AI chat.
|
|
1844
1877
|
*
|
|
@@ -1940,7 +1973,7 @@ declare function LiveblocksProvider<U extends BaseUserMeta = DU>(props: PropsWit
|
|
|
1940
1973
|
* LiveblocksProvider created in this way takes no props, because it uses
|
|
1941
1974
|
* settings from the given client instead.
|
|
1942
1975
|
*/
|
|
1943
|
-
declare function createLiveblocksContext<U extends BaseUserMeta = DU,
|
|
1976
|
+
declare function createLiveblocksContext<U extends BaseUserMeta = DU, TM extends BaseMetadata$1 = DTM, CM extends BaseMetadata$1 = DCM>(client: OpaqueClient): LiveblocksContextBundle<U, TM, CM>;
|
|
1944
1977
|
/**
|
|
1945
1978
|
* Returns the inbox notifications for the current user.
|
|
1946
1979
|
*
|
|
@@ -2067,7 +2100,7 @@ declare function useGroupInfo(groupId: string): GroupInfoAsyncResult;
|
|
|
2067
2100
|
* const { info } = useGroupInfo("group-id");
|
|
2068
2101
|
*/
|
|
2069
2102
|
declare function useGroupInfoSuspense(groupId: string): GroupInfoAsyncSuccess;
|
|
2070
|
-
type TypedBundle$1 = LiveblocksContextBundle<DU,
|
|
2103
|
+
type TypedBundle$1 = LiveblocksContextBundle<DU, DTM, DCM>;
|
|
2071
2104
|
/**
|
|
2072
2105
|
* Returns the thread associated with a `"thread"` inbox notification.
|
|
2073
2106
|
*
|
|
@@ -2287,33 +2320,17 @@ declare function useOthersConnectionIds(): readonly number[];
|
|
|
2287
2320
|
/**
|
|
2288
2321
|
* @private
|
|
2289
2322
|
*/
|
|
2290
|
-
declare function useCreateRoomThread<
|
|
2323
|
+
declare function useCreateRoomThread<TM extends BaseMetadata$1, CM extends BaseMetadata$1>(roomId: string): (options: CreateThreadOptions<TM, CM>) => ThreadData$1<TM, CM>;
|
|
2291
2324
|
declare function useDeleteRoomThread(roomId: string): (threadId: string) => void;
|
|
2292
|
-
declare function useEditRoomThreadMetadata<
|
|
2293
|
-
/**
|
|
2294
|
-
* Returns a function that adds a comment to a thread.
|
|
2295
|
-
*
|
|
2296
|
-
* @example
|
|
2297
|
-
* const createComment = useCreateComment();
|
|
2298
|
-
* createComment({ threadId: "th_xxx", body: {} });
|
|
2299
|
-
*/
|
|
2300
|
-
declare function useCreateComment(): (options: CreateCommentOptions) => CommentData$1;
|
|
2325
|
+
declare function useEditRoomThreadMetadata<TM extends BaseMetadata$1>(roomId: string): (options: EditThreadMetadataOptions<TM>) => void;
|
|
2301
2326
|
/**
|
|
2302
2327
|
* @private
|
|
2303
2328
|
*/
|
|
2304
|
-
declare function useCreateRoomComment(roomId: string): (options: CreateCommentOptions) => CommentData$1
|
|
2305
|
-
/**
|
|
2306
|
-
* Returns a function that edits a comment's body.
|
|
2307
|
-
*
|
|
2308
|
-
* @example
|
|
2309
|
-
* const editComment = useEditComment()
|
|
2310
|
-
* editComment({ threadId: "th_xxx", commentId: "cm_xxx", body: {} })
|
|
2311
|
-
*/
|
|
2312
|
-
declare function useEditComment(): (options: EditCommentOptions) => void;
|
|
2329
|
+
declare function useCreateRoomComment<CM extends BaseMetadata$1>(roomId: string): (options: CreateCommentOptions<CM>) => CommentData$1<CM>;
|
|
2313
2330
|
/**
|
|
2314
2331
|
* @private
|
|
2315
2332
|
*/
|
|
2316
|
-
declare function useEditRoomComment(roomId: string): (options: EditCommentOptions) => void;
|
|
2333
|
+
declare function useEditRoomComment<CM extends BaseMetadata$1>(roomId: string): (options: EditCommentOptions<CM>) => void;
|
|
2317
2334
|
/**
|
|
2318
2335
|
* Returns a function that deletes a comment.
|
|
2319
2336
|
* If it is the last non-deleted comment, the thread also gets deleted.
|
|
@@ -2330,7 +2347,7 @@ declare function useDeleteRoomComment(roomId: string): ({ threadId, commentId }:
|
|
|
2330
2347
|
/**
|
|
2331
2348
|
* @private
|
|
2332
2349
|
*/
|
|
2333
|
-
declare function useAddRoomCommentReaction
|
|
2350
|
+
declare function useAddRoomCommentReaction(roomId: string): ({ threadId, commentId, emoji }: CommentReactionOptions) => void;
|
|
2334
2351
|
/**
|
|
2335
2352
|
* Returns a function that removes a reaction on a comment.
|
|
2336
2353
|
*
|
|
@@ -2469,8 +2486,8 @@ declare function useRoomPermissions(roomId: string): Set<_liveblocks_core.Permis
|
|
|
2469
2486
|
* that any RoomProvider created in this way does not need to be nested in
|
|
2470
2487
|
* LiveblocksProvider, as it already has access to the client.
|
|
2471
2488
|
*/
|
|
2472
|
-
declare function createRoomContext<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUserMeta = DU, E extends Json = DE,
|
|
2473
|
-
type TypedBundle = RoomContextBundle<DP, DS, DU, DE,
|
|
2489
|
+
declare function createRoomContext<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUserMeta = DU, E extends Json = DE, TM extends BaseMetadata$1 = DTM, CM extends BaseMetadata$1 = DCM>(client: OpaqueClient): RoomContextBundle<P, S, U, E, TM, CM>;
|
|
2490
|
+
type TypedBundle = RoomContextBundle<DP, DS, DU, DE, DTM, DCM>;
|
|
2474
2491
|
/**
|
|
2475
2492
|
* Makes a Room available in the component hierarchy below.
|
|
2476
2493
|
* Joins the room when the component is mounted, and automatically leaves
|
|
@@ -2589,6 +2606,31 @@ declare const _useDeleteThread: TypedBundle["useDeleteThread"];
|
|
|
2589
2606
|
* editThreadMetadata({ threadId: "th_xxx", metadata: {} })
|
|
2590
2607
|
*/
|
|
2591
2608
|
declare const _useEditThreadMetadata: TypedBundle["useEditThreadMetadata"];
|
|
2609
|
+
/**
|
|
2610
|
+
* Returns a function that adds a comment to a thread.
|
|
2611
|
+
*
|
|
2612
|
+
* @example
|
|
2613
|
+
* const createComment = useCreateComment();
|
|
2614
|
+
* createComment({ threadId: "th_xxx", body: {} });
|
|
2615
|
+
*/
|
|
2616
|
+
declare const _useCreateComment: TypedBundle["useCreateComment"];
|
|
2617
|
+
/**
|
|
2618
|
+
* Returns a function that edits a comment.
|
|
2619
|
+
*
|
|
2620
|
+
* @example
|
|
2621
|
+
* const editComment = useEditComment()
|
|
2622
|
+
* editComment({ threadId: "th_xxx", commentId: "cm_xxx", body: {} })
|
|
2623
|
+
*/
|
|
2624
|
+
declare const _useEditComment: TypedBundle["useEditComment"];
|
|
2625
|
+
/**
|
|
2626
|
+
* Returns a function that edits a comment's metadata.
|
|
2627
|
+
* To delete an existing metadata property, set its value to `null`.
|
|
2628
|
+
*
|
|
2629
|
+
* @example
|
|
2630
|
+
* const editCommentMetadata = useEditCommentMetadata();
|
|
2631
|
+
* editCommentMetadata({ threadId: "th_xxx", commentId: "cm_xxx", metadata: { slackChannelId: "C024BE91L", slackMessageTs: "1700311782.001200" } })
|
|
2632
|
+
*/
|
|
2633
|
+
declare const _useEditCommentMetadata: TypedBundle["useEditCommentMetadata"];
|
|
2592
2634
|
/**
|
|
2593
2635
|
* useEventListener is a React hook that allows you to respond to events broadcast
|
|
2594
2636
|
* by other users in the room.
|
|
@@ -2947,4 +2989,4 @@ declare const _useStorageRoot: TypedBundle["useStorageRoot"];
|
|
|
2947
2989
|
*/
|
|
2948
2990
|
declare const _useUpdateMyPresence: TypedBundle["useUpdateMyPresence"];
|
|
2949
2991
|
|
|
2950
|
-
export { _useEditThreadMetadata as $, type AiChatStatus as A, createLiveblocksContext as B, ClientContext as C, useDeleteAllInboxNotifications as D, useDeleteInboxNotification as E, useErrorListener as F, type GroupAsyncResult as G, useMarkAllInboxNotificationsAsRead as H, useMarkInboxNotificationAsRead as I, useSyncStatus as J, createRoomContext as K, LiveblocksProvider as L, type MutationContext as M, _RoomProvider as N, _useAddReaction as O, _useBroadcastEvent as P, useCanRedo as Q, type RegisterAiKnowledgeProps as R, type SendAiMessageOptions as S, useCanUndo as T, type UseSendAiMessageOptions as U,
|
|
2992
|
+
export { _useEditThreadMetadata as $, type AiChatStatus as A, createLiveblocksContext as B, ClientContext as C, useDeleteAllInboxNotifications as D, useDeleteInboxNotification as E, useErrorListener as F, type GroupAsyncResult as G, useMarkAllInboxNotificationsAsRead as H, useMarkInboxNotificationAsRead as I, useSyncStatus as J, createRoomContext as K, LiveblocksProvider as L, type MutationContext as M, _RoomProvider as N, _useAddReaction as O, _useBroadcastEvent as P, useCanRedo as Q, type RegisterAiKnowledgeProps as R, type SendAiMessageOptions as S, useCanUndo as T, type UseSendAiMessageOptions as U, _useCreateComment as V, _useCreateThread as W, useDeleteComment as X, _useDeleteThread as Y, _useEditComment as Z, _useInboxNotificationThread as _, useAddRoomCommentReaction as a, useGroupInfoSuspense as a$, _useEditCommentMetadata as a0, useMarkThreadAsResolved as a1, useMarkThreadAsUnresolved as a2, useSubscribeToThread as a3, useUnsubscribeFromThread as a4, _useEventListener as a5, useHistory as a6, _useIsInsideRoom as a7, useLostConnectionListener as a8, useMarkThreadAsRead as a9, useUpdateNotificationSettings as aA, useCreateAiChat as aB, useDeleteAiChat as aC, useSendAiMessage as aD, _useUserThreads_experimental as aE, useRoomInfo as aF, useGroupInfo as aG, useUnreadInboxNotificationsCount as aH, _useUser as aI, _useAiChat as aJ, _useAiChats as aK, _useAiChatMessages as aL, useAiChatStatus as aM, _useUrlMetadata as aN, _useOtherSuspense as aO, _useOthersSuspense as aP, useOthersConnectionIdsSuspense as aQ, _useOthersMappedSuspense as aR, _useSelfSuspense as aS, _useStorageSuspense as aT, _useThreadsSuspense as aU, useAttachmentUrlSuspense as aV, _useHistoryVersionsSuspense as aW, _useRoomSubscriptionSettingsSuspense as aX, useInboxNotificationsSuspense as aY, useNotificationSettingsSuspense as aZ, useRoomInfoSuspense as a_, _useMutation as aa, _useMyPresence as ab, _useOthersListener as ac, useRedo as ad, useRemoveReaction as ae, _useRoom as af, useStatus as ag, _useStorageRoot as ah, useThreadSubscription as ai, useUndo as aj, _useUpdateMyPresence as ak, useUpdateRoomSubscriptionSettings as al, useHistoryVersionData as am, _useOther as an, _useOthers as ao, useOthersConnectionIds as ap, _useOthersMapped as aq, _useSelf as ar, _useStorage as as, _useThreads as at, _useSearchComments as au, useAttachmentUrl as av, _useHistoryVersions as aw, _useRoomSubscriptionSettings as ax, useInboxNotifications as ay, useNotificationSettings as az, useCreateRoomComment as b, useUnreadInboxNotificationsCountSuspense as b0, _useUserSuspense as b1, _useUserThreadsSuspense_experimental as b2, _useAiChatsSuspense as b3, _useAiChatMessagesSuspense as b4, _useAiChatSuspense as b5, _useUrlMetadataSuspense as b6, useCreateRoomThread as c, useCreateTextMention as d, useDeleteRoomComment as e, useDeleteRoomThread as f, getUmbrellaStoreForClient as g, useDeleteTextMention as h, useEditRoomComment as i, useEditRoomThreadMetadata as j, useMarkRoomThreadAsRead as k, useMarkRoomThreadAsResolved as l, useMarkRoomThreadAsUnresolved as m, useMentionSuggestionsCache as n, useRemoveRoomCommentReaction as o, useReportTextEditor as p, useResolveMentionSuggestions as q, useRoomAttachmentUrl as r, useRoomPermissions as s, useRoomThreadSubscription as t, useClientOrNull as u, useYjsProvider as v, type RegisterAiToolProps as w, type UseThreadsOptions as x, RoomContext as y, useClient as z };
|