@liveblocks/react 3.7.0 → 3.7.1

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 CHANGED
@@ -25,7 +25,7 @@
25
25
 
26
26
 
27
27
 
28
- var _chunkW2H56LB3cjs = require('./chunk-W2H56LB3.cjs');
28
+ var _chunk4GCS3365cjs = require('./chunk-4GCS3365.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 = _chunkW2H56LB3cjs.useClient.call(void 0, );
53
+ const client = _chunk4GCS3365cjs.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 _chunkW2H56LB3cjs.useSyncExternalStoreWithSelector.call(void 0,
62
+ return _chunk4GCS3365cjs.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 = _chunkW2H56LB3cjs.useResolveMentionSuggestions.call(void 0, );
84
- const mentionSuggestionsCache = _chunkW2H56LB3cjs.useMentionSuggestionsCache.call(void 0, );
83
+ const resolveMentionSuggestions = _chunk4GCS3365cjs.useResolveMentionSuggestions.call(void 0, );
84
+ const mentionSuggestionsCache = _chunk4GCS3365cjs.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 = _chunkW2H56LB3cjs.useClient.call(void 0, );
139
+ const client = _chunk4GCS3365cjs.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 = _chunkW2H56LB3cjs.getUmbrellaStoreForClient; exports.useAddRoomCommentReaction = _chunkW2H56LB3cjs.useAddRoomCommentReaction; exports.useClientOrNull = _chunkW2H56LB3cjs.useClientOrNull; exports.useCreateRoomComment = _chunkW2H56LB3cjs.useCreateRoomComment; exports.useCreateRoomThread = _chunkW2H56LB3cjs.useCreateRoomThread; exports.useCreateTextMention = _chunkW2H56LB3cjs.useCreateTextMention; exports.useDeleteRoomComment = _chunkW2H56LB3cjs.useDeleteRoomComment; exports.useDeleteRoomThread = _chunkW2H56LB3cjs.useDeleteRoomThread; exports.useDeleteTextMention = _chunkW2H56LB3cjs.useDeleteTextMention; exports.useEditRoomComment = _chunkW2H56LB3cjs.useEditRoomComment; exports.useEditRoomThreadMetadata = _chunkW2H56LB3cjs.useEditRoomThreadMetadata; exports.useGroup = useGroup; exports.useLatest = _chunkW2H56LB3cjs.useLatest; exports.useLayoutEffect = useLayoutEffect; exports.useMarkRoomThreadAsRead = _chunkW2H56LB3cjs.useMarkRoomThreadAsRead; exports.useMarkRoomThreadAsResolved = _chunkW2H56LB3cjs.useMarkRoomThreadAsResolved; exports.useMarkRoomThreadAsUnresolved = _chunkW2H56LB3cjs.useMarkRoomThreadAsUnresolved; exports.useMentionSuggestions = useMentionSuggestions; exports.useMentionSuggestionsCache = _chunkW2H56LB3cjs.useMentionSuggestionsCache; exports.useRemoveRoomCommentReaction = _chunkW2H56LB3cjs.useRemoveRoomCommentReaction; exports.useReportTextEditor = _chunkW2H56LB3cjs.useReportTextEditor; exports.useResolveMentionSuggestions = _chunkW2H56LB3cjs.useResolveMentionSuggestions; exports.useRoomAttachmentUrl = _chunkW2H56LB3cjs.useRoomAttachmentUrl; exports.useRoomPermissions = _chunkW2H56LB3cjs.useRoomPermissions; exports.useRoomThreadSubscription = _chunkW2H56LB3cjs.useRoomThreadSubscription; exports.useSignal = _chunkW2H56LB3cjs.useSignal; exports.useSyncExternalStoreWithSelector = _chunkW2H56LB3cjs.useSyncExternalStoreWithSelector; exports.useSyncSource = useSyncSource; exports.useYjsProvider = _chunkW2H56LB3cjs.useYjsProvider;
179
+ exports.getUmbrellaStoreForClient = _chunk4GCS3365cjs.getUmbrellaStoreForClient; exports.useAddRoomCommentReaction = _chunk4GCS3365cjs.useAddRoomCommentReaction; exports.useClientOrNull = _chunk4GCS3365cjs.useClientOrNull; exports.useCreateRoomComment = _chunk4GCS3365cjs.useCreateRoomComment; exports.useCreateRoomThread = _chunk4GCS3365cjs.useCreateRoomThread; exports.useCreateTextMention = _chunk4GCS3365cjs.useCreateTextMention; exports.useDeleteRoomComment = _chunk4GCS3365cjs.useDeleteRoomComment; exports.useDeleteRoomThread = _chunk4GCS3365cjs.useDeleteRoomThread; exports.useDeleteTextMention = _chunk4GCS3365cjs.useDeleteTextMention; exports.useEditRoomComment = _chunk4GCS3365cjs.useEditRoomComment; exports.useEditRoomThreadMetadata = _chunk4GCS3365cjs.useEditRoomThreadMetadata; exports.useGroup = useGroup; exports.useLatest = _chunk4GCS3365cjs.useLatest; exports.useLayoutEffect = useLayoutEffect; exports.useMarkRoomThreadAsRead = _chunk4GCS3365cjs.useMarkRoomThreadAsRead; exports.useMarkRoomThreadAsResolved = _chunk4GCS3365cjs.useMarkRoomThreadAsResolved; exports.useMarkRoomThreadAsUnresolved = _chunk4GCS3365cjs.useMarkRoomThreadAsUnresolved; exports.useMentionSuggestions = useMentionSuggestions; exports.useMentionSuggestionsCache = _chunk4GCS3365cjs.useMentionSuggestionsCache; exports.useRemoveRoomCommentReaction = _chunk4GCS3365cjs.useRemoveRoomCommentReaction; exports.useReportTextEditor = _chunk4GCS3365cjs.useReportTextEditor; exports.useResolveMentionSuggestions = _chunk4GCS3365cjs.useResolveMentionSuggestions; exports.useRoomAttachmentUrl = _chunk4GCS3365cjs.useRoomAttachmentUrl; exports.useRoomPermissions = _chunk4GCS3365cjs.useRoomPermissions; exports.useRoomThreadSubscription = _chunk4GCS3365cjs.useRoomThreadSubscription; exports.useSignal = _chunk4GCS3365cjs.useSignal; exports.useSyncExternalStoreWithSelector = _chunk4GCS3365cjs.useSyncExternalStoreWithSelector; exports.useSyncSource = useSyncSource; exports.useYjsProvider = _chunk4GCS3365cjs.useYjsProvider;
180
180
  //# sourceMappingURL=_private.cjs.map
@@ -1,5 +1,5 @@
1
- import { G as GroupAsyncResult } from './room-mUz5TTmo.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-mUz5TTmo.cjs';
1
+ import { G as GroupAsyncResult } from './room-BtcL74U0.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-BtcL74U0.cjs';
3
3
  import { MutableRefObject, useEffect } from 'react';
4
4
  import { MentionData, ISignal, SyncSource } from '@liveblocks/core';
5
5
  import '@liveblocks/client';
@@ -1,5 +1,5 @@
1
- import { G as GroupAsyncResult } from './room-mUz5TTmo.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-mUz5TTmo.js';
1
+ import { G as GroupAsyncResult } from './room-BtcL74U0.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-BtcL74U0.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-WGUV4Z4E.js";
28
+ } from "./chunk-OKYUUXNY.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) => matchesQuery(thread, query) && matchesMetadata(thread, query);
330
+ return (thread) => matchesThreadsQuery(thread, query) && matchesMetadata(thread, query);
334
331
  }
