@liveblocks/react 2.24.0-deque1 → 2.24.0-sub1

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.
@@ -1,9 +1,9 @@
1
1
  import * as _liveblocks_core from '@liveblocks/core';
2
- import { BaseMetadata, StorageStatus, QueryMetadata, AsyncResult, DRI, AsyncSuccess, Resolve, CommentBody, CommentAttachment, PartialUnless, Patchable, InboxNotificationData, UserNotificationSettings, Relax, ToImmutable, PartialUserNotificationSettings, AsyncLoading, AsyncError, ThreadData, HistoryVersion, Client, LiveblocksError, SyncStatus, RoomEventMessage, CommentData, MutableSignal, ThreadDataWithDeleteInfo, ThreadDeleteInfo, DerivedSignal, DefaultMap, OpaqueClient, CommentUserReaction, InboxNotificationDeleteInfo, RoomNotificationSettings as RoomNotificationSettings$1, ISignal, Permission, BaseUserMeta as BaseUserMeta$1, DistributiveOmit, DU, DM, TextEditorType, IYjsProvider, DP, DS, DE } from '@liveblocks/core';
2
+ import { BaseMetadata, StorageStatus, QueryMetadata, AsyncResult, DRI, AsyncSuccess, Resolve, CommentBody, CommentAttachment, PartialUnless, Patchable, InboxNotificationData, NotificationSettings, Relax, ToImmutable, PartialNotificationSettings, AsyncLoading, AsyncError, ThreadData, HistoryVersion, Client, LiveblocksError, SyncStatus, RoomEventMessage, CommentData, MutableSignal, ThreadDataWithDeleteInfo, ThreadDeleteInfo, DerivedSignal, DefaultMap, OpaqueClient, SubscriptionData, SubscriptionKey, CommentUserReaction, InboxNotificationDeleteInfo, SubscriptionDeleteInfo, RoomSubscriptionSettings as RoomSubscriptionSettings$1, ISignal, Permission, BaseUserMeta as BaseUserMeta$1, DistributiveOmit, DU, DM, TextEditorType, IYjsProvider, DP, DS, DE } from '@liveblocks/core';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import { Context, PropsWithChildren, ReactNode } from 'react';
6
- import { JsonObject, LsonObject, BaseUserMeta, LiveObject, User, Json, RoomNotificationSettings, Room, Status, BroadcastOptions, OthersEvent, LostConnectionEvent, History, BaseMetadata as BaseMetadata$1, Client as Client$1, ClientOptions, StorageStatus as StorageStatus$1, ThreadData as ThreadData$1, CommentData as CommentData$1 } from '@liveblocks/client';
6
+ import { JsonObject, LsonObject, BaseUserMeta, LiveObject, User, Json, RoomSubscriptionSettings, Room, Status, BroadcastOptions, OthersEvent, LostConnectionEvent, History, BaseMetadata as BaseMetadata$1, Client as Client$1, ClientOptions, StorageStatus as StorageStatus$1, ThreadData as ThreadData$1, CommentData as CommentData$1 } from '@liveblocks/client';
7
7
 
