@liveblocks/react 2.15.1 → 2.16.0-rc1
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.d.mts +6 -4
- package/dist/_private.d.ts +6 -4
- package/dist/_private.js +9 -6
- package/dist/_private.js.map +1 -1
- package/dist/_private.mjs +10 -7
- package/dist/_private.mjs.map +1 -1
- package/dist/{chunk-WV5AI4AE.js → chunk-IFSN2WSB.js} +2 -2
- package/dist/chunk-IFSN2WSB.js.map +1 -0
- package/dist/{chunk-GMKB6I6V.mjs → chunk-JZBPCFEX.mjs} +567 -892
- package/dist/chunk-JZBPCFEX.mjs.map +1 -0
- package/dist/{chunk-NUDMG62P.js → chunk-NZL5WL5O.js} +571 -896
- package/dist/chunk-NZL5WL5O.js.map +1 -0
- package/dist/{chunk-UX3CG7ZS.mjs → chunk-SIZA7M3F.mjs} +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -4
- package/dist/index.mjs.map +1 -1
- package/dist/{room-XbmI0Hoh.d.mts → room-Ce3twcjb.d.mts} +148 -308
- package/dist/{room-XbmI0Hoh.d.ts → room-Ce3twcjb.d.ts} +148 -308
- package/dist/suspense.d.mts +1 -1
- package/dist/suspense.d.ts +1 -1
- package/dist/suspense.js +4 -4
- package/dist/suspense.js.map +1 -1
- package/dist/suspense.mjs +2 -2
- package/dist/suspense.mjs.map +1 -1
- package/package.json +6 -6
- package/dist/chunk-GMKB6I6V.mjs.map +0 -1
- package/dist/chunk-NUDMG62P.js.map +0 -1
- package/dist/chunk-WV5AI4AE.js.map +0 -1
- /package/dist/{chunk-UX3CG7ZS.mjs.map → chunk-SIZA7M3F.mjs.map} +0 -0
|
@@ -1,128 +1,21 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import * as react from 'react';
|
|
3
2
|
import { Context, PropsWithChildren, ReactNode } from 'react';
|
|
4
|
-
import { JsonObject, LsonObject, BaseUserMeta,
|
|
3
|
+
import { JsonObject, LsonObject, BaseUserMeta, Json, BaseMetadata, Room, LiveObject, User, RoomNotificationSettings, Status, BroadcastOptions, OthersEvent, LostConnectionEvent, History, Client as Client$1, ClientOptions, StorageStatus as StorageStatus$1, ThreadData as ThreadData$1, CommentData as CommentData$1 } from '@liveblocks/client';
|
|
5
4
|
import * as _liveblocks_core from '@liveblocks/core';
|
|
6
|
-
import {
|
|
5
|
+
import { OpaqueRoom, BaseMetadata as BaseMetadata$1, StorageStatus, QueryMetadata, AsyncResult, DRI, AsyncSuccess, Resolve, CommentBody, CommentAttachment, PartialUnless, Patchable, InboxNotificationData, Relax, ToImmutable, AsyncLoading, AsyncError, ThreadData, HistoryVersion, Client, LiveblocksError, SyncStatus, RoomEventMessage, CommentData, MutableSignal, ThreadDataWithDeleteInfo, ThreadDeleteInfo, DerivedSignal, DefaultMap, OpaqueClient, CommentUserReaction, InboxNotificationDeleteInfo, RoomNotificationSettings as RoomNotificationSettings$1, ISignal, Permission, BaseUserMeta as BaseUserMeta$1, DistributiveOmit, DU, DM, TextEditorType, IYjsProvider, DP, DS, DE } from '@liveblocks/core';
|
|
6
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
context: {
|
|
14
|
-
roomId: string;
|
|
15
|
-
threadId: string;
|
|
16
|
-
commentId: string;
|
|
17
|
-
body: CommentBody;
|
|
18
|
-
metadata: M;
|
|
19
|
-
};
|
|
20
|
-
constructor(cause: Error, context: {
|
|
21
|
-
roomId: string;
|
|
22
|
-
threadId: string;
|
|
23
|
-
commentId: string;
|
|
24
|
-
body: CommentBody;
|
|
25
|
-
metadata: M;
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* @private Internal API, do not rely on it.
|
|
30
|
-
*/
|
|
31
|
-
declare class EditThreadMetadataError<M extends BaseMetadata> extends Error {
|
|
32
|
-
cause: Error;
|
|
33
|
-
context: {
|
|
34
|
-
roomId: string;
|
|
35
|
-
threadId: string;
|
|
36
|
-
metadata: Patchable<M>;
|
|
37
|
-
};
|
|
38
|
-
constructor(cause: Error, context: {
|
|
39
|
-
roomId: string;
|
|
40
|
-
threadId: string;
|
|
41
|
-
metadata: Patchable<M>;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* @private Internal API, do not rely on it.
|
|
46
|
-
*/
|
|
47
|
-
declare class CreateCommentError extends Error {
|
|
48
|
-
cause: Error;
|
|
49
|
-
context: {
|
|
50
|
-
roomId: string;
|
|
51
|
-
threadId: string;
|
|
52
|
-
commentId: string;
|
|
53
|
-
body: CommentBody;
|
|
54
|
-
};
|
|
55
|
-
constructor(cause: Error, context: {
|
|
56
|
-
roomId: string;
|
|
57
|
-
threadId: string;
|
|
58
|
-
commentId: string;
|
|
59
|
-
body: CommentBody;
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* @private Internal API, do not rely on it.
|
|
64
|
-
*/
|
|
65
|
-
declare class EditCommentError extends Error {
|
|
66
|
-
cause: Error;
|
|
67
|
-
context: {
|
|
68
|
-
roomId: string;
|
|
69
|
-
threadId: string;
|
|
70
|
-
commentId: string;
|
|
71
|
-
body: CommentBody;
|
|
72
|
-
};
|
|
73
|
-
constructor(cause: Error, context: {
|
|
74
|
-
roomId: string;
|
|
75
|
-
threadId: string;
|
|
76
|
-
commentId: string;
|
|
77
|
-
body: CommentBody;
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* @private Internal API, do not rely on it.
|
|
82
|
-
*/
|
|
83
|
-
declare class DeleteCommentError extends Error {
|
|
84
|
-
cause: Error;
|
|
85
|
-
context: {
|
|
86
|
-
roomId: string;
|
|
87
|
-
threadId: string;
|
|
88
|
-
commentId: string;
|
|
89
|
-
};
|
|
90
|
-
constructor(cause: Error, context: {
|
|
91
|
-
roomId: string;
|
|
92
|
-
threadId: string;
|
|
93
|
-
commentId: string;
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* @private Internal API, do not rely on it.
|
|
98
|
-
*/
|
|
99
|
-
declare class MarkInboxNotificationAsReadError extends Error {
|
|
100
|
-
cause: Error;
|
|
101
|
-
context: {
|
|
102
|
-
inboxNotificationId: string;
|
|
103
|
-
};
|
|
104
|
-
constructor(cause: Error, context: {
|
|
105
|
-
inboxNotificationId: string;
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* @private Internal API, do not rely on it.
|
|
110
|
-
*/
|
|
111
|
-
declare class UpdateNotificationSettingsError extends Error {
|
|
112
|
-
cause: Error;
|
|
113
|
-
context: {
|
|
114
|
-
roomId: string;
|
|
115
|
-
};
|
|
116
|
-
constructor(cause: Error, context: {
|
|
117
|
-
roomId: string;
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* @private Internal API, do not rely on it.
|
|
9
|
+
* Raw access to the React context where the RoomProvider stores the current
|
|
10
|
+
* room. Exposed for advanced use cases only.
|
|
11
|
+
*
|
|
12
|
+
* @private This is a private/advanced API. Do not rely on it.
|
|
122
13
|
*/
|
|
123
|
-
declare
|
|
14
|
+
declare const RoomContext: react.Context<OpaqueRoom | null>;
|
|
15
|
+
/** @private */
|
|
16
|
+
declare function useRoomOrNull<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json, M extends BaseMetadata>(): Room<P, S, U, E, M> | null;
|
|
124
17
|
|
|
125
|
-
|
|
18
|
+
type UseSyncStatusOptions = {
|
|
126
19
|
/**
|
|
127
20
|
* When setting smooth, the hook will not update immediately as status
|
|
128
21
|
* changes. This is because in typical applications, these states can change
|
|
@@ -131,9 +24,9 @@ declare type UseSyncStatusOptions = {
|
|
|
131
24
|
*/
|
|
132
25
|
smooth?: boolean;
|
|
133
26
|
};
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
27
|
+
type UseStorageStatusOptions = UseSyncStatusOptions;
|
|
28
|
+
type StorageStatusSuccess = Exclude<StorageStatus, "not-loaded" | "loading">;
|
|
29
|
+
type ThreadsQuery<M extends BaseMetadata$1> = {
|
|
137
30
|
/**
|
|
138
31
|
* Whether to only return threads marked as resolved or unresolved. If not provided,
|
|
139
32
|
* all threads will be returned.
|
|
@@ -145,14 +38,14 @@ declare type ThreadsQuery<M extends BaseMetadata> = {
|
|
|
145
38
|
*/
|
|
146
39
|
metadata?: Partial<QueryMetadata<M>>;
|
|
147
40
|
};
|
|
148
|
-
|
|
41
|
+
type UseUserThreadsOptions<M extends BaseMetadata$1> = {
|
|
149
42
|
/**
|
|
150
43
|
* The query (including metadata) to filter the threads by. If provided, only threads
|
|
151
44
|
* that match the query will be returned. If not provided, all threads will be returned.
|
|
152
45
|
*/
|
|
153
46
|
query?: ThreadsQuery<M>;
|
|
154
47
|
};
|
|
155
|
-
|
|
48
|
+
type UseThreadsOptions<M extends BaseMetadata$1> = {
|
|
156
49
|
/**
|
|
157
50
|
* The query (including metadata) to filter the threads by. If provided, only threads
|
|
158
51
|
* that match the query will be returned. If not provided, all threads will be returned.
|
|
@@ -167,68 +60,62 @@ declare type UseThreadsOptions<M extends BaseMetadata> = {
|
|
|
167
60
|
*/
|
|
168
61
|
scrollOnLoad?: boolean;
|
|
169
62
|
};
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
63
|
+
type UserAsyncResult<T> = AsyncResult<T, "user">;
|
|
64
|
+
type UserAsyncSuccess<T> = AsyncSuccess<T, "user">;
|
|
65
|
+
type RoomInfoAsyncResult = AsyncResult<DRI, "info">;
|
|
66
|
+
type RoomInfoAsyncSuccess = AsyncSuccess<DRI, "info">;
|
|
67
|
+
type AttachmentUrlAsyncResult = AsyncResult<string, "url">;
|
|
68
|
+
type AttachmentUrlAsyncSuccess = AsyncSuccess<string, "url">;
|
|
69
|
+
type CreateThreadOptions<M extends BaseMetadata$1> = Resolve<{
|
|
177
70
|
body: CommentBody;
|
|
178
71
|
attachments?: CommentAttachment[];
|
|
179
72
|
} & PartialUnless<M, {
|
|
180
73
|
metadata: M;
|
|
181
74
|
}>>;
|
|
182
|
-
|
|
75
|
+
type EditThreadMetadataOptions<M extends BaseMetadata$1> = {
|
|
183
76
|
threadId: string;
|
|
184
77
|
metadata: Patchable<M>;
|
|
185
78
|
};
|
|
186
|
-
|
|
79
|
+
type CreateCommentOptions = {
|
|
187
80
|
threadId: string;
|
|
188
81
|
body: CommentBody;
|
|
189
82
|
attachments?: CommentAttachment[];
|
|
190
83
|
};
|
|
191
|
-
|
|
84
|
+
type EditCommentOptions = {
|
|
192
85
|
threadId: string;
|
|
193
86
|
commentId: string;
|
|
194
87
|
body: CommentBody;
|
|
195
88
|
attachments?: CommentAttachment[];
|
|
196
89
|
};
|
|
197
|
-
|
|
90
|
+
type DeleteCommentOptions = {
|
|
198
91
|
threadId: string;
|
|
199
92
|
commentId: string;
|
|
200
93
|
};
|
|
201
|
-
|
|
94
|
+
type CommentReactionOptions = {
|
|
202
95
|
threadId: string;
|
|
203
96
|
commentId: string;
|
|
204
97
|
emoji: string;
|
|
205
98
|
};
|
|
206
|
-
|
|
207
|
-
hasFetchedAll?: never;
|
|
208
|
-
isFetchingMore?: never;
|
|
209
|
-
fetchMore?: never;
|
|
210
|
-
fetchMoreError?: never;
|
|
211
|
-
};
|
|
212
|
-
declare type PaginationFields = {
|
|
99
|
+
type PaginationFields = {
|
|
213
100
|
hasFetchedAll: boolean;
|
|
214
101
|
isFetchingMore: boolean;
|
|
215
102
|
fetchMore: () => void;
|
|
216
103
|
fetchMoreError?: Error;
|
|
217
104
|
};
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
105
|
+
type PagedAsyncSuccess<T, F extends string> = Resolve<AsyncSuccess<T, F> & PaginationFields>;
|
|
106
|
+
type PagedAsyncResult<T, F extends string> = Relax<AsyncLoading<F> | AsyncError<F> | PagedAsyncSuccess<T, F>>;
|
|
107
|
+
type ThreadsAsyncSuccess<M extends BaseMetadata$1> = PagedAsyncSuccess<ThreadData<M>[], "threads">;
|
|
108
|
+
type ThreadsAsyncResult<M extends BaseMetadata$1> = PagedAsyncResult<ThreadData<M>[], "threads">;
|
|
109
|
+
type InboxNotificationsAsyncSuccess = PagedAsyncSuccess<InboxNotificationData[], "inboxNotifications">;
|
|
110
|
+
type InboxNotificationsAsyncResult = PagedAsyncResult<InboxNotificationData[], "inboxNotifications">;
|
|
111
|
+
type UnreadInboxNotificationsCountAsyncSuccess = AsyncSuccess<number, "count">;
|
|
112
|
+
type UnreadInboxNotificationsCountAsyncResult = AsyncResult<number, "count">;
|
|
113
|
+
type RoomNotificationSettingsAsyncSuccess = AsyncSuccess<RoomNotificationSettings, "settings">;
|
|
114
|
+
type RoomNotificationSettingsAsyncResult = AsyncResult<RoomNotificationSettings, "settings">;
|
|
115
|
+
type HistoryVersionDataAsyncResult = AsyncResult<Uint8Array>;
|
|
116
|
+
type HistoryVersionsAsyncSuccess = AsyncSuccess<HistoryVersion[], "versions">;
|
|
117
|
+
type HistoryVersionsAsyncResult = AsyncResult<HistoryVersion[], "versions">;
|
|
118
|
+
type RoomProviderProps<P extends JsonObject, S extends LsonObject> = Resolve<{
|
|
232
119
|
/**
|
|
233
120
|
* The id of the room you want to connect to
|
|
234
121
|
*/
|
|
@@ -259,8 +146,8 @@ declare type RoomProviderProps<P extends JsonObject, S extends LsonObject> = Res
|
|
|
259
146
|
* For any function type, returns a similar function type, but without the
|
|
260
147
|
* first argument.
|
|
261
148
|
*/
|
|
262
|
-
|
|
263
|
-
|
|
149
|
+
type OmitFirstArg<F> = F extends (first: any, ...rest: infer A) => infer R ? (...args: A) => R : never;
|
|
150
|
+
type MutationContext<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta> = {
|
|
264
151
|
storage: LiveObject<S>;
|
|
265
152
|
self: User<P, U>;
|
|
266
153
|
others: readonly User<P, U>[];
|
|
@@ -268,17 +155,16 @@ declare type MutationContext<P extends JsonObject, S extends LsonObject, U exten
|
|
|
268
155
|
addToHistory: boolean;
|
|
269
156
|
}) => void;
|
|
270
157
|
};
|
|
271
|
-
|
|
158
|
+
type ThreadSubscription = Relax<{
|
|
272
159
|
status: "not-subscribed";
|
|
273
|
-
unreadSince?: never;
|
|
274
160
|
} | {
|
|
275
161
|
status: "subscribed";
|
|
276
162
|
unreadSince: null;
|
|
277
163
|
} | {
|
|
278
164
|
status: "subscribed";
|
|
279
165
|
unreadSince: Date;
|
|
280
|
-
}
|
|
281
|
-
|
|
166
|
+
}>;
|
|
167
|
+
type SharedContextBundle<U extends BaseUserMeta> = {
|
|
282
168
|
classic: {
|
|
283
169
|
/**
|
|
284
170
|
* Obtains a reference to the current Liveblocks client.
|
|
@@ -305,6 +191,17 @@ declare type SharedContextBundle<U extends BaseUserMeta> = {
|
|
|
305
191
|
* const isInsideRoom = useIsInsideRoom();
|
|
306
192
|
*/
|
|
307
193
|
useIsInsideRoom(): boolean;
|
|
194
|
+
/**
|
|
195
|
+
* useErrorListener is a React hook that allows you to respond to any
|
|
196
|
+
* Liveblocks error, for example room connection errors, errors
|
|
197
|
+
* creating/editing/deleting threads, etc.
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* useErrorListener(err => {
|
|
201
|
+
* console.error(err);
|
|
202
|
+
* })
|
|
203
|
+
*/
|
|
204
|
+
useErrorListener(callback: (err: LiveblocksError) => void): void;
|
|
308
205
|
/**
|
|
309
206
|
* Returns the current Liveblocks sync status, and triggers a re-render
|
|
310
207
|
* whenever it changes. Can be used to render a "Saving..." indicator, or for
|
|
@@ -343,6 +240,17 @@ declare type SharedContextBundle<U extends BaseUserMeta> = {
|
|
|
343
240
|
* const isInsideRoom = useIsInsideRoom();
|
|
344
241
|
*/
|
|
345
242
|
useIsInsideRoom(): boolean;
|
|
243
|
+
/**
|
|
244
|
+
* useErrorListener is a React hook that allows you to respond to any
|
|
245
|
+
* Liveblocks error, for example room connection errors, errors
|
|
246
|
+
* creating/editing/deleting threads, etc.
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* useErrorListener(err => {
|
|
250
|
+
* console.error(err);
|
|
251
|
+
* })
|
|
252
|
+
*/
|
|
253
|
+
useErrorListener(callback: (err: LiveblocksError) => void): void;
|
|
346
254
|
/**
|
|
347
255
|
* Returns the current Liveblocks sync status, and triggers a re-render
|
|
348
256
|
* whenever it changes. Can be used to render a "Saving..." indicator, or for
|
|
@@ -359,7 +267,7 @@ declare type SharedContextBundle<U extends BaseUserMeta> = {
|
|
|
359
267
|
/**
|
|
360
268
|
* Properties that are the same in RoomContext and RoomContext["suspense"].
|
|
361
269
|
*/
|
|
362
|
-
|
|
270
|
+
type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json, M extends BaseMetadata$1> = {
|
|
363
271
|
/**
|
|
364
272
|
* You normally don't need to directly interact with the RoomContext, but
|
|
365
273
|
* it can be necessary if you're building an advanced app where you need to
|
|
@@ -435,16 +343,6 @@ declare type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject,
|
|
|
435
343
|
* })
|
|
436
344
|
*/
|
|
437
345
|
useLostConnectionListener(callback: (event: LostConnectionEvent) => void): void;
|
|
438
|
-
/**
|
|
439
|
-
* useErrorListener is a React hook that allows you to respond to potential room
|
|
440
|
-
* connection errors.
|
|
441
|
-
*
|
|
442
|
-
* @example
|
|
443
|
-
* useErrorListener(er => {
|
|
444
|
-
* console.error(er);
|
|
445
|
-
* })
|
|
446
|
-
*/
|
|
447
|
-
useErrorListener(callback: (err: LiveblocksError) => void): void;
|
|
448
346
|
/**
|
|
449
347
|
* useEventListener is a React hook that allows you to respond to events broadcast
|
|
450
348
|
* by other users in the room.
|
|
@@ -768,17 +666,7 @@ declare type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject,
|
|
|
768
666
|
*/
|
|
769
667
|
useThreadSubscription(threadId: string): ThreadSubscription;
|
|
770
668
|
};
|
|
771
|
-
|
|
772
|
-
* @private
|
|
773
|
-
*
|
|
774
|
-
* Private methods and variables used in the core internals, but as a user
|
|
775
|
-
* of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
|
|
776
|
-
* will probably happen if you do.
|
|
777
|
-
*/
|
|
778
|
-
declare type PrivateRoomContextApi = {
|
|
779
|
-
useCommentsErrorListener<M extends BaseMetadata>(callback: (err: CommentsError<M>) => void): void;
|
|
780
|
-
};
|
|
781
|
-
declare type RoomContextBundle<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json, M extends BaseMetadata> = Resolve<RoomContextBundleCommon<P, S, U, E, M> & SharedContextBundle<U>["classic"] & {
|
|
669
|
+
type RoomContextBundle<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json, M extends BaseMetadata$1> = Resolve<RoomContextBundleCommon<P, S, U, E, M> & SharedContextBundle<U>["classic"] & {
|
|
782
670
|
/**
|
|
783
671
|
* Returns the current storage status for the Room, and triggers
|
|
784
672
|
* a re-render whenever it changes. Can be used to render a "Saving..."
|
|
@@ -970,11 +858,11 @@ declare type RoomContextBundle<P extends JsonObject, S extends LsonObject, U ext
|
|
|
970
858
|
*/
|
|
971
859
|
useAttachmentUrl(attachmentId: string): AttachmentUrlAsyncSuccess;
|
|
972
860
|
}>;
|
|
973
|
-
}
|
|
861
|
+
}>;
|
|
974
862
|
/**
|
|
975
863
|
* Properties that are the same in LiveblocksContext and LiveblocksContext["suspense"].
|
|
976
864
|
*/
|
|
977
|
-
|
|
865
|
+
type LiveblocksContextBundleCommon<M extends BaseMetadata$1> = {
|
|
978
866
|
/**
|
|
979
867
|
* Makes Liveblocks features outside of rooms (e.g. Notifications) available
|
|
980
868
|
* in the component hierarchy below.
|
|
@@ -1040,7 +928,7 @@ declare type LiveblocksContextBundleCommon<M extends BaseMetadata> = {
|
|
|
1040
928
|
*/
|
|
1041
929
|
useSyncStatus(options?: UseSyncStatusOptions): SyncStatus;
|
|
1042
930
|
};
|
|
1043
|
-
|
|
931
|
+
type LiveblocksContextBundle<U extends BaseUserMeta, M extends BaseMetadata$1> = Resolve<LiveblocksContextBundleCommon<M> & SharedContextBundle<U>["classic"] & {
|
|
1044
932
|
/**
|
|
1045
933
|
* Returns the inbox notifications for the current user.
|
|
1046
934
|
*
|
|
@@ -1087,7 +975,7 @@ declare type LiveblocksContextBundle<U extends BaseUserMeta, M extends BaseMetad
|
|
|
1087
975
|
}>;
|
|
1088
976
|
}>;
|
|
1089
977
|
|
|
1090
|
-
|
|
978
|
+
type ReadonlyThreadDB<M extends BaseMetadata$1> = Omit<ThreadDB<M>, "upsert" | "delete" | "signal">;
|
|
1091
979
|
/**
|
|
1092
980
|
* This class implements a lightweight, in-memory, "database" for all Thread
|
|
1093
981
|
* instances.
|
|
@@ -1105,7 +993,7 @@ declare type ReadonlyThreadDB<M extends BaseMetadata> = Omit<ThreadDB<M>, "upser
|
|
|
1105
993
|
* optimistic updates without losing the original thread contents.
|
|
1106
994
|
*
|
|
1107
995
|
*/
|
|
1108
|
-
declare class ThreadDB<M extends BaseMetadata> {
|
|
996
|
+
declare class ThreadDB<M extends BaseMetadata$1> {
|
|
1109
997
|
#private;
|
|
1110
998
|
readonly signal: MutableSignal<this>;
|
|
1111
999
|
constructor();
|
|
@@ -1118,10 +1006,7 @@ declare class ThreadDB<M extends BaseMetadata> {
|
|
|
1118
1006
|
upsert(thread: ThreadDataWithDeleteInfo<M>): void;
|
|
1119
1007
|
/** Like .upsert(), except it won't update if a thread by this ID already exists. */
|
|
1120
1008
|
upsertIfNewer(thread: ThreadDataWithDeleteInfo<M>): void;
|
|
1121
|
-
applyDelta(
|
|
1122
|
-
newThreads: ThreadData<M>[];
|
|
1123
|
-
deletedThreads: ThreadDeleteInfo[];
|
|
1124
|
-
}): void;
|
|
1009
|
+
applyDelta(newThreads: ThreadData<M>[], deletedThreads: ThreadDeleteInfo[]): void;
|
|
1125
1010
|
/**
|
|
1126
1011
|
* Marks a thread as deleted. It will no longer pop up in .findMany()
|
|
1127
1012
|
* queries, but it can still be accessed via `.getEvenIfDeleted()`.
|
|
@@ -1141,50 +1026,50 @@ declare class ThreadDB<M extends BaseMetadata> {
|
|
|
1141
1026
|
findMany(roomId: string | undefined, query: ThreadsQuery<M>, direction: "asc" | "desc"): ThreadData<M>[];
|
|
1142
1027
|
}
|
|
1143
1028
|
|
|
1144
|
-
|
|
1145
|
-
|
|
1029
|
+
type OptimisticUpdate<M extends BaseMetadata$1> = CreateThreadOptimisticUpdate<M> | DeleteThreadOptimisticUpdate | EditThreadMetadataOptimisticUpdate<M> | MarkThreadAsResolvedOptimisticUpdate | MarkThreadAsUnresolvedOptimisticUpdate | CreateCommentOptimisticUpdate | EditCommentOptimisticUpdate | DeleteCommentOptimisticUpdate | AddReactionOptimisticUpdate | RemoveReactionOptimisticUpdate | MarkInboxNotificationAsReadOptimisticUpdate | MarkAllInboxNotificationsAsReadOptimisticUpdate | DeleteInboxNotificationOptimisticUpdate | DeleteAllInboxNotificationsOptimisticUpdate | UpdateNotificationSettingsOptimisticUpdate;
|
|
1030
|
+
type CreateThreadOptimisticUpdate<M extends BaseMetadata$1> = {
|
|
1146
1031
|
type: "create-thread";
|
|
1147
1032
|
id: string;
|
|
1148
1033
|
roomId: string;
|
|
1149
1034
|
thread: ThreadData<M>;
|
|
1150
1035
|
};
|
|
1151
|
-
|
|
1036
|
+
type DeleteThreadOptimisticUpdate = {
|
|
1152
1037
|
type: "delete-thread";
|
|
1153
1038
|
id: string;
|
|
1154
1039
|
roomId: string;
|
|
1155
1040
|
threadId: string;
|
|
1156
1041
|
deletedAt: Date;
|
|
1157
1042
|
};
|
|
1158
|
-
|
|
1043
|
+
type EditThreadMetadataOptimisticUpdate<M extends BaseMetadata$1> = {
|
|
1159
1044
|
type: "edit-thread-metadata";
|
|
1160
1045
|
id: string;
|
|
1161
1046
|
threadId: string;
|
|
1162
1047
|
metadata: Resolve<Patchable<M>>;
|
|
1163
1048
|
updatedAt: Date;
|
|
1164
1049
|
};
|
|
1165
|
-
|
|
1050
|
+
type MarkThreadAsResolvedOptimisticUpdate = {
|
|
1166
1051
|
type: "mark-thread-as-resolved";
|
|
1167
1052
|
id: string;
|
|
1168
1053
|
threadId: string;
|
|
1169
1054
|
updatedAt: Date;
|
|
1170
1055
|
};
|
|
1171
|
-
|
|
1056
|
+
type MarkThreadAsUnresolvedOptimisticUpdate = {
|
|
1172
1057
|
type: "mark-thread-as-unresolved";
|
|
1173
1058
|
id: string;
|
|
1174
1059
|
threadId: string;
|
|
1175
1060
|
updatedAt: Date;
|
|
1176
1061
|
};
|
|
1177
|
-
|
|
1062
|
+
type CreateCommentOptimisticUpdate = {
|
|
1178
1063
|
type: "create-comment";
|
|
1179
1064
|
id: string;
|
|
1180
1065
|
comment: CommentData;
|
|
1181
1066
|
};
|
|
1182
|
-
|
|
1067
|
+
type EditCommentOptimisticUpdate = {
|
|
1183
1068
|
type: "edit-comment";
|
|
1184
1069
|
id: string;
|
|
1185
1070
|
comment: CommentData;
|
|
1186
1071
|
};
|
|
1187
|
-
|
|
1072
|
+
type DeleteCommentOptimisticUpdate = {
|
|
1188
1073
|
type: "delete-comment";
|
|
1189
1074
|
id: string;
|
|
1190
1075
|
roomId: string;
|
|
@@ -1192,14 +1077,14 @@ declare type DeleteCommentOptimisticUpdate = {
|
|
|
1192
1077
|
deletedAt: Date;
|
|
1193
1078
|
commentId: string;
|
|
1194
1079
|
};
|
|
1195
|
-
|
|
1080
|
+
type AddReactionOptimisticUpdate = {
|
|
1196
1081
|
type: "add-reaction";
|
|
1197
1082
|
id: string;
|
|
1198
1083
|
threadId: string;
|
|
1199
1084
|
commentId: string;
|
|
1200
1085
|
reaction: CommentUserReaction;
|
|
1201
1086
|
};
|
|
1202
|
-
|
|
1087
|
+
type RemoveReactionOptimisticUpdate = {
|
|
1203
1088
|
type: "remove-reaction";
|
|
1204
1089
|
id: string;
|
|
1205
1090
|
threadId: string;
|
|
@@ -1208,29 +1093,29 @@ declare type RemoveReactionOptimisticUpdate = {
|
|
|
1208
1093
|
userId: string;
|
|
1209
1094
|
removedAt: Date;
|
|
1210
1095
|
};
|
|
1211
|
-
|
|
1096
|
+
type MarkInboxNotificationAsReadOptimisticUpdate = {
|
|
1212
1097
|
type: "mark-inbox-notification-as-read";
|
|
1213
1098
|
id: string;
|
|
1214
1099
|
inboxNotificationId: string;
|
|
1215
1100
|
readAt: Date;
|
|
1216
1101
|
};
|
|
1217
|
-
|
|
1102
|
+
type MarkAllInboxNotificationsAsReadOptimisticUpdate = {
|
|
1218
1103
|
type: "mark-all-inbox-notifications-as-read";
|
|
1219
1104
|
id: string;
|
|
1220
1105
|
readAt: Date;
|
|
1221
1106
|
};
|
|
1222
|
-
|
|
1107
|
+
type DeleteInboxNotificationOptimisticUpdate = {
|
|
1223
1108
|
type: "delete-inbox-notification";
|
|
1224
1109
|
id: string;
|
|
1225
1110
|
inboxNotificationId: string;
|
|
1226
1111
|
deletedAt: Date;
|
|
1227
1112
|
};
|
|
1228
|
-
|
|
1113
|
+
type DeleteAllInboxNotificationsOptimisticUpdate = {
|
|
1229
1114
|
type: "delete-all-inbox-notifications";
|
|
1230
1115
|
id: string;
|
|
1231
1116
|
deletedAt: Date;
|
|
1232
1117
|
};
|
|
1233
|
-
|
|
1118
|
+
type UpdateNotificationSettingsOptimisticUpdate = {
|
|
1234
1119
|
type: "update-notification-settings";
|
|
1235
1120
|
id: string;
|
|
1236
1121
|
roomId: string;
|
|
@@ -1241,7 +1126,7 @@ declare type UpdateNotificationSettingsOptimisticUpdate = {
|
|
|
1241
1126
|
* field, indicating the status of the promise.
|
|
1242
1127
|
* This is compatible with React's `use()` promises, hence the name.
|
|
1243
1128
|
*/
|
|
1244
|
-
|
|
1129
|
+
type UsablePromise<T> = Promise<T> & ({
|
|
1245
1130
|
status: "pending";
|
|
1246
1131
|
} | {
|
|
1247
1132
|
status: "rejected";
|
|
@@ -1250,24 +1135,17 @@ declare type UsablePromise<T> = Promise<T> & ({
|
|
|
1250
1135
|
status: "fulfilled";
|
|
1251
1136
|
value: T;
|
|
1252
1137
|
});
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
* e.g. { 'room-abc': {versions: "all versions"}}
|
|
1261
|
-
*/
|
|
1262
|
-
declare type VersionsByRoomId = Record<RoomId, Record<string, HistoryVersion>>;
|
|
1138
|
+
type LoadableResource<T> = {
|
|
1139
|
+
signal: ISignal<T>;
|
|
1140
|
+
waitUntilLoaded: () => UsablePromise<void>;
|
|
1141
|
+
};
|
|
1142
|
+
type RoomId = string;
|
|
1143
|
+
type UserQueryKey = string;
|
|
1144
|
+
type RoomQueryKey = string;
|
|
1263
1145
|
/**
|
|
1264
1146
|
* A lookup table (LUT) for all the inbox notifications.
|
|
1265
1147
|
*/
|
|
1266
|
-
|
|
1267
|
-
/**
|
|
1268
|
-
* A lookup table (LUT) for all the room notification settings.
|
|
1269
|
-
*/
|
|
1270
|
-
declare type SettingsLUT = Map<RoomId, RoomNotificationSettings$1>;
|
|
1148
|
+
type NotificationsLUT = Map<string, InboxNotificationData>;
|
|
1271
1149
|
/**
|
|
1272
1150
|
* Notification settings by room ID.
|
|
1273
1151
|
* e.g. { 'room-abc': { threads: "all" },
|
|
@@ -1275,10 +1153,10 @@ declare type SettingsLUT = Map<RoomId, RoomNotificationSettings$1>;
|
|
|
1275
1153
|
* 'room-xyz': { threads: "none" },
|
|
1276
1154
|
* }
|
|
1277
1155
|
*/
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1156
|
+
type SettingsByRoomId = Record<RoomId, RoomNotificationSettings$1>;
|
|
1157
|
+
type PermissionHintsLUT = DefaultMap<RoomId, Set<Permission>>;
|
|
1158
|
+
type CleanThreadifications<M extends BaseMetadata$1> = CleanThreads<M> & CleanNotifications;
|
|
1159
|
+
type CleanThreads<M extends BaseMetadata$1> = {
|
|
1282
1160
|
/**
|
|
1283
1161
|
* Keep track of loading and error status of all the queries made by the client.
|
|
1284
1162
|
* e.g. 'room-abc-{"color":"red"}' - ok
|
|
@@ -1286,7 +1164,7 @@ declare type CleanThreads<M extends BaseMetadata> = {
|
|
|
1286
1164
|
*/
|
|
1287
1165
|
threadsDB: ReadonlyThreadDB<M>;
|
|
1288
1166
|
};
|
|
1289
|
-
|
|
1167
|
+
type CleanNotifications = {
|
|
1290
1168
|
/**
|
|
1291
1169
|
* All inbox notifications in a sorted array, optimistic updates applied.
|
|
1292
1170
|
*/
|
|
@@ -1298,39 +1176,37 @@ declare type CleanNotifications = {
|
|
|
1298
1176
|
notificationsById: Record<string, InboxNotificationData>;
|
|
1299
1177
|
};
|
|
1300
1178
|
declare function createStore_forNotifications(): {
|
|
1301
|
-
signal:
|
|
1179
|
+
signal: ISignal<NotificationsLUT>;
|
|
1302
1180
|
markAllRead: (readAt: Date) => void;
|
|
1303
1181
|
markRead: (notificationId: string, readAt: Date) => void;
|
|
1304
1182
|
delete: (inboxNotificationId: string) => void;
|
|
1305
|
-
applyDelta: (
|
|
1183
|
+
applyDelta: (newNotifications: InboxNotificationData[], deletedNotifications: InboxNotificationDeleteInfo[]) => void;
|
|
1306
1184
|
clear: () => void;
|
|
1307
1185
|
updateAssociatedNotification: (newComment: CommentData) => void;
|
|
1308
|
-
|
|
1309
|
-
invalidate: () => void;
|
|
1186
|
+
upsert: (notification: InboxNotificationData) => void;
|
|
1310
1187
|
};
|
|
1311
|
-
declare function createStore_forRoomNotificationSettings(): {
|
|
1312
|
-
signal:
|
|
1188
|
+
declare function createStore_forRoomNotificationSettings(updates: ISignal<readonly OptimisticUpdate<BaseMetadata$1>[]>): {
|
|
1189
|
+
signal: DerivedSignal<SettingsByRoomId>;
|
|
1313
1190
|
update: (roomId: string, settings: RoomNotificationSettings$1) => void;
|
|
1314
|
-
invalidate: () => void;
|
|
1315
1191
|
};
|
|
1316
1192
|
declare function createStore_forHistoryVersions(): {
|
|
1317
|
-
signal:
|
|
1193
|
+
signal: DerivedSignal<{
|
|
1194
|
+
[k: string]: {
|
|
1195
|
+
[k: string]: HistoryVersion;
|
|
1196
|
+
};
|
|
1197
|
+
}>;
|
|
1318
1198
|
update: (roomId: string, versions: HistoryVersion[]) => void;
|
|
1319
|
-
force_set: (callback: (lut: VersionsLUT) => void | boolean) => void;
|
|
1320
|
-
invalidate: () => void;
|
|
1321
1199
|
};
|
|
1322
1200
|
declare function createStore_forPermissionHints(): {
|
|
1323
|
-
signal:
|
|
1201
|
+
signal: ISignal<PermissionHintsLUT>;
|
|
1324
1202
|
update: (newHints: Record<string, Permission[]>) => void;
|
|
1325
|
-
invalidate: () => void;
|
|
1326
1203
|
};
|
|
1327
|
-
declare function createStore_forOptimistic<M extends BaseMetadata>(client: Client<BaseUserMeta$1, M>): {
|
|
1328
|
-
signal:
|
|
1204
|
+
declare function createStore_forOptimistic<M extends BaseMetadata$1>(client: Client<BaseUserMeta$1, M>): {
|
|
1205
|
+
signal: ISignal<readonly OptimisticUpdate<M>[]>;
|
|
1329
1206
|
add: (optimisticUpdate: DistributiveOmit<OptimisticUpdate<M>, "id">) => string;
|
|
1330
1207
|
remove: (optimisticId: string) => void;
|
|
1331
|
-
invalidate: () => void;
|
|
1332
1208
|
};
|
|
1333
|
-
declare class UmbrellaStore<M extends BaseMetadata> {
|
|
1209
|
+
declare class UmbrellaStore<M extends BaseMetadata$1> {
|
|
1334
1210
|
#private;
|
|
1335
1211
|
readonly threads: ThreadDB<M>;
|
|
1336
1212
|
readonly notifications: ReturnType<typeof createStore_forNotifications>;
|
|
@@ -1340,32 +1216,15 @@ declare class UmbrellaStore<M extends BaseMetadata> {
|
|
|
1340
1216
|
readonly optimisticUpdates: ReturnType<typeof createStore_forOptimistic<M>>;
|
|
1341
1217
|
readonly outputs: {
|
|
1342
1218
|
readonly threadifications: DerivedSignal<CleanThreadifications<M>>;
|
|
1343
|
-
readonly threads: DerivedSignal<
|
|
1219
|
+
readonly threads: DerivedSignal<ReadonlyThreadDB<M>>;
|
|
1220
|
+
readonly loadingRoomThreads: DefaultMap<RoomQueryKey, LoadableResource<ThreadsAsyncResult<M>>>;
|
|
1221
|
+
readonly loadingUserThreads: DefaultMap<UserQueryKey, LoadableResource<ThreadsAsyncResult<M>>>;
|
|
1344
1222
|
readonly notifications: DerivedSignal<CleanNotifications>;
|
|
1345
|
-
readonly
|
|
1346
|
-
readonly
|
|
1223
|
+
readonly loadingNotifications: LoadableResource<InboxNotificationsAsyncResult>;
|
|
1224
|
+
readonly settingsByRoomId: DefaultMap<RoomId, LoadableResource<RoomNotificationSettingsAsyncResult>>;
|
|
1225
|
+
readonly versionsByRoomId: DefaultMap<RoomId, LoadableResource<HistoryVersionsAsyncResult>>;
|
|
1347
1226
|
};
|
|
1348
1227
|
constructor(client: OpaqueClient);
|
|
1349
|
-
get1_both(): CleanThreadifications<M>;
|
|
1350
|
-
subscribe1_both(callback: () => void): () => void;
|
|
1351
|
-
get1_threads(): CleanThreads<M>;
|
|
1352
|
-
subscribe1_threads(callback: () => void): () => void;
|
|
1353
|
-
get1_notifications(): CleanNotifications;
|
|
1354
|
-
subscribe1_notifications(callback: () => void): () => void;
|
|
1355
|
-
get2(): SettingsByRoomId;
|
|
1356
|
-
subscribe2(callback: () => void): () => void;
|
|
1357
|
-
get3(): VersionsByRoomId;
|
|
1358
|
-
subscribe3(callback: () => void): () => void;
|
|
1359
|
-
/**
|
|
1360
|
-
* Returns the async result of the given query and room id. If the query is success,
|
|
1361
|
-
* then it will return the threads that match that provided query and room id.
|
|
1362
|
-
*
|
|
1363
|
-
*/
|
|
1364
|
-
getRoomThreadsLoadingState(roomId: string, query: ThreadsQuery<M> | undefined): ThreadsAsyncResult<M>;
|
|
1365
|
-
getUserThreadsLoadingState(query: ThreadsQuery<M> | undefined): ThreadsAsyncResult<M>;
|
|
1366
|
-
getInboxNotificationsLoadingState(): InboxNotificationsAsyncResult;
|
|
1367
|
-
getNotificationSettingsLoadingState(roomId: string): RoomNotificationSettingsAsyncResult;
|
|
1368
|
-
getRoomVersionsLoadingState(roomId: string): AsyncResult<HistoryVersion[], "versions">;
|
|
1369
1228
|
/**
|
|
1370
1229
|
* Updates an existing inbox notification with a new value, replacing the
|
|
1371
1230
|
* corresponding optimistic update.
|
|
@@ -1417,15 +1276,9 @@ declare class UmbrellaStore<M extends BaseMetadata> {
|
|
|
1417
1276
|
*/
|
|
1418
1277
|
updateRoomNotificationSettings(roomId: string, optimisticId: string, settings: Readonly<RoomNotificationSettings$1>): void;
|
|
1419
1278
|
fetchNotificationsDeltaUpdate(signal: AbortSignal): Promise<void>;
|
|
1420
|
-
waitUntilNotificationsLoaded(): UsablePromise<void>;
|
|
1421
|
-
waitUntilRoomThreadsLoaded(roomId: string, query: ThreadsQuery<M> | undefined): UsablePromise<void>;
|
|
1422
1279
|
fetchRoomThreadsDeltaUpdate(roomId: string, signal: AbortSignal): Promise<void>;
|
|
1423
|
-
waitUntilUserThreadsLoaded(query: ThreadsQuery<M> | undefined): UsablePromise<void>;
|
|
1424
|
-
invalidateEntireStore(): void;
|
|
1425
1280
|
fetchUserThreadsDeltaUpdate(signal: AbortSignal): Promise<void>;
|
|
1426
|
-
waitUntilRoomVersionsLoaded(roomId: string): UsablePromise<void>;
|
|
1427
1281
|
fetchRoomVersionsDeltaUpdate(roomId: string, signal: AbortSignal): Promise<void>;
|
|
1428
|
-
waitUntilRoomNotificationSettingsLoaded(roomId: string): UsablePromise<void>;
|
|
1429
1282
|
refreshRoomNotificationSettings(roomId: string, signal: AbortSignal): Promise<void>;
|
|
1430
1283
|
}
|
|
1431
1284
|
|
|
@@ -1441,15 +1294,15 @@ declare const ClientContext: react.Context<OpaqueClient | null>;
|
|
|
1441
1294
|
*
|
|
1442
1295
|
* @private
|
|
1443
1296
|
*/
|
|
1444
|
-
declare function getUmbrellaStoreForClient<M extends BaseMetadata
|
|
1297
|
+
declare function getUmbrellaStoreForClient<M extends BaseMetadata>(client: OpaqueClient): UmbrellaStore<M>;
|
|
1445
1298
|
/**
|
|
1446
1299
|
* @private This is an internal API.
|
|
1447
1300
|
*/
|
|
1448
|
-
declare function useClientOrNull<U extends BaseUserMeta>(): Client$1<U
|
|
1301
|
+
declare function useClientOrNull<U extends BaseUserMeta>(): Client$1<U> | null;
|
|
1449
1302
|
/**
|
|
1450
1303
|
* Obtains a reference to the current Liveblocks client.
|
|
1451
1304
|
*/
|
|
1452
|
-
declare function useClient<U extends BaseUserMeta>(): Client$1<U
|
|
1305
|
+
declare function useClient<U extends BaseUserMeta>(): Client$1<U>;
|
|
1453
1306
|
/**
|
|
1454
1307
|
* Sets up a client for connecting to Liveblocks, and is the recommended way to do
|
|
1455
1308
|
* this for React apps. You must define either `authEndpoint` or `publicApiKey`.
|
|
@@ -1464,7 +1317,7 @@ declare function LiveblocksProvider<U extends BaseUserMeta = DU>(props: PropsWit
|
|
|
1464
1317
|
* LiveblocksProvider created in this way takes no props, because it uses
|
|
1465
1318
|
* settings from the given client instead.
|
|
1466
1319
|
*/
|
|
1467
|
-
declare function createLiveblocksContext<U extends BaseUserMeta = DU, M extends BaseMetadata
|
|
1320
|
+
declare function createLiveblocksContext<U extends BaseUserMeta = DU, M extends BaseMetadata = DM>(client: OpaqueClient): LiveblocksContextBundle<U, M>;
|
|
1468
1321
|
/**
|
|
1469
1322
|
* Returns the inbox notifications for the current user.
|
|
1470
1323
|
*
|
|
@@ -1480,7 +1333,7 @@ declare function useInboxNotifications(): InboxNotificationsAsyncResult;
|
|
|
1480
1333
|
*/
|
|
1481
1334
|
declare function useInboxNotificationsSuspense(): {
|
|
1482
1335
|
readonly isLoading: false;
|
|
1483
|
-
readonly inboxNotifications: InboxNotificationData[];
|
|
1336
|
+
readonly inboxNotifications: _liveblocks_core.InboxNotificationData[];
|
|
1484
1337
|
readonly error?: undefined;
|
|
1485
1338
|
hasFetchedAll: boolean;
|
|
1486
1339
|
isFetchingMore: boolean;
|
|
@@ -1551,7 +1404,7 @@ declare function useRoomInfo(roomId: string): RoomInfoAsyncResult;
|
|
|
1551
1404
|
* const { info } = useRoomInfo("room-id");
|
|
1552
1405
|
*/
|
|
1553
1406
|
declare function useRoomInfoSuspense(roomId: string): RoomInfoAsyncSuccess;
|
|
1554
|
-
|
|
1407
|
+
type TypedBundle$1 = LiveblocksContextBundle<DU, DM>;
|
|
1555
1408
|
/**
|
|
1556
1409
|
* Returns the thread associated with a `"thread"` inbox notification.
|
|
1557
1410
|
*
|
|
@@ -1625,16 +1478,17 @@ declare const _useUserThreadsSuspense_experimental: TypedBundle$1["suspense"]["u
|
|
|
1625
1478
|
* const syncStatus = useSyncStatus({ smooth: true });
|
|
1626
1479
|
*/
|
|
1627
1480
|
declare function useSyncStatus(options?: UseSyncStatusOptions): SyncStatus;
|
|
1628
|
-
|
|
1629
1481
|
/**
|
|
1630
|
-
*
|
|
1631
|
-
*
|
|
1482
|
+
* useErrorListener is a React hook that allows you to respond to any
|
|
1483
|
+
* Liveblocks error, for example room connection errors, errors
|
|
1484
|
+
* creating/editing/deleting threads, etc.
|
|
1632
1485
|
*
|
|
1633
|
-
* @
|
|
1486
|
+
* @example
|
|
1487
|
+
* useErrorListener(err => {
|
|
1488
|
+
* console.error(err);
|
|
1489
|
+
* })
|
|
1634
1490
|
*/
|
|
1635
|
-
declare
|
|
1636
|
-
/** @private */
|
|
1637
|
-
declare function useRoomOrNull<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json, M extends BaseMetadata$1>(): Room<P, S, U, E, M> | null;
|
|
1491
|
+
declare function useErrorListener(callback: (err: LiveblocksError) => void): void;
|
|
1638
1492
|
|
|
1639
1493
|
/**
|
|
1640
1494
|
* Returns the current connection status for the Room, and triggers
|
|
@@ -1692,16 +1546,6 @@ declare function useBatch<T>(): (callback: () => T) => T;
|
|
|
1692
1546
|
* })
|
|
1693
1547
|
*/
|
|
1694
1548
|
declare function useLostConnectionListener(callback: (event: LostConnectionEvent) => void): void;
|
|
1695
|
-
/**
|
|
1696
|
-
* useErrorListener is a React hook that allows you to respond to potential room
|
|
1697
|
-
* connection errors.
|
|
1698
|
-
*
|
|
1699
|
-
* @example
|
|
1700
|
-
* useErrorListener(er => {
|
|
1701
|
-
* console.error(er);
|
|
1702
|
-
* })
|
|
1703
|
-
*/
|
|
1704
|
-
declare function useErrorListener(callback: (err: LiveblocksError) => void): void;
|
|
1705
1549
|
/**
|
|
1706
1550
|
* Returns the room.history
|
|
1707
1551
|
*/
|
|
@@ -1739,16 +1583,12 @@ declare function useCanRedo(): boolean;
|
|
|
1739
1583
|
* // [2, 4, 7]
|
|
1740
1584
|
*/
|
|
1741
1585
|
declare function useOthersConnectionIds(): readonly number[];
|
|
1742
|
-
/**
|
|
1743
|
-
* @private Internal API, do not rely on it.
|
|
1744
|
-
*/
|
|
1745
|
-
declare function useCommentsErrorListener<M extends BaseMetadata$1>(callback: (error: CommentsError<M>) => void): void;
|
|
1746
1586
|
/**
|
|
1747
1587
|
* @private
|
|
1748
1588
|
*/
|
|
1749
|
-
declare function useCreateRoomThread<M extends BaseMetadata
|
|
1589
|
+
declare function useCreateRoomThread<M extends BaseMetadata>(roomId: string): (options: CreateThreadOptions<M>) => ThreadData$1<M>;
|
|
1750
1590
|
declare function useDeleteRoomThread(roomId: string): (threadId: string) => void;
|
|
1751
|
-
declare function useEditRoomThreadMetadata<M extends BaseMetadata
|
|
1591
|
+
declare function useEditRoomThreadMetadata<M extends BaseMetadata>(roomId: string): (options: EditThreadMetadataOptions<M>) => void;
|
|
1752
1592
|
/**
|
|
1753
1593
|
* Returns a function that adds a comment to a thread.
|
|
1754
1594
|
*
|
|
@@ -1789,7 +1629,7 @@ declare function useDeleteRoomComment(roomId: string): ({ threadId, commentId }:
|
|
|
1789
1629
|
/**
|
|
1790
1630
|
* @private
|
|
1791
1631
|
*/
|
|
1792
|
-
declare function useAddRoomCommentReaction<M extends BaseMetadata
|
|
1632
|
+
declare function useAddRoomCommentReaction<M extends BaseMetadata>(roomId: string): ({ threadId, commentId, emoji }: CommentReactionOptions) => void;
|
|
1793
1633
|
/**
|
|
1794
1634
|
* Returns a function that removes a reaction on a comment.
|
|
1795
1635
|
*
|
|
@@ -1915,8 +1755,8 @@ declare function useRoomPermissions(roomId: string): Set<unknown>;
|
|
|
1915
1755
|
* that any RoomProvider created in this way does not need to be nested in
|
|
1916
1756
|
* LiveblocksProvider, as it already has access to the client.
|
|
1917
1757
|
*/
|
|
1918
|
-
declare function createRoomContext<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUserMeta = DU, E extends Json = DE, M extends BaseMetadata
|
|
1919
|
-
|
|
1758
|
+
declare function createRoomContext<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUserMeta = DU, E extends Json = DE, M extends BaseMetadata = DM>(client: OpaqueClient): RoomContextBundle<P, S, U, E, M>;
|
|
1759
|
+
type TypedBundle = RoomContextBundle<DP, DS, DU, DE, DM>;
|
|
1920
1760
|
/**
|
|
1921
1761
|
* Makes a Room available in the component hierarchy below.
|
|
1922
1762
|
* Joins the room when the component is mounted, and automatically leaves
|
|
@@ -2386,4 +2226,4 @@ declare const _useStorageRoot: TypedBundle["useStorageRoot"];
|
|
|
2386
2226
|
*/
|
|
2387
2227
|
declare const _useUpdateMyPresence: TypedBundle["useUpdateMyPresence"];
|
|
2388
2228
|
|
|
2389
|
-
export {
|
|
2229
|
+
export { useHistory as $, useDeleteInboxNotification as A, useErrorListener as B, ClientContext as C, useMarkAllInboxNotificationsAsRead as D, useMarkInboxNotificationAsRead as E, useSyncStatus as F, createRoomContext as G, _RoomProvider as H, _useAddReaction as I, useBatch as J, _useBroadcastEvent as K, LiveblocksProvider as L, type MutationContext as M, useCanRedo as N, useCanUndo as O, useCreateComment as P, _useCreateThread as Q, RoomContext as R, useDeleteComment as S, _useDeleteThread as T, type UseStorageStatusOptions as U, useEditComment as V, _useEditThreadMetadata as W, useMarkThreadAsResolved as X, useMarkThreadAsUnresolved as Y, _useEventListener as Z, _useInboxNotificationThread as _, useClientOrNull as a, _useIsInsideRoom as a0, useLostConnectionListener as a1, useMarkThreadAsRead as a2, _useMutation as a3, _useMyPresence as a4, _useOthersListener as a5, useRedo as a6, useRemoveReaction as a7, _useRoom as a8, useStatus as a9, _useSelfSuspense as aA, _useStorageSuspense as aB, useStorageStatusSuspense as aC, _useThreadsSuspense as aD, useAttachmentUrlSuspense as aE, _useHistoryVersionsSuspense as aF, _useRoomNotificationSettingsSuspense as aG, useInboxNotificationsSuspense as aH, useRoomInfoSuspense as aI, useUnreadInboxNotificationsCountSuspense as aJ, _useUserSuspense as aK, _useUserThreadsSuspense_experimental as aL, _useStorageRoot as aa, useThreadSubscription as ab, useUndo as ac, _useUpdateMyPresence as ad, useUpdateRoomNotificationSettings as ae, useHistoryVersionData as af, _useOther as ag, _useOthers as ah, useOthersConnectionIds as ai, _useOthersMapped as aj, _useSelf as ak, _useStorage as al, useStorageStatus as am, _useThreads as an, useAttachmentUrl as ao, _useHistoryVersions as ap, _useRoomNotificationSettings as aq, useInboxNotifications as ar, _useUserThreads_experimental as as, useRoomInfo as at, useUnreadInboxNotificationsCount as au, _useUser as av, _useOtherSuspense as aw, _useOthersSuspense as ax, useOthersConnectionIdsSuspense as ay, _useOthersMappedSuspense as az, useAddRoomCommentReaction as b, useCreateRoomComment as c, useCreateRoomThread as d, useCreateTextMention as e, useDeleteRoomComment as f, getUmbrellaStoreForClient as g, useDeleteRoomThread as h, useDeleteTextMention as i, useEditRoomComment as j, useEditRoomThreadMetadata as k, useMarkRoomThreadAsRead as l, useMarkRoomThreadAsResolved as m, useMarkRoomThreadAsUnresolved as n, useMentionSuggestionsCache as o, useRemoveRoomCommentReaction as p, useReportTextEditor as q, useResolveMentionSuggestions as r, useRoomAttachmentUrl as s, useRoomPermissions as t, useRoomOrNull as u, useYjsProvider as v, type UseThreadsOptions as w, createLiveblocksContext as x, useClient as y, useDeleteAllInboxNotifications as z };
|