@liveblocks/react 3.7.1-tiptap3 → 3.8.0-next1
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 +7 -7
- package/dist/_private.d.cts +2 -2
- package/dist/_private.d.ts +2 -2
- package/dist/_private.js +1 -1
- package/dist/{chunk-W2H56LB3.cjs → chunk-45BFK66K.cjs} +101 -46
- package/dist/chunk-45BFK66K.cjs.map +1 -0
- package/dist/{chunk-WGUV4Z4E.js → chunk-GXPZZIB2.js} +73 -18
- package/dist/chunk-GXPZZIB2.js.map +1 -0
- package/dist/{chunk-6ZXBTPII.js → chunk-TMNECRRU.js} +2 -2
- package/dist/{chunk-BKAKZTP4.cjs → chunk-X3KI55GF.cjs} +2 -2
- package/dist/{chunk-BKAKZTP4.cjs.map → chunk-X3KI55GF.cjs.map} +1 -1
- package/dist/index.cjs +6 -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 +4 -2
- package/dist/index.js.map +1 -1
- package/dist/{room-mUz5TTmo.d.cts → room-DSJuooXd.d.cts} +65 -6
- package/dist/{room-mUz5TTmo.d.ts → room-DSJuooXd.d.ts} +65 -6
- package/dist/suspense.cjs +6 -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 +4 -2
- package/dist/suspense.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-W2H56LB3.cjs.map +0 -1
- package/dist/chunk-WGUV4Z4E.js.map +0 -1
- /package/dist/{chunk-6ZXBTPII.js.map → chunk-TMNECRRU.js.map} +0 -0
package/dist/_private.cjs
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _chunk45BFK66Kcjs = require('./chunk-45BFK66K.cjs');
|
|
29
29
|
|
|
30
30
|
// src/lib/use-layout-effect.ts
|
|
31
31
|
var _react = require('react');
|
|
@@ -50,7 +50,7 @@ function selectorFor_useGroup(state) {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
function useGroup(groupId) {
|
|
53
|
-
const client =
|
|
53
|
+
const client = _chunk45BFK66Kcjs.useClient.call(void 0, );
|
|
54
54
|
const store = client[_core.kInternal].httpClient.groupsStore;
|
|
55
55
|
const getGroupState = _react.useCallback.call(void 0,
|
|
56
56
|
() => store.getItemState(groupId),
|
|
@@ -59,7 +59,7 @@ function useGroup(groupId) {
|
|
|
59
59
|
_react.useEffect.call(void 0, () => {
|
|
60
60
|
void store.enqueue(groupId);
|
|
61
61
|
}, [store, groupId]);
|
|
62
|
-
return
|
|
62
|
+
return _chunk45BFK66Kcjs.useSyncExternalStoreWithSelector.call(void 0,
|
|
63
63
|
store.subscribe,
|
|
64
64
|
getGroupState,
|
|
65
65
|
getGroupState,
|
|
@@ -80,8 +80,8 @@ function normalizeMentionSuggestions(suggestions) {
|
|
|
80
80
|
function useMentionSuggestions(roomId, search) {
|
|
81
81
|
const [mentionSuggestions, setMentionSuggestions] = _react.useState.call(void 0, );
|
|
82
82
|
const lastInvokedAt = _react.useRef.call(void 0, );
|
|
83
|
-
const resolveMentionSuggestions =
|
|
84
|
-
const mentionSuggestionsCache =
|
|
83
|
+
const resolveMentionSuggestions = _chunk45BFK66Kcjs.useResolveMentionSuggestions.call(void 0, );
|
|
84
|
+
const mentionSuggestionsCache = _chunk45BFK66Kcjs.useMentionSuggestionsCache.call(void 0, );
|
|
85
85
|
_react.useEffect.call(void 0, () => {
|
|
86
86
|
if (search === void 0 || !resolveMentionSuggestions) {
|
|
87
87
|
return;
|
|
@@ -136,7 +136,7 @@ function useMentionSuggestions(roomId, search) {
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
function useSyncSource() {
|
|
139
|
-
const client =
|
|
139
|
+
const client = _chunk45BFK66Kcjs.useClient.call(void 0, );
|
|
140
140
|
const createSyncSource = client[_core.kInternal].createSyncSource;
|
|
141
141
|
const [syncSource, setSyncSource] = _react.useState.call(void 0, );
|
|
142
142
|
_react.useEffect.call(void 0, () => {
|
|
@@ -176,5 +176,5 @@ function useSyncSource() {
|
|
|
176
176
|
|
|
177
177
|
|
|
178
178
|
|
|
179
|
-
exports.getUmbrellaStoreForClient =
|
|
179
|
+
exports.getUmbrellaStoreForClient = _chunk45BFK66Kcjs.getUmbrellaStoreForClient; exports.useAddRoomCommentReaction = _chunk45BFK66Kcjs.useAddRoomCommentReaction; exports.useClientOrNull = _chunk45BFK66Kcjs.useClientOrNull; exports.useCreateRoomComment = _chunk45BFK66Kcjs.useCreateRoomComment; exports.useCreateRoomThread = _chunk45BFK66Kcjs.useCreateRoomThread; exports.useCreateTextMention = _chunk45BFK66Kcjs.useCreateTextMention; exports.useDeleteRoomComment = _chunk45BFK66Kcjs.useDeleteRoomComment; exports.useDeleteRoomThread = _chunk45BFK66Kcjs.useDeleteRoomThread; exports.useDeleteTextMention = _chunk45BFK66Kcjs.useDeleteTextMention; exports.useEditRoomComment = _chunk45BFK66Kcjs.useEditRoomComment; exports.useEditRoomThreadMetadata = _chunk45BFK66Kcjs.useEditRoomThreadMetadata; exports.useGroup = useGroup; exports.useLatest = _chunk45BFK66Kcjs.useLatest; exports.useLayoutEffect = useLayoutEffect; exports.useMarkRoomThreadAsRead = _chunk45BFK66Kcjs.useMarkRoomThreadAsRead; exports.useMarkRoomThreadAsResolved = _chunk45BFK66Kcjs.useMarkRoomThreadAsResolved; exports.useMarkRoomThreadAsUnresolved = _chunk45BFK66Kcjs.useMarkRoomThreadAsUnresolved; exports.useMentionSuggestions = useMentionSuggestions; exports.useMentionSuggestionsCache = _chunk45BFK66Kcjs.useMentionSuggestionsCache; exports.useRemoveRoomCommentReaction = _chunk45BFK66Kcjs.useRemoveRoomCommentReaction; exports.useReportTextEditor = _chunk45BFK66Kcjs.useReportTextEditor; exports.useResolveMentionSuggestions = _chunk45BFK66Kcjs.useResolveMentionSuggestions; exports.useRoomAttachmentUrl = _chunk45BFK66Kcjs.useRoomAttachmentUrl; exports.useRoomPermissions = _chunk45BFK66Kcjs.useRoomPermissions; exports.useRoomThreadSubscription = _chunk45BFK66Kcjs.useRoomThreadSubscription; exports.useSignal = _chunk45BFK66Kcjs.useSignal; exports.useSyncExternalStoreWithSelector = _chunk45BFK66Kcjs.useSyncExternalStoreWithSelector; exports.useSyncSource = useSyncSource; exports.useYjsProvider = _chunk45BFK66Kcjs.useYjsProvider;
|
|
180
180
|
//# sourceMappingURL=_private.cjs.map
|
package/dist/_private.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as GroupAsyncResult } from './room-
|
|
2
|
-
export { g as getUmbrellaStoreForClient, a as useAddRoomCommentReaction, u as useClientOrNull, b as useCreateRoomComment, c as useCreateRoomThread, d as useCreateTextMention, e as useDeleteRoomComment, f as useDeleteRoomThread, h as useDeleteTextMention, i as useEditRoomComment, j as useEditRoomThreadMetadata, k as useMarkRoomThreadAsRead, l as useMarkRoomThreadAsResolved, m as useMarkRoomThreadAsUnresolved, n as useMentionSuggestionsCache, o as useRemoveRoomCommentReaction, p as useReportTextEditor, q as useResolveMentionSuggestions, r as useRoomAttachmentUrl, s as useRoomPermissions, t as useRoomThreadSubscription, v as useYjsProvider } from './room-
|
|
1
|
+
import { G as GroupAsyncResult } from './room-DSJuooXd.cjs';
|
|
2
|
+
export { g as getUmbrellaStoreForClient, a as useAddRoomCommentReaction, u as useClientOrNull, b as useCreateRoomComment, c as useCreateRoomThread, d as useCreateTextMention, e as useDeleteRoomComment, f as useDeleteRoomThread, h as useDeleteTextMention, i as useEditRoomComment, j as useEditRoomThreadMetadata, k as useMarkRoomThreadAsRead, l as useMarkRoomThreadAsResolved, m as useMarkRoomThreadAsUnresolved, n as useMentionSuggestionsCache, o as useRemoveRoomCommentReaction, p as useReportTextEditor, q as useResolveMentionSuggestions, r as useRoomAttachmentUrl, s as useRoomPermissions, t as useRoomThreadSubscription, v as useYjsProvider } from './room-DSJuooXd.cjs';
|
|
3
3
|
import { MutableRefObject, useEffect } from 'react';
|
|
4
4
|
import { MentionData, ISignal, SyncSource } from '@liveblocks/core';
|
|
5
5
|
import '@liveblocks/client';
|
package/dist/_private.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as GroupAsyncResult } from './room-
|
|
2
|
-
export { g as getUmbrellaStoreForClient, a as useAddRoomCommentReaction, u as useClientOrNull, b as useCreateRoomComment, c as useCreateRoomThread, d as useCreateTextMention, e as useDeleteRoomComment, f as useDeleteRoomThread, h as useDeleteTextMention, i as useEditRoomComment, j as useEditRoomThreadMetadata, k as useMarkRoomThreadAsRead, l as useMarkRoomThreadAsResolved, m as useMarkRoomThreadAsUnresolved, n as useMentionSuggestionsCache, o as useRemoveRoomCommentReaction, p as useReportTextEditor, q as useResolveMentionSuggestions, r as useRoomAttachmentUrl, s as useRoomPermissions, t as useRoomThreadSubscription, v as useYjsProvider } from './room-
|
|
1
|
+
import { G as GroupAsyncResult } from './room-DSJuooXd.js';
|
|
2
|
+
export { g as getUmbrellaStoreForClient, a as useAddRoomCommentReaction, u as useClientOrNull, b as useCreateRoomComment, c as useCreateRoomThread, d as useCreateTextMention, e as useDeleteRoomComment, f as useDeleteRoomThread, h as useDeleteTextMention, i as useEditRoomComment, j as useEditRoomThreadMetadata, k as useMarkRoomThreadAsRead, l as useMarkRoomThreadAsResolved, m as useMarkRoomThreadAsUnresolved, n as useMentionSuggestionsCache, o as useRemoveRoomCommentReaction, p as useReportTextEditor, q as useResolveMentionSuggestions, r as useRoomAttachmentUrl, s as useRoomPermissions, t as useRoomThreadSubscription, v as useYjsProvider } from './room-DSJuooXd.js';
|
|
3
3
|
import { MutableRefObject, useEffect } from 'react';
|
|
4
4
|
import { MentionData, ISignal, SyncSource } from '@liveblocks/core';
|
|
5
5
|
import '@liveblocks/client';
|
package/dist/_private.js
CHANGED
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
useSignal,
|
|
26
26
|
useSyncExternalStoreWithSelector,
|
|
27
27
|
useYjsProvider
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-GXPZZIB2.js";
|
|
29
29
|
|
|
30
30
|
// src/lib/use-layout-effect.ts
|
|
31
31
|
import { useEffect, useLayoutEffect as useOriginalLayoutEffect } from "react";
|
|
@@ -324,15 +324,12 @@ function autobind(self) {
|
|
|
324
324
|
} while ((obj = Reflect.getPrototypeOf(obj)) && obj !== Object.prototype);
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
-
// src/ThreadDB.ts
|
|
328
|
-
|
|
329
|
-
|
|
330
327
|
// src/lib/querying.ts
|
|
331
328
|
|
|
332
329
|
function makeThreadsFilter(query) {
|
|
333
|
-
return (thread) =>
|
|
330
|
+
return (thread) => matchesThreadsQuery(thread, query) && matchesMetadata(thread, query);
|
|
334
331
|
}
|
|
335
|
-
function
|
|
332
|
+
function matchesThreadsQuery(thread, q) {
|
|
336
333
|
return q.resolved === void 0 || thread.resolved === q.resolved;
|
|
337
334
|
}
|
|
338
335
|
function matchesMetadata(thread, q) {
|
|
@@ -354,8 +351,15 @@ function matchesOperator(value, op) {
|
|
|
354
351
|
return value === op;
|
|
355
352
|
}
|
|
356
353
|
}
|
|
354
|
+
function makeInboxNotificationsFilter(query) {
|
|
355
|
+
return (inboxNotification) => matchesInboxNotificationsQuery(inboxNotification, query);
|
|
356
|
+
}
|
|
357
|
+
function matchesInboxNotificationsQuery(inboxNotification, q) {
|
|
358
|
+
return (q.roomId === void 0 || q.roomId === inboxNotification.roomId) && (q.kind === void 0 || q.kind === inboxNotification.kind);
|
|
359
|
+
}
|
|
357
360
|
|
|
358
361
|
// src/ThreadDB.ts
|
|
362
|
+
|
|
359
363
|
function sanitizeThread(thread) {
|
|
360
364
|
if (thread.deletedAt) {
|
|
361
365
|
if (thread.comments.length > 0) {
|
|
@@ -1087,10 +1091,17 @@ var UmbrellaStore = class {
|
|
|
1087
1091
|
if (result.isLoading || result.error) {
|
|
1088
1092
|
return result;
|
|
1089
1093
|
}
|
|
1094
|
+
const crit = [];
|
|
1095
|
+
if (query !== void 0) {
|
|
1096
|
+
crit.push(makeInboxNotificationsFilter(query));
|
|
1097
|
+
}
|
|
1098
|
+
const inboxNotifications = this.outputs.notifications.get().sortedNotifications.filter(
|
|
1099
|
+
(inboxNotification) => crit.every((pred) => pred(inboxNotification))
|
|
1100
|
+
);
|
|
1090
1101
|
const page = result.data;
|
|
1091
1102
|
return {
|
|
1092
1103
|
isLoading: false,
|
|
1093
|
-
inboxNotifications
|
|
1104
|
+
inboxNotifications,
|
|
1094
1105
|
hasFetchedAll: page.hasFetchedAll,
|
|
1095
1106
|
isFetchingMore: page.isFetchingMore,
|
|
1096
1107
|
fetchMoreError: page.fetchMoreError,
|
|
@@ -2128,7 +2139,7 @@ function makeLiveblocksContextBundle(client) {
|
|
|
2128
2139
|
const bundle = {
|
|
2129
2140
|
LiveblocksProvider: LiveblocksProvider2,
|
|
2130
2141
|
useInboxNotifications: (options) => useInboxNotifications_withClient(client, identity2, _core.shallow, options),
|
|
2131
|
-
useUnreadInboxNotificationsCount: () => useUnreadInboxNotificationsCount_withClient(client),
|
|
2142
|
+
useUnreadInboxNotificationsCount: (options) => useUnreadInboxNotificationsCount_withClient(client, options),
|
|
2132
2143
|
useMarkInboxNotificationAsRead: useMarkInboxNotificationAsRead2,
|
|
2133
2144
|
useMarkAllInboxNotificationsAsRead: useMarkAllInboxNotificationsAsRead2,
|
|
2134
2145
|
useDeleteInboxNotification: useDeleteInboxNotification2,
|
|
@@ -2140,6 +2151,7 @@ function makeLiveblocksContextBundle(client) {
|
|
|
2140
2151
|
useAiChats,
|
|
2141
2152
|
useAiChat,
|
|
2142
2153
|
useAiChatMessages,
|
|
2154
|
+
useAiChatStatus,
|
|
2143
2155
|
useCreateAiChat,
|
|
2144
2156
|
useDeleteAiChat,
|
|
2145
2157
|
useSendAiMessage,
|
|
@@ -2147,7 +2159,7 @@ function makeLiveblocksContextBundle(client) {
|
|
|
2147
2159
|
suspense: {
|
|
2148
2160
|
LiveblocksProvider: LiveblocksProvider2,
|
|
2149
2161
|
useInboxNotifications: (options) => useInboxNotificationsSuspense_withClient(client, options),
|
|
2150
|
-
useUnreadInboxNotificationsCount: () => useUnreadInboxNotificationsCountSuspense_withClient(client),
|
|
2162
|
+
useUnreadInboxNotificationsCount: (options) => useUnreadInboxNotificationsCountSuspense_withClient(client, options),
|
|
2151
2163
|
useMarkInboxNotificationAsRead: useMarkInboxNotificationAsRead2,
|
|
2152
2164
|
useMarkAllInboxNotificationsAsRead: useMarkAllInboxNotificationsAsRead2,
|
|
2153
2165
|
useDeleteInboxNotification: useDeleteInboxNotification2,
|
|
@@ -2159,6 +2171,7 @@ function makeLiveblocksContextBundle(client) {
|
|
|
2159
2171
|
useAiChats: useAiChatsSuspense,
|
|
2160
2172
|
useAiChat: useAiChatSuspense,
|
|
2161
2173
|
useAiChatMessages: useAiChatMessagesSuspense,
|
|
2174
|
+
useAiChatStatus,
|
|
2162
2175
|
useCreateAiChat,
|
|
2163
2176
|
useDeleteAiChat,
|
|
2164
2177
|
useSendAiMessage,
|
|
@@ -2211,21 +2224,22 @@ function useInboxNotificationsSuspense_withClient(client, options) {
|
|
|
2211
2224
|
_core.assert.call(void 0, !result.isLoading, "Did not expect loading");
|
|
2212
2225
|
return result;
|
|
2213
2226
|
}
|
|
2214
|
-
function useUnreadInboxNotificationsCount_withClient(client) {
|
|
2227
|
+
function useUnreadInboxNotificationsCount_withClient(client, options) {
|
|
2215
2228
|
return useInboxNotifications_withClient(
|
|
2216
2229
|
client,
|
|
2217
2230
|
selectorFor_useUnreadInboxNotificationsCount,
|
|
2218
|
-
_core.shallow
|
|
2231
|
+
_core.shallow,
|
|
2232
|
+
options
|
|
2219
2233
|
);
|
|
2220
2234
|
}
|
|
2221
|
-
function useUnreadInboxNotificationsCountSuspense_withClient(client) {
|
|
2235
|
+
function useUnreadInboxNotificationsCountSuspense_withClient(client, options) {
|
|
2222
2236
|
ensureNotServerSide();
|
|
2223
2237
|
const store = getLiveblocksExtrasForClient(client).store;
|
|
2224
|
-
const queryKey = makeInboxNotificationsQueryKey(
|
|
2238
|
+
const queryKey = makeInboxNotificationsQueryKey(_optionalChain([options, 'optionalAccess', _15 => _15.query]));
|
|
2225
2239
|
use(
|
|
2226
2240
|
store.outputs.loadingNotifications.getOrCreate(queryKey).waitUntilLoaded()
|
|
2227
2241
|
);
|
|
2228
|
-
const result = useUnreadInboxNotificationsCount_withClient(client);
|
|
2242
|
+
const result = useUnreadInboxNotificationsCount_withClient(client, options);
|
|
2229
2243
|
_core.assert.call(void 0, !result.isLoading, "Did not expect loading");
|
|
2230
2244
|
_core.assert.call(void 0, !result.error, "Did not expect error");
|
|
2231
2245
|
return result;
|
|
@@ -2376,7 +2390,7 @@ function useUpdateNotificationSettings_withClient(client) {
|
|
|
2376
2390
|
store.optimisticUpdates.remove(optimisticUpdateId);
|
|
2377
2391
|
if (err instanceof _core.HttpError) {
|
|
2378
2392
|
if (err.status === 422) {
|
|
2379
|
-
const msg = [_optionalChain([err, 'access',
|
|
2393
|
+
const msg = [_optionalChain([err, 'access', _16 => _16.details, 'optionalAccess', _17 => _17.error]), _optionalChain([err, 'access', _18 => _18.details, 'optionalAccess', _19 => _19.reason])].filter(Boolean).join("\n");
|
|
2380
2394
|
_core.console.error(msg);
|
|
2381
2395
|
}
|
|
2382
2396
|
client[_core.kInternal].emitError(
|
|
@@ -2611,7 +2625,7 @@ function useGroupInfoSuspense_withClient(client, groupId) {
|
|
|
2611
2625
|
function useAiChats(options) {
|
|
2612
2626
|
const client = useClient();
|
|
2613
2627
|
const store = getUmbrellaStoreForClient(client);
|
|
2614
|
-
const queryKey = makeAiChatsQueryKey(_optionalChain([options, 'optionalAccess',
|
|
2628
|
+
const queryKey = makeAiChatsQueryKey(_optionalChain([options, 'optionalAccess', _20 => _20.query]));
|
|
2615
2629
|
useEnsureAiConnection(client);
|
|
2616
2630
|
_react.useEffect.call(void 0,
|
|
2617
2631
|
() => void store.outputs.aiChats.getOrCreate(queryKey).waitUntilLoaded()
|
|
@@ -2635,7 +2649,7 @@ function useAiChatsSuspense(options) {
|
|
|
2635
2649
|
const client = useClient();
|
|
2636
2650
|
const store = getUmbrellaStoreForClient(client);
|
|
2637
2651
|
useEnsureAiConnection(client);
|
|
2638
|
-
const queryKey = makeAiChatsQueryKey(_optionalChain([options, 'optionalAccess',
|
|
2652
|
+
const queryKey = makeAiChatsQueryKey(_optionalChain([options, 'optionalAccess', _21 => _21.query]));
|
|
2639
2653
|
use(store.outputs.aiChats.getOrCreate(queryKey).waitUntilLoaded());
|
|
2640
2654
|
const result = useAiChats(options);
|
|
2641
2655
|
_core.assert.call(void 0, !result.error, "Did not expect error");
|
|
@@ -2647,7 +2661,7 @@ function useAiChatMessages(chatId, options) {
|
|
|
2647
2661
|
const store = getUmbrellaStoreForClient(client);
|
|
2648
2662
|
useEnsureAiConnection(client);
|
|
2649
2663
|
_react.useEffect.call(void 0,
|
|
2650
|
-
() => void store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2664
|
+
() => void store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _22 => _22.branchId]), () => ( null))).waitUntilLoaded()
|
|
2651
2665
|
// NOTE: Deliberately *not* using a dependency array here!
|
|
2652
2666
|
//
|
|
2653
2667
|
// It is important to call waitUntil on *every* render.
|
|
@@ -2658,7 +2672,7 @@ function useAiChatMessages(chatId, options) {
|
|
|
2658
2672
|
// *next* render after that, a *new* fetch/promise will get created.
|
|
2659
2673
|
);
|
|
2660
2674
|
return useSignal(
|
|
2661
|
-
store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2675
|
+
store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _23 => _23.branchId]), () => ( null))).signal
|
|
2662
2676
|
);
|
|
2663
2677
|
}
|
|
2664
2678
|
function useAiChatMessagesSuspense(chatId, options) {
|
|
@@ -2667,7 +2681,7 @@ function useAiChatMessagesSuspense(chatId, options) {
|
|
|
2667
2681
|
const store = getUmbrellaStoreForClient(client);
|
|
2668
2682
|
useEnsureAiConnection(client);
|
|
2669
2683
|
use(
|
|
2670
|
-
store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2684
|
+
store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _24 => _24.branchId]), () => ( null))).waitUntilLoaded()
|
|
2671
2685
|
);
|
|
2672
2686
|
const result = useAiChatMessages(chatId, options);
|
|
2673
2687
|
_core.assert.call(void 0, !result.error, "Did not expect error");
|
|
@@ -2734,6 +2748,43 @@ function useDeleteAiChat() {
|
|
|
2734
2748
|
[client]
|
|
2735
2749
|
);
|
|
2736
2750
|
}
|
|
2751
|
+
var LOADING = Object.freeze({ status: "loading" });
|
|
2752
|
+
var IDLE = Object.freeze({ status: "idle" });
|
|
2753
|
+
function useAiChatStatus(chatId, branchId) {
|
|
2754
|
+
const client = useClient();
|
|
2755
|
+
const store = getUmbrellaStoreForClient(client);
|
|
2756
|
+
useEnsureAiConnection(client);
|
|
2757
|
+
_react.useEffect.call(void 0,
|
|
2758
|
+
() => void store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(branchId, () => ( null))).waitUntilLoaded()
|
|
2759
|
+
);
|
|
2760
|
+
return useSignal(
|
|
2761
|
+
// Signal
|
|
2762
|
+
store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(branchId, () => ( null))).signal,
|
|
2763
|
+
// Selector
|
|
2764
|
+
(result) => {
|
|
2765
|
+
if (result.isLoading) return LOADING;
|
|
2766
|
+
if (result.error) return IDLE;
|
|
2767
|
+
const messages = result.messages;
|
|
2768
|
+
const lastMessage = messages[messages.length - 1];
|
|
2769
|
+
if (_optionalChain([lastMessage, 'optionalAccess', _25 => _25.role]) !== "assistant") return IDLE;
|
|
2770
|
+
if (lastMessage.status !== "generating" && lastMessage.status !== "awaiting-tool")
|
|
2771
|
+
return IDLE;
|
|
2772
|
+
const contentSoFar = lastMessage.contentSoFar;
|
|
2773
|
+
const lastPart = contentSoFar[contentSoFar.length - 1];
|
|
2774
|
+
if (_optionalChain([lastPart, 'optionalAccess', _26 => _26.type]) === "tool-invocation") {
|
|
2775
|
+
return {
|
|
2776
|
+
status: "generating",
|
|
2777
|
+
partType: "tool-invocation",
|
|
2778
|
+
toolName: lastPart.name
|
|
2779
|
+
};
|
|
2780
|
+
} else {
|
|
2781
|
+
return { status: "generating", partType: _optionalChain([lastPart, 'optionalAccess', _27 => _27.type]) };
|
|
2782
|
+
}
|
|
2783
|
+
},
|
|
2784
|
+
// Consider { status: "generating", partType: "text" } and { status: "generating", partType: "text" } equal
|
|
2785
|
+
_core.shallow
|
|
2786
|
+
);
|
|
2787
|
+
}
|
|
2737
2788
|
function useSendAiMessage(chatId, options) {
|
|
2738
2789
|
const client = useClient();
|
|
2739
2790
|
return _react.useCallback.call(void 0,
|
|
@@ -2750,7 +2801,7 @@ function useSendAiMessage(chatId, options) {
|
|
|
2750
2801
|
"chatId must be provided to either `useSendAiMessage` or its returned function."
|
|
2751
2802
|
)));
|
|
2752
2803
|
const messages = client[_core.kInternal].ai.signals.getChatMessagesForBranch\u03A3(resolvedChatId).get();
|
|
2753
|
-
if (process.env.NODE_ENV !== "production" && !messageOptionsCopilotId && !_optionalChain([options, 'optionalAccess',
|
|
2804
|
+
if (process.env.NODE_ENV !== "production" && !messageOptionsCopilotId && !_optionalChain([options, 'optionalAccess', _28 => _28.copilotId])) {
|
|
2754
2805
|
_core.console.warn(
|
|
2755
2806
|
`No copilot ID was provided to useSendAiMessage when sending the message "${messageText.slice(
|
|
2756
2807
|
0,
|
|
@@ -2762,8 +2813,8 @@ To ensure the correct copilot ID is used, specify it either through the hook as
|
|
|
2762
2813
|
)}\u2026", copilotId: "co_xxx" })'`
|
|
2763
2814
|
);
|
|
2764
2815
|
}
|
|
2765
|
-
const resolvedCopilotId = _nullishCoalesce(_nullishCoalesce(messageOptionsCopilotId, () => ( _optionalChain([options, 'optionalAccess',
|
|
2766
|
-
const lastMessageId = _nullishCoalesce(_optionalChain([messages, 'access',
|
|
2816
|
+
const resolvedCopilotId = _nullishCoalesce(_nullishCoalesce(messageOptionsCopilotId, () => ( _optionalChain([options, 'optionalAccess', _29 => _29.copilotId]))), () => ( client[_core.kInternal].ai.getLastUsedCopilotId(resolvedChatId)));
|
|
2817
|
+
const lastMessageId = _nullishCoalesce(_optionalChain([messages, 'access', _30 => _30[messages.length - 1], 'optionalAccess', _31 => _31.id]), () => ( null));
|
|
2767
2818
|
const content = [{ type: "text", text: messageText }];
|
|
2768
2819
|
const newMessageId = client[_core.kInternal].ai[_core.kInternal].context.messagesStore.createOptimistically(
|
|
2769
2820
|
resolvedChatId,
|
|
@@ -2783,10 +2834,10 @@ To ensure the correct copilot ID is used, specify it either through the hook as
|
|
|
2783
2834
|
{ id: newMessageId, parentMessageId: lastMessageId, content },
|
|
2784
2835
|
targetMessageId,
|
|
2785
2836
|
{
|
|
2786
|
-
stream: _nullishCoalesce(messageOptions.stream, () => ( _optionalChain([options, 'optionalAccess',
|
|
2837
|
+
stream: _nullishCoalesce(messageOptions.stream, () => ( _optionalChain([options, 'optionalAccess', _32 => _32.stream]))),
|
|
2787
2838
|
copilotId: resolvedCopilotId,
|
|
2788
|
-
timeout: _nullishCoalesce(messageOptions.timeout, () => ( _optionalChain([options, 'optionalAccess',
|
|
2789
|
-
knowledge: _nullishCoalesce(messageOptions.knowledge, () => ( _optionalChain([options, 'optionalAccess',
|
|
2839
|
+
timeout: _nullishCoalesce(messageOptions.timeout, () => ( _optionalChain([options, 'optionalAccess', _33 => _33.timeout]))),
|
|
2840
|
+
knowledge: _nullishCoalesce(messageOptions.knowledge, () => ( _optionalChain([options, 'optionalAccess', _34 => _34.knowledge])))
|
|
2790
2841
|
}
|
|
2791
2842
|
);
|
|
2792
2843
|
return newMessage;
|
|
@@ -2794,10 +2845,10 @@ To ensure the correct copilot ID is used, specify it either through the hook as
|
|
|
2794
2845
|
[
|
|
2795
2846
|
client,
|
|
2796
2847
|
chatId,
|
|
2797
|
-
_optionalChain([options, 'optionalAccess',
|
|
2798
|
-
_optionalChain([options, 'optionalAccess',
|
|
2799
|
-
_optionalChain([options, 'optionalAccess',
|
|
2800
|
-
_optionalChain([options, 'optionalAccess',
|
|
2848
|
+
_optionalChain([options, 'optionalAccess', _35 => _35.copilotId]),
|
|
2849
|
+
_optionalChain([options, 'optionalAccess', _36 => _36.stream]),
|
|
2850
|
+
_optionalChain([options, 'optionalAccess', _37 => _37.timeout]),
|
|
2851
|
+
_optionalChain([options, 'optionalAccess', _38 => _38.knowledge])
|
|
2801
2852
|
]
|
|
2802
2853
|
);
|
|
2803
2854
|
}
|
|
@@ -2833,7 +2884,7 @@ function createSharedContext(client) {
|
|
|
2833
2884
|
}
|
|
2834
2885
|
function useEnsureNoLiveblocksProvider(options) {
|
|
2835
2886
|
const existing = useClientOrNull();
|
|
2836
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
2887
|
+
if (!_optionalChain([options, 'optionalAccess', _39 => _39.allowNesting]) && existing !== null) {
|
|
2837
2888
|
throw new Error(
|
|
2838
2889
|
"You cannot nest multiple LiveblocksProvider instances in the same React tree."
|
|
2839
2890
|
);
|
|
@@ -2947,11 +2998,14 @@ function useDeleteAllInboxNotifications() {
|
|
|
2947
2998
|
function useDeleteInboxNotification() {
|
|
2948
2999
|
return useDeleteInboxNotification_withClient(useClient());
|
|
2949
3000
|
}
|
|
2950
|
-
function useUnreadInboxNotificationsCount() {
|
|
2951
|
-
return useUnreadInboxNotificationsCount_withClient(useClient());
|
|
3001
|
+
function useUnreadInboxNotificationsCount(options) {
|
|
3002
|
+
return useUnreadInboxNotificationsCount_withClient(useClient(), options);
|
|
2952
3003
|
}
|
|
2953
|
-
function useUnreadInboxNotificationsCountSuspense() {
|
|
2954
|
-
return useUnreadInboxNotificationsCountSuspense_withClient(
|
|
3004
|
+
function useUnreadInboxNotificationsCountSuspense(options) {
|
|
3005
|
+
return useUnreadInboxNotificationsCountSuspense_withClient(
|
|
3006
|
+
useClient(),
|
|
3007
|
+
options
|
|
3008
|
+
);
|
|
2955
3009
|
}
|
|
2956
3010
|
function useNotificationSettings() {
|
|
2957
3011
|
return useNotificationSettings_withClient(useClient());
|
|
@@ -2994,7 +3048,7 @@ var _useAiChatSuspense = useAiChatSuspense;
|
|
|
2994
3048
|
var _useAiChatMessages = useAiChatMessages;
|
|
2995
3049
|
var _useAiChatMessagesSuspense = useAiChatMessagesSuspense;
|
|
2996
3050
|
function useSyncStatus_withClient(client, options) {
|
|
2997
|
-
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
3051
|
+
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _40 => _40.smooth]), () => ( false)));
|
|
2998
3052
|
if (smooth) {
|
|
2999
3053
|
return useSyncStatusSmooth_withClient(client);
|
|
3000
3054
|
} else {
|
|
@@ -3173,8 +3227,8 @@ function makeRoomExtrasForClient(client) {
|
|
|
3173
3227
|
if (innerError.status === 403) {
|
|
3174
3228
|
const detailedMessage = [
|
|
3175
3229
|
innerError.message,
|
|
3176
|
-
_optionalChain([innerError, 'access',
|
|
3177
|
-
_optionalChain([innerError, 'access',
|
|
3230
|
+
_optionalChain([innerError, 'access', _41 => _41.details, 'optionalAccess', _42 => _42.suggestion]),
|
|
3231
|
+
_optionalChain([innerError, 'access', _43 => _43.details, 'optionalAccess', _44 => _44.docs])
|
|
3178
3232
|
].filter(Boolean).join("\n");
|
|
3179
3233
|
_core.console.error(detailedMessage);
|
|
3180
3234
|
}
|
|
@@ -3469,7 +3523,7 @@ function RoomProviderInner(props) {
|
|
|
3469
3523
|
}
|
|
3470
3524
|
function useRoom(options) {
|
|
3471
3525
|
const room = useRoomOrNull();
|
|
3472
|
-
if (room === null && !_optionalChain([options, 'optionalAccess',
|
|
3526
|
+
if (room === null && !_optionalChain([options, 'optionalAccess', _45 => _45.allowOutsideRoom])) {
|
|
3473
3527
|
throw new Error("RoomProvider is missing from the React tree.");
|
|
3474
3528
|
}
|
|
3475
3529
|
return room;
|
|
@@ -3819,7 +3873,7 @@ function useCreateRoomThread(roomId) {
|
|
|
3819
3873
|
thread: newThread,
|
|
3820
3874
|
roomId
|
|
3821
3875
|
});
|
|
3822
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3876
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _46 => _46.map, 'call', _47 => _47((attachment) => attachment.id)]);
|
|
3823
3877
|
client[_core.kInternal].httpClient.createThread({
|
|
3824
3878
|
roomId,
|
|
3825
3879
|
threadId,
|
|
@@ -3859,7 +3913,7 @@ function useDeleteRoomThread(roomId) {
|
|
|
3859
3913
|
const { store, onMutationFailure } = getRoomExtrasForClient(client);
|
|
3860
3914
|
const userId = getCurrentUserId(client);
|
|
3861
3915
|
const existing = store.outputs.threads.get().get(threadId);
|
|
3862
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
3916
|
+
if (_optionalChain([existing, 'optionalAccess', _48 => _48.comments, 'optionalAccess', _49 => _49[0], 'optionalAccess', _50 => _50.userId]) !== userId) {
|
|
3863
3917
|
throw new Error("Only the thread creator can delete the thread");
|
|
3864
3918
|
}
|
|
3865
3919
|
const optimisticId = store.optimisticUpdates.add({
|
|
@@ -3947,7 +4001,7 @@ function useCreateRoomComment(roomId) {
|
|
|
3947
4001
|
type: "create-comment",
|
|
3948
4002
|
comment
|
|
3949
4003
|
});
|
|
3950
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
4004
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _51 => _51.map, 'call', _52 => _52((attachment) => attachment.id)]);
|
|
3951
4005
|
client[_core.kInternal].httpClient.createComment({ roomId, threadId, commentId, body, attachmentIds }).then(
|
|
3952
4006
|
(newComment) => {
|
|
3953
4007
|
store.createComment(newComment, optimisticId);
|
|
@@ -4003,7 +4057,7 @@ function useEditRoomComment(roomId) {
|
|
|
4003
4057
|
attachments: _nullishCoalesce(attachments, () => ( []))
|
|
4004
4058
|
}
|
|
4005
4059
|
});
|
|
4006
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
4060
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _53 => _53.map, 'call', _54 => _54((attachment) => attachment.id)]);
|
|
4007
4061
|
client[_core.kInternal].httpClient.editComment({ roomId, threadId, commentId, body, attachmentIds }).then(
|
|
4008
4062
|
(editedComment) => {
|
|
4009
4063
|
store.editComment(threadId, optimisticId, editedComment);
|
|
@@ -4344,7 +4398,7 @@ function useRoomThreadSubscription(roomId, threadId) {
|
|
|
4344
4398
|
}
|
|
4345
4399
|
return {
|
|
4346
4400
|
status: "subscribed",
|
|
4347
|
-
unreadSince: _nullishCoalesce(_optionalChain([notification, 'optionalAccess',
|
|
4401
|
+
unreadSince: _nullishCoalesce(_optionalChain([notification, 'optionalAccess', _55 => _55.readAt]), () => ( null)),
|
|
4348
4402
|
subscribe,
|
|
4349
4403
|
unsubscribe
|
|
4350
4404
|
};
|
|
@@ -4555,7 +4609,7 @@ function useThreadsSuspense(options = {}) {
|
|
|
4555
4609
|
return result;
|
|
4556
4610
|
}
|
|
4557
4611
|
function selectorFor_useAttachmentUrl(state) {
|
|
4558
|
-
if (state === void 0 || _optionalChain([state, 'optionalAccess',
|
|
4612
|
+
if (state === void 0 || _optionalChain([state, 'optionalAccess', _56 => _56.isLoading])) {
|
|
4559
4613
|
return _nullishCoalesce(state, () => ( { isLoading: true }));
|
|
4560
4614
|
}
|
|
4561
4615
|
if (state.error) {
|
|
@@ -4782,5 +4836,6 @@ var _useUpdateMyPresence = useUpdateMyPresence;
|
|
|
4782
4836
|
|
|
4783
4837
|
|
|
4784
4838
|
|
|
4785
|
-
|
|
4786
|
-
|
|
4839
|
+
|
|
4840
|
+
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.useAiChatStatus = useAiChatStatus; 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.useGroupInfo = useGroupInfo; exports.useGroupInfoSuspense = useGroupInfoSuspense; 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;
|
|
4841
|
+
//# sourceMappingURL=chunk-45BFK66K.cjs.map
|