335
- function matchesQuery(thread, q) {
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: this.outputs.notifications.get().sortedNotifications,
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,
@@ -2147,7 +2158,7 @@ function makeLiveblocksContextBundle(client) {
2147
2158
  suspense: {
2148
2159
  LiveblocksProvider: LiveblocksProvider2,
2149
2160
  useInboxNotifications: (options) => useInboxNotificationsSuspense_withClient(client, options),
2150
- useUnreadInboxNotificationsCount: () => useUnreadInboxNotificationsCountSuspense_withClient(client),
2161
+ useUnreadInboxNotificationsCount: (options) => useUnreadInboxNotificationsCountSuspense_withClient(client, options),
2151
2162
  useMarkInboxNotificationAsRead: useMarkInboxNotificationAsRead2,
2152
2163
  useMarkAllInboxNotificationsAsRead: useMarkAllInboxNotificationsAsRead2,
2153
2164
  useDeleteInboxNotification: useDeleteInboxNotification2,
@@ -2211,21 +2222,22 @@ function useInboxNotificationsSuspense_withClient(client, options) {
2211
2222
  _core.assert.call(void 0, !result.isLoading, "Did not expect loading");
2212
2223
  return result;
2213
2224
  }
2214
- function useUnreadInboxNotificationsCount_withClient(client) {
2225
+ function useUnreadInboxNotificationsCount_withClient(client, options) {
2215
2226
  return useInboxNotifications_withClient(
2216
2227
  client,
2217
2228
  selectorFor_useUnreadInboxNotificationsCount,
2218
- _core.shallow
2229
+ _core.shallow,
2230
+ options
2219
2231
  );
2220
2232
  }
2221
- function useUnreadInboxNotificationsCountSuspense_withClient(client) {
2233
+ function useUnreadInboxNotificationsCountSuspense_withClient(client, options) {
2222
2234
  ensureNotServerSide();
2223
2235
  const store = getLiveblocksExtrasForClient(client).store;
2224
- const queryKey = makeInboxNotificationsQueryKey(void 0);
2236
+ const queryKey = makeInboxNotificationsQueryKey(_optionalChain([options, 'optionalAccess', _15 => _15.query]));
2225
2237
  use(
2226
2238
  store.outputs.loadingNotifications.getOrCreate(queryKey).waitUntilLoaded()
2227
2239
  );
2228
- const result = useUnreadInboxNotificationsCount_withClient(client);
2240
+ const result = useUnreadInboxNotificationsCount_withClient(client, options);
2229
2241
  _core.assert.call(void 0, !result.isLoading, "Did not expect loading");
2230
2242
  _core.assert.call(void 0, !result.error, "Did not expect error");
2231
2243
  return result;
@@ -2376,7 +2388,7 @@ function useUpdateNotificationSettings_withClient(client) {
2376
2388
  store.optimisticUpdates.remove(optimisticUpdateId);
2377
2389
  if (err instanceof _core.HttpError) {
2378
2390
  if (err.status === 422) {
2379
- const msg = [_optionalChain([err, 'access', _15 => _15.details, 'optionalAccess', _16 => _16.error]), _optionalChain([err, 'access', _17 => _17.details, 'optionalAccess', _18 => _18.reason])].filter(Boolean).join("\n");
2391
+ 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
2392
  _core.console.error(msg);
2381
2393
  }
2382
2394
  client[_core.kInternal].emitError(
@@ -2611,7 +2623,7 @@ function useGroupInfoSuspense_withClient(client, groupId) {
2611
2623
  function useAiChats(options) {
2612
2624
  const client = useClient();
2613
2625
  const store = getUmbrellaStoreForClient(client);
2614
- const queryKey = makeAiChatsQueryKey(_optionalChain([options, 'optionalAccess', _19 => _19.query]));
2626
+ const queryKey = makeAiChatsQueryKey(_optionalChain([options, 'optionalAccess', _20 => _20.query]));
2615
2627
  useEnsureAiConnection(client);
2616
2628
  _react.useEffect.call(void 0,
2617
2629
  () => void store.outputs.aiChats.getOrCreate(queryKey).waitUntilLoaded()
@@ -2635,7 +2647,7 @@ function useAiChatsSuspense(options) {
2635
2647
  const client = useClient();
2636
2648
  const store = getUmbrellaStoreForClient(client);
2637
2649
  useEnsureAiConnection(client);
2638
- const queryKey = makeAiChatsQueryKey(_optionalChain([options, 'optionalAccess', _20 => _20.query]));
2650
+ const queryKey = makeAiChatsQueryKey(_optionalChain([options, 'optionalAccess', _21 => _21.query]));
2639
2651
  use(store.outputs.aiChats.getOrCreate(queryKey).waitUntilLoaded());
2640
2652
  const result = useAiChats(options);
2641
2653
  _core.assert.call(void 0, !result.error, "Did not expect error");
@@ -2647,7 +2659,7 @@ function useAiChatMessages(chatId, options) {
2647
2659
  const store = getUmbrellaStoreForClient(client);
2648
2660
  useEnsureAiConnection(client);
2649
2661
  _react.useEffect.call(void 0,
2650
- () => void store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _21 => _21.branchId]), () => ( null))).waitUntilLoaded()
2662
+ () => void store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _22 => _22.branchId]), () => ( null))).waitUntilLoaded()
2651
2663
  // NOTE: Deliberately *not* using a dependency array here!
2652
2664
  //
2653
2665
  // It is important to call waitUntil on *every* render.
@@ -2658,7 +2670,7 @@ function useAiChatMessages(chatId, options) {
2658
2670
  // *next* render after that, a *new* fetch/promise will get created.
2659
2671
  );
2660
2672
  return useSignal(
2661
- store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _22 => _22.branchId]), () => ( null))).signal
2673
+ store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _23 => _23.branchId]), () => ( null))).signal
2662
2674
  );
