@liveblocks/react 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_private.cjs +5 -5
- package/dist/_private.d.cts +1 -1
- package/dist/_private.d.ts +1 -1
- package/dist/_private.js +1 -1
- package/dist/{chunk-ZB24FJPU.js → chunk-2A27UCH4.js} +2 -2
- package/dist/{chunk-YZRXMG3Z.js → chunk-UHR5FZDL.js} +95 -66
- package/dist/chunk-UHR5FZDL.js.map +1 -0
- package/dist/{chunk-LJQILG65.cjs → chunk-V36VCKRB.cjs} +112 -83
- package/dist/chunk-V36VCKRB.cjs.map +1 -0
- package/dist/{chunk-JI4VQVXW.cjs → chunk-YXNWSNHJ.cjs} +2 -2
- package/dist/{chunk-JI4VQVXW.cjs.map → chunk-YXNWSNHJ.cjs.map} +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/{room-DRYXmQT5.d.cts → room-BE4TZf40.d.cts} +141 -24
- package/dist/{room-DRYXmQT5.d.ts → room-BE4TZf40.d.ts} +141 -24
- package/dist/suspense.cjs +4 -4
- package/dist/suspense.cjs.map +1 -1
- package/dist/suspense.d.cts +1 -1
- package/dist/suspense.d.ts +1 -1
- package/dist/suspense.js +2 -2
- package/dist/suspense.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-LJQILG65.cjs.map +0 -1
- package/dist/chunk-YZRXMG3Z.js.map +0 -1
- /package/dist/{chunk-ZB24FJPU.js.map → chunk-2A27UCH4.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/contexts.ts
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/contexts.ts
|
|
2
2
|
var _core = require('@liveblocks/core');
|
|
3
|
-
var _react = require('react');
|
|
3
|
+
var _react = require('react'); var React = _interopRequireWildcard(_react);
|
|
4
4
|
var ClientContext = _react.createContext.call(void 0, null);
|
|
5
5
|
function useClientOrNull() {
|
|
6
6
|
return _react.useContext.call(void 0, ClientContext);
|
|
@@ -258,31 +258,30 @@ function useInitialUnlessFunction(latestValue) {
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
// src/lib/use-polyfill.ts
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}
|
|
261
|
+
|
|
262
|
+
var reactUse = React[" use ".trim().toString()];
|
|
263
|
+
var use = _nullishCoalesce(reactUse, () => ( ((promise) => {
|
|
264
|
+
if (promise.status === "pending") {
|
|
265
|
+
throw promise;
|
|
266
|
+
} else if (promise.status === "fulfilled") {
|
|
267
|
+
return promise.value;
|
|
268
|
+
} else if (promise.status === "rejected") {
|
|
269
|
+
throw promise.reason;
|
|
270
|
+
} else {
|
|
271
|
+
promise.status = "pending";
|
|
272
|
+
promise.then(
|
|
273
|
+
(v) => {
|
|
274
|
+
promise.status = "fulfilled";
|
|
275
|
+
promise.value = v;
|
|
276
|
+
},
|
|
277
|
+
(e) => {
|
|
278
|
+
promise.status = "rejected";
|
|
279
|
+
promise.reason = e;
|
|
280
|
+
}
|
|
281
|
+
);
|
|
282
|
+
throw promise;
|
|
284
283
|
}
|
|
285
|
-
);
|
|
284
|
+
})));
|
|
286
285
|
|
|
287
286
|
// src/umbrella-store.ts
|
|
288
287
|
|
|
@@ -488,6 +487,9 @@ function makeRoomThreadsQueryKey(roomId, query) {
|
|
|
488
487
|
function makeUserThreadsQueryKey(query) {
|
|
489
488
|
return _core.stableStringify.call(void 0, _nullishCoalesce(query, () => ( {})));
|
|
490
489
|
}
|
|
490
|
+
function makeAiChatsQueryKey(query) {
|
|
491
|
+
return _core.stableStringify.call(void 0, _nullishCoalesce(query, () => ( {})));
|
|
492
|
+
}
|
|
491
493
|
function usify(promise) {
|
|
492
494
|
if ("status" in promise) {
|
|
493
495
|
return promise;
|
|
@@ -925,8 +927,6 @@ var UmbrellaStore = class {
|
|
|
925
927
|
#roomVersionsLastRequestedAtByRoom = /* @__PURE__ */ new Map();
|
|
926
928
|
// Notification Settings
|
|
927
929
|
#notificationSettings;
|
|
928
|
-
// Copilot chats
|
|
929
|
-
#aiChats;
|
|
930
930
|
constructor(client) {
|
|
931
931
|
this.#client = client[_core.kInternal].as();
|
|
932
932
|
this.optimisticUpdates = createStore_forOptimistic(this.#client);
|
|
@@ -956,12 +956,6 @@ var UmbrellaStore = class {
|
|
|
956
956
|
this.#notificationSettings = new SinglePageResource(
|
|
957
957
|
notificationSettingsFetcher
|
|
958
958
|
);
|
|
959
|
-
this.#aiChats = new PaginatedResource(async (cursor) => {
|
|
960
|
-
const result = await this.#client[_core.kInternal].ai.getChats({
|
|
961
|
-
cursor
|
|
962
|
-
});
|
|
963
|
-
return result.nextCursor;
|
|
964
|
-
});
|
|
965
959
|
this.threads = new ThreadDB();
|
|
966
960
|
this.subscriptions = createStore_forSubscriptions(
|
|
967
961
|
this.optimisticUpdates.signal,
|
|
@@ -1168,23 +1162,34 @@ var UmbrellaStore = class {
|
|
|
1168
1162
|
}, _core.shallow),
|
|
1169
1163
|
waitUntilLoaded: this.#notificationSettings.waitUntilLoaded
|
|
1170
1164
|
};
|
|
1171
|
-
const aiChats =
|
|
1172
|
-
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1165
|
+
const aiChats = new (0, _core.DefaultMap)(
|
|
1166
|
+
(queryKey) => {
|
|
1167
|
+
const query = JSON.parse(queryKey);
|
|
1168
|
+
const resource = new PaginatedResource(async (cursor) => {
|
|
1169
|
+
const result = await this.#client[_core.kInternal].ai.getChats({
|
|
1170
|
+
cursor,
|
|
1171
|
+
query
|
|
1172
|
+
});
|
|
1173
|
+
return result.nextCursor;
|
|
1174
|
+
});
|
|
1175
|
+
const signal = _core.DerivedSignal.from(() => {
|
|
1176
|
+
const result = resource.get();
|
|
1177
|
+
if (result.isLoading || result.error) {
|
|
1178
|
+
return result;
|
|
1179
|
+
}
|
|
1180
|
+
const chats = this.#client[_core.kInternal].ai.queryChats(query);
|
|
1181
|
+
return {
|
|
1182
|
+
isLoading: false,
|
|
1183
|
+
chats,
|
|
1184
|
+
hasFetchedAll: result.data.hasFetchedAll,
|
|
1185
|
+
isFetchingMore: result.data.isFetchingMore,
|
|
1186
|
+
fetchMore: result.data.fetchMore,
|
|
1187
|
+
fetchMoreError: result.data.fetchMoreError
|
|
1188
|
+
};
|
|
1189
|
+
}, _core.shallow);
|
|
1190
|
+
return { signal, waitUntilLoaded: resource.waitUntilLoaded };
|
|
1191
|
+
}
|
|
1192
|
+
);
|
|
1188
1193
|
const messagesByChatId = new (0, _core.DefaultMap)((chatId) => {
|
|
1189
1194
|
const resource\u03A3 = new SinglePageResource(async () => {
|
|
1190
1195
|
await this.#client[_core.kInternal].ai.getMessageTree(chatId);
|
|
@@ -2526,12 +2531,13 @@ function useRoomInfoSuspense_withClient(client, roomId) {
|
|
|
2526
2531
|
error: void 0
|
|
2527
2532
|
};
|
|
2528
2533
|
}
|
|
2529
|
-
function useAiChats() {
|
|
2534
|
+
function useAiChats(options) {
|
|
2530
2535
|
const client = useClient();
|
|
2531
2536
|
const store = getUmbrellaStoreForClient(client);
|
|
2537
|
+
const queryKey = makeAiChatsQueryKey(_optionalChain([options, 'optionalAccess', _16 => _16.query]));
|
|
2532
2538
|
useEnsureAiConnection(client);
|
|
2533
2539
|
_react.useEffect.call(void 0,
|
|
2534
|
-
() => void store.outputs.aiChats.waitUntilLoaded()
|
|
2540
|
+
() => void store.outputs.aiChats.getOrCreate(queryKey).waitUntilLoaded()
|
|
2535
2541
|
// NOTE: Deliberately *not* using a dependency array here!
|
|
2536
2542
|
//
|
|
2537
2543
|
// It is important to call waitUntil on *every* render.
|
|
@@ -2541,15 +2547,16 @@ function useAiChats() {
|
|
|
2541
2547
|
// 3. If ever the promise would fail, then after 5 seconds it would reset, and on the very
|
|
2542
2548
|
// *next* render after that, a *new* fetch/promise will get created.
|
|
2543
2549
|
);
|
|
2544
|
-
return useSignal(store.outputs.aiChats.signal, identity2, _core.shallow);
|
|
2550
|
+
return useSignal(store.outputs.aiChats.getOrCreate(queryKey).signal, identity2, _core.shallow);
|
|
2545
2551
|
}
|
|
2546
|
-
function useAiChatsSuspense() {
|
|
2552
|
+
function useAiChatsSuspense(options) {
|
|
2547
2553
|
ensureNotServerSide();
|
|
2548
2554
|
const client = useClient();
|
|
2549
2555
|
const store = getUmbrellaStoreForClient(client);
|
|
2550
2556
|
useEnsureAiConnection(client);
|
|
2551
|
-
|
|
2552
|
-
|
|
2557
|
+
const queryKey = makeAiChatsQueryKey(_optionalChain([options, 'optionalAccess', _17 => _17.query]));
|
|
2558
|
+
use(store.outputs.aiChats.getOrCreate(queryKey).waitUntilLoaded());
|
|
2559
|
+
const result = useAiChats(options);
|
|
2553
2560
|
_core.assert.call(void 0, !result.error, "Did not expect error");
|
|
2554
2561
|
_core.assert.call(void 0, !result.isLoading, "Did not expect loading");
|
|
2555
2562
|
return result;
|
|
@@ -2559,7 +2566,7 @@ function useAiChatMessages(chatId, options) {
|
|
|
2559
2566
|
const store = getUmbrellaStoreForClient(client);
|
|
2560
2567
|
useEnsureAiConnection(client);
|
|
2561
2568
|
_react.useEffect.call(void 0,
|
|
2562
|
-
() => void store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2569
|
+
() => void store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _18 => _18.branchId]), () => ( null))).waitUntilLoaded()
|
|
2563
2570
|
// NOTE: Deliberately *not* using a dependency array here!
|
|
2564
2571
|
//
|
|
2565
2572
|
// It is important to call waitUntil on *every* render.
|
|
@@ -2570,7 +2577,7 @@ function useAiChatMessages(chatId, options) {
|
|
|
2570
2577
|
// *next* render after that, a *new* fetch/promise will get created.
|
|
2571
2578
|
);
|
|
2572
2579
|
return useSignal(
|
|
2573
|
-
store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2580
|
+
store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _19 => _19.branchId]), () => ( null))).signal
|
|
2574
2581
|
);
|
|
2575
2582
|
}
|
|
2576
2583
|
function useAiChatMessagesSuspense(chatId, options) {
|
|
@@ -2579,7 +2586,7 @@ function useAiChatMessagesSuspense(chatId, options) {
|
|
|
2579
2586
|
const store = getUmbrellaStoreForClient(client);
|
|
2580
2587
|
useEnsureAiConnection(client);
|
|
2581
2588
|
use(
|
|
2582
|
-
store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2589
|
+
store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _20 => _20.branchId]), () => ( null))).waitUntilLoaded()
|
|
2583
2590
|
);
|
|
2584
2591
|
const result = useAiChatMessages(chatId, options);
|
|
2585
2592
|
_core.assert.call(void 0, !result.error, "Did not expect error");
|
|
@@ -2618,6 +2625,9 @@ function useCreateAiChat() {
|
|
|
2618
2625
|
const client = useClient();
|
|
2619
2626
|
return _react.useCallback.call(void 0,
|
|
2620
2627
|
(options) => {
|
|
2628
|
+
if (typeof options === "string") {
|
|
2629
|
+
options = { id: options };
|
|
2630
|
+
}
|
|
2621
2631
|
client[_core.kInternal].ai.getOrCreateChat(options.id, {
|
|
2622
2632
|
title: options.title,
|
|
2623
2633
|
metadata: options.metadata
|
|
@@ -2645,35 +2655,54 @@ function useDeleteAiChat() {
|
|
|
2645
2655
|
}
|
|
2646
2656
|
function useSendAiMessage(chatId, options) {
|
|
2647
2657
|
const client = useClient();
|
|
2648
|
-
const copilotId = _optionalChain([options, 'optionalAccess', _19 => _19.copilotId]);
|
|
2649
2658
|
return _react.useCallback.call(void 0,
|
|
2650
2659
|
(message) => {
|
|
2651
|
-
const
|
|
2652
|
-
|
|
2653
|
-
|
|
2660
|
+
const {
|
|
2661
|
+
text: messageText,
|
|
2662
|
+
chatId: messageOptionsChatId,
|
|
2663
|
+
...messageOptions
|
|
2664
|
+
} = typeof message === "string" ? { text: message } : message;
|
|
2665
|
+
const resolvedChatId = _nullishCoalesce(_nullishCoalesce(messageOptionsChatId, () => ( chatId)), () => ( // The `useSendAiMessage` overloads prevent this scenario from happening
|
|
2666
|
+
// at the type level, and this error prevents it from happening at runtime.
|
|
2667
|
+
_core.raise.call(void 0,
|
|
2668
|
+
"chatId must be provided to either `useSendAiMessage` or its returned function."
|
|
2669
|
+
)));
|
|
2670
|
+
const messages = client[_core.kInternal].ai.signals.getChatMessagesForBranch\u03A3(resolvedChatId).get();
|
|
2671
|
+
const lastMessageId = _nullishCoalesce(_optionalChain([messages, 'access', _21 => _21[messages.length - 1], 'optionalAccess', _22 => _22.id]), () => ( null));
|
|
2672
|
+
const content = [{ type: "text", text: messageText }];
|
|
2654
2673
|
const newMessageId = client[_core.kInternal].ai[_core.kInternal].context.messagesStore.createOptimistically(
|
|
2655
|
-
|
|
2674
|
+
resolvedChatId,
|
|
2656
2675
|
"user",
|
|
2657
2676
|
lastMessageId,
|
|
2658
2677
|
content
|
|
2659
2678
|
);
|
|
2679
|
+
const newMessage = client[_core.kInternal].ai[_core.kInternal].context.messagesStore.getMessageById(newMessageId);
|
|
2660
2680
|
const targetMessageId = client[_core.kInternal].ai[_core.kInternal].context.messagesStore.createOptimistically(
|
|
2661
|
-
|
|
2681
|
+
resolvedChatId,
|
|
2662
2682
|
"assistant",
|
|
2663
2683
|
newMessageId
|
|
2664
2684
|
);
|
|
2665
2685
|
void client[_core.kInternal].ai.askUserMessageInChat(
|
|
2666
|
-
|
|
2686
|
+
resolvedChatId,
|
|
2667
2687
|
{ id: newMessageId, parentMessageId: lastMessageId, content },
|
|
2668
2688
|
targetMessageId,
|
|
2669
2689
|
{
|
|
2670
|
-
stream: _optionalChain([options, 'optionalAccess',
|
|
2671
|
-
copilotId,
|
|
2672
|
-
timeout: _optionalChain([options, 'optionalAccess',
|
|
2690
|
+
stream: _nullishCoalesce(messageOptions.stream, () => ( _optionalChain([options, 'optionalAccess', _23 => _23.stream]))),
|
|
2691
|
+
copilotId: _nullishCoalesce(messageOptions.copilotId, () => ( _optionalChain([options, 'optionalAccess', _24 => _24.copilotId]))),
|
|
2692
|
+
timeout: _nullishCoalesce(messageOptions.timeout, () => ( _optionalChain([options, 'optionalAccess', _25 => _25.timeout]))),
|
|
2693
|
+
knowledge: _nullishCoalesce(messageOptions.knowledge, () => ( _optionalChain([options, 'optionalAccess', _26 => _26.knowledge])))
|
|
2673
2694
|
}
|
|
2674
2695
|
);
|
|
2696
|
+
return newMessage;
|
|
2675
2697
|
},
|
|
2676
|
-
[
|
|
2698
|
+
[
|
|
2699
|
+
client,
|
|
2700
|
+
chatId,
|
|
2701
|
+
_optionalChain([options, 'optionalAccess', _27 => _27.copilotId]),
|
|
2702
|
+
_optionalChain([options, 'optionalAccess', _28 => _28.stream]),
|
|
2703
|
+
_optionalChain([options, 'optionalAccess', _29 => _29.timeout]),
|
|
2704
|
+
_optionalChain([options, 'optionalAccess', _30 => _30.knowledge])
|
|
2705
|
+
]
|
|
2677
2706
|
);
|
|
2678
2707
|
}
|
|
2679
2708
|
function createSharedContext(client) {
|
|
@@ -2706,7 +2735,7 @@ function createSharedContext(client) {
|
|
|
2706
2735
|
}
|
|
2707
2736
|
function useEnsureNoLiveblocksProvider(options) {
|
|
2708
2737
|
const existing = useClientOrNull();
|
|
2709
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
2738
|
+
if (!_optionalChain([options, 'optionalAccess', _31 => _31.allowNesting]) && existing !== null) {
|
|
2710
2739
|
throw new Error(
|
|
2711
2740
|
"You cannot nest multiple LiveblocksProvider instances in the same React tree."
|
|
2712
2741
|
);
|
|
@@ -2855,7 +2884,7 @@ var _useAiChatSuspense = useAiChatSuspense;
|
|
|
2855
2884
|
var _useAiChatMessages = useAiChatMessages;
|
|
2856
2885
|
var _useAiChatMessagesSuspense = useAiChatMessagesSuspense;
|
|
2857
2886
|
function useSyncStatus_withClient(client, options) {
|
|
2858
|
-
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2887
|
+
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _32 => _32.smooth]), () => ( false)));
|
|
2859
2888
|
if (smooth) {
|
|
2860
2889
|
return useSyncStatusSmooth_withClient(client);
|
|
2861
2890
|
} else {
|
|
@@ -3034,8 +3063,8 @@ function makeRoomExtrasForClient(client) {
|
|
|
3034
3063
|
if (innerError.status === 403) {
|
|
3035
3064
|
const detailedMessage = [
|
|
3036
3065
|
innerError.message,
|
|
3037
|
-
_optionalChain([innerError, 'access',
|
|
3038
|
-
_optionalChain([innerError, 'access',
|
|
3066
|
+
_optionalChain([innerError, 'access', _33 => _33.details, 'optionalAccess', _34 => _34.suggestion]),
|
|
3067
|
+
_optionalChain([innerError, 'access', _35 => _35.details, 'optionalAccess', _36 => _36.docs])
|
|
3039
3068
|
].filter(Boolean).join("\n");
|
|
3040
3069
|
_core.console.error(detailedMessage);
|
|
3041
3070
|
}
|
|
@@ -3327,7 +3356,7 @@ function RoomProviderInner(props) {
|
|
|
3327
3356
|
}
|
|
3328
3357
|
function useRoom(options) {
|
|
3329
3358
|
const room = useRoomOrNull();
|
|
3330
|
-
if (room === null && !_optionalChain([options, 'optionalAccess',
|
|
3359
|
+
if (room === null && !_optionalChain([options, 'optionalAccess', _37 => _37.allowOutsideRoom])) {
|
|
3331
3360
|
throw new Error("RoomProvider is missing from the React tree.");
|
|
3332
3361
|
}
|
|
3333
3362
|
return room;
|
|
@@ -3677,7 +3706,7 @@ function useCreateRoomThread(roomId) {
|
|
|
3677
3706
|
thread: newThread,
|
|
3678
3707
|
roomId
|
|
3679
3708
|
});
|
|
3680
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3709
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _38 => _38.map, 'call', _39 => _39((attachment) => attachment.id)]);
|
|
3681
3710
|
client[_core.kInternal].httpClient.createThread({
|
|
3682
3711
|
roomId,
|
|
3683
3712
|
threadId,
|
|
@@ -3717,7 +3746,7 @@ function useDeleteRoomThread(roomId) {
|
|
|
3717
3746
|
const { store, onMutationFailure } = getRoomExtrasForClient(client);
|
|
3718
3747
|
const userId = getCurrentUserId(client);
|
|
3719
3748
|
const existing = store.outputs.threads.get().get(threadId);
|
|
3720
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
3749
|
+
if (_optionalChain([existing, 'optionalAccess', _40 => _40.comments, 'optionalAccess', _41 => _41[0], 'optionalAccess', _42 => _42.userId]) !== userId) {
|
|
3721
3750
|
throw new Error("Only the thread creator can delete the thread");
|
|
3722
3751
|
}
|
|
3723
3752
|
const optimisticId = store.optimisticUpdates.add({
|
|
@@ -3805,7 +3834,7 @@ function useCreateRoomComment(roomId) {
|
|
|
3805
3834
|
type: "create-comment",
|
|
3806
3835
|
comment
|
|
3807
3836
|
});
|
|
3808
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3837
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _43 => _43.map, 'call', _44 => _44((attachment) => attachment.id)]);
|
|
3809
3838
|
client[_core.kInternal].httpClient.createComment({ roomId, threadId, commentId, body, attachmentIds }).then(
|
|
3810
3839
|
(newComment) => {
|
|
3811
3840
|
store.createComment(newComment, optimisticId);
|
|
@@ -3861,7 +3890,7 @@ function useEditRoomComment(roomId) {
|
|
|
3861
3890
|
attachments: _nullishCoalesce(attachments, () => ( []))
|
|
3862
3891
|
}
|
|
3863
3892
|
});
|
|
3864
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3893
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _45 => _45.map, 'call', _46 => _46((attachment) => attachment.id)]);
|
|
3865
3894
|
client[_core.kInternal].httpClient.editComment({ roomId, threadId, commentId, body, attachmentIds }).then(
|
|
3866
3895
|
(editedComment) => {
|
|
3867
3896
|
store.editComment(threadId, optimisticId, editedComment);
|
|
@@ -4202,7 +4231,7 @@ function useRoomThreadSubscription(roomId, threadId) {
|
|
|
4202
4231
|
}
|
|
4203
4232
|
return {
|
|
4204
4233
|
status: "subscribed",
|
|
4205
|
-
unreadSince: _nullishCoalesce(_optionalChain([notification, 'optionalAccess',
|
|
4234
|
+
unreadSince: _nullishCoalesce(_optionalChain([notification, 'optionalAccess', _47 => _47.readAt]), () => ( null)),
|
|
4206
4235
|
subscribe,
|
|
4207
4236
|
unsubscribe
|
|
4208
4237
|
};
|
|
@@ -4413,7 +4442,7 @@ function useThreadsSuspense(options = {}) {
|
|
|
4413
4442
|
return result;
|
|
4414
4443
|
}
|
|
4415
4444
|
function selectorFor_useAttachmentUrl(state) {
|
|
4416
|
-
if (state === void 0 || _optionalChain([state, 'optionalAccess',
|
|
4445
|
+
if (state === void 0 || _optionalChain([state, 'optionalAccess', _48 => _48.isLoading])) {
|
|
4417
4446
|
return _nullishCoalesce(state, () => ( { isLoading: true }));
|
|
4418
4447
|
}
|
|
4419
4448
|
if (state.error) {
|
|
@@ -4639,4 +4668,4 @@ var _useUpdateMyPresence = useUpdateMyPresence;
|
|
|
4639
4668
|
|
|
4640
4669
|
|
|
4641
4670
|
exports.ClientContext = ClientContext; exports.useClientOrNull = useClientOrNull; exports.useClient = useClient; exports.RoomContext = RoomContext; exports.useLatest = useLatest; exports.RegisterAiKnowledge = RegisterAiKnowledge; exports.RegisterAiTool = RegisterAiTool; exports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector; exports.useSignal = useSignal; exports.getUmbrellaStoreForClient = getUmbrellaStoreForClient; exports.useCreateAiChat = useCreateAiChat; exports.useDeleteAiChat = useDeleteAiChat; exports.useSendAiMessage = useSendAiMessage; exports.LiveblocksProvider = LiveblocksProvider; exports.createLiveblocksContext = createLiveblocksContext; exports.useInboxNotifications = useInboxNotifications; exports.useInboxNotificationsSuspense = useInboxNotificationsSuspense; exports.useMarkAllInboxNotificationsAsRead = useMarkAllInboxNotificationsAsRead; exports.useMarkInboxNotificationAsRead = useMarkInboxNotificationAsRead; exports.useDeleteAllInboxNotifications = useDeleteAllInboxNotifications; exports.useDeleteInboxNotification = useDeleteInboxNotification; exports.useUnreadInboxNotificationsCount = useUnreadInboxNotificationsCount; exports.useUnreadInboxNotificationsCountSuspense = useUnreadInboxNotificationsCountSuspense; exports.useNotificationSettings = useNotificationSettings; exports.useNotificationSettingsSuspense = useNotificationSettingsSuspense; exports.useUpdateNotificationSettings = useUpdateNotificationSettings; exports.useRoomInfo = useRoomInfo; exports.useRoomInfoSuspense = useRoomInfoSuspense; exports._useInboxNotificationThread = _useInboxNotificationThread; exports._useUser = _useUser; exports._useUserSuspense = _useUserSuspense; exports._useUserThreads_experimental = _useUserThreads_experimental; exports._useUserThreadsSuspense_experimental = _useUserThreadsSuspense_experimental; exports._useAiChats = _useAiChats; exports._useAiChatsSuspense = _useAiChatsSuspense; exports._useAiChat = _useAiChat; exports._useAiChatSuspense = _useAiChatSuspense; exports._useAiChatMessages = _useAiChatMessages; exports._useAiChatMessagesSuspense = _useAiChatMessagesSuspense; exports.useSyncStatus = useSyncStatus; exports.useErrorListener = useErrorListener; exports.useStatus = useStatus; exports.useReportTextEditor = useReportTextEditor; exports.useYjsProvider = useYjsProvider; exports.useCreateTextMention = useCreateTextMention; exports.useDeleteTextMention = useDeleteTextMention; exports.useResolveMentionSuggestions = useResolveMentionSuggestions; exports.useMentionSuggestionsCache = useMentionSuggestionsCache; exports.useLostConnectionListener = useLostConnectionListener; exports.useHistory = useHistory; exports.useUndo = useUndo; exports.useRedo = useRedo; exports.useCanUndo = useCanUndo; exports.useCanRedo = useCanRedo; exports.useOthersConnectionIds = useOthersConnectionIds; exports.useCreateRoomThread = useCreateRoomThread; exports.useDeleteRoomThread = useDeleteRoomThread; exports.useEditRoomThreadMetadata = useEditRoomThreadMetadata; exports.useCreateComment = useCreateComment; exports.useCreateRoomComment = useCreateRoomComment; exports.useEditComment = useEditComment; exports.useEditRoomComment = useEditRoomComment; exports.useDeleteComment = useDeleteComment; exports.useDeleteRoomComment = useDeleteRoomComment; exports.useAddRoomCommentReaction = useAddRoomCommentReaction; exports.useRemoveReaction = useRemoveReaction; exports.useRemoveRoomCommentReaction = useRemoveRoomCommentReaction; exports.useMarkThreadAsRead = useMarkThreadAsRead; exports.useMarkRoomThreadAsRead = useMarkRoomThreadAsRead; exports.useMarkThreadAsResolved = useMarkThreadAsResolved; exports.useMarkRoomThreadAsResolved = useMarkRoomThreadAsResolved; exports.useMarkThreadAsUnresolved = useMarkThreadAsUnresolved; exports.useMarkRoomThreadAsUnresolved = useMarkRoomThreadAsUnresolved; exports.useSubscribeToThread = useSubscribeToThread; exports.useUnsubscribeFromThread = useUnsubscribeFromThread; exports.useThreadSubscription = useThreadSubscription; exports.useRoomThreadSubscription = useRoomThreadSubscription; exports.useHistoryVersionData = useHistoryVersionData; exports.useUpdateRoomSubscriptionSettings = useUpdateRoomSubscriptionSettings; exports.useOthersConnectionIdsSuspense = useOthersConnectionIdsSuspense; exports.useAttachmentUrl = useAttachmentUrl; exports.useRoomAttachmentUrl = useRoomAttachmentUrl; exports.useAttachmentUrlSuspense = useAttachmentUrlSuspense; exports.useRoomPermissions = useRoomPermissions; exports.createRoomContext = createRoomContext; exports._RoomProvider = _RoomProvider; exports._useBroadcastEvent = _useBroadcastEvent; exports._useOthersListener = _useOthersListener; exports._useRoom = _useRoom; exports._useIsInsideRoom = _useIsInsideRoom; exports._useAddReaction = _useAddReaction; exports._useMutation = _useMutation; exports._useCreateThread = _useCreateThread; exports._useDeleteThread = _useDeleteThread; exports._useEditThreadMetadata = _useEditThreadMetadata; exports._useEventListener = _useEventListener; exports._useMyPresence = _useMyPresence; exports._useOthersMapped = _useOthersMapped; exports._useOthersMappedSuspense = _useOthersMappedSuspense; exports._useThreads = _useThreads; exports._useThreadsSuspense = _useThreadsSuspense; exports._useRoomSubscriptionSettings = _useRoomSubscriptionSettings; exports._useRoomSubscriptionSettingsSuspense = _useRoomSubscriptionSettingsSuspense; exports._useHistoryVersions = _useHistoryVersions; exports._useHistoryVersionsSuspense = _useHistoryVersionsSuspense; exports._useOther = _useOther; exports._useOthers = _useOthers; exports._useOtherSuspense = _useOtherSuspense; exports._useOthersSuspense = _useOthersSuspense; exports._useStorage = _useStorage; exports._useStorageSuspense = _useStorageSuspense; exports._useSelf = _useSelf; exports._useSelfSuspense = _useSelfSuspense; exports._useStorageRoot = _useStorageRoot; exports._useUpdateMyPresence = _useUpdateMyPresence;
|
|
4642
|
-
//# sourceMappingURL=chunk-
|
|
4671
|
+
//# sourceMappingURL=chunk-V36VCKRB.cjs.map
|