@liveblocks/react 2.16.0 → 2.16.1-ai
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 +1 -1
- package/dist/_private.d.ts +1 -1
- package/dist/_private.js +7 -5
- package/dist/_private.js.map +1 -1
- package/dist/_private.mjs +3 -1
- package/dist/_private.mjs.map +1 -1
- package/dist/{chunk-YA4OXDFC.js → chunk-ANPXBJP5.js} +2 -2
- package/dist/{chunk-YA4OXDFC.js.map → chunk-ANPXBJP5.js.map} +1 -1
- package/dist/{chunk-JZBPCFEX.mjs → chunk-FQKGWA7O.mjs} +214 -99
- package/dist/chunk-FQKGWA7O.mjs.map +1 -0
- package/dist/{chunk-NZL5WL5O.js → chunk-VJYVOAD5.js} +217 -102
- package/dist/chunk-VJYVOAD5.js.map +1 -0
- package/dist/{chunk-GMP4DSRI.mjs → chunk-XBBRJ42N.mjs} +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{room-Ce3twcjb.d.mts → room-BjHGIaNf.d.mts} +154 -36
- package/dist/{room-Ce3twcjb.d.ts → room-BjHGIaNf.d.ts} +154 -36
- 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 +4 -4
- package/dist/chunk-JZBPCFEX.mjs.map +0 -1
- package/dist/chunk-NZL5WL5O.js.map +0 -1
- /package/dist/{chunk-GMP4DSRI.mjs.map → chunk-XBBRJ42N.mjs.map} +0 -0
|
@@ -233,6 +233,8 @@ var use = (
|
|
|
233
233
|
|
|
234
234
|
|
|
235
235
|
|
|
236
|
+
|
|
237
|
+
|
|
236
238
|
// src/lib/autobind.ts
|
|
237
239
|
function autobind(self) {
|
|
238
240
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -280,16 +282,16 @@ function matchesMetadata(thread, q) {
|
|
|
280
282
|
const metadata = thread.metadata;
|
|
281
283
|
return q.metadata === void 0 || Object.entries(q.metadata).every(
|
|
282
284
|
([key, op]) => (
|
|
283
|
-
//
|
|
284
|
-
//
|
|
285
|
-
|
|
285
|
+
// NOTE: `op` can be explicitly-`undefined` here, which ideally would not
|
|
286
|
+
// mean "filter for absence" like it does now, as this does not match the
|
|
287
|
+
// backend behavior at the moment. For an in-depth discussion, see
|
|
288
|
+
// https://liveblocks.slack.com/archives/C02PZL7QAAW/p1728546988505989
|
|
289
|
+
matchesOperator(metadata[key], op)
|
|
286
290
|
)
|
|
287
291
|
);
|
|
288
292
|
}
|
|
289
293
|
function matchesOperator(value, op) {
|
|
290
|
-
if (
|
|
291
|
-
return value === void 0;
|
|
292
|
-
} else if (_core.isStartsWithOperator.call(void 0, op)) {
|
|
294
|
+
if (_core.isStartsWithOperator.call(void 0, op)) {
|
|
293
295
|
return typeof value === "string" && value.startsWith(op.startsWith);
|
|
294
296
|
} else {
|
|
295
297
|
return value === op;
|
|
@@ -834,7 +836,7 @@ var UmbrellaStore = class {
|
|
|
834
836
|
);
|
|
835
837
|
const loadingUserThreads = new (0, _core.DefaultMap)(
|
|
836
838
|
(queryKey) => {
|
|
837
|
-
const query =
|
|
839
|
+
const query = _core.unstringify.call(void 0, queryKey);
|
|
838
840
|
const resource = new PaginatedResource(async (cursor) => {
|
|
839
841
|
const result = await this.#client[_core.kInternal].httpClient.getUserThreads_experimental({
|
|
840
842
|
cursor,
|
|
@@ -876,7 +878,7 @@ var UmbrellaStore = class {
|
|
|
876
878
|
);
|
|
877
879
|
const loadingRoomThreads = new (0, _core.DefaultMap)(
|
|
878
880
|
(queryKey) => {
|
|
879
|
-
const [roomId, query] =
|
|
881
|
+
const [roomId, query] = _core.unstringify.call(void 0, queryKey);
|
|
880
882
|
const resource = new PaginatedResource(async (cursor) => {
|
|
881
883
|
const result = await this.#client[_core.kInternal].httpClient.getThreads({
|
|
882
884
|
roomId,
|
|
@@ -939,7 +941,10 @@ var UmbrellaStore = class {
|
|
|
939
941
|
const resource = new SinglePageResource(async () => {
|
|
940
942
|
const room = this.#client.getRoom(roomId);
|
|
941
943
|
if (room === null) {
|
|
942
|
-
throw new
|
|
944
|
+
throw new (0, _core.HttpError)(
|
|
945
|
+
`Room '${roomId}' is not available on client`,
|
|
946
|
+
479
|
|
947
|
+
);
|
|
943
948
|
}
|
|
944
949
|
const result = await room.getNotificationSettings();
|
|
945
950
|
this.roomNotificationSettings.update(roomId, result);
|
|
@@ -962,7 +967,10 @@ var UmbrellaStore = class {
|
|
|
962
967
|
const resource = new SinglePageResource(async () => {
|
|
963
968
|
const room = this.#client.getRoom(roomId);
|
|
964
969
|
if (room === null) {
|
|
965
|
-
throw new
|
|
970
|
+
throw new (0, _core.HttpError)(
|
|
971
|
+
`Room '${roomId}' is not available on client`,
|
|
972
|
+
479
|
|
973
|
+
);
|
|
966
974
|
}
|
|
967
975
|
const result = await room[_core.kInternal].listTextVersions();
|
|
968
976
|
this.historyVersions.update(roomId, result.versions);
|
|
@@ -1818,15 +1826,8 @@ function useMarkInboxNotificationAsRead_withClient(client) {
|
|
|
1818
1826
|
optimisticId
|
|
1819
1827
|
);
|
|
1820
1828
|
},
|
|
1821
|
-
(
|
|
1829
|
+
() => {
|
|
1822
1830
|
store.optimisticUpdates.remove(optimisticId);
|
|
1823
|
-
client[_core.kInternal].emitError(
|
|
1824
|
-
{
|
|
1825
|
-
type: "MARK_INBOX_NOTIFICATION_AS_READ_ERROR",
|
|
1826
|
-
inboxNotificationId
|
|
1827
|
-
},
|
|
1828
|
-
err
|
|
1829
|
-
);
|
|
1830
1831
|
}
|
|
1831
1832
|
);
|
|
1832
1833
|
},
|
|
@@ -1845,13 +1846,8 @@ function useMarkAllInboxNotificationsAsRead_withClient(client) {
|
|
|
1845
1846
|
() => {
|
|
1846
1847
|
store.markAllInboxNotificationsRead(optimisticId, readAt);
|
|
1847
1848
|
},
|
|
1848
|
-
(
|
|
1849
|
+
() => {
|
|
1849
1850
|
store.optimisticUpdates.remove(optimisticId);
|
|
1850
|
-
client[_core.kInternal].emitError(
|
|
1851
|
-
// No roomId, threadId, commentId to include for this error
|
|
1852
|
-
{ type: "MARK_ALL_INBOX_NOTIFICATIONS_AS_READ_ERROR" },
|
|
1853
|
-
err
|
|
1854
|
-
);
|
|
1855
1851
|
}
|
|
1856
1852
|
);
|
|
1857
1853
|
}, [client]);
|
|
@@ -1870,12 +1866,8 @@ function useDeleteInboxNotification_withClient(client) {
|
|
|
1870
1866
|
() => {
|
|
1871
1867
|
store.deleteInboxNotification(inboxNotificationId, optimisticId);
|
|
1872
1868
|
},
|
|
1873
|
-
(
|
|
1869
|
+
() => {
|
|
1874
1870
|
store.optimisticUpdates.remove(optimisticId);
|
|
1875
|
-
client[_core.kInternal].emitError(
|
|
1876
|
-
{ type: "DELETE_INBOX_NOTIFICATION_ERROR", inboxNotificationId },
|
|
1877
|
-
err
|
|
1878
|
-
);
|
|
1879
1871
|
}
|
|
1880
1872
|
);
|
|
1881
1873
|
},
|
|
@@ -1894,12 +1886,8 @@ function useDeleteAllInboxNotifications_withClient(client) {
|
|
|
1894
1886
|
() => {
|
|
1895
1887
|
store.deleteAllInboxNotifications(optimisticId);
|
|
1896
1888
|
},
|
|
1897
|
-
(
|
|
1889
|
+
() => {
|
|
1898
1890
|
store.optimisticUpdates.remove(optimisticId);
|
|
1899
|
-
client[_core.kInternal].emitError(
|
|
1900
|
-
{ type: "DELETE_ALL_INBOX_NOTIFICATIONS_ERROR" },
|
|
1901
|
-
err
|
|
1902
|
-
);
|
|
1903
1891
|
}
|
|
1904
1892
|
);
|
|
1905
1893
|
}, [client]);
|
|
@@ -2061,7 +2049,6 @@ function createSharedContext(client) {
|
|
|
2061
2049
|
useUser: (userId) => useUser_withClient(client, userId),
|
|
2062
2050
|
useRoomInfo: (roomId) => useRoomInfo_withClient(client, roomId),
|
|
2063
2051
|
useIsInsideRoom,
|
|
2064
|
-
useErrorListener,
|
|
2065
2052
|
useSyncStatus: useSyncStatus2
|
|
2066
2053
|
},
|
|
2067
2054
|
suspense: {
|
|
@@ -2069,7 +2056,6 @@ function createSharedContext(client) {
|
|
|
2069
2056
|
useUser: (userId) => useUserSuspense_withClient(client, userId),
|
|
2070
2057
|
useRoomInfo: (roomId) => useRoomInfoSuspense_withClient(client, roomId),
|
|
2071
2058
|
useIsInsideRoom,
|
|
2072
|
-
useErrorListener,
|
|
2073
2059
|
useSyncStatus: useSyncStatus2
|
|
2074
2060
|
}
|
|
2075
2061
|
};
|
|
@@ -2249,14 +2235,104 @@ function useSyncStatusSmooth_withClient(client) {
|
|
|
2249
2235
|
function useSyncStatus(options) {
|
|
2250
2236
|
return useSyncStatus_withClient(useClient(), options);
|
|
2251
2237
|
}
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
(
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2238
|
+
|
|
2239
|
+
// src/types/errors.ts
|
|
2240
|
+
var CreateThreadError = class extends Error {
|
|
2241
|
+
constructor(cause, context) {
|
|
2242
|
+
super("Create thread failed.");
|
|
2243
|
+
this.cause = cause;
|
|
2244
|
+
this.context = context;
|
|
2245
|
+
this.name = "CreateThreadError";
|
|
2246
|
+
}
|
|
2247
|
+
};
|
|
2248
|
+
var DeleteThreadError = class extends Error {
|
|
2249
|
+
constructor(cause, context) {
|
|
2250
|
+
super("Delete thread failed.");
|
|
2251
|
+
this.cause = cause;
|
|
2252
|
+
this.context = context;
|
|
2253
|
+
this.name = "DeleteThreadError";
|
|
2254
|
+
}
|
|
2255
|
+
};
|
|
2256
|
+
var EditThreadMetadataError = class extends Error {
|
|
2257
|
+
constructor(cause, context) {
|
|
2258
|
+
super("Edit thread metadata failed.");
|
|
2259
|
+
this.cause = cause;
|
|
2260
|
+
this.context = context;
|
|
2261
|
+
this.name = "EditThreadMetadataError";
|
|
2262
|
+
}
|
|
2263
|
+
};
|
|
2264
|
+
var MarkThreadAsResolvedError = class extends Error {
|
|
2265
|
+
constructor(cause, context) {
|
|
2266
|
+
super("Mark thread as resolved failed.");
|
|
2267
|
+
this.cause = cause;
|
|
2268
|
+
this.context = context;
|
|
2269
|
+
this.name = "MarkThreadAsResolvedError";
|
|
2270
|
+
}
|
|
2271
|
+
};
|
|
2272
|
+
var MarkThreadAsUnresolvedError = class extends Error {
|
|
2273
|
+
constructor(cause, context) {
|
|
2274
|
+
super("Mark thread as unresolved failed.");
|
|
2275
|
+
this.cause = cause;
|
|
2276
|
+
this.context = context;
|
|
2277
|
+
this.name = "MarkThreadAsUnresolvedError";
|
|
2278
|
+
}
|
|
2279
|
+
};
|
|
2280
|
+
var CreateCommentError = class extends Error {
|
|
2281
|
+
constructor(cause, context) {
|
|
2282
|
+
super("Create comment failed.");
|
|
2283
|
+
this.cause = cause;
|
|
2284
|
+
this.context = context;
|
|
2285
|
+
this.name = "CreateCommentError";
|
|
2286
|
+
}
|
|
2287
|
+
};
|
|
2288
|
+
var EditCommentError = class extends Error {
|
|
2289
|
+
constructor(cause, context) {
|
|
2290
|
+
super("Edit comment failed.");
|
|
2291
|
+
this.cause = cause;
|
|
2292
|
+
this.context = context;
|
|
2293
|
+
this.name = "EditCommentError";
|
|
2294
|
+
}
|
|
2295
|
+
};
|
|
2296
|
+
var DeleteCommentError = class extends Error {
|
|
2297
|
+
constructor(cause, context) {
|
|
2298
|
+
super("Delete comment failed.");
|
|
2299
|
+
this.cause = cause;
|
|
2300
|
+
this.context = context;
|
|
2301
|
+
this.name = "DeleteCommentError";
|
|
2302
|
+
}
|
|
2303
|
+
};
|
|
2304
|
+
var AddReactionError = class extends Error {
|
|
2305
|
+
constructor(cause, context) {
|
|
2306
|
+
super("Add reaction failed.");
|
|
2307
|
+
this.cause = cause;
|
|
2308
|
+
this.context = context;
|
|
2309
|
+
this.name = "AddReactionError";
|
|
2310
|
+
}
|
|
2311
|
+
};
|
|
2312
|
+
var RemoveReactionError = class extends Error {
|
|
2313
|
+
constructor(cause, context) {
|
|
2314
|
+
super("Remove reaction failed.");
|
|
2315
|
+
this.cause = cause;
|
|
2316
|
+
this.context = context;
|
|
2317
|
+
this.name = "RemoveReactionError";
|
|
2318
|
+
}
|
|
2319
|
+
};
|
|
2320
|
+
var MarkInboxNotificationAsReadError = class extends Error {
|
|
2321
|
+
constructor(cause, context) {
|
|
2322
|
+
super("Mark inbox notification as read failed.");
|
|
2323
|
+
this.cause = cause;
|
|
2324
|
+
this.context = context;
|
|
2325
|
+
this.name = "MarkInboxNotificationAsReadError";
|
|
2326
|
+
}
|
|
2327
|
+
};
|
|
2328
|
+
var UpdateNotificationSettingsError = class extends Error {
|
|
2329
|
+
constructor(cause, context) {
|
|
2330
|
+
super("Update notification settings failed.");
|
|
2331
|
+
this.cause = cause;
|
|
2332
|
+
this.context = context;
|
|
2333
|
+
this.name = "UpdateNotificationSettingsError";
|
|
2334
|
+
}
|
|
2335
|
+
};
|
|
2260
2336
|
|
|
2261
2337
|
// src/room.tsx
|
|
2262
2338
|
var _client = require('@liveblocks/client');
|
|
@@ -2280,6 +2356,7 @@ var _client = require('@liveblocks/client');
|
|
|
2280
2356
|
|
|
2281
2357
|
|
|
2282
2358
|
|
|
2359
|
+
|
|
2283
2360
|
|
|
2284
2361
|
|
|
2285
2362
|
// src/use-scroll-to-comment-on-load-effect.ts
|
|
@@ -2362,6 +2439,14 @@ function getCurrentUserId(client) {
|
|
|
2362
2439
|
}
|
|
2363
2440
|
return userId;
|
|
2364
2441
|
}
|
|
2442
|
+
function handleApiError(err) {
|
|
2443
|
+
const message = `Request failed with status ${err.status}: ${err.message}`;
|
|
2444
|
+
if (_optionalChain([err, 'access', _14 => _14.details, 'optionalAccess', _15 => _15.error]) === "FORBIDDEN") {
|
|
2445
|
+
const detailedMessage = [message, err.details.suggestion, err.details.docs].filter(Boolean).join("\n");
|
|
2446
|
+
_core.console.error(detailedMessage);
|
|
2447
|
+
}
|
|
2448
|
+
return new Error(message);
|
|
2449
|
+
}
|
|
2365
2450
|
var _extras2 = /* @__PURE__ */ new WeakMap();
|
|
2366
2451
|
var _bundles2 = /* @__PURE__ */ new WeakMap();
|
|
2367
2452
|
function getOrCreateRoomContextBundle(client) {
|
|
@@ -2382,21 +2467,19 @@ function getRoomExtrasForClient(client) {
|
|
|
2382
2467
|
}
|
|
2383
2468
|
function makeRoomExtrasForClient(client) {
|
|
2384
2469
|
const store = getUmbrellaStoreForClient(client);
|
|
2385
|
-
|
|
2470
|
+
const commentsErrorEventSource = _core.makeEventSource.call(void 0, );
|
|
2471
|
+
function onMutationFailure(innerError, optimisticId, createPublicError) {
|
|
2386
2472
|
store.optimisticUpdates.remove(optimisticId);
|
|
2387
2473
|
if (innerError instanceof _core.HttpError) {
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
_optionalChain([innerError, 'access', _14 => _14.details, 'optionalAccess', _15 => _15.suggestion]),
|
|
2392
|
-
_optionalChain([innerError, 'access', _16 => _16.details, 'optionalAccess', _17 => _17.docs])
|
|
2393
|
-
].filter(Boolean).join("\n");
|
|
2394
|
-
_core.console.error(detailedMessage);
|
|
2395
|
-
}
|
|
2396
|
-
client[_core.kInternal].emitError(context, innerError);
|
|
2397
|
-
} else {
|
|
2398
|
-
throw innerError;
|
|
2474
|
+
const error = handleApiError(innerError);
|
|
2475
|
+
commentsErrorEventSource.notify(createPublicError(error));
|
|
2476
|
+
return;
|
|
2399
2477
|
}
|
|
2478
|
+
if (innerError instanceof _core.HttpError) {
|
|
2479
|
+
handleApiError(innerError);
|
|
2480
|
+
return;
|
|
2481
|
+
}
|
|
2482
|
+
throw innerError;
|
|
2400
2483
|
}
|
|
2401
2484
|
const threadsPollersByRoomId = new (0, _core.DefaultMap)(
|
|
2402
2485
|
(roomId) => _core.makePoller.call(void 0,
|
|
@@ -2442,6 +2525,7 @@ function makeRoomExtrasForClient(client) {
|
|
|
2442
2525
|
);
|
|
2443
2526
|
return {
|
|
2444
2527
|
store,
|
|
2528
|
+
commentsErrorEventSource: commentsErrorEventSource.observable,
|
|
2445
2529
|
onMutationFailure,
|
|
2446
2530
|
getOrCreateThreadsPollerForRoomId: threadsPollersByRoomId.getOrCreate.bind(
|
|
2447
2531
|
threadsPollersByRoomId
|
|
@@ -2467,6 +2551,7 @@ function makeRoomContextBundle(client) {
|
|
|
2467
2551
|
useBroadcastEvent,
|
|
2468
2552
|
useOthersListener,
|
|
2469
2553
|
useLostConnectionListener,
|
|
2554
|
+
useErrorListener,
|
|
2470
2555
|
useEventListener,
|
|
2471
2556
|
useHistory,
|
|
2472
2557
|
useUndo,
|
|
@@ -2512,6 +2597,7 @@ function makeRoomContextBundle(client) {
|
|
|
2512
2597
|
useBroadcastEvent,
|
|
2513
2598
|
useOthersListener,
|
|
2514
2599
|
useLostConnectionListener,
|
|
2600
|
+
useErrorListener,
|
|
2515
2601
|
useEventListener,
|
|
2516
2602
|
useHistory,
|
|
2517
2603
|
useUndo,
|
|
@@ -2547,7 +2633,8 @@ function makeRoomContextBundle(client) {
|
|
|
2547
2633
|
useRoomNotificationSettings: useRoomNotificationSettingsSuspense,
|
|
2548
2634
|
useUpdateRoomNotificationSettings,
|
|
2549
2635
|
...shared.suspense
|
|
2550
|
-
}
|
|
2636
|
+
},
|
|
2637
|
+
useCommentsErrorListener
|
|
2551
2638
|
};
|
|
2552
2639
|
return Object.defineProperty(bundle, _core.kInternal, {
|
|
2553
2640
|
enumerable: false
|
|
@@ -2743,7 +2830,7 @@ function useMentionSuggestionsCache() {
|
|
|
2743
2830
|
return client[_core.kInternal].mentionSuggestionsCache;
|
|
2744
2831
|
}
|
|
2745
2832
|
function useStorageStatus(options) {
|
|
2746
|
-
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2833
|
+
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _16 => _16.smooth]), () => ( false)));
|
|
2747
2834
|
if (smooth) {
|
|
2748
2835
|
return useStorageStatusSmooth();
|
|
2749
2836
|
} else {
|
|
@@ -2808,6 +2895,14 @@ function useLostConnectionListener(callback) {
|
|
|
2808
2895
|
[room, savedCallback]
|
|
2809
2896
|
);
|
|
2810
2897
|
}
|
|
2898
|
+
function useErrorListener(callback) {
|
|
2899
|
+
const room = useRoom();
|
|
2900
|
+
const savedCallback = useLatest(callback);
|
|
2901
|
+
_react.useEffect.call(void 0,
|
|
2902
|
+
() => room.events.error.subscribe((e) => savedCallback.current(e)),
|
|
2903
|
+
[room, savedCallback]
|
|
2904
|
+
);
|
|
2905
|
+
}
|
|
2811
2906
|
function useEventListener(callback) {
|
|
2812
2907
|
const room = useRoom();
|
|
2813
2908
|
const savedCallback = useLatest(callback);
|
|
@@ -3017,6 +3112,14 @@ function useThreads(options = {}) {
|
|
|
3017
3112
|
useScrollToCommentOnLoadEffect(scrollOnLoad, result);
|
|
3018
3113
|
return result;
|
|
3019
3114
|
}
|
|
3115
|
+
function useCommentsErrorListener(callback) {
|
|
3116
|
+
const client = useClient();
|
|
3117
|
+
const savedCallback = useLatest(callback);
|
|
3118
|
+
const { commentsErrorEventSource } = getRoomExtrasForClient(client);
|
|
3119
|
+
_react.useEffect.call(void 0, () => {
|
|
3120
|
+
return commentsErrorEventSource.subscribe(savedCallback.current);
|
|
3121
|
+
}, [savedCallback, commentsErrorEventSource]);
|
|
3122
|
+
}
|
|
3020
3123
|
function useCreateThread() {
|
|
3021
3124
|
return useCreateRoomThread(useRoom().id);
|
|
3022
3125
|
}
|
|
@@ -3057,7 +3160,7 @@ function useCreateRoomThread(roomId) {
|
|
|
3057
3160
|
thread: newThread,
|
|
3058
3161
|
roomId
|
|
3059
3162
|
});
|
|
3060
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3163
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _17 => _17.map, 'call', _18 => _18((attachment) => attachment.id)]);
|
|
3061
3164
|
client[_core.kInternal].httpClient.createThread({
|
|
3062
3165
|
roomId,
|
|
3063
3166
|
threadId,
|
|
@@ -3070,16 +3173,15 @@ function useCreateRoomThread(roomId) {
|
|
|
3070
3173
|
store.createThread(optimisticId, thread);
|
|
3071
3174
|
},
|
|
3072
3175
|
(err) => onMutationFailure(
|
|
3176
|
+
err,
|
|
3073
3177
|
optimisticId,
|
|
3074
|
-
{
|
|
3075
|
-
type: "CREATE_THREAD_ERROR",
|
|
3178
|
+
(err2) => new CreateThreadError(err2, {
|
|
3076
3179
|
roomId,
|
|
3077
3180
|
threadId,
|
|
3078
3181
|
commentId,
|
|
3079
3182
|
body,
|
|
3080
3183
|
metadata
|
|
3081
|
-
}
|
|
3082
|
-
err
|
|
3184
|
+
})
|
|
3083
3185
|
)
|
|
3084
3186
|
);
|
|
3085
3187
|
return newThread;
|
|
@@ -3097,7 +3199,7 @@ function useDeleteRoomThread(roomId) {
|
|
|
3097
3199
|
const { store, onMutationFailure } = getRoomExtrasForClient(client);
|
|
3098
3200
|
const userId = getCurrentUserId(client);
|
|
3099
3201
|
const existing = store.outputs.threads.get().get(threadId);
|
|
3100
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
3202
|
+
if (_optionalChain([existing, 'optionalAccess', _19 => _19.comments, 'optionalAccess', _20 => _20[0], 'optionalAccess', _21 => _21.userId]) !== userId) {
|
|
3101
3203
|
throw new Error("Only the thread creator can delete the thread");
|
|
3102
3204
|
}
|
|
3103
3205
|
const optimisticId = store.optimisticUpdates.add({
|
|
@@ -3111,9 +3213,9 @@ function useDeleteRoomThread(roomId) {
|
|
|
3111
3213
|
store.deleteThread(threadId, optimisticId);
|
|
3112
3214
|
},
|
|
3113
3215
|
(err) => onMutationFailure(
|
|
3216
|
+
err,
|
|
3114
3217
|
optimisticId,
|
|
3115
|
-
|
|
3116
|
-
err
|
|
3218
|
+
(err2) => new DeleteThreadError(err2, { roomId, threadId })
|
|
3117
3219
|
)
|
|
3118
3220
|
);
|
|
3119
3221
|
},
|
|
@@ -3146,14 +3248,13 @@ function useEditRoomThreadMetadata(roomId) {
|
|
|
3146
3248
|
store.patchThread(threadId, optimisticId, { metadata: metadata2 }, updatedAt)
|
|
3147
3249
|
),
|
|
3148
3250
|
(err) => onMutationFailure(
|
|
3251
|
+
err,
|
|
3149
3252
|
optimisticId,
|
|
3150
|
-
{
|
|
3151
|
-
type: "EDIT_THREAD_METADATA_ERROR",
|
|
3253
|
+
(error) => new EditThreadMetadataError(error, {
|
|
3152
3254
|
roomId,
|
|
3153
3255
|
threadId,
|
|
3154
3256
|
metadata
|
|
3155
|
-
}
|
|
3156
|
-
err
|
|
3257
|
+
})
|
|
3157
3258
|
)
|
|
3158
3259
|
);
|
|
3159
3260
|
},
|
|
@@ -3185,21 +3286,20 @@ function useCreateRoomComment(roomId) {
|
|
|
3185
3286
|
type: "create-comment",
|
|
3186
3287
|
comment
|
|
3187
3288
|
});
|
|
3188
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3289
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _22 => _22.map, 'call', _23 => _23((attachment) => attachment.id)]);
|
|
3189
3290
|
client[_core.kInternal].httpClient.createComment({ roomId, threadId, commentId, body, attachmentIds }).then(
|
|
3190
3291
|
(newComment) => {
|
|
3191
3292
|
store.createComment(newComment, optimisticId);
|
|
3192
3293
|
},
|
|
3193
3294
|
(err) => onMutationFailure(
|
|
3295
|
+
err,
|
|
3194
3296
|
optimisticId,
|
|
3195
|
-
{
|
|
3196
|
-
type: "CREATE_COMMENT_ERROR",
|
|
3297
|
+
(err2) => new CreateCommentError(err2, {
|
|
3197
3298
|
roomId,
|
|
3198
3299
|
threadId,
|
|
3199
3300
|
commentId,
|
|
3200
3301
|
body
|
|
3201
|
-
}
|
|
3202
|
-
err
|
|
3302
|
+
})
|
|
3203
3303
|
)
|
|
3204
3304
|
);
|
|
3205
3305
|
return comment;
|
|
@@ -3241,15 +3341,20 @@ function useEditRoomComment(roomId) {
|
|
|
3241
3341
|
attachments: _nullishCoalesce(attachments, () => ( []))
|
|
3242
3342
|
}
|
|
3243
3343
|
});
|
|
3244
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3344
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _24 => _24.map, 'call', _25 => _25((attachment) => attachment.id)]);
|
|
3245
3345
|
client[_core.kInternal].httpClient.editComment({ roomId, threadId, commentId, body, attachmentIds }).then(
|
|
3246
3346
|
(editedComment) => {
|
|
3247
3347
|
store.editComment(threadId, optimisticId, editedComment);
|
|
3248
3348
|
},
|
|
3249
3349
|
(err) => onMutationFailure(
|
|
3350
|
+
err,
|
|
3250
3351
|
optimisticId,
|
|
3251
|
-
|
|
3252
|
-
|
|
3352
|
+
(error) => new EditCommentError(error, {
|
|
3353
|
+
roomId,
|
|
3354
|
+
threadId,
|
|
3355
|
+
commentId,
|
|
3356
|
+
body
|
|
3357
|
+
})
|
|
3253
3358
|
)
|
|
3254
3359
|
);
|
|
3255
3360
|
},
|
|
@@ -3277,9 +3382,13 @@ function useDeleteRoomComment(roomId) {
|
|
|
3277
3382
|
store.deleteComment(threadId, optimisticId, commentId, deletedAt);
|
|
3278
3383
|
},
|
|
3279
3384
|
(err) => onMutationFailure(
|
|
3385
|
+
err,
|
|
3280
3386
|
optimisticId,
|
|
3281
|
-
|
|
3282
|
-
|
|
3387
|
+
(error) => new DeleteCommentError(error, {
|
|
3388
|
+
roomId,
|
|
3389
|
+
threadId,
|
|
3390
|
+
commentId
|
|
3391
|
+
})
|
|
3283
3392
|
)
|
|
3284
3393
|
);
|
|
3285
3394
|
},
|
|
@@ -3317,15 +3426,14 @@ function useAddRoomCommentReaction(roomId) {
|
|
|
3317
3426
|
);
|
|
3318
3427
|
},
|
|
3319
3428
|
(err) => onMutationFailure(
|
|
3429
|
+
err,
|
|
3320
3430
|
optimisticId,
|
|
3321
|
-
{
|
|
3322
|
-
type: "ADD_REACTION_ERROR",
|
|
3431
|
+
(error) => new AddReactionError(error, {
|
|
3323
3432
|
roomId,
|
|
3324
3433
|
threadId,
|
|
3325
3434
|
commentId,
|
|
3326
3435
|
emoji
|
|
3327
|
-
}
|
|
3328
|
-
err
|
|
3436
|
+
})
|
|
3329
3437
|
)
|
|
3330
3438
|
);
|
|
3331
3439
|
},
|
|
@@ -3362,15 +3470,14 @@ function useRemoveRoomCommentReaction(roomId) {
|
|
|
3362
3470
|
);
|
|
3363
3471
|
},
|
|
3364
3472
|
(err) => onMutationFailure(
|
|
3473
|
+
err,
|
|
3365
3474
|
optimisticId,
|
|
3366
|
-
{
|
|
3367
|
-
type: "REMOVE_REACTION_ERROR",
|
|
3475
|
+
(error) => new RemoveReactionError(error, {
|
|
3368
3476
|
roomId,
|
|
3369
3477
|
threadId,
|
|
3370
3478
|
commentId,
|
|
3371
3479
|
emoji
|
|
3372
|
-
}
|
|
3373
|
-
err
|
|
3480
|
+
})
|
|
3374
3481
|
)
|
|
3375
3482
|
);
|
|
3376
3483
|
},
|
|
@@ -3410,13 +3517,11 @@ function useMarkRoomThreadAsRead(roomId) {
|
|
|
3410
3517
|
},
|
|
3411
3518
|
(err) => {
|
|
3412
3519
|
onMutationFailure(
|
|
3520
|
+
err,
|
|
3413
3521
|
optimisticId,
|
|
3414
|
-
{
|
|
3415
|
-
type: "MARK_INBOX_NOTIFICATION_AS_READ_ERROR",
|
|
3416
|
-
roomId,
|
|
3522
|
+
(error) => new MarkInboxNotificationAsReadError(error, {
|
|
3417
3523
|
inboxNotificationId: inboxNotification.id
|
|
3418
|
-
}
|
|
3419
|
-
err
|
|
3524
|
+
})
|
|
3420
3525
|
);
|
|
3421
3526
|
return;
|
|
3422
3527
|
}
|
|
@@ -3449,9 +3554,12 @@ function useMarkRoomThreadAsResolved(roomId) {
|
|
|
3449
3554
|
);
|
|
3450
3555
|
},
|
|
3451
3556
|
(err) => onMutationFailure(
|
|
3557
|
+
err,
|
|
3452
3558
|
optimisticId,
|
|
3453
|
-
|
|
3454
|
-
|
|
3559
|
+
(error) => new MarkThreadAsResolvedError(error, {
|
|
3560
|
+
roomId,
|
|
3561
|
+
threadId
|
|
3562
|
+
})
|
|
3455
3563
|
)
|
|
3456
3564
|
);
|
|
3457
3565
|
},
|
|
@@ -3482,9 +3590,12 @@ function useMarkRoomThreadAsUnresolved(roomId) {
|
|
|
3482
3590
|
);
|
|
3483
3591
|
},
|
|
3484
3592
|
(err) => onMutationFailure(
|
|
3593
|
+
err,
|
|
3485
3594
|
optimisticId,
|
|
3486
|
-
|
|
3487
|
-
|
|
3595
|
+
(error) => new MarkThreadAsUnresolvedError(error, {
|
|
3596
|
+
roomId,
|
|
3597
|
+
threadId
|
|
3598
|
+
})
|
|
3488
3599
|
)
|
|
3489
3600
|
);
|
|
3490
3601
|
},
|
|
@@ -3634,9 +3745,11 @@ function useUpdateRoomNotificationSettings() {
|
|
|
3634
3745
|
store.updateRoomNotificationSettings(room.id, optimisticId, settings2);
|
|
3635
3746
|
},
|
|
3636
3747
|
(err) => onMutationFailure(
|
|
3748
|
+
err,
|
|
3637
3749
|
optimisticId,
|
|
3638
|
-
|
|
3639
|
-
|
|
3750
|
+
(error) => new UpdateNotificationSettingsError(error, {
|
|
3751
|
+
roomId: room.id
|
|
3752
|
+
})
|
|
3640
3753
|
)
|
|
3641
3754
|
);
|
|
3642
3755
|
},
|
|
@@ -3709,7 +3822,7 @@ function useThreadsSuspense(options = {}) {
|
|
|
3709
3822
|
return result;
|
|
3710
3823
|
}
|
|
3711
3824
|
function selectorFor_useAttachmentUrl(state) {
|
|
3712
|
-
if (state === void 0 || _optionalChain([state, 'optionalAccess',
|
|
3825
|
+
if (state === void 0 || _optionalChain([state, 'optionalAccess', _26 => _26.isLoading])) {
|
|
3713
3826
|
return _nullishCoalesce(state, () => ( { isLoading: true }));
|
|
3714
3827
|
}
|
|
3715
3828
|
if (state.error) {
|
|
@@ -3924,5 +4037,7 @@ var _useUpdateMyPresence = useUpdateMyPresence;
|
|
|
3924
4037
|
|
|
3925
4038
|
|
|
3926
4039
|
|
|
3927
|
-
|
|
3928
|
-
|
|
4040
|
+
|
|
4041
|
+
|
|
4042
|
+
exports.RoomContext = RoomContext; exports.useRoomOrNull = useRoomOrNull; exports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector; exports.useSignal = useSignal; exports.ClientContext = ClientContext; exports.getUmbrellaStoreForClient = getUmbrellaStoreForClient; exports.useClientOrNull = useClientOrNull; exports.useClient = useClient; 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.useRoomInfo = useRoomInfo; exports.useRoomInfoSuspense = useRoomInfoSuspense; exports._useInboxNotificationThread = _useInboxNotificationThread; exports._useUser = _useUser; exports._useUserSuspense = _useUserSuspense; exports._useUserThreads_experimental = _useUserThreads_experimental; exports._useUserThreadsSuspense_experimental = _useUserThreadsSuspense_experimental; exports.useSyncStatus = useSyncStatus; exports.CreateThreadError = CreateThreadError; exports.useStatus = useStatus; exports.useReportTextEditor = useReportTextEditor; exports.useYjsProvider = useYjsProvider; exports.useCreateTextMention = useCreateTextMention; exports.useDeleteTextMention = useDeleteTextMention; exports.useResolveMentionSuggestions = useResolveMentionSuggestions; exports.useMentionSuggestionsCache = useMentionSuggestionsCache; exports.useStorageStatus = useStorageStatus; exports.useBatch = useBatch; exports.useLostConnectionListener = useLostConnectionListener; exports.useErrorListener = useErrorListener; exports.useHistory = useHistory; exports.useUndo = useUndo; exports.useRedo = useRedo; exports.useCanUndo = useCanUndo; exports.useCanRedo = useCanRedo; exports.useOthersConnectionIds = useOthersConnectionIds; exports.useCommentsErrorListener = useCommentsErrorListener; 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.useThreadSubscription = useThreadSubscription; exports.useHistoryVersionData = useHistoryVersionData; exports.useUpdateRoomNotificationSettings = useUpdateRoomNotificationSettings; exports.useOthersConnectionIdsSuspense = useOthersConnectionIdsSuspense; exports.useStorageStatusSuspense = useStorageStatusSuspense; 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._useThreadsSuspense = _useThreadsSuspense; exports._useRoomNotificationSettings = _useRoomNotificationSettings; exports._useRoomNotificationSettingsSuspense = _useRoomNotificationSettingsSuspense; 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;
|
|
4043
|
+
//# sourceMappingURL=chunk-VJYVOAD5.js.map
|