2663
2675
  }
2664
2676
  function useAiChatMessagesSuspense(chatId, options) {
@@ -2667,7 +2679,7 @@ function useAiChatMessagesSuspense(chatId, options) {
2667
2679
  const store = getUmbrellaStoreForClient(client);
2668
2680
  useEnsureAiConnection(client);
2669
2681
  use(
2670
- store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _23 => _23.branchId]), () => ( null))).waitUntilLoaded()
2682
+ store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _24 => _24.branchId]), () => ( null))).waitUntilLoaded()
2671
2683
  );
2672
2684
  const result = useAiChatMessages(chatId, options);
2673
2685
  _core.assert.call(void 0, !result.error, "Did not expect error");
@@ -2750,7 +2762,7 @@ function useSendAiMessage(chatId, options) {
2750
2762
  "chatId must be provided to either `useSendAiMessage` or its returned function."
2751
2763
  )));
2752
2764
  const messages = client[_core.kInternal].ai.signals.getChatMessagesForBranch\u03A3(resolvedChatId).get();
2753
- if (process.env.NODE_ENV !== "production" && !messageOptionsCopilotId && !_optionalChain([options, 'optionalAccess', _24 => _24.copilotId])) {
2765
+ if (process.env.NODE_ENV !== "production" && !messageOptionsCopilotId && !_optionalChain([options, 'optionalAccess', _25 => _25.copilotId])) {
2754
2766
  _core.console.warn(
2755
2767
  `No copilot ID was provided to useSendAiMessage when sending the message "${messageText.slice(
2756
2768
  0,
@@ -2762,8 +2774,8 @@ To ensure the correct copilot ID is used, specify it either through the hook as
2762
2774
  )}\u2026", copilotId: "co_xxx" })'`
2763
2775
  );
2764
2776
  }
2765
- const resolvedCopilotId = _nullishCoalesce(_nullishCoalesce(messageOptionsCopilotId, () => ( _optionalChain([options, 'optionalAccess', _25 => _25.copilotId]))), () => ( client[_core.kInternal].ai.getLastUsedCopilotId(resolvedChatId)));
2766
- const lastMessageId = _nullishCoalesce(_optionalChain([messages, 'access', _26 => _26[messages.length - 1], 'optionalAccess', _27 => _27.id]), () => ( null));
2777
+ const resolvedCopilotId = _nullishCoalesce(_nullishCoalesce(messageOptionsCopilotId, () => ( _optionalChain([options, 'optionalAccess', _26 => _26.copilotId]))), () => ( client[_core.kInternal].ai.getLastUsedCopilotId(resolvedChatId)));
2778
+ const lastMessageId = _nullishCoalesce(_optionalChain([messages, 'access', _27 => _27[messages.length - 1], 'optionalAccess', _28 => _28.id]), () => ( null));
2767
2779
  const content = [{ type: "text", text: messageText }];
2768
2780
  const newMessageId = client[_core.kInternal].ai[_core.kInternal].context.messagesStore.createOptimistically(
2769
2781
  resolvedChatId,
@@ -2783,10 +2795,10 @@ To ensure the correct copilot ID is used, specify it either through the hook as
2783
2795
  { id: newMessageId, parentMessageId: lastMessageId, content },
2784
2796
  targetMessageId,
2785
2797
  {
2786
- stream: _nullishCoalesce(messageOptions.stream, () => ( _optionalChain([options, 'optionalAccess', _28 => _28.stream]))),
2798
+ stream: _nullishCoalesce(messageOptions.stream, () => ( _optionalChain([options, 'optionalAccess', _29 => _29.stream]))),
2787
2799
  copilotId: resolvedCopilotId,
2788
- timeout: _nullishCoalesce(messageOptions.timeout, () => ( _optionalChain([options, 'optionalAccess', _29 => _29.timeout]))),
2789
- knowledge: _nullishCoalesce(messageOptions.knowledge, () => ( _optionalChain([options, 'optionalAccess', _30 => _30.knowledge])))
2800
+ timeout: _nullishCoalesce(messageOptions.timeout, () => ( _optionalChain([options, 'optionalAccess', _30 => _30.timeout]))),
2801
+ knowledge: _nullishCoalesce(messageOptions.knowledge, () => ( _optionalChain([options, 'optionalAccess', _31 => _31.knowledge])))
2790
2802
  }
2791
2803
  );
2792
2804
  return newMessage;
@@ -2794,10 +2806,10 @@ To ensure the correct copilot ID is used, specify it either through the hook as
2794
2806
  [
2795
2807
  client,
2796
2808
  chatId,
2797
- _optionalChain([options, 'optionalAccess', _31 => _31.copilotId]),
2798
- _optionalChain([options, 'optionalAccess', _32 => _32.stream]),
2799
- _optionalChain([options, 'optionalAccess', _33 => _33.timeout]),
2800
- _optionalChain([options, 'optionalAccess', _34 => _34.knowledge])
2809
+ _optionalChain([options, 'optionalAccess', _32 => _32.copilotId]),
2810
+ _optionalChain([options, 'optionalAccess', _33 => _33.stream]),
2811
+ _optionalChain([options, 'optionalAccess', _34 => _34.timeout]),
2812
+ _optionalChain([options, 'optionalAccess', _35 => _35.knowledge])
2801
2813
  ]
2802
2814
  );
