@liveblocks/react 2.25.0-aiprivatebeta1 → 2.25.0-aiprivatebeta10
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.cjs.map +1 -1
- package/dist/_private.d.cts +2 -2
- package/dist/_private.d.ts +2 -2
- package/dist/_private.js +1 -1
- package/dist/_private.js.map +1 -1
- package/dist/{chunk-GSA4MPRG.cjs → chunk-MSLJX4ZW.cjs} +2 -2
- package/dist/{chunk-GSA4MPRG.cjs.map → chunk-MSLJX4ZW.cjs.map} +1 -1
- package/dist/{chunk-EDEUY3EM.js → chunk-Y2RSQZ5R.js} +2 -2
- package/dist/{chunk-ZGVKI7OM.cjs → chunk-Y6Z36KDP.cjs} +175 -49
- package/dist/chunk-Y6Z36KDP.cjs.map +1 -0
- package/dist/{chunk-E6PCFJWE.js → chunk-Y7BGHNHH.js} +269 -143
- package/dist/chunk-Y7BGHNHH.js.map +1 -0
- package/dist/index.cjs +10 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -11
- package/dist/index.d.ts +30 -11
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/{room-DmsjrDvP.d.cts → room-BYtyYCxu.d.cts} +162 -24
- package/dist/{room-DmsjrDvP.d.ts → room-BYtyYCxu.d.ts} +162 -24
- package/dist/suspense.cjs +10 -4
- package/dist/suspense.cjs.map +1 -1
- package/dist/suspense.d.cts +2 -2
- package/dist/suspense.d.ts +2 -2
- package/dist/suspense.js +8 -2
- package/dist/suspense.js.map +1 -1
- package/package.json +13 -3
- package/dist/chunk-E6PCFJWE.js.map +0 -1
- package/dist/chunk-ZGVKI7OM.cjs.map +0 -1
- /package/dist/{chunk-EDEUY3EM.js.map → chunk-Y2RSQZ5R.js.map} +0 -0
|
@@ -1,5 +1,13 @@
|
|
|
1
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
|
|
2
|
+
var _core = require('@liveblocks/core');
|
|
2
3
|
var _react = require('react');
|
|
4
|
+
var ClientContext = _react.createContext.call(void 0, null);
|
|
5
|
+
function useClientOrNull() {
|
|
6
|
+
return _react.useContext.call(void 0, ClientContext);
|
|
7
|
+
}
|
|
8
|
+
function useClient() {
|
|
9
|
+
return _nullishCoalesce(useClientOrNull(), () => ( _core.raise.call(void 0, "LiveblocksProvider is missing from the React tree.")));
|
|
10
|
+
}
|
|
3
11
|
var RoomContext = _react.createContext.call(void 0, null);
|
|
4
12
|
function useRoomOrNull() {
|
|
5
13
|
return _react.useContext.call(void 0, RoomContext);
|
|
@@ -9,6 +17,38 @@ function useIsInsideRoom() {
|
|
|
9
17
|
return room !== null;
|
|
10
18
|
}
|
|
11
19
|
|
|
20
|
+
// src/ai.tsx
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
function useAi() {
|
|
24
|
+
return useClient()[_core.kInternal].ai;
|
|
25
|
+
}
|
|
26
|
+
function useRandom() {
|
|
27
|
+
return _react.useState.call(void 0, _core.nanoid)[0];
|
|
28
|
+
}
|
|
29
|
+
var RegisterAiKnowledge = _react.memo.call(void 0, function RegisterAiKnowledge2(props) {
|
|
30
|
+
const layerId = _react.useId.call(void 0, );
|
|
31
|
+
const ai = useAi();
|
|
32
|
+
const { description, value } = props;
|
|
33
|
+
const [layerKey, setLayerKey] = _react.useState.call(void 0, );
|
|
34
|
+
_react.useEffect.call(void 0, () => {
|
|
35
|
+
const layerKey2 = ai.registerKnowledgeLayer(layerId);
|
|
36
|
+
setLayerKey(layerKey2);
|
|
37
|
+
return () => {
|
|
38
|
+
ai.deregisterKnowledgeLayer(layerKey2);
|
|
39
|
+
setLayerKey(void 0);
|
|
40
|
+
};
|
|
41
|
+
}, [ai, layerId]);
|
|
42
|
+
const randomKey = useRandom();
|
|
43
|
+
const knowledgeKey = _nullishCoalesce(props.id, () => ( randomKey));
|
|
44
|
+
_react.useEffect.call(void 0, () => {
|
|
45
|
+
if (layerKey !== void 0) {
|
|
46
|
+
ai.updateKnowledge(layerKey, { description, value }, knowledgeKey);
|
|
47
|
+
}
|
|
48
|
+
}, [ai, layerKey, knowledgeKey, description, value]);
|
|
49
|
+
return null;
|
|
50
|
+
});
|
|
51
|
+
|
|
12
52
|
// src/use-sync-external-store-with-selector.ts
|
|
13
53
|
|
|
14
54
|
|
|
@@ -86,7 +126,7 @@ function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnaps
|
|
|
86
126
|
}
|
|
87
127
|
|
|
88
128
|
// src/use-signal.ts
|
|
89
|
-
|
|
129
|
+
|
|
90
130
|
var identity = (value) => value;
|
|
91
131
|
function useSignal(signal, selector, isEqual) {
|
|
92
132
|
if (signal instanceof _core.MutableSignal) {
|
|
@@ -120,10 +160,6 @@ function useSignal(signal, selector, isEqual) {
|
|
|
120
160
|
|
|
121
161
|
|
|
122
162
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
163
|
|
|
128
164
|
// src/config.ts
|
|
129
165
|
var SECONDS = 1e3;
|
|
@@ -746,21 +782,26 @@ function createStore_forHistoryVersions() {
|
|
|
746
782
|
};
|
|
747
783
|
}
|
|
748
784
|
function createStore_forPermissionHints() {
|
|
749
|
-
const
|
|
750
|
-
new (0, _core.
|
|
785
|
+
const permissionsByRoomId = new (0, _core.DefaultMap)(
|
|
786
|
+
() => new (0, _core.Signal)(/* @__PURE__ */ new Set())
|
|
751
787
|
);
|
|
752
788
|
function update(newHints) {
|
|
753
|
-
|
|
754
|
-
for (const [roomId,
|
|
755
|
-
const
|
|
756
|
-
|
|
757
|
-
|
|
789
|
+
_core.batch.call(void 0, () => {
|
|
790
|
+
for (const [roomId, permissions] of Object.entries(newHints)) {
|
|
791
|
+
const signal = permissionsByRoomId.getOrCreate(roomId);
|
|
792
|
+
const existingPermissions = new Set(signal.get());
|
|
793
|
+
for (const permission of permissions) {
|
|
794
|
+
existingPermissions.add(permission);
|
|
758
795
|
}
|
|
796
|
+
signal.set(existingPermissions);
|
|
759
797
|
}
|
|
760
798
|
});
|
|
761
799
|
}
|
|
800
|
+
function getPermissionForRoom\u03A3(roomId) {
|
|
801
|
+
return permissionsByRoomId.getOrCreate(roomId);
|
|
802
|
+
}
|
|
762
803
|
return {
|
|
763
|
-
|
|
804
|
+
getPermissionForRoom\u03A3,
|
|
764
805
|
// Mutations
|
|
765
806
|
update
|
|
766
807
|
};
|
|
@@ -1152,6 +1193,31 @@ var UmbrellaStore = class {
|
|
|
1152
1193
|
}
|
|
1153
1194
|
);
|
|
1154
1195
|
});
|
|
1196
|
+
const aiChatById = new (0, _core.DefaultMap)((chatId) => {
|
|
1197
|
+
const resource = new SinglePageResource(async () => {
|
|
1198
|
+
await this.#client[_core.kInternal].ai.getOrCreateChat(chatId);
|
|
1199
|
+
});
|
|
1200
|
+
const signal = _core.DerivedSignal.from(() => {
|
|
1201
|
+
const chat = this.#client[_core.kInternal].ai.getChatById(chatId);
|
|
1202
|
+
if (chat === void 0) {
|
|
1203
|
+
const result = resource.get();
|
|
1204
|
+
if (result.isLoading || result.error) {
|
|
1205
|
+
return result;
|
|
1206
|
+
} else {
|
|
1207
|
+
return ASYNC_OK(
|
|
1208
|
+
"chat",
|
|
1209
|
+
_core.nn.call(void 0, this.#client[_core.kInternal].ai.getChatById(chatId))
|
|
1210
|
+
);
|
|
1211
|
+
}
|
|
1212
|
+
} else {
|
|
1213
|
+
return ASYNC_OK(
|
|
1214
|
+
"chat",
|
|
1215
|
+
_core.nn.call(void 0, this.#client[_core.kInternal].ai.getChatById(chatId))
|
|
1216
|
+
);
|
|
1217
|
+
}
|
|
1218
|
+
}, _core.shallow);
|
|
1219
|
+
return { signal, waitUntilLoaded: resource.waitUntilLoaded };
|
|
1220
|
+
});
|
|
1155
1221
|
this.outputs = {
|
|
1156
1222
|
threadifications,
|
|
1157
1223
|
threads,
|
|
@@ -1164,7 +1230,8 @@ var UmbrellaStore = class {
|
|
|
1164
1230
|
notificationSettings,
|
|
1165
1231
|
threadSubscriptions,
|
|
1166
1232
|
aiChats,
|
|
1167
|
-
messagesByChatId
|
|
1233
|
+
messagesByChatId,
|
|
1234
|
+
aiChatById
|
|
1168
1235
|
};
|
|
1169
1236
|
autobind(this);
|
|
1170
1237
|
}
|
|
@@ -1885,7 +1952,6 @@ function isThreadParticipant(thread, userId) {
|
|
|
1885
1952
|
|
|
1886
1953
|
// src/liveblocks.tsx
|
|
1887
1954
|
var _jsxruntime = require('react/jsx-runtime');
|
|
1888
|
-
var ClientContext = _react.createContext.call(void 0, null);
|
|
1889
1955
|
function missingUserError(userId) {
|
|
1890
1956
|
return new Error(`resolveUsers didn't return anything for user '${userId}'`);
|
|
1891
1957
|
}
|
|
@@ -2044,9 +2110,11 @@ function makeLiveblocksContextBundle(client) {
|
|
|
2044
2110
|
useInboxNotificationThread: useInboxNotificationThread2,
|
|
2045
2111
|
useUserThreads_experimental,
|
|
2046
2112
|
useAiChats,
|
|
2113
|
+
useAiChat,
|
|
2047
2114
|
useAiChatMessages,
|
|
2048
2115
|
useCreateAiChat,
|
|
2049
2116
|
useDeleteAiChat,
|
|
2117
|
+
useSendAiMessage,
|
|
2050
2118
|
...shared.classic,
|
|
2051
2119
|
suspense: {
|
|
2052
2120
|
LiveblocksProvider: LiveblocksProvider2,
|
|
@@ -2061,9 +2129,11 @@ function makeLiveblocksContextBundle(client) {
|
|
|
2061
2129
|
useUpdateNotificationSettings: useUpdateNotificationSettings2,
|
|
2062
2130
|
useUserThreads_experimental: useUserThreadsSuspense_experimental,
|
|
2063
2131
|
useAiChats: useAiChatsSuspense,
|
|
2132
|
+
useAiChat: useAiChatSuspense,
|
|
2064
2133
|
useAiChatMessages: useAiChatMessagesSuspense,
|
|
2065
2134
|
useCreateAiChat,
|
|
2066
2135
|
useDeleteAiChat,
|
|
2136
|
+
useSendAiMessage,
|
|
2067
2137
|
...shared.suspense
|
|
2068
2138
|
}
|
|
2069
2139
|
};
|
|
@@ -2462,11 +2532,11 @@ function useAiChatsSuspense() {
|
|
|
2462
2532
|
_core.assert.call(void 0, !result.isLoading, "Did not expect loading");
|
|
2463
2533
|
return result;
|
|
2464
2534
|
}
|
|
2465
|
-
function useAiChatMessages(chatId,
|
|
2535
|
+
function useAiChatMessages(chatId, options) {
|
|
2466
2536
|
const client = useClient();
|
|
2467
2537
|
const store = getUmbrellaStoreForClient(client);
|
|
2468
2538
|
_react.useEffect.call(void 0,
|
|
2469
|
-
() => void store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(
|
|
2539
|
+
() => void store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _16 => _16.branchId]), () => ( null))).waitUntilLoaded()
|
|
2470
2540
|
// NOTE: Deliberately *not* using a dependency array here!
|
|
2471
2541
|
//
|
|
2472
2542
|
// It is important to call waitUntil on *every* render.
|
|
@@ -2477,17 +2547,43 @@ function useAiChatMessages(chatId, branch) {
|
|
|
2477
2547
|
// *next* render after that, a *new* fetch/promise will get created.
|
|
2478
2548
|
);
|
|
2479
2549
|
return useSignal(
|
|
2480
|
-
store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(
|
|
2550
|
+
store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _17 => _17.branchId]), () => ( null))).signal
|
|
2481
2551
|
);
|
|
2482
2552
|
}
|
|
2483
|
-
function useAiChatMessagesSuspense(chatId,
|
|
2553
|
+
function useAiChatMessagesSuspense(chatId, options) {
|
|
2484
2554
|
ensureNotServerSide();
|
|
2485
2555
|
const client = useClient();
|
|
2486
2556
|
const store = getUmbrellaStoreForClient(client);
|
|
2487
2557
|
use(
|
|
2488
|
-
store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(
|
|
2558
|
+
store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _18 => _18.branchId]), () => ( null))).waitUntilLoaded()
|
|
2559
|
+
);
|
|
2560
|
+
const result = useAiChatMessages(chatId, options);
|
|
2561
|
+
_core.assert.call(void 0, !result.error, "Did not expect error");
|
|
2562
|
+
_core.assert.call(void 0, !result.isLoading, "Did not expect loading");
|
|
2563
|
+
return result;
|
|
2564
|
+
}
|
|
2565
|
+
function useAiChat(chatId) {
|
|
2566
|
+
const client = useClient();
|
|
2567
|
+
const store = getUmbrellaStoreForClient(client);
|
|
2568
|
+
_react.useEffect.call(void 0,
|
|
2569
|
+
() => void store.outputs.aiChatById.getOrCreate(chatId).waitUntilLoaded()
|
|
2570
|
+
// NOTE: Deliberately *not* using a dependency array here!
|
|
2571
|
+
//
|
|
2572
|
+
// It is important to call waitUntil on *every* render.
|
|
2573
|
+
// This is harmless though, on most renders, except:
|
|
2574
|
+
// 1. The very first render, in which case we'll want to trigger the initial page fetch.
|
|
2575
|
+
// 2. All other subsequent renders now "just" return the same promise (a quick operation).
|
|
2576
|
+
// 3. If ever the promise would fail, then after 5 seconds it would reset, and on the very
|
|
2577
|
+
// *next* render after that, a *new* fetch/promise will get created.
|
|
2489
2578
|
);
|
|
2490
|
-
|
|
2579
|
+
return useSignal(store.outputs.aiChatById.getOrCreate(chatId).signal);
|
|
2580
|
+
}
|
|
2581
|
+
function useAiChatSuspense(chatId) {
|
|
2582
|
+
ensureNotServerSide();
|
|
2583
|
+
const client = useClient();
|
|
2584
|
+
const store = getUmbrellaStoreForClient(client);
|
|
2585
|
+
use(store.outputs.aiChatById.getOrCreate(chatId).waitUntilLoaded());
|
|
2586
|
+
const result = useAiChat(chatId);
|
|
2491
2587
|
_core.assert.call(void 0, !result.error, "Did not expect error");
|
|
2492
2588
|
_core.assert.call(void 0, !result.isLoading, "Did not expect loading");
|
|
2493
2589
|
return result;
|
|
@@ -2496,7 +2592,7 @@ function useCreateAiChat() {
|
|
|
2496
2592
|
const client = useClient();
|
|
2497
2593
|
return _react.useCallback.call(void 0,
|
|
2498
2594
|
(options) => {
|
|
2499
|
-
client[_core.kInternal].ai.
|
|
2595
|
+
client[_core.kInternal].ai.getOrCreateChat(options.id, options).catch((err) => {
|
|
2500
2596
|
console.error(
|
|
2501
2597
|
`Failed to create chat with ID "${options.id}": ${String(err)}`
|
|
2502
2598
|
);
|
|
@@ -2518,6 +2614,38 @@ function useDeleteAiChat() {
|
|
|
2518
2614
|
[client]
|
|
2519
2615
|
);
|
|
2520
2616
|
}
|
|
2617
|
+
function useSendAiMessage(chatId, options) {
|
|
2618
|
+
const client = useClient();
|
|
2619
|
+
const copilotId = _optionalChain([options, 'optionalAccess', _19 => _19.copilotId]);
|
|
2620
|
+
return _react.useCallback.call(void 0,
|
|
2621
|
+
(message) => {
|
|
2622
|
+
const messages = client[_core.kInternal].ai.signals.getChatMessagesForBranch\u03A3(chatId).get();
|
|
2623
|
+
const lastMessageId = _nullishCoalesce(_optionalChain([messages, 'access', _20 => _20[messages.length - 1], 'optionalAccess', _21 => _21.id]), () => ( null));
|
|
2624
|
+
const content = [{ type: "text", text: message }];
|
|
2625
|
+
const newMessageId = client[_core.kInternal].ai[_core.kInternal].context.messagesStore.createOptimistically(
|
|
2626
|
+
chatId,
|
|
2627
|
+
"user",
|
|
2628
|
+
lastMessageId,
|
|
2629
|
+
content
|
|
2630
|
+
);
|
|
2631
|
+
const targetMessageId = client[_core.kInternal].ai[_core.kInternal].context.messagesStore.createOptimistically(
|
|
2632
|
+
chatId,
|
|
2633
|
+
"assistant",
|
|
2634
|
+
newMessageId
|
|
2635
|
+
);
|
|
2636
|
+
void client[_core.kInternal].ai.askUserMessageInChat(
|
|
2637
|
+
chatId,
|
|
2638
|
+
{ id: newMessageId, parentMessageId: lastMessageId, content },
|
|
2639
|
+
targetMessageId,
|
|
2640
|
+
{
|
|
2641
|
+
stream: false,
|
|
2642
|
+
copilotId
|
|
2643
|
+
}
|
|
2644
|
+
);
|
|
2645
|
+
},
|
|
2646
|
+
[client, chatId, copilotId]
|
|
2647
|
+
);
|
|
2648
|
+
}
|
|
2521
2649
|
function createSharedContext(client) {
|
|
2522
2650
|
const useClient2 = () => client;
|
|
2523
2651
|
function useSyncStatus2(options) {
|
|
@@ -2530,7 +2658,8 @@ function createSharedContext(client) {
|
|
|
2530
2658
|
useRoomInfo: (roomId) => useRoomInfo_withClient(client, roomId),
|
|
2531
2659
|
useIsInsideRoom,
|
|
2532
2660
|
useErrorListener,
|
|
2533
|
-
useSyncStatus: useSyncStatus2
|
|
2661
|
+
useSyncStatus: useSyncStatus2,
|
|
2662
|
+
RegisterAiKnowledge
|
|
2534
2663
|
},
|
|
2535
2664
|
suspense: {
|
|
2536
2665
|
useClient: useClient2,
|
|
@@ -2538,24 +2667,19 @@ function createSharedContext(client) {
|
|
|
2538
2667
|
useRoomInfo: (roomId) => useRoomInfoSuspense_withClient(client, roomId),
|
|
2539
2668
|
useIsInsideRoom,
|
|
2540
2669
|
useErrorListener,
|
|
2541
|
-
useSyncStatus: useSyncStatus2
|
|
2670
|
+
useSyncStatus: useSyncStatus2,
|
|
2671
|
+
RegisterAiKnowledge
|
|
2542
2672
|
}
|
|
2543
2673
|
};
|
|
2544
2674
|
}
|
|
2545
2675
|
function useEnsureNoLiveblocksProvider(options) {
|
|
2546
2676
|
const existing = useClientOrNull();
|
|
2547
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
2677
|
+
if (!_optionalChain([options, 'optionalAccess', _22 => _22.allowNesting]) && existing !== null) {
|
|
2548
2678
|
throw new Error(
|
|
2549
2679
|
"You cannot nest multiple LiveblocksProvider instances in the same React tree."
|
|
2550
2680
|
);
|
|
2551
2681
|
}
|
|
2552
2682
|
}
|
|
2553
|
-
function useClientOrNull() {
|
|
2554
|
-
return _react.useContext.call(void 0, ClientContext);
|
|
2555
|
-
}
|
|
2556
|
-
function useClient() {
|
|
2557
|
-
return _nullishCoalesce(useClientOrNull(), () => ( _core.raise.call(void 0, "LiveblocksProvider is missing from the React tree.")));
|
|
2558
|
-
}
|
|
2559
2683
|
function LiveblocksProviderWithClient(props) {
|
|
2560
2684
|
useEnsureNoLiveblocksProvider(props);
|
|
2561
2685
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ClientContext.Provider, { value: props.client, children: props.children });
|
|
@@ -2696,10 +2820,12 @@ var _useUserThreads_experimental = useUserThreads_experimental;
|
|
|
2696
2820
|
var _useUserThreadsSuspense_experimental = useUserThreadsSuspense_experimental;
|
|
2697
2821
|
var _useAiChats = useAiChats;
|
|
2698
2822
|
var _useAiChatsSuspense = useAiChatsSuspense;
|
|
2823
|
+
var _useAiChat = useAiChat;
|
|
2824
|
+
var _useAiChatSuspense = useAiChatSuspense;
|
|
2699
2825
|
var _useAiChatMessages = useAiChatMessages;
|
|
2700
2826
|
var _useAiChatMessagesSuspense = useAiChatMessagesSuspense;
|
|
2701
2827
|
function useSyncStatus_withClient(client, options) {
|
|
2702
|
-
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2828
|
+
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _23 => _23.smooth]), () => ( false)));
|
|
2703
2829
|
if (smooth) {
|
|
2704
2830
|
return useSyncStatusSmooth_withClient(client);
|
|
2705
2831
|
} else {
|
|
@@ -2878,8 +3004,8 @@ function makeRoomExtrasForClient(client) {
|
|
|
2878
3004
|
if (innerError.status === 403) {
|
|
2879
3005
|
const detailedMessage = [
|
|
2880
3006
|
innerError.message,
|
|
2881
|
-
_optionalChain([innerError, 'access',
|
|
2882
|
-
_optionalChain([innerError, 'access',
|
|
3007
|
+
_optionalChain([innerError, 'access', _24 => _24.details, 'optionalAccess', _25 => _25.suggestion]),
|
|
3008
|
+
_optionalChain([innerError, 'access', _26 => _26.details, 'optionalAccess', _27 => _27.docs])
|
|
2883
3009
|
].filter(Boolean).join("\n");
|
|
2884
3010
|
_core.console.error(detailedMessage);
|
|
2885
3011
|
}
|
|
@@ -3179,7 +3305,7 @@ function RoomProviderInner(props) {
|
|
|
3179
3305
|
}
|
|
3180
3306
|
function useRoom(options) {
|
|
3181
3307
|
const room = useRoomOrNull();
|
|
3182
|
-
if (room === null && !_optionalChain([options, 'optionalAccess',
|
|
3308
|
+
if (room === null && !_optionalChain([options, 'optionalAccess', _28 => _28.allowOutsideRoom])) {
|
|
3183
3309
|
throw new Error("RoomProvider is missing from the React tree.");
|
|
3184
3310
|
}
|
|
3185
3311
|
return room;
|
|
@@ -3254,7 +3380,7 @@ function useMentionSuggestionsCache() {
|
|
|
3254
3380
|
return client[_core.kInternal].mentionSuggestionsCache;
|
|
3255
3381
|
}
|
|
3256
3382
|
function useStorageStatus(options) {
|
|
3257
|
-
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
3383
|
+
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _29 => _29.smooth]), () => ( false)));
|
|
3258
3384
|
if (smooth) {
|
|
3259
3385
|
return useStorageStatusSmooth();
|
|
3260
3386
|
} else {
|
|
@@ -3568,7 +3694,7 @@ function useCreateRoomThread(roomId) {
|
|
|
3568
3694
|
thread: newThread,
|
|
3569
3695
|
roomId
|
|
3570
3696
|
});
|
|
3571
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3697
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _30 => _30.map, 'call', _31 => _31((attachment) => attachment.id)]);
|
|
3572
3698
|
client[_core.kInternal].httpClient.createThread({
|
|
3573
3699
|
roomId,
|
|
3574
3700
|
threadId,
|
|
@@ -3608,7 +3734,7 @@ function useDeleteRoomThread(roomId) {
|
|
|
3608
3734
|
const { store, onMutationFailure } = getRoomExtrasForClient(client);
|
|
3609
3735
|
const userId = getCurrentUserId(client);
|
|
3610
3736
|
const existing = store.outputs.threads.get().get(threadId);
|
|
3611
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
3737
|
+
if (_optionalChain([existing, 'optionalAccess', _32 => _32.comments, 'optionalAccess', _33 => _33[0], 'optionalAccess', _34 => _34.userId]) !== userId) {
|
|
3612
3738
|
throw new Error("Only the thread creator can delete the thread");
|
|
3613
3739
|
}
|
|
3614
3740
|
const optimisticId = store.optimisticUpdates.add({
|
|
@@ -3696,7 +3822,7 @@ function useCreateRoomComment(roomId) {
|
|
|
3696
3822
|
type: "create-comment",
|
|
3697
3823
|
comment
|
|
3698
3824
|
});
|
|
3699
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3825
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _35 => _35.map, 'call', _36 => _36((attachment) => attachment.id)]);
|
|
3700
3826
|
client[_core.kInternal].httpClient.createComment({ roomId, threadId, commentId, body, attachmentIds }).then(
|
|
3701
3827
|
(newComment) => {
|
|
3702
3828
|
store.createComment(newComment, optimisticId);
|
|
@@ -3752,7 +3878,7 @@ function useEditRoomComment(roomId) {
|
|
|
3752
3878
|
attachments: _nullishCoalesce(attachments, () => ( []))
|
|
3753
3879
|
}
|
|
3754
3880
|
});
|
|
3755
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3881
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _37 => _37.map, 'call', _38 => _38((attachment) => attachment.id)]);
|
|
3756
3882
|
client[_core.kInternal].httpClient.editComment({ roomId, threadId, commentId, body, attachmentIds }).then(
|
|
3757
3883
|
(editedComment) => {
|
|
3758
3884
|
store.editComment(threadId, optimisticId, editedComment);
|
|
@@ -4093,7 +4219,7 @@ function useRoomThreadSubscription(roomId, threadId) {
|
|
|
4093
4219
|
}
|
|
4094
4220
|
return {
|
|
4095
4221
|
status: "subscribed",
|
|
4096
|
-
unreadSince: _nullishCoalesce(_optionalChain([notification, 'optionalAccess',
|
|
4222
|
+
unreadSince: _nullishCoalesce(_optionalChain([notification, 'optionalAccess', _39 => _39.readAt]), () => ( null)),
|
|
4097
4223
|
subscribe,
|
|
4098
4224
|
unsubscribe
|
|
4099
4225
|
};
|
|
@@ -4388,7 +4514,7 @@ function useThreadsSuspense(options = {}) {
|
|
|
4388
4514
|
return result;
|
|
4389
4515
|
}
|
|
4390
4516
|
function selectorFor_useAttachmentUrl(state) {
|
|
4391
|
-
if (state === void 0 || _optionalChain([state, 'optionalAccess',
|
|
4517
|
+
if (state === void 0 || _optionalChain([state, 'optionalAccess', _40 => _40.isLoading])) {
|
|
4392
4518
|
return _nullishCoalesce(state, () => ( { isLoading: true }));
|
|
4393
4519
|
}
|
|
4394
4520
|
if (state.error) {
|
|
@@ -4450,14 +4576,10 @@ function useAttachmentUrlSuspense(attachmentId) {
|
|
|
4450
4576
|
error: void 0
|
|
4451
4577
|
};
|
|
4452
4578
|
}
|
|
4453
|
-
var NO_PERMISSIONS = /* @__PURE__ */ new Set();
|
|
4454
4579
|
function useRoomPermissions(roomId) {
|
|
4455
4580
|
const client = useClient();
|
|
4456
4581
|
const store = getRoomExtrasForClient(client).store;
|
|
4457
|
-
return useSignal(
|
|
4458
|
-
store.permissionHints.signal,
|
|
4459
|
-
(hints) => _nullishCoalesce(hints.get(roomId), () => ( NO_PERMISSIONS))
|
|
4460
|
-
);
|
|
4582
|
+
return useSignal(store.permissionHints.getPermissionForRoom\u03A3(roomId));
|
|
4461
4583
|
}
|
|
4462
4584
|
function createRoomContext(client) {
|
|
4463
4585
|
return getOrCreateRoomContextBundle(client);
|
|
@@ -4619,5 +4741,9 @@ var _useUpdateMyPresence = useUpdateMyPresence;
|
|
|
4619
4741
|
|
|
4620
4742
|
|
|
4621
4743
|
|
|
4622
|
-
|
|
4623
|
-
|
|
4744
|
+
|
|
4745
|
+
|
|
4746
|
+
|
|
4747
|
+
|
|
4748
|
+
exports.ClientContext = ClientContext; exports.useClientOrNull = useClientOrNull; exports.useClient = useClient; exports.RoomContext = RoomContext; exports.RegisterAiKnowledge = RegisterAiKnowledge; 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.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.useSubscribeToThread = useSubscribeToThread; exports.useUnsubscribeFromThread = useUnsubscribeFromThread; exports.useThreadSubscription = useThreadSubscription; exports.useRoomThreadSubscription = useRoomThreadSubscription; exports.useHistoryVersionData = useHistoryVersionData; exports.useUpdateRoomNotificationSettings = useUpdateRoomNotificationSettings; exports.useUpdateRoomSubscriptionSettings = useUpdateRoomSubscriptionSettings; 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._useRoomSubscriptionSettings = _useRoomSubscriptionSettings; exports._useRoomNotificationSettingsSuspense = _useRoomNotificationSettingsSuspense; 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;
|
|
4749
|
+
//# sourceMappingURL=chunk-Y6Z36KDP.cjs.map
|