8
8
  type UseSyncStatusOptions = {
9
9
  /**
@@ -100,9 +100,9 @@ type InboxNotificationsAsyncSuccess = PagedAsyncSuccess<InboxNotificationData[],
100
100
  type InboxNotificationsAsyncResult = PagedAsyncResult<InboxNotificationData[], "inboxNotifications">;
101
101
  type UnreadInboxNotificationsCountAsyncSuccess = AsyncSuccess<number, "count">;
102
102
  type UnreadInboxNotificationsCountAsyncResult = AsyncResult<number, "count">;
103
- type UserNotificationSettingsAsyncResult = AsyncResult<UserNotificationSettings, "settings">;
104
- type RoomNotificationSettingsAsyncSuccess = AsyncSuccess<RoomNotificationSettings, "settings">;
105
- type RoomNotificationSettingsAsyncResult = AsyncResult<RoomNotificationSettings, "settings">;
103
+ type NotificationSettingsAsyncResult = AsyncResult<NotificationSettings, "settings">;
104
+ type RoomSubscriptionSettingsAsyncSuccess = AsyncSuccess<RoomSubscriptionSettings, "settings">;
105
+ type RoomSubscriptionSettingsAsyncResult = AsyncResult<RoomSubscriptionSettings, "settings">;
106
106
  type HistoryVersionDataAsyncResult = AsyncResult<Uint8Array>;
107
107
  type HistoryVersionsAsyncSuccess = AsyncSuccess<HistoryVersion[], "versions">;
108
108
  type HistoryVersionsAsyncResult = AsyncResult<HistoryVersion[], "versions">;
@@ -148,12 +148,18 @@ type MutationContext<P extends JsonObject, S extends LsonObject, U extends BaseU
148
148
  };
149
149
  type ThreadSubscription = Relax<{
150
150
  status: "not-subscribed";
151
+ subscribe: () => void;
152
+ unsubscribe: () => void;
151
153
  } | {
152
154
  status: "subscribed";
153
155
  unreadSince: null;
156
+ subscribe: () => void;
157
+ unsubscribe: () => void;
154
158
  } | {
155
159
  status: "subscribed";
156
160
  unreadSince: Date;
161
+ subscribe: () => void;
162
+ unsubscribe: () => void;
157
163
  }>;
158
164
  type SharedContextBundle<U extends BaseUserMeta> = {
159
165
  classic: {
@@ -596,6 +602,22 @@ type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject, U exten
596
602
  * markThreadAsUnresolved("th_xxx");
597
603
  */
598
604
  useMarkThreadAsUnresolved(): (threadId: string) => void;
605
+ /**
606
+ * Returns a function that subscribes the user to a thread.
607
+ *
608
+ * @example
609
+ * const subscribeToThread = useSubscribeToThread();
610
+ * subscribeToThread("th_xxx");
611
+ */
612
+ useSubscribeToThread(): (threadId: string) => void;
613
+ /**
614
+ * Returns a function that unsubscribes the user from a thread.
615
+ *
616
+ * @example
617
+ * const unsubscribeFromThread = useUnsubscribeFromThread();
618
+ * unsubscribeFromThread("th_xxx");
619
+ */
620
+ useUnsubscribeFromThread(): (threadId: string) => void;
599
621
  /**
600
622
  * Returns a function that adds a comment to a thread.
601
623
  *
@@ -638,14 +660,21 @@ type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject, U exten
638
660
  */
639
661
  useRemoveReaction(): (options: CommentReactionOptions) => void;
640
662
  /**
641
- * Returns a function that updates the user's notification settings
663
+ * @deprecated Renamed to `useUpdateRoomSubscriptionSettings`
664
+ *
665
+ * Returns a function that updates the user's subscription settings
666
+ * for the current room.
667
+ */
668
+ useUpdateRoomNotificationSettings(): (settings: Partial<RoomSubscriptionSettings>) => void;
669
+ /**
670
+ * Returns a function that updates the user's subscription settings
642
671
  * for the current room.
643
672
  *
644
673
  * @example
645
- * const updateRoomNotificationSettings = useUpdateRoomNotificationSettings();
646
- * updateRoomNotificationSettings({ threads: "all" });
674
+ * const updateRoomSubscriptionSettings = useUpdateRoomSubscriptionSettings();
675
+ * updateRoomSubscriptionSettings({ threads: "all" });
647
676
  */
648
- useUpdateRoomNotificationSettings(): (settings: Partial<RoomNotificationSettings>) => void;
677
+ useUpdateRoomSubscriptionSettings(): (settings: Partial<RoomSubscriptionSettings>) => void;
649
678
  /**
650
679
  * Returns a function that marks a thread as read.
651
680
  *
@@ -655,10 +684,11 @@ type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject, U exten
655
684
  */
656
685
  useMarkThreadAsRead(): (threadId: string) => void;
657
686
  /**
658
- * Returns the subscription status of a thread.
687
+ * Returns the subscription status of a thread, methods to update it, and when
688
+ * the thread was last read.
659
689
  *
660
690
  * @example
661
- * const { status, unreadSince } = useThreadSubscription("th_xxx");
691
+ * const { status, subscribe, unsubscribe, unreadSince } = useThreadSubscription("th_xxx");
662
692
  */
663
693
  useThreadSubscription(threadId: string): ThreadSubscription;
664
694
  };
@@ -733,15 +763,25 @@ type RoomContextBundle<P extends JsonObject, S extends LsonObject, U extends Bas
733
763
  */
734
764
  useThreads(options?: UseThreadsOptions<M>): ThreadsAsyncResult<M>;
735
765
  /**
766
+ * @deprecated Renamed to `useRoomSubscriptionSettings`
767
+ *
736
768
  * Returns the user's notification settings for the current room
737
769
  * and a function to update them.
770
+ */
771
+ useRoomNotificationSettings(): [
772
+ RoomSubscriptionSettingsAsyncResult,
773
+ (settings: Partial<RoomSubscriptionSettings>) => void
774
+ ];
775
+ /**
776
+ * Returns the user's subscription settings for the current room
777
+ * and a function to update them.
738
778
  *
739
779
  * @example
740
- * const [{ settings }, updateSettings] = useRoomNotificationSettings();
780
+ * const [{ settings }, updateSettings] = useRoomSubscriptionSettings();
741
781
  */