2803
2815
  }
@@ -2833,7 +2845,7 @@ function createSharedContext(client) {
2833
2845
  }
2834
2846
  function useEnsureNoLiveblocksProvider(options) {
2835
2847
  const existing = useClientOrNull();
2836
- if (!_optionalChain([options, 'optionalAccess', _35 => _35.allowNesting]) && existing !== null) {
2848
+ if (!_optionalChain([options, 'optionalAccess', _36 => _36.allowNesting]) && existing !== null) {
2837
2849
  throw new Error(
2838
2850
  "You cannot nest multiple LiveblocksProvider instances in the same React tree."
2839
2851
  );
@@ -2947,11 +2959,14 @@ function useDeleteAllInboxNotifications() {
2947
2959
  function useDeleteInboxNotification() {
2948
2960
  return useDeleteInboxNotification_withClient(useClient());
2949
2961
  }
2950
- function useUnreadInboxNotificationsCount() {
2951
- return useUnreadInboxNotificationsCount_withClient(useClient());
2962
+ function useUnreadInboxNotificationsCount(options) {
2963
+ return useUnreadInboxNotificationsCount_withClient(useClient(), options);
2952
2964
  }
2953
- function useUnreadInboxNotificationsCountSuspense() {
2954
- return useUnreadInboxNotificationsCountSuspense_withClient(useClient());
2965
+ function useUnreadInboxNotificationsCountSuspense(options) {
2966
+ return useUnreadInboxNotificationsCountSuspense_withClient(
2967
+ useClient(),
2968
+ options
2969
+ );
2955
2970
  }
2956
2971
  function useNotificationSettings() {
2957
2972
  return useNotificationSettings_withClient(useClient());
@@ -2994,7 +3009,7 @@ var _useAiChatSuspense = useAiChatSuspense;
2994
3009
  var _useAiChatMessages = useAiChatMessages;
2995
3010
  var _useAiChatMessagesSuspense = useAiChatMessagesSuspense;
2996
3011
  function useSyncStatus_withClient(client, options) {
2997
- const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _36 => _36.smooth]), () => ( false)));
3012
+ const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _37 => _37.smooth]), () => ( false)));
2998
3013
  if (smooth) {
2999
3014
  return useSyncStatusSmooth_withClient(client);
3000
3015
  } else {
@@ -3173,8 +3188,8 @@ function makeRoomExtrasForClient(client) {
3173
3188
  if (innerError.status === 403) {
3174
3189
  const detailedMessage = [
3175
3190
  innerError.message,
3176
- _optionalChain([innerError, 'access', _37 => _37.details, 'optionalAccess', _38 => _38.suggestion]),
3177
- _optionalChain([innerError, 'access', _39 => _39.details, 'optionalAccess', _40 => _40.docs])
3191
+ _optionalChain([innerError, 'access', _38 => _38.details, 'optionalAccess', _39 => _39.suggestion]),
3192
+ _optionalChain([innerError, 'access', _40 => _40.details, 'optionalAccess', _41 => _41.docs])
3178
3193
  ].filter(Boolean).join("\n");
3179
3194
  _core.console.error(detailedMessage);
3180
3195
  }
@@ -3469,7 +3484,7 @@ function RoomProviderInner(props) {
3469
3484
  }
3470
3485
  function useRoom(options) {
3471
3486
  const room = useRoomOrNull();
3472
- if (room === null && !_optionalChain([options, 'optionalAccess', _41 => _41.allowOutsideRoom])) {
3487
+ if (room === null && !_optionalChain([options, 'optionalAccess', _42 => _42.allowOutsideRoom])) {
3473
3488
  throw new Error("RoomProvider is missing from the React tree.");
3474
3489
  }
3475
3490
  return room;
@@ -3819,7 +3834,7 @@ function useCreateRoomThread(roomId) {
3819
3834
  thread: newThread,
3820
3835
  roomId
3821
3836
  });
3822
- const attachmentIds = _optionalChain([attachments, 'optionalAccess', _42 => _42.map, 'call', _43 => _43((attachment) => attachment.id)]);
3837
+ const attachmentIds = _optionalChain([attachments, 'optionalAccess', _43 => _43.map, 'call', _44 => _44((attachment) => attachment.id)]);
3823
3838
  client[_core.kInternal].httpClient.createThread({
3824
3839
  roomId,
3825
3840
  threadId,
@@ -3859,7 +3874,7 @@ function useDeleteRoomThread(roomId) {
3859
3874
  const { store, onMutationFailure } = getRoomExtrasForClient(client);
3860
3875
  const userId = getCurrentUserId(client);
3861
3876
  const existing = store.outputs.threads.get().get(threadId);
3862
- if (_optionalChain([existing, 'optionalAccess', _44 => _44.comments, 'optionalAccess', _45 => _45[0], 'optionalAccess', _46 => _46.userId]) !== userId) {
3877
+ if (_optionalChain([existing, 'optionalAccess', _45 => _45.comments, 'optionalAccess', _46 => _46[0], 'optionalAccess', _47 => _47.userId]) !== userId) {
3863
3878
  throw new Error("Only the thread creator can delete the thread");
3864
3879
  }
3865
3880
  const optimisticId = store.optimisticUpdates.add({
@@ -3947,7 +3962,7 @@ function useCreateRoomComment(roomId) {
3947
3962
  type: "create-comment",
3948
3963
  comment
3949
3964
  });
3950
- const attachmentIds = _optionalChain([attachments, 'optionalAccess', _47 => _47.map, 'call', _48 => _48((attachment) => attachment.id)]);
3965
+ const attachmentIds = _optionalChain([attachments, 'optionalAccess', _48 => _48.map, 'call', _49 => _49((attachment) => attachment.id)]);
3951
3966
  client[_core.kInternal].httpClient.createComment({ roomId, threadId, commentId, body, attachmentIds }).then(
3952
3967
  (newComment) => {
3953
3968
  store.createComment(newComment, optimisticId);
@@ -4003,7 +4018,7 @@ function useEditRoomComment(roomId) {
4003
4018
  attachments: _nullishCoalesce(attachments, () => ( []))
4004
4019
  }
4005
4020
  });
4006
- const attachmentIds = _optionalChain([attachments, 'optionalAccess', _49 => _49.map, 'call', _50 => _50((attachment) => attachment.id)]);
4021
+ const attachmentIds = _optionalChain([attachments, 'optionalAccess', _50 => _50.map, 'call', _51 => _51((attachment) => attachment.id)]);
4007
4022
  client[_core.kInternal].httpClient.editComment({ roomId, threadId, commentId, body, attachmentIds }).then(
4008
4023
  (editedComment) => {
4009
4024
  store.editComment(threadId, optimisticId, editedComment);
@@ -4344,7 +4359,7 @@ function useRoomThreadSubscription(roomId, threadId) {
4344
4359
  }
4345
4360
  return {
4346
4361
  status: "subscribed",
4347
- unreadSince: _nullishCoalesce(_optionalChain([notification, 'optionalAccess', _51 => _51.readAt]), () => ( null)),
4362
+ unreadSince: _nullishCoalesce(_optionalChain([notification, 'optionalAccess', _52 => _52.readAt]), () => ( null)),
4348
4363
  subscribe,
4349
4364
  unsubscribe
4350
4365
  };
@@ -4555,7 +4570,7 @@ function useThreadsSuspense(options = {}) {
4555
4570
  return result;
4556
4571
  }
4557
4572
  function selectorFor_useAttachmentUrl(state) {
4558
- if (state === void 0 || _optionalChain([state, 'optionalAccess', _52 => _52.isLoading])) {
4573
+ if (state === void 0 || _optionalChain([state, 'optionalAccess', _53 => _53.isLoading])) {
4559
4574
  return _nullishCoalesce(state, () => ( { isLoading: true }));
4560
4575
  }
4561
4576
  if (state.error) {
@@ -4783,4 +4798,4 @@ var _useUpdateMyPresence = useUpdateMyPresence;
4783
4798
 
4784
4799
 
4785
4800
  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;
4786
- //# sourceMappingURL=chunk-W2H56LB3.cjs.map
4801
+ //# sourceMappingURL=chunk-4GCS3365.cjs.map