@liveblocks/react 3.6.1-preview1 → 3.7.0-preview1
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 +46 -8
- package/dist/_private.cjs.map +1 -1
- package/dist/_private.d.cts +8 -7
- package/dist/_private.d.ts +8 -7
- package/dist/_private.js +45 -7
- package/dist/_private.js.map +1 -1
- package/dist/{chunk-EEINMYNI.cjs → chunk-42HXAXED.cjs} +128 -62
- package/dist/chunk-42HXAXED.cjs.map +1 -0
- package/dist/{chunk-B5I7RQMM.js → chunk-AUFFB5BH.js} +2 -2
- package/dist/{chunk-I2UW4JM4.js → chunk-LYWCKEAX.js} +100 -34
- package/dist/chunk-LYWCKEAX.js.map +1 -0
- package/dist/{chunk-5WJEEON5.cjs → chunk-X5PYKCZB.cjs} +2 -2
- package/dist/{chunk-5WJEEON5.cjs.map → chunk-X5PYKCZB.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-BE4TZf40.d.cts → room-RdHnZMhs.d.cts} +36 -8
- package/dist/{room-BE4TZf40.d.ts → room-RdHnZMhs.d.ts} +36 -8
- 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-EEINMYNI.cjs.map +0 -1
- package/dist/chunk-I2UW4JM4.js.map +0 -1
- /package/dist/{chunk-B5I7RQMM.js.map → chunk-AUFFB5BH.js.map} +0 -0
|
@@ -305,7 +305,6 @@ var use = _nullishCoalesce(reactUse, () => ( ((promise) => {
|
|
|
305
305
|
|
|
306
306
|
|
|
307
307
|
|
|
308
|
-
|
|
309
308
|
|
|
310
309
|
|
|
311
310
|
// src/lib/autobind.ts
|
|
@@ -1741,15 +1740,7 @@ function applyOptimisticUpdates_forSubscriptions(subscriptionsLUT, threads, opti
|
|
|
1741
1740
|
delete subscriptions[subscriptionKey];
|
|
1742
1741
|
break;
|
|
1743
1742
|
}
|
|
1744
|
-
// Create subscriptions for every threads in the room which the user participates in but doesn't have a subscription for yet
|
|
1745
1743
|
case "replies_and_mentions": {
|
|
1746
|
-
if (isThreadParticipant(thread, update.userId) && !subscriptions[subscriptionKey]) {
|
|
1747
|
-
subscriptions[subscriptionKey] = {
|
|
1748
|
-
kind: "thread",
|
|
1749
|
-
subjectId: thread.id,
|
|
1750
|
-
createdAt: /* @__PURE__ */ new Date()
|
|
1751
|
-
};
|
|
1752
|
-
}
|
|
1753
1744
|
break;
|
|
1754
1745
|
}
|
|
1755
1746
|
default:
|
|
@@ -1950,27 +1941,6 @@ function upsertReaction(reactions, reaction) {
|
|
|
1950
1941
|
}
|
|
1951
1942
|
return reactions;
|
|
1952
1943
|
}
|
|
1953
|
-
function isThreadParticipant(thread, userId) {
|
|
1954
|
-
let isParticipant = false;
|
|
1955
|
-
for (const comment of thread.comments) {
|
|
1956
|
-
if (comment.deletedAt) {
|
|
1957
|
-
continue;
|
|
1958
|
-
}
|
|
1959
|
-
if (comment.userId === userId) {
|
|
1960
|
-
isParticipant = true;
|
|
1961
|
-
break;
|
|
1962
|
-
}
|
|
1963
|
-
const mentions = _core.getMentionsFromCommentBody.call(void 0,
|
|
1964
|
-
comment.body,
|
|
1965
|
-
(mention) => mention.kind === "user" && mention.id === userId
|
|
1966
|
-
);
|
|
1967
|
-
if (mentions.length > 0) {
|
|
1968
|
-
isParticipant = true;
|
|
1969
|
-
break;
|
|
1970
|
-
}
|
|
1971
|
-
}
|
|
1972
|
-
return isParticipant;
|
|
1973
|
-
}
|
|
1974
1944
|
|
|
1975
1945
|
// src/liveblocks.tsx
|
|
1976
1946
|
var _jsxruntime = require('react/jsx-runtime');
|
|
@@ -1982,6 +1952,11 @@ function missingRoomInfoError(roomId) {
|
|
|
1982
1952
|
`resolveRoomsInfo didn't return anything for room '${roomId}'`
|
|
1983
1953
|
);
|
|
1984
1954
|
}
|
|
1955
|
+
function missingGroupInfoError(groupId) {
|
|
1956
|
+
return new Error(
|
|
1957
|
+
`resolveGroupsInfo didn't return anything for group '${groupId}'`
|
|
1958
|
+
);
|
|
1959
|
+
}
|
|
1985
1960
|
function identity2(x) {
|
|
1986
1961
|
return x;
|
|
1987
1962
|
}
|
|
@@ -2036,6 +2011,24 @@ function selectorFor_useRoomInfo(state, roomId) {
|
|
|
2036
2011
|
info: state.data
|
|
2037
2012
|
};
|
|
2038
2013
|
}
|
|
2014
|
+
function selectorFor_useGroupInfo(state, groupId) {
|
|
2015
|
+
if (state === void 0 || _optionalChain([state, 'optionalAccess', _12 => _12.isLoading])) {
|
|
2016
|
+
return _nullishCoalesce(state, () => ( { isLoading: true }));
|
|
2017
|
+
}
|
|
2018
|
+
if (state.error) {
|
|
2019
|
+
return state;
|
|
2020
|
+
}
|
|
2021
|
+
if (!state.data) {
|
|
2022
|
+
return {
|
|
2023
|
+
isLoading: false,
|
|
2024
|
+
error: missingGroupInfoError(groupId)
|
|
2025
|
+
};
|
|
2026
|
+
}
|
|
2027
|
+
return {
|
|
2028
|
+
isLoading: false,
|
|
2029
|
+
info: state.data
|
|
2030
|
+
};
|
|
2031
|
+
}
|
|
2039
2032
|
function getOrCreateContextBundle(client) {
|
|
2040
2033
|
let bundle = _bundles.get(client);
|
|
2041
2034
|
if (!bundle) {
|
|
@@ -2363,7 +2356,7 @@ function useUpdateNotificationSettings_withClient(client) {
|
|
|
2363
2356
|
store.optimisticUpdates.remove(optimisticUpdateId);
|
|
2364
2357
|
if (err instanceof _core.HttpError) {
|
|
2365
2358
|
if (err.status === 422) {
|
|
2366
|
-
const msg = [_optionalChain([err, 'access',
|
|
2359
|
+
const msg = [_optionalChain([err, 'access', _13 => _13.details, 'optionalAccess', _14 => _14.error]), _optionalChain([err, 'access', _15 => _15.details, 'optionalAccess', _16 => _16.reason])].filter(Boolean).join("\n");
|
|
2367
2360
|
_core.console.error(msg);
|
|
2368
2361
|
}
|
|
2369
2362
|
client[_core.kInternal].emitError(
|
|
@@ -2533,10 +2526,72 @@ function useRoomInfoSuspense_withClient(client, roomId) {
|
|
|
2533
2526
|
error: void 0
|
|
2534
2527
|
};
|
|
2535
2528
|
}
|
|
2529
|
+
function useGroupInfo_withClient(client, groupId) {
|
|
2530
|
+
const groupsInfoStore = client[_core.kInternal].groupsInfoStore;
|
|
2531
|
+
const getGroupInfoState = _react.useCallback.call(void 0,
|
|
2532
|
+
() => groupsInfoStore.getItemState(groupId),
|
|
2533
|
+
[groupsInfoStore, groupId]
|
|
2534
|
+
);
|
|
2535
|
+
const selector = _react.useCallback.call(void 0,
|
|
2536
|
+
(state) => selectorFor_useGroupInfo(state, groupId),
|
|
2537
|
+
[groupId]
|
|
2538
|
+
);
|
|
2539
|
+
const result = useSyncExternalStoreWithSelector(
|
|
2540
|
+
groupsInfoStore.subscribe,
|
|
2541
|
+
getGroupInfoState,
|
|
2542
|
+
getGroupInfoState,
|
|
2543
|
+
selector,
|
|
2544
|
+
_core.shallow
|
|
2545
|
+
);
|
|
2546
|
+
_react.useEffect.call(void 0,
|
|
2547
|
+
() => void groupsInfoStore.enqueue(groupId)
|
|
2548
|
+
// NOTE: Deliberately *not* using a dependency array here!
|
|
2549
|
+
//
|
|
2550
|
+
// It is important to call groupsInfoStore.enqueue on *every* render.
|
|
2551
|
+
// This is harmless though, on most renders, except:
|
|
2552
|
+
// 1. The very first render, in which case we'll want to trigger evaluation
|
|
2553
|
+
// of the groupId.
|
|
2554
|
+
// 2. All other subsequent renders now are a no-op (from the implementation
|
|
2555
|
+
// of .enqueue)
|
|
2556
|
+
// 3. If ever the groupId gets invalidated, the group info would be fetched again.
|
|
2557
|
+
);
|
|
2558
|
+
return result;
|
|
2559
|
+
}
|
|
2560
|
+
function useGroupInfoSuspense_withClient(client, groupId) {
|
|
2561
|
+
const groupsInfoStore = client[_core.kInternal].groupsInfoStore;
|
|
2562
|
+
const getGroupInfoState = _react.useCallback.call(void 0,
|
|
2563
|
+
() => groupsInfoStore.getItemState(groupId),
|
|
2564
|
+
[groupsInfoStore, groupId]
|
|
2565
|
+
);
|
|
2566
|
+
const groupInfoState = getGroupInfoState();
|
|
2567
|
+
if (!groupInfoState || groupInfoState.isLoading) {
|
|
2568
|
+
throw groupsInfoStore.enqueue(groupId);
|
|
2569
|
+
}
|
|
2570
|
+
if (groupInfoState.error) {
|
|
2571
|
+
throw groupInfoState.error;
|
|
2572
|
+
}
|
|
2573
|
+
if (!groupInfoState.data) {
|
|
2574
|
+
throw missingGroupInfoError(groupId);
|
|
2575
|
+
}
|
|
2576
|
+
const state = _react.useSyncExternalStore.call(void 0,
|
|
2577
|
+
groupsInfoStore.subscribe,
|
|
2578
|
+
getGroupInfoState,
|
|
2579
|
+
getGroupInfoState
|
|
2580
|
+
);
|
|
2581
|
+
_core.assert.call(void 0, state !== void 0, "Unexpected missing state");
|
|
2582
|
+
_core.assert.call(void 0, !state.isLoading, "Unexpected loading state");
|
|
2583
|
+
_core.assert.call(void 0, !state.error, "Unexpected error state");
|
|
2584
|
+
_core.assert.call(void 0, state.data !== void 0, "Unexpected missing group info data");
|
|
2585
|
+
return {
|
|
2586
|
+
isLoading: false,
|
|
2587
|
+
info: state.data,
|
|
2588
|
+
error: void 0
|
|
2589
|
+
};
|
|
2590
|
+
}
|
|
2536
2591
|
function useAiChats(options) {
|
|
2537
2592
|
const client = useClient();
|
|
2538
2593
|
const store = getUmbrellaStoreForClient(client);
|
|
2539
|
-
const queryKey = makeAiChatsQueryKey(_optionalChain([options, 'optionalAccess',
|
|
2594
|
+
const queryKey = makeAiChatsQueryKey(_optionalChain([options, 'optionalAccess', _17 => _17.query]));
|
|
2540
2595
|
useEnsureAiConnection(client);
|
|
2541
2596
|
_react.useEffect.call(void 0,
|
|
2542
2597
|
() => void store.outputs.aiChats.getOrCreate(queryKey).waitUntilLoaded()
|
|
@@ -2560,7 +2615,7 @@ function useAiChatsSuspense(options) {
|
|
|
2560
2615
|
const client = useClient();
|
|
2561
2616
|
const store = getUmbrellaStoreForClient(client);
|
|
2562
2617
|
useEnsureAiConnection(client);
|
|
2563
|
-
const queryKey = makeAiChatsQueryKey(_optionalChain([options, 'optionalAccess',
|
|
2618
|
+
const queryKey = makeAiChatsQueryKey(_optionalChain([options, 'optionalAccess', _18 => _18.query]));
|
|
2564
2619
|
use(store.outputs.aiChats.getOrCreate(queryKey).waitUntilLoaded());
|
|
2565
2620
|
const result = useAiChats(options);
|
|
2566
2621
|
_core.assert.call(void 0, !result.error, "Did not expect error");
|
|
@@ -2572,7 +2627,7 @@ function useAiChatMessages(chatId, options) {
|
|
|
2572
2627
|
const store = getUmbrellaStoreForClient(client);
|
|
2573
2628
|
useEnsureAiConnection(client);
|
|
2574
2629
|
_react.useEffect.call(void 0,
|
|
2575
|
-
() => void store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2630
|
+
() => void store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _19 => _19.branchId]), () => ( null))).waitUntilLoaded()
|
|
2576
2631
|
// NOTE: Deliberately *not* using a dependency array here!
|
|
2577
2632
|
//
|
|
2578
2633
|
// It is important to call waitUntil on *every* render.
|
|
@@ -2583,7 +2638,7 @@ function useAiChatMessages(chatId, options) {
|
|
|
2583
2638
|
// *next* render after that, a *new* fetch/promise will get created.
|
|
2584
2639
|
);
|
|
2585
2640
|
return useSignal(
|
|
2586
|
-
store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2641
|
+
store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _20 => _20.branchId]), () => ( null))).signal
|
|
2587
2642
|
);
|
|
2588
2643
|
}
|
|
2589
2644
|
function useAiChatMessagesSuspense(chatId, options) {
|
|
@@ -2592,7 +2647,7 @@ function useAiChatMessagesSuspense(chatId, options) {
|
|
|
2592
2647
|
const store = getUmbrellaStoreForClient(client);
|
|
2593
2648
|
useEnsureAiConnection(client);
|
|
2594
2649
|
use(
|
|
2595
|
-
store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2650
|
+
store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _21 => _21.branchId]), () => ( null))).waitUntilLoaded()
|
|
2596
2651
|
);
|
|
2597
2652
|
const result = useAiChatMessages(chatId, options);
|
|
2598
2653
|
_core.assert.call(void 0, !result.error, "Did not expect error");
|
|
@@ -2675,7 +2730,7 @@ function useSendAiMessage(chatId, options) {
|
|
|
2675
2730
|
"chatId must be provided to either `useSendAiMessage` or its returned function."
|
|
2676
2731
|
)));
|
|
2677
2732
|
const messages = client[_core.kInternal].ai.signals.getChatMessagesForBranch\u03A3(resolvedChatId).get();
|
|
2678
|
-
if (process.env.NODE_ENV !== "production" && !messageOptionsCopilotId && !_optionalChain([options, 'optionalAccess',
|
|
2733
|
+
if (process.env.NODE_ENV !== "production" && !messageOptionsCopilotId && !_optionalChain([options, 'optionalAccess', _22 => _22.copilotId])) {
|
|
2679
2734
|
_core.console.warn(
|
|
2680
2735
|
`No copilot ID was provided to useSendAiMessage when sending the message "${messageText.slice(
|
|
2681
2736
|
0,
|
|
@@ -2687,8 +2742,8 @@ To ensure the correct copilot ID is used, specify it either through the hook as
|
|
|
2687
2742
|
)}\u2026", copilotId: "co_xxx" })'`
|
|
2688
2743
|
);
|
|
2689
2744
|
}
|
|
2690
|
-
const resolvedCopilotId = _nullishCoalesce(_nullishCoalesce(messageOptionsCopilotId, () => ( _optionalChain([options, 'optionalAccess',
|
|
2691
|
-
const lastMessageId = _nullishCoalesce(_optionalChain([messages, 'access',
|
|
2745
|
+
const resolvedCopilotId = _nullishCoalesce(_nullishCoalesce(messageOptionsCopilotId, () => ( _optionalChain([options, 'optionalAccess', _23 => _23.copilotId]))), () => ( client[_core.kInternal].ai.getLastUsedCopilotId(resolvedChatId)));
|
|
2746
|
+
const lastMessageId = _nullishCoalesce(_optionalChain([messages, 'access', _24 => _24[messages.length - 1], 'optionalAccess', _25 => _25.id]), () => ( null));
|
|
2692
2747
|
const content = [{ type: "text", text: messageText }];
|
|
2693
2748
|
const newMessageId = client[_core.kInternal].ai[_core.kInternal].context.messagesStore.createOptimistically(
|
|
2694
2749
|
resolvedChatId,
|
|
@@ -2708,10 +2763,10 @@ To ensure the correct copilot ID is used, specify it either through the hook as
|
|
|
2708
2763
|
{ id: newMessageId, parentMessageId: lastMessageId, content },
|
|
2709
2764
|
targetMessageId,
|
|
2710
2765
|
{
|
|
2711
|
-
stream: _nullishCoalesce(messageOptions.stream, () => ( _optionalChain([options, 'optionalAccess',
|
|
2766
|
+
stream: _nullishCoalesce(messageOptions.stream, () => ( _optionalChain([options, 'optionalAccess', _26 => _26.stream]))),
|
|
2712
2767
|
copilotId: resolvedCopilotId,
|
|
2713
|
-
timeout: _nullishCoalesce(messageOptions.timeout, () => ( _optionalChain([options, 'optionalAccess',
|
|
2714
|
-
knowledge: _nullishCoalesce(messageOptions.knowledge, () => ( _optionalChain([options, 'optionalAccess',
|
|
2768
|
+
timeout: _nullishCoalesce(messageOptions.timeout, () => ( _optionalChain([options, 'optionalAccess', _27 => _27.timeout]))),
|
|
2769
|
+
knowledge: _nullishCoalesce(messageOptions.knowledge, () => ( _optionalChain([options, 'optionalAccess', _28 => _28.knowledge])))
|
|
2715
2770
|
}
|
|
2716
2771
|
);
|
|
2717
2772
|
return newMessage;
|
|
@@ -2719,10 +2774,10 @@ To ensure the correct copilot ID is used, specify it either through the hook as
|
|
|
2719
2774
|
[
|
|
2720
2775
|
client,
|
|
2721
2776
|
chatId,
|
|
2722
|
-
_optionalChain([options, 'optionalAccess',
|
|
2723
|
-
_optionalChain([options, 'optionalAccess',
|
|
2724
|
-
_optionalChain([options, 'optionalAccess',
|
|
2725
|
-
_optionalChain([options, 'optionalAccess',
|
|
2777
|
+
_optionalChain([options, 'optionalAccess', _29 => _29.copilotId]),
|
|
2778
|
+
_optionalChain([options, 'optionalAccess', _30 => _30.stream]),
|
|
2779
|
+
_optionalChain([options, 'optionalAccess', _31 => _31.timeout]),
|
|
2780
|
+
_optionalChain([options, 'optionalAccess', _32 => _32.knowledge])
|
|
2726
2781
|
]
|
|
2727
2782
|
);
|
|
2728
2783
|
}
|
|
@@ -2736,6 +2791,7 @@ function createSharedContext(client) {
|
|
|
2736
2791
|
useClient: useClient2,
|
|
2737
2792
|
useUser: (userId) => useUser_withClient(client, userId),
|
|
2738
2793
|
useRoomInfo: (roomId) => useRoomInfo_withClient(client, roomId),
|
|
2794
|
+
useGroupInfo: (groupId) => useGroupInfo_withClient(client, groupId),
|
|
2739
2795
|
useIsInsideRoom,
|
|
2740
2796
|
useErrorListener,
|
|
2741
2797
|
useSyncStatus: useSyncStatus2,
|
|
@@ -2746,6 +2802,7 @@ function createSharedContext(client) {
|
|
|
2746
2802
|
useClient: useClient2,
|
|
2747
2803
|
useUser: (userId) => useUserSuspense_withClient(client, userId),
|
|
2748
2804
|
useRoomInfo: (roomId) => useRoomInfoSuspense_withClient(client, roomId),
|
|
2805
|
+
useGroupInfo: (groupId) => useGroupInfoSuspense_withClient(client, groupId),
|
|
2749
2806
|
useIsInsideRoom,
|
|
2750
2807
|
useErrorListener,
|
|
2751
2808
|
useSyncStatus: useSyncStatus2,
|
|
@@ -2756,7 +2813,7 @@ function createSharedContext(client) {
|
|
|
2756
2813
|
}
|
|
2757
2814
|
function useEnsureNoLiveblocksProvider(options) {
|
|
2758
2815
|
const existing = useClientOrNull();
|
|
2759
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
2816
|
+
if (!_optionalChain([options, 'optionalAccess', _33 => _33.allowNesting]) && existing !== null) {
|
|
2760
2817
|
throw new Error(
|
|
2761
2818
|
"You cannot nest multiple LiveblocksProvider instances in the same React tree."
|
|
2762
2819
|
);
|
|
@@ -2783,6 +2840,7 @@ function LiveblocksProvider(props) {
|
|
|
2783
2840
|
),
|
|
2784
2841
|
resolveUsers: useInitialUnlessFunction(o.resolveUsers),
|
|
2785
2842
|
resolveRoomsInfo: useInitialUnlessFunction(o.resolveRoomsInfo),
|
|
2843
|
+
resolveGroupsInfo: useInitialUnlessFunction(o.resolveGroupsInfo),
|
|
2786
2844
|
baseUrl: useInitial(
|
|
2787
2845
|
// @ts-expect-error - Hidden config options
|
|
2788
2846
|
o.baseUrl
|
|
@@ -2893,6 +2951,12 @@ function useRoomInfo(roomId) {
|
|
|
2893
2951
|
function useRoomInfoSuspense(roomId) {
|
|
2894
2952
|
return useRoomInfoSuspense_withClient(useClient(), roomId);
|
|
2895
2953
|
}
|
|
2954
|
+
function useGroupInfo(groupId) {
|
|
2955
|
+
return useGroupInfo_withClient(useClient(), groupId);
|
|
2956
|
+
}
|
|
2957
|
+
function useGroupInfoSuspense(groupId) {
|
|
2958
|
+
return useGroupInfoSuspense_withClient(useClient(), groupId);
|
|
2959
|
+
}
|
|
2896
2960
|
var _useInboxNotificationThread = useInboxNotificationThread;
|
|
2897
2961
|
var _useUser = useUser;
|
|
2898
2962
|
var _useUserSuspense = useUserSuspense;
|
|
@@ -2905,7 +2969,7 @@ var _useAiChatSuspense = useAiChatSuspense;
|
|
|
2905
2969
|
var _useAiChatMessages = useAiChatMessages;
|
|
2906
2970
|
var _useAiChatMessagesSuspense = useAiChatMessagesSuspense;
|
|
2907
2971
|
function useSyncStatus_withClient(client, options) {
|
|
2908
|
-
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2972
|
+
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _34 => _34.smooth]), () => ( false)));
|
|
2909
2973
|
if (smooth) {
|
|
2910
2974
|
return useSyncStatusSmooth_withClient(client);
|
|
2911
2975
|
} else {
|
|
@@ -3084,8 +3148,8 @@ function makeRoomExtrasForClient(client) {
|
|
|
3084
3148
|
if (innerError.status === 403) {
|
|
3085
3149
|
const detailedMessage = [
|
|
3086
3150
|
innerError.message,
|
|
3087
|
-
_optionalChain([innerError, 'access',
|
|
3088
|
-
_optionalChain([innerError, 'access',
|
|
3151
|
+
_optionalChain([innerError, 'access', _35 => _35.details, 'optionalAccess', _36 => _36.suggestion]),
|
|
3152
|
+
_optionalChain([innerError, 'access', _37 => _37.details, 'optionalAccess', _38 => _38.docs])
|
|
3089
3153
|
].filter(Boolean).join("\n");
|
|
3090
3154
|
_core.console.error(detailedMessage);
|
|
3091
3155
|
}
|
|
@@ -3380,7 +3444,7 @@ function RoomProviderInner(props) {
|
|
|
3380
3444
|
}
|
|
3381
3445
|
function useRoom(options) {
|
|
3382
3446
|
const room = useRoomOrNull();
|
|
3383
|
-
if (room === null && !_optionalChain([options, 'optionalAccess',
|
|
3447
|
+
if (room === null && !_optionalChain([options, 'optionalAccess', _39 => _39.allowOutsideRoom])) {
|
|
3384
3448
|
throw new Error("RoomProvider is missing from the React tree.");
|
|
3385
3449
|
}
|
|
3386
3450
|
return room;
|
|
@@ -3424,10 +3488,10 @@ function useYjsProvider() {
|
|
|
3424
3488
|
function useCreateTextMention() {
|
|
3425
3489
|
const room = useRoom();
|
|
3426
3490
|
return _react.useCallback.call(void 0,
|
|
3427
|
-
(
|
|
3428
|
-
room[_core.kInternal].createTextMention(
|
|
3491
|
+
(mentionId, mention) => {
|
|
3492
|
+
room[_core.kInternal].createTextMention(mentionId, mention).catch((err) => {
|
|
3429
3493
|
_core.console.error(
|
|
3430
|
-
`Cannot create text mention for
|
|
3494
|
+
`Cannot create text mention for mention '${mentionId}'`,
|
|
3431
3495
|
err
|
|
3432
3496
|
);
|
|
3433
3497
|
});
|
|
@@ -3730,7 +3794,7 @@ function useCreateRoomThread(roomId) {
|
|
|
3730
3794
|
thread: newThread,
|
|
3731
3795
|
roomId
|
|
3732
3796
|
});
|
|
3733
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3797
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _40 => _40.map, 'call', _41 => _41((attachment) => attachment.id)]);
|
|
3734
3798
|
client[_core.kInternal].httpClient.createThread({
|
|
3735
3799
|
roomId,
|
|
3736
3800
|
threadId,
|
|
@@ -3770,7 +3834,7 @@ function useDeleteRoomThread(roomId) {
|
|
|
3770
3834
|
const { store, onMutationFailure } = getRoomExtrasForClient(client);
|
|
3771
3835
|
const userId = getCurrentUserId(client);
|
|
3772
3836
|
const existing = store.outputs.threads.get().get(threadId);
|
|
3773
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
3837
|
+
if (_optionalChain([existing, 'optionalAccess', _42 => _42.comments, 'optionalAccess', _43 => _43[0], 'optionalAccess', _44 => _44.userId]) !== userId) {
|
|
3774
3838
|
throw new Error("Only the thread creator can delete the thread");
|
|
3775
3839
|
}
|
|
3776
3840
|
const optimisticId = store.optimisticUpdates.add({
|
|
@@ -3858,7 +3922,7 @@ function useCreateRoomComment(roomId) {
|
|
|
3858
3922
|
type: "create-comment",
|
|
3859
3923
|
comment
|
|
3860
3924
|
});
|
|
3861
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3925
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _45 => _45.map, 'call', _46 => _46((attachment) => attachment.id)]);
|
|
3862
3926
|
client[_core.kInternal].httpClient.createComment({ roomId, threadId, commentId, body, attachmentIds }).then(
|
|
3863
3927
|
(newComment) => {
|
|
3864
3928
|
store.createComment(newComment, optimisticId);
|
|
@@ -3914,7 +3978,7 @@ function useEditRoomComment(roomId) {
|
|
|
3914
3978
|
attachments: _nullishCoalesce(attachments, () => ( []))
|
|
3915
3979
|
}
|
|
3916
3980
|
});
|
|
3917
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3981
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _47 => _47.map, 'call', _48 => _48((attachment) => attachment.id)]);
|
|
3918
3982
|
client[_core.kInternal].httpClient.editComment({ roomId, threadId, commentId, body, attachmentIds }).then(
|
|
3919
3983
|
(editedComment) => {
|
|
3920
3984
|
store.editComment(threadId, optimisticId, editedComment);
|
|
@@ -4255,7 +4319,7 @@ function useRoomThreadSubscription(roomId, threadId) {
|
|
|
4255
4319
|
}
|
|
4256
4320
|
return {
|
|
4257
4321
|
status: "subscribed",
|
|
4258
|
-
unreadSince: _nullishCoalesce(_optionalChain([notification, 'optionalAccess',
|
|
4322
|
+
unreadSince: _nullishCoalesce(_optionalChain([notification, 'optionalAccess', _49 => _49.readAt]), () => ( null)),
|
|
4259
4323
|
subscribe,
|
|
4260
4324
|
unsubscribe
|
|
4261
4325
|
};
|
|
@@ -4466,7 +4530,7 @@ function useThreadsSuspense(options = {}) {
|
|
|
4466
4530
|
return result;
|
|
4467
4531
|
}
|
|
4468
4532
|
function selectorFor_useAttachmentUrl(state) {
|
|
4469
|
-
if (state === void 0 || _optionalChain([state, 'optionalAccess',
|
|
4533
|
+
if (state === void 0 || _optionalChain([state, 'optionalAccess', _50 => _50.isLoading])) {
|
|
4470
4534
|
return _nullishCoalesce(state, () => ( { isLoading: true }));
|
|
4471
4535
|
}
|
|
4472
4536
|
if (state.error) {
|
|
@@ -4691,5 +4755,7 @@ var _useUpdateMyPresence = useUpdateMyPresence;
|
|
|
4691
4755
|
|
|
4692
4756
|
|
|
4693
4757
|
|
|
4694
|
-
|
|
4695
|
-
|
|
4758
|
+
|
|
4759
|
+
|
|
4760
|
+
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.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;
|
|
4761
|
+
//# sourceMappingURL=chunk-42HXAXED.cjs.map
|