742
- useRoomNotificationSettings(): [
743
- RoomNotificationSettingsAsyncResult,
744
- (settings: Partial<RoomNotificationSettings>) => void
782
+ useRoomSubscriptionSettings(): [
783
+ RoomSubscriptionSettingsAsyncResult,
784
+ (settings: Partial<RoomSubscriptionSettings>) => void
745
785
  ];
746
786
  /**
747
787
  * Returns a presigned URL for an attachment by its ID.
@@ -836,15 +876,25 @@ type RoomContextBundle<P extends JsonObject, S extends LsonObject, U extends Bas
836
876
  */
837
877
  useHistoryVersions(): HistoryVersionsAsyncSuccess;
838
878
  /**
879
+ * @deprecated Renamed to `useRoomSubscriptionSettings`
880
+ *
839
881
  * Returns the user's notification settings for the current room
840
882
  * and a function to update them.
883
+ */
884
+ useRoomNotificationSettings(): [
885
+ RoomSubscriptionSettingsAsyncSuccess,
886
+ (settings: Partial<RoomSubscriptionSettings>) => void
887
+ ];
888
+ /**
889
+ * Returns the user's subscription settings for the current room
890
+ * and a function to update them.
841
891
  *
842
892
  * @example
843
- * const [{ settings }, updateSettings] = useRoomNotificationSettings();
893
+ * const [{ settings }, updateSettings] = useRoomSubscriptionSettings();
844
894
  */
845
- useRoomNotificationSettings(): [
846
- RoomNotificationSettingsAsyncSuccess,
847
- (settings: Partial<RoomNotificationSettings>) => void
895
+ useRoomSubscriptionSettings(): [
896
+ RoomSubscriptionSettingsAsyncSuccess,
897
+ (settings: Partial<RoomSubscriptionSettings>) => void
848
898
  ];
849
899
  /**
850
900
  * Returns a presigned URL for an attachment by its ID.
@@ -919,8 +969,8 @@ type LiveblocksContextBundleCommon<M extends BaseMetadata> = {
919
969
  * const [{ settings }, updateNotificationSettings] = useNotificationSettings()
920
970
  */
921
971
  useNotificationSettings(): [
922
- UserNotificationSettingsAsyncResult,
923
- (settings: PartialUserNotificationSettings) => void
972
+ NotificationSettingsAsyncResult,
973
+ (settings: PartialNotificationSettings) => void
924
974
  ];
925
975
  /**
926
976
  * Returns a function that updates the user's notification
@@ -929,7 +979,7 @@ type LiveblocksContextBundleCommon<M extends BaseMetadata> = {
929
979
  * @example
930
980
  * const updateNotificationSettings = useUpdateNotificationSettings()
931
981
  */
932
- useUpdateNotificationSettings(): (settings: PartialUserNotificationSettings) => void;
982
+ useUpdateNotificationSettings(): (settings: PartialNotificationSettings) => void;
933
983
  /**
934
984
  * Returns the current Liveblocks sync status, and triggers a re-render
935
985
  * whenever it changes. Can be used to render a "Saving..." indicator, or for
@@ -986,8 +1036,8 @@ type LiveblocksContextBundle<U extends BaseUserMeta, M extends BaseMetadata> = R
986
1036
  * const [{ settings }, updateNotificationSettings] = useNotificationSettings()
987
1037
  */
988
1038
  useNotificationSettings(): [
989
- UserNotificationSettingsAsyncResult,
990
- (settings: PartialUserNotificationSettings) => void
1039
+ NotificationSettingsAsyncResult,
1040
+ (settings: PartialNotificationSettings) => void
991
1041
  ];
992
1042
  /**
993
1043
  * @experimental
@@ -1047,10 +1097,10 @@ declare class ThreadDB<M extends BaseMetadata> {
1047
1097
  *
1048
1098
  * Will never return deleted threads in the result.
1049
1099
  */
1050
- findMany(roomId: string | undefined, query: ThreadsQuery<M>, direction: "asc" | "desc"): ThreadData<M>[];
1100
+ findMany(roomId: string | undefined, query: ThreadsQuery<M> | undefined, direction: "asc" | "desc"): ThreadData<M>[];
1051
1101
  }
1052
1102
 
1053
- type OptimisticUpdate<M extends BaseMetadata> = CreateThreadOptimisticUpdate<M> | DeleteThreadOptimisticUpdate | EditThreadMetadataOptimisticUpdate<M> | MarkThreadAsResolvedOptimisticUpdate | MarkThreadAsUnresolvedOptimisticUpdate | CreateCommentOptimisticUpdate | EditCommentOptimisticUpdate | DeleteCommentOptimisticUpdate | AddReactionOptimisticUpdate | RemoveReactionOptimisticUpdate | MarkInboxNotificationAsReadOptimisticUpdate | MarkAllInboxNotificationsAsReadOptimisticUpdate | DeleteInboxNotificationOptimisticUpdate | DeleteAllInboxNotificationsOptimisticUpdate | UpdateNotificationSettingsOptimisticUpdate | UpdateUserNotificationSettingsOptimisticUpdate;
1103
+ type OptimisticUpdate<M extends BaseMetadata> = CreateThreadOptimisticUpdate<M> | DeleteThreadOptimisticUpdate | EditThreadMetadataOptimisticUpdate<M> | MarkThreadAsResolvedOptimisticUpdate | MarkThreadAsUnresolvedOptimisticUpdate | SubscribeToThreadOptimisticUpdate | UnsubscribeFromThreadOptimisticUpdate | CreateCommentOptimisticUpdate | EditCommentOptimisticUpdate | DeleteCommentOptimisticUpdate | AddReactionOptimisticUpdate | RemoveReactionOptimisticUpdate | MarkInboxNotificationAsReadOptimisticUpdate | MarkAllInboxNotificationsAsReadOptimisticUpdate | DeleteInboxNotificationOptimisticUpdate | DeleteAllInboxNotificationsOptimisticUpdate | UpdateRoomSubscriptionSettingsOptimisticUpdate | UpdateNotificationSettingsOptimisticUpdate;
1054
1104
  type CreateThreadOptimisticUpdate<M extends BaseMetadata> = {
1055
1105
  type: "create-thread";
1056
1106
  id: string;
@@ -1083,6 +1133,18 @@ type MarkThreadAsUnresolvedOptimisticUpdate = {
1083
1133
  threadId: string;
1084
1134
  updatedAt: Date;
1085
1135
  };
1136
+ type SubscribeToThreadOptimisticUpdate = {
1137
+ type: "subscribe-to-thread";
1138
+ id: string;
1139
+ threadId: string;
1140
+ subscribedAt: Date;
1141
+ };
1142
+ type UnsubscribeFromThreadOptimisticUpdate = {
1143
+ type: "unsubscribe-from-thread";
1144
+ id: string;
1145
+ threadId: string;
1146
+ unsubscribedAt: Date;
1147
+ };
1086
1148
  type CreateCommentOptimisticUpdate = {
1087
1149
  type: "create-comment";
1088
1150
  id: string;
@@ -1139,16 +1201,17 @@ type DeleteAllInboxNotificationsOptimisticUpdate = {
1139
1201
  id: string;
1140
1202
  deletedAt: Date;
1141
1203
  };
1142
- type UpdateNotificationSettingsOptimisticUpdate = {
1143
- type: "update-notification-settings";
1204
+ type UpdateRoomSubscriptionSettingsOptimisticUpdate = {
1205
+ type: "update-room-subscription-settings";
1144
1206
  id: string;
1145
1207
  roomId: string;
1146
- settings: Partial<RoomNotificationSettings$1>;
1208
+ userId: string;
1209
+ settings: Partial<RoomSubscriptionSettings$1>;
1147
1210
  };
1148
- type UpdateUserNotificationSettingsOptimisticUpdate = {
1149
- type: "update-user-notification-settings";
1211
+ type UpdateNotificationSettingsOptimisticUpdate = {
1212
+ type: "update-notification-settings";
1150
1213
  id: string;
1151
- settings: PartialUserNotificationSettings;
1214
+ settings: PartialNotificationSettings;
1152
1215
  };
1153
1216
  /**
1154
1217
  * Like Promise<T>, except it will have a synchronously readable `status`
@@ -1176,13 +1239,14 @@ type RoomQueryKey = string;
1176
1239
  */
1177
1240
  type NotificationsLUT = Map<string, InboxNotificationData>;
1178
1241
  /**
1179
- * Notification settings by room ID.
1242
+ * Room subscription settings by room ID.
1180
1243
  * e.g. { 'room-abc': { threads: "all" },
1181
1244
  * 'room-def': { threads: "replies_and_mentions" },
1182
1245
  * 'room-xyz': { threads: "none" },
1183
1246
  * }
1184
1247
  */
1185
- type SettingsByRoomId = Record<RoomId, RoomNotificationSettings$1>;
1248
+ type RoomSubscriptionSettingsByRoomId = Record<RoomId, RoomSubscriptionSettings$1>;
1249
+ type SubscriptionsByKey = Record<SubscriptionKey, SubscriptionData>;
1186
1250
  type PermissionHintsLUT = DefaultMap<RoomId, Set<Permission>>;
1187
1251
  type CleanThreadifications<M extends BaseMetadata> = CleanThreads<M> & CleanNotifications;
1188
1252
  type CleanThreads<M extends BaseMetadata> = {
@@ -1204,6 +1268,21 @@ type CleanNotifications = {
1204
1268
  */
1205
1269
  notificationsById: Record<string, InboxNotificationData>;
1206
1270
  };
1271
+ type CleanThreadSubscriptions = {
1272
+ /**
1273
+ * Thread subscriptions by key (kind + subject ID).
1274
+ * e.g. `thread:${string}`, `$custom:${string}`, etc
1275
+ */
1276
+ subscriptions: SubscriptionsByKey;
1277
+ /**
1278
+ * All inbox notifications in a sorted array, optimistic updates applied.
1279
+ *
1280
+ * `useThreadSubscription` returns the subscription status based on subscriptions
1281
+ * but also the `readAt` value of the associated notification, so we need to
1282
+ * expose the notifications here as well.
1283
+ */
1284
+ notifications: InboxNotificationData[];
1285
+ };
1207
1286
  declare function createStore_forNotifications(): {
1208
1287
  signal: ISignal<NotificationsLUT>;
1209
1288
  markAllRead: (readAt: Date) => void;
@@ -1214,9 +1293,15 @@ declare function createStore_forNotifications(): {
1214
1293
  updateAssociatedNotification: (newComment: CommentData) => void;
1215
1294
  upsert: (notification: InboxNotificationData) => void;
1216
1295
  };
1217
- declare function createStore_forRoomNotificationSettings(updates: ISignal<readonly OptimisticUpdate<BaseMetadata>[]>): {
1218
- signal: DerivedSignal<SettingsByRoomId>;
1219
- update: (roomId: string, settings: RoomNotificationSettings$1) => void;
1296
+ declare function createStore_forSubscriptions(updates: ISignal<readonly OptimisticUpdate<BaseMetadata>[]>, threads: ReadonlyThreadDB<BaseMetadata>): {
1297
+ signal: DerivedSignal<SubscriptionsByKey>;
1298
+ applyDelta: (newSubscriptions: SubscriptionData[], deletedSubscriptions: SubscriptionDeleteInfo[]) => void;
1299
+ create: (subscription: SubscriptionData) => void;
1300
+ delete: (subscriptionKey: SubscriptionKey) => void;
1301
+ };
1302
+ declare function createStore_forRoomSubscriptionSettings(updates: ISignal<readonly OptimisticUpdate<BaseMetadata>[]>): {
1303
+ signal: DerivedSignal<RoomSubscriptionSettingsByRoomId>;
1304
+ update: (roomId: string, settings: RoomSubscriptionSettings$1) => void;
1220
1305
  };
1221
1306
  declare function createStore_forHistoryVersions(): {
1222
1307
  signal: DerivedSignal<{
@@ -1231,7 +1316,8 @@ declare function createStore_forPermissionHints(): {
1231
1316
  update: (newHints: Record<string, Permission[]>) => void;
1232
1317
  };
1233
1318
  /**
1234
- * User notification settings
1319
+ * Notification settings
1320
+ *
1235
1321
  * e.g.
1236
1322
  * {
1237
1323
  * email: {
@@ -1247,9 +1333,9 @@ declare function createStore_forPermissionHints(): {
1247
1333
  * }
1248
1334
  * e.g. {} when before the first successful fetch.
1249
1335
  */
1250
- declare function createStore_forUserNotificationSettings(updates: ISignal<readonly OptimisticUpdate<BaseMetadata>[]>): {
1251
- signal: DerivedSignal<UserNotificationSettings>;
1252
- update: (settings: UserNotificationSettings) => void;
1336
+ declare function createStore_forNotificationSettings(updates: ISignal<readonly OptimisticUpdate<BaseMetadata>[]>): {
1337
+ signal: DerivedSignal<NotificationSettings>;
1338
+ update: (settings: NotificationSettings) => void;
1253
1339
  };
1254
1340
  declare function createStore_forOptimistic<M extends BaseMetadata>(client: Client<BaseUserMeta$1, M>): {
1255
1341
  signal: ISignal<readonly OptimisticUpdate<M>[]>;
@@ -1260,10 +1346,11 @@ declare class UmbrellaStore<M extends BaseMetadata> {
1260
1346
  #private;
1261
1347
  readonly threads: ThreadDB<M>;
1262
1348
  readonly notifications: ReturnType<typeof createStore_forNotifications>;
1263
- readonly roomNotificationSettings: ReturnType<typeof createStore_forRoomNotificationSettings>;
1349
+ readonly subscriptions: ReturnType<typeof createStore_forSubscriptions>;
1350
+ readonly roomSubscriptionSettings: ReturnType<typeof createStore_forRoomSubscriptionSettings>;
1264
1351
  readonly historyVersions: ReturnType<typeof createStore_forHistoryVersions>;
1265
1352
  readonly permissionHints: ReturnType<typeof createStore_forPermissionHints>;
1266
- readonly userNotificationSettings: ReturnType<typeof createStore_forUserNotificationSettings>;
1353
+ readonly notificationSettings: ReturnType<typeof createStore_forNotificationSettings>;
1267
1354
  readonly optimisticUpdates: ReturnType<typeof createStore_forOptimistic<M>>;
1268
1355
  readonly outputs: {
1269
1356
  readonly threadifications: DerivedSignal<CleanThreadifications<M>>;
@@ -1271,10 +1358,11 @@ declare class UmbrellaStore<M extends BaseMetadata> {
1271
1358
  readonly loadingRoomThreads: DefaultMap<RoomQueryKey, LoadableResource<ThreadsAsyncResult<M>>>;
1272
1359
  readonly loadingUserThreads: DefaultMap<UserQueryKey, LoadableResource<ThreadsAsyncResult<M>>>;
1273
1360
  readonly notifications: DerivedSignal<CleanNotifications>;
1361
+ readonly threadSubscriptions: DerivedSignal<CleanThreadSubscriptions>;
1274
1362
  readonly loadingNotifications: LoadableResource<InboxNotificationsAsyncResult>;
1275
- readonly settingsByRoomId: DefaultMap<RoomId, LoadableResource<RoomNotificationSettingsAsyncResult>>;
1363
+ readonly roomSubscriptionSettingsByRoomId: DefaultMap<RoomId, LoadableResource<RoomSubscriptionSettingsAsyncResult>>;
1276
1364
  readonly versionsByRoomId: DefaultMap<RoomId, LoadableResource<HistoryVersionsAsyncResult>>;
1277
- readonly userNotificationSettings: LoadableResource<UserNotificationSettingsAsyncResult>;
1365
+ readonly notificationSettings: LoadableResource<NotificationSettingsAsyncResult>;
1278
1366
  };
1279
1367
  constructor(client: OpaqueClient);
1280
1368
  /**
@@ -1295,6 +1383,16 @@ declare class UmbrellaStore<M extends BaseMetadata> {
1295
1383
  * update.
1296
1384
  */
1297
1385
  deleteAllInboxNotifications(optimisticId: string): void;
1386
+ /**
1387
+ * Creates a existing subscription, replacing the corresponding
1388
+ * optimistic update.
1389
+ */
1390
+ createSubscription(subscription: SubscriptionData, optimisticId: string): void;
1391
+ /**
1392
+ * Deletes an existing subscription, replacing the corresponding
1393
+ * optimistic update.
1394
+ */
1395
+ deleteSubscription(subscriptionKey: SubscriptionKey, optimisticId: string): void;
1298
1396
  /**
1299
1397
  * Creates an new thread, replacing the corresponding optimistic update.
1300
1398
  */
@@ -1321,26 +1419,26 @@ declare class UmbrellaStore<M extends BaseMetadata> {
1321
1419
  createComment(newComment: CommentData, optimisticId: string): void;
1322
1420
  editComment(threadId: string, optimisticId: string, editedComment: CommentData): void;
1323
1421
  deleteComment(threadId: string, optimisticId: string, commentId: string, deletedAt: Date): void;
1324
- updateThreadifications(threads: ThreadData<M>[], notifications: InboxNotificationData[], deletedThreads?: ThreadDeleteInfo[], deletedNotifications?: InboxNotificationDeleteInfo[]): void;
1422
+ updateThreadifications(threads: ThreadData<M>[], notifications: InboxNotificationData[], subscriptions: SubscriptionData[], deletedThreads?: ThreadDeleteInfo[], deletedNotifications?: InboxNotificationDeleteInfo[], deletedSubscriptions?: SubscriptionDeleteInfo[]): void;
1325
1423
  /**
1326
- * Updates existing notification setting for a room with a new value,
1424
+ * Updates existing subscription settings for a room with a new value,
1327
1425
  * replacing the corresponding optimistic update.
1328
1426
  */
1329
- updateRoomNotificationSettings(roomId: string, optimisticId: string, settings: Readonly<RoomNotificationSettings$1>): void;
1427
+ updateRoomSubscriptionSettings(roomId: string, optimisticId: string, settings: Readonly<RoomSubscriptionSettings$1>): void;
1330
1428
  fetchNotificationsDeltaUpdate(signal: AbortSignal): Promise<void>;
1331
1429
  fetchRoomThreadsDeltaUpdate(roomId: string, signal: AbortSignal): Promise<void>;
1332
1430
  fetchUserThreadsDeltaUpdate(signal: AbortSignal): Promise<void>;
1333
1431
  fetchRoomVersionsDeltaUpdate(roomId: string, signal: AbortSignal): Promise<void>;
1334
- refreshRoomNotificationSettings(roomId: string, signal: AbortSignal): Promise<void>;
1432
+ refreshRoomSubscriptionSettings(roomId: string, signal: AbortSignal): Promise<void>;
1335
1433
  /**
1336
- * Refresh User Notification Settings from poller
1434
+ * Refresh notification settings from poller
1337
1435
  */
1338
- refreshUserNotificationSettings(signal: AbortSignal): Promise<void>;
1436
+ refreshNotificationSettings(signal: AbortSignal): Promise<void>;
1339
1437
  /**
1340
- * Updates user notification settings with a new value, replacing the
1438
+ * Updates notification settings with a new value, replacing the
1341
1439
  * corresponding optimistic update.
1342
1440
  */
1343
- updateUserNotificationSettings_confirmOptimisticUpdate(settings: UserNotificationSettings, optimisticUpdateId: string): void;
1441
+ updateNotificationSettings_confirmOptimisticUpdate(settings: NotificationSettings, optimisticUpdateId: string): void;
1344
1442
  }
1345
1443
 
1346
1444
  /**
@@ -1457,7 +1555,7 @@ declare function useUnreadInboxNotificationsCountSuspense(): {
1457
1555
  * @example
1458
1556
  * const [{ settings }, updateNotificationSettings] = useNotificationSettings()
1459
1557
  */
1460
- declare function useNotificationSettings(): [UserNotificationSettingsAsyncResult, (settings: PartialUserNotificationSettings) => void];
1558
+ declare function useNotificationSettings(): [NotificationSettingsAsyncResult, (settings: PartialNotificationSettings) => void];
1461
1559
  /**
1462
1560
  * Returns notification settings for the current user.
1463
1561
  *
@@ -1466,9 +1564,9 @@ declare function useNotificationSettings(): [UserNotificationSettingsAsyncResult
1466
1564
  */
1467
1565
  declare function useNotificationSettingsSuspense(): [{
1468
1566
  readonly isLoading: false;
1469
- readonly settings: _liveblocks_core.UserNotificationSettings;
1567
+ readonly settings: _liveblocks_core.NotificationSettings;
1470
1568
  readonly error?: undefined;
1471
- }, (settings: PartialUserNotificationSettings) => void];
1569
+ }, (settings: PartialNotificationSettings) => void];
1472
1570
  /**
1473
1571
  * Returns a function that updates the user's notification
1474
1572
  * settings for a project.
@@ -1476,7 +1574,7 @@ declare function useNotificationSettingsSuspense(): [{
1476
1574
  * @example
1477
1575
  * const updateNotificationSettings = useUpdateNotificationSettings()
1478
1576
  */
1479
- declare function useUpdateNotificationSettings(): (settings: PartialUserNotificationSettings) => void;
1577
+ declare function useUpdateNotificationSettings(): (settings: PartialNotificationSettings) => void;
1480
1578
  /**
1481
1579
  * Returns room info from a given room ID.
1482
1580
  *
@@ -1766,12 +1864,33 @@ declare function useMarkThreadAsUnresolved(): (threadId: string) => void;
1766
1864
  */
1767
1865
  declare function useMarkRoomThreadAsUnresolved(roomId: string): (threadId: string) => void;
1768
1866
  /**
1769
- * Returns the subscription status of a thread.
1867
+ * Returns a function that subscribes the user to a thread.
1868
+ *
1869
+ * @example
1870
+ * const subscribeToThread = useSubscribeToThread();
1871
+ * subscribeToThread("th_xxx");
1872
+ */
1873
+ declare function useSubscribeToThread(): (threadId: string) => void;
1874
+ /**
1875
+ * Returns a function that unsubscribes the user from a thread.
1876
+ *
1877
+ * @example
1878
+ * const unsubscribeFromThread = useUnsubscribeFromThread();
1879
+ * unsubscribeFromThread("th_xxx");
1880
+ */
1881
+ declare function useUnsubscribeFromThread(): (threadId: string) => void;
1882
+ /**
1883
+ * Returns the subscription status of a thread, methods to update it, and when
1884
+ * the thread was last read.
1770
1885
  *
1771
1886
  * @example
1772
- * const { status, unreadSince } = useThreadSubscription("th_xxx");
1887
+ * const { status, subscribe, unsubscribe, unreadSince } = useThreadSubscription("th_xxx");
1773
1888
  */
1774
1889
  declare function useThreadSubscription(threadId: string): ThreadSubscription;
1890
+ /**
1891
+ * @private
1892
+ */
1893
+ declare function useRoomThreadSubscription(roomId: string, threadId: string): ThreadSubscription;
1775
1894
  /**
1776
1895
  * Returns the version data bianry for a given version
1777
1896
  *
@@ -1780,14 +1899,21 @@ declare function useThreadSubscription(threadId: string): ThreadSubscription;
1780
1899
  */
1781
1900
  declare function useHistoryVersionData(versionId: string): HistoryVersionDataAsyncResult;
1782
1901
  /**
1783
- * Returns a function that updates the user's notification settings
1902
+ * @deprecated Renamed to `useUpdateRoomSubscriptionSettings`
1903
+ *
1904
+ * Returns a function that updates the user's subscription settings
1905
+ * for the current room.
1906
+ */
1907
+ declare function useUpdateRoomNotificationSettings(): (settings: Partial<RoomSubscriptionSettings$1>) => void;
1908
+ /**
1909
+ * Returns a function that updates the user's subscription settings
1784
1910
  * for the current room.
1785
1911
  *
1786
1912
  * @example
1787
- * const updateRoomNotificationSettings = useUpdateRoomNotificationSettings();
1788
- * updateRoomNotificationSettings({ threads: "all" });
1913
+ * const updateRoomSubscriptionSettings = useUpdateRoomSubscriptionSettings();
1914
+ * updateRoomSubscriptionSettings({ threads: "all" });
1789
1915
  */
1790
- declare function useUpdateRoomNotificationSettings(): (settings: Partial<RoomNotificationSettings>) => void;
1916
+ declare function useUpdateRoomSubscriptionSettings(): (settings: Partial<RoomSubscriptionSettings$1>) => void;
1791
1917
  /**
1792
1918
  * Returns an array of connection IDs. This matches the values you'll get by
1793
1919
  * using the `useOthers()` hook.
@@ -2057,21 +2183,35 @@ declare const _useThreads: TypedBundle["useThreads"];
2057
2183
  */
2058
2184
  declare const _useThreadsSuspense: TypedBundle["suspense"]["useThreads"];
2059
2185
  /**
2060
- * Returns the user's notification settings for the current room
2061
- * and a function to update them.
2186
+ * @deprecated Renamed to `useRoomSubscriptionSettings`
2062
2187
  *
2063
- * @example
2064
- * const [{ settings }, updateSettings] = useRoomNotificationSettings();
2188
+ * Returns the user's subscription settings for the current room
2189
+ * and a function to update them.
2065
2190
  */
2066
2191
  declare const _useRoomNotificationSettings: TypedBundle["useRoomNotificationSettings"];
2067
2192
  /**
2068
- * Returns the user's notification settings for the current room
2193
+ * Returns the user's subscription settings for the current room
2069
2194
  * and a function to update them.
2070
2195
  *
2071
2196
  * @example
2072
- * const [{ settings }, updateSettings] = useRoomNotificationSettings();
2197
+ * const [{ settings }, updateSettings] = useRoomSubscriptionSettings();
2198
+ */
2199
+ declare const _useRoomSubscriptionSettings: TypedBundle["useRoomSubscriptionSettings"];
2200
+ /**
2201
+ * @deprecated Renamed to `useRoomSubscriptionSettings`
2202
+ *
2203
+ * Returns the user's subscription settings for the current room
2204
+ * and a function to update them.
2073
2205
  */
2074
2206
  declare const _useRoomNotificationSettingsSuspense: TypedBundle["suspense"]["useRoomNotificationSettings"];
2207
+ /**
2208
+ * Returns the user's subscription settings for the current room
2209
+ * and a function to update them.
2210
+ *
2211
+ * @example
2212
+ * const [{ settings }, updateSettings] = useRoomSubscriptionSettings();
2213
+ */
2214
+ declare const _useRoomSubscriptionSettingsSuspense: TypedBundle["suspense"]["useRoomSubscriptionSettings"];
2075
2215
  /**
2076
2216
  * (Private beta) Returns a history of versions of the current room.
2077
2217
  *
@@ -2313,4 +2453,4 @@ declare const _useStorageRoot: TypedBundle["useStorageRoot"];
2313
2453
  */
2314
2454
  declare const _useUpdateMyPresence: TypedBundle["useUpdateMyPresence"];
2315
2455
 
2316
- export { useLostConnectionListener as $, useErrorListener as A, useMarkAllInboxNotificationsAsRead as B, ClientContext as C, useMarkInboxNotificationAsRead as D, useSyncStatus as E, createRoomContext as F, _RoomProvider as G, _useAddReaction as H, useBatch as I, _useBroadcastEvent as J, useCanRedo as K, LiveblocksProvider as L, type MutationContext as M, useCanUndo as N, useCreateComment as O, _useCreateThread as P, useDeleteComment as Q, _useDeleteThread as R, useEditComment as S, _useEditThreadMetadata as T, type UseStorageStatusOptions as U, useMarkThreadAsResolved as V, useMarkThreadAsUnresolved as W, _useEventListener as X, useHistory as Y, _useIsInsideRoom as Z, _useInboxNotificationThread as _, useAddRoomCommentReaction as a, useMarkThreadAsRead as a0, _useMutation as a1, _useMyPresence as a2, _useOthersListener as a3, useRedo as a4, useRemoveReaction as a5, _useRoom as a6, useStatus as a7, _useStorageRoot as a8, useThreadSubscription as a9, _useSelfSuspense as aA, _useStorageSuspense as aB, useStorageStatusSuspense as aC, _useThreadsSuspense as aD, useAttachmentUrlSuspense as aE, _useHistoryVersionsSuspense as aF, _useRoomNotificationSettingsSuspense as aG, useInboxNotificationsSuspense as aH, useNotificationSettingsSuspense as aI, useRoomInfoSuspense as aJ, useUnreadInboxNotificationsCountSuspense as aK, _useUserSuspense as aL, _useUserThreadsSuspense_experimental as aM, useUndo as aa, _useUpdateMyPresence as ab, useUpdateRoomNotificationSettings as ac, useHistoryVersionData as ad, _useOther as ae, _useOthers as af, useOthersConnectionIds as ag, _useOthersMapped as ah, _useSelf as ai, _useStorage as aj, useStorageStatus as ak, _useThreads as al, useAttachmentUrl as am, _useHistoryVersions as an, _useRoomNotificationSettings as ao, useInboxNotifications as ap, useNotificationSettings as aq, useUpdateNotificationSettings as ar, _useUserThreads_experimental as as, useRoomInfo as at, useUnreadInboxNotificationsCount as au, _useUser as av, _useOtherSuspense as aw, _useOthersSuspense as ax, useOthersConnectionIdsSuspense as ay, _useOthersMappedSuspense as az, useCreateRoomComment as b, useCreateRoomThread as c, useCreateTextMention as d, useDeleteRoomComment as e, useDeleteRoomThread as f, getUmbrellaStoreForClient as g, useDeleteTextMention as h, useEditRoomComment as i, useEditRoomThreadMetadata as j, useMarkRoomThreadAsRead as k, useMarkRoomThreadAsResolved as l, useMarkRoomThreadAsUnresolved as m, useMentionSuggestionsCache as n, useRemoveRoomCommentReaction as o, useReportTextEditor as p, useResolveMentionSuggestions as q, useRoomAttachmentUrl as r, useRoomPermissions as s, useYjsProvider as t, useClientOrNull as u, type UseThreadsOptions as v, createLiveblocksContext as w, useClient as x, useDeleteAllInboxNotifications as y, useDeleteInboxNotification as z };
2456
+ export { _useEventListener as $, useDeleteInboxNotification as A, useErrorListener as B, ClientContext as C, useMarkAllInboxNotificationsAsRead as D, useMarkInboxNotificationAsRead as E, useSyncStatus as F, createRoomContext as G, _RoomProvider as H, _useAddReaction as I, useBatch as J, _useBroadcastEvent as K, LiveblocksProvider as L, type MutationContext as M, useCanRedo as N, useCanUndo as O, useCreateComment as P, _useCreateThread as Q, useDeleteComment as R, _useDeleteThread as S, useEditComment as T, type UseStorageStatusOptions as U, _useEditThreadMetadata as V, useMarkThreadAsResolved as W, useMarkThreadAsUnresolved as X, useSubscribeToThread as Y, useUnsubscribeFromThread as Z, _useInboxNotificationThread as _, useAddRoomCommentReaction as a, useHistory as a0, _useIsInsideRoom as a1, useLostConnectionListener as a2, useMarkThreadAsRead as a3, _useMutation as a4, _useMyPresence as a5, _useOthersListener as a6, useRedo as a7, useRemoveReaction as a8, _useRoom as a9, _useUser as aA, _useOtherSuspense as aB, _useOthersSuspense as aC, useOthersConnectionIdsSuspense as aD, _useOthersMappedSuspense as aE, _useSelfSuspense as aF, _useStorageSuspense as aG, useStorageStatusSuspense as aH, _useThreadsSuspense as aI, useAttachmentUrlSuspense as aJ, _useHistoryVersionsSuspense as aK, _useRoomNotificationSettingsSuspense as aL, _useRoomSubscriptionSettingsSuspense as aM, useInboxNotificationsSuspense as aN, useNotificationSettingsSuspense as aO, useRoomInfoSuspense as aP, useUnreadInboxNotificationsCountSuspense as aQ, _useUserSuspense as aR, _useUserThreadsSuspense_experimental as aS, useStatus as aa, _useStorageRoot as ab, useThreadSubscription as ac, useUndo as ad, _useUpdateMyPresence as ae, useUpdateRoomNotificationSettings as af, useUpdateRoomSubscriptionSettings as ag, useHistoryVersionData as ah, _useOther as ai, _useOthers as aj, useOthersConnectionIds as ak, _useOthersMapped as al, _useSelf as am, _useStorage as an, useStorageStatus as ao, _useThreads as ap, useAttachmentUrl as aq, _useHistoryVersions as ar, _useRoomNotificationSettings as as, _useRoomSubscriptionSettings as at, useInboxNotifications as au, useNotificationSettings as av, useUpdateNotificationSettings as aw, _useUserThreads_experimental as ax, useRoomInfo as ay, useUnreadInboxNotificationsCount as az, useCreateRoomComment as b, useCreateRoomThread as c, useCreateTextMention as d, useDeleteRoomComment as e, useDeleteRoomThread as f, getUmbrellaStoreForClient as g, useDeleteTextMention as h, useEditRoomComment as i, useEditRoomThreadMetadata as j, useMarkRoomThreadAsRead as k, useMarkRoomThreadAsResolved as l, useMarkRoomThreadAsUnresolved as m, useMentionSuggestionsCache as n, useRemoveRoomCommentReaction as o, useReportTextEditor as p, useResolveMentionSuggestions as q, useRoomAttachmentUrl as r, useRoomPermissions as s, useRoomThreadSubscription as t, useClientOrNull as u, useYjsProvider as v, type UseThreadsOptions as w, createLiveblocksContext as x, useClient as y, useDeleteAllInboxNotifications as z };