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