@liveblocks/react 2.16.0-toolbars5 → 2.17.0-channels1
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.d.mts +1 -1
- package/dist/_private.d.ts +1 -1
- package/dist/_private.js +5 -5
- package/dist/_private.mjs +1 -1
- package/dist/{chunk-VJYVOAD5.js → chunk-22QRR3GV.js} +209 -24
- package/dist/chunk-22QRR3GV.js.map +1 -0
- package/dist/{chunk-DMCBV3T3.mjs → chunk-KFACA6OH.mjs} +2 -2
- package/dist/{chunk-3AQRT3Y6.js → chunk-RABQO63H.js} +2 -2
- package/dist/{chunk-3AQRT3Y6.js.map → chunk-RABQO63H.js.map} +1 -1
- package/dist/{chunk-FQKGWA7O.mjs → chunk-VX6Y3GQO.mjs} +192 -7
- package/dist/chunk-VX6Y3GQO.mjs.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -3
- package/dist/index.mjs.map +1 -1
- package/dist/{room-ne1TCZyH.d.mts → room-C0TyErPq.d.mts} +77 -13
- package/dist/{room-ne1TCZyH.d.ts → room-C0TyErPq.d.ts} +77 -13
- package/dist/suspense.d.mts +2 -2
- package/dist/suspense.d.ts +2 -2
- package/dist/suspense.js +12 -4
- package/dist/suspense.js.map +1 -1
- package/dist/suspense.mjs +11 -3
- package/dist/suspense.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-FQKGWA7O.mjs.map +0 -1
- package/dist/chunk-VJYVOAD5.js.map +0 -1
- /package/dist/{chunk-DMCBV3T3.mjs.map → chunk-KFACA6OH.mjs.map} +0 -0
package/dist/_private.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as CreateThreadError, g as getUmbrellaStoreForClient, b as useAddRoomCommentReaction, a as useClientOrNull, c as useCreateRoomComment, d as useCreateRoomThread, e as useCreateTextMention, f as useDeleteRoomComment, h as useDeleteRoomThread, i as useDeleteTextMention, j as useEditRoomComment, k as useEditRoomThreadMetadata, l as useMarkRoomThreadAsRead, m as useMarkRoomThreadAsResolved, n as useMarkRoomThreadAsUnresolved, o as useMentionSuggestionsCache, p as useRemoveRoomCommentReaction, q as useReportTextEditor, r as useResolveMentionSuggestions, s as useRoomAttachmentUrl, u as useRoomOrNull, t as useRoomPermissions, v as useYjsProvider } from './room-
|
|
1
|
+
export { C as CreateThreadError, g as getUmbrellaStoreForClient, b as useAddRoomCommentReaction, a as useClientOrNull, c as useCreateRoomComment, d as useCreateRoomThread, e as useCreateTextMention, f as useDeleteRoomComment, h as useDeleteRoomThread, i as useDeleteTextMention, j as useEditRoomComment, k as useEditRoomThreadMetadata, l as useMarkRoomThreadAsRead, m as useMarkRoomThreadAsResolved, n as useMarkRoomThreadAsUnresolved, o as useMentionSuggestionsCache, p as useRemoveRoomCommentReaction, q as useReportTextEditor, r as useResolveMentionSuggestions, s as useRoomAttachmentUrl, u as useRoomOrNull, t as useRoomPermissions, v as useYjsProvider } from './room-C0TyErPq.mjs';
|
|
2
2
|
import { useLayoutEffect as useLayoutEffect$1 } from 'react';
|
|
3
3
|
import { ISignal, SyncSource } from '@liveblocks/core';
|
|
4
4
|
import '@liveblocks/client';
|
package/dist/_private.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as CreateThreadError, g as getUmbrellaStoreForClient, b as useAddRoomCommentReaction, a as useClientOrNull, c as useCreateRoomComment, d as useCreateRoomThread, e as useCreateTextMention, f as useDeleteRoomComment, h as useDeleteRoomThread, i as useDeleteTextMention, j as useEditRoomComment, k as useEditRoomThreadMetadata, l as useMarkRoomThreadAsRead, m as useMarkRoomThreadAsResolved, n as useMarkRoomThreadAsUnresolved, o as useMentionSuggestionsCache, p as useRemoveRoomCommentReaction, q as useReportTextEditor, r as useResolveMentionSuggestions, s as useRoomAttachmentUrl, u as useRoomOrNull, t as useRoomPermissions, v as useYjsProvider } from './room-
|
|
1
|
+
export { C as CreateThreadError, g as getUmbrellaStoreForClient, b as useAddRoomCommentReaction, a as useClientOrNull, c as useCreateRoomComment, d as useCreateRoomThread, e as useCreateTextMention, f as useDeleteRoomComment, h as useDeleteRoomThread, i as useDeleteTextMention, j as useEditRoomComment, k as useEditRoomThreadMetadata, l as useMarkRoomThreadAsRead, m as useMarkRoomThreadAsResolved, n as useMarkRoomThreadAsUnresolved, o as useMentionSuggestionsCache, p as useRemoveRoomCommentReaction, q as useReportTextEditor, r as useResolveMentionSuggestions, s as useRoomAttachmentUrl, u as useRoomOrNull, t as useRoomPermissions, v as useYjsProvider } from './room-C0TyErPq.js';
|
|
2
2
|
import { useLayoutEffect as useLayoutEffect$1 } from 'react';
|
|
3
3
|
import { ISignal, SyncSource } from '@liveblocks/core';
|
|
4
4
|
import '@liveblocks/client';
|
package/dist/_private.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _chunk22QRR3GVjs = require('./chunk-22QRR3GV.js');
|
|
29
29
|
|
|
30
30
|
// src/lib/use-layout-effect.ts
|
|
31
31
|
var _react = require('react');
|
|
@@ -38,8 +38,8 @@ var MENTION_SUGGESTIONS_DEBOUNCE = 500;
|
|
|
38
38
|
function useMentionSuggestions(roomId, search) {
|
|
39
39
|
const [mentionSuggestions, setMentionSuggestions] = _react.useState.call(void 0, );
|
|
40
40
|
const lastInvokedAt = _react.useRef.call(void 0, );
|
|
41
|
-
const resolveMentionSuggestions =
|
|
42
|
-
const mentionSuggestionsCache =
|
|
41
|
+
const resolveMentionSuggestions = _chunk22QRR3GVjs.useResolveMentionSuggestions.call(void 0, );
|
|
42
|
+
const mentionSuggestionsCache = _chunk22QRR3GVjs.useMentionSuggestionsCache.call(void 0, );
|
|
43
43
|
_react.useEffect.call(void 0, () => {
|
|
44
44
|
if (search === void 0 || !resolveMentionSuggestions) {
|
|
45
45
|
return;
|
|
@@ -88,7 +88,7 @@ function useMentionSuggestions(roomId, search) {
|
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
function useSyncSource() {
|
|
91
|
-
const client =
|
|
91
|
+
const client = _chunk22QRR3GVjs.useClient.call(void 0, );
|
|
92
92
|
const createSyncSource = client[_core.kInternal].createSyncSource;
|
|
93
93
|
const [syncSource, setSyncSource] = _react.useState.call(void 0, );
|
|
94
94
|
_react.useEffect.call(void 0, () => {
|
|
@@ -127,5 +127,5 @@ function useSyncSource() {
|
|
|
127
127
|
|
|
128
128
|
|
|
129
129
|
|
|
130
|
-
exports.CreateThreadError =
|
|
130
|
+
exports.CreateThreadError = _chunk22QRR3GVjs.CreateThreadError; exports.getUmbrellaStoreForClient = _chunk22QRR3GVjs.getUmbrellaStoreForClient; exports.useAddRoomCommentReaction = _chunk22QRR3GVjs.useAddRoomCommentReaction; exports.useClientOrNull = _chunk22QRR3GVjs.useClientOrNull; exports.useCreateRoomComment = _chunk22QRR3GVjs.useCreateRoomComment; exports.useCreateRoomThread = _chunk22QRR3GVjs.useCreateRoomThread; exports.useCreateTextMention = _chunk22QRR3GVjs.useCreateTextMention; exports.useDeleteRoomComment = _chunk22QRR3GVjs.useDeleteRoomComment; exports.useDeleteRoomThread = _chunk22QRR3GVjs.useDeleteRoomThread; exports.useDeleteTextMention = _chunk22QRR3GVjs.useDeleteTextMention; exports.useEditRoomComment = _chunk22QRR3GVjs.useEditRoomComment; exports.useEditRoomThreadMetadata = _chunk22QRR3GVjs.useEditRoomThreadMetadata; exports.useLayoutEffect = useLayoutEffect; exports.useMarkRoomThreadAsRead = _chunk22QRR3GVjs.useMarkRoomThreadAsRead; exports.useMarkRoomThreadAsResolved = _chunk22QRR3GVjs.useMarkRoomThreadAsResolved; exports.useMarkRoomThreadAsUnresolved = _chunk22QRR3GVjs.useMarkRoomThreadAsUnresolved; exports.useMentionSuggestions = useMentionSuggestions; exports.useMentionSuggestionsCache = _chunk22QRR3GVjs.useMentionSuggestionsCache; exports.useRemoveRoomCommentReaction = _chunk22QRR3GVjs.useRemoveRoomCommentReaction; exports.useReportTextEditor = _chunk22QRR3GVjs.useReportTextEditor; exports.useResolveMentionSuggestions = _chunk22QRR3GVjs.useResolveMentionSuggestions; exports.useRoomAttachmentUrl = _chunk22QRR3GVjs.useRoomAttachmentUrl; exports.useRoomOrNull = _chunk22QRR3GVjs.useRoomOrNull; exports.useRoomPermissions = _chunk22QRR3GVjs.useRoomPermissions; exports.useSignal = _chunk22QRR3GVjs.useSignal; exports.useSyncExternalStoreWithSelector = _chunk22QRR3GVjs.useSyncExternalStoreWithSelector; exports.useSyncSource = useSyncSource; exports.useYjsProvider = _chunk22QRR3GVjs.useYjsProvider;
|
|
131
131
|
//# sourceMappingURL=_private.js.map
|
package/dist/_private.mjs
CHANGED
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
useSignal,
|
|
26
26
|
useSyncExternalStoreWithSelector,
|
|
27
27
|
useYjsProvider
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-VX6Y3GQO.mjs";
|
|
29
29
|
|
|
30
30
|
// src/lib/use-layout-effect.ts
|
|
31
31
|
import { useEffect, useLayoutEffect as useOriginalLayoutEffect } from "react";
|
|
@@ -130,7 +130,9 @@ var config = {
|
|
|
130
130
|
HISTORY_VERSIONS_POLL_INTERVAL: 1 * MINUTES,
|
|
131
131
|
HISTORY_VERSIONS_MAX_STALE_TIME: 5 * SECONDS,
|
|
132
132
|
NOTIFICATION_SETTINGS_POLL_INTERVAL: 1 * MINUTES,
|
|
133
|
-
NOTIFICATION_SETTINGS_MAX_STALE_TIME: 5 * SECONDS
|
|
133
|
+
NOTIFICATION_SETTINGS_MAX_STALE_TIME: 5 * SECONDS,
|
|
134
|
+
CHANNEL_NOTIFICATION_SETTINGS_INTERVAL: 5 * MINUTES,
|
|
135
|
+
CHANNEL_NOTIFICATION_SETTINGS_MAX_STALE_TIME: 1 * MINUTES
|
|
134
136
|
};
|
|
135
137
|
|
|
136
138
|
// src/lib/AsyncResult.ts
|
|
@@ -235,6 +237,8 @@ var use = (
|
|
|
235
237
|
|
|
236
238
|
|
|
237
239
|
|
|
240
|
+
|
|
241
|
+
|
|
238
242
|
// src/lib/autobind.ts
|
|
239
243
|
function autobind(self) {
|
|
240
244
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -244,7 +248,7 @@ function autobind(self) {
|
|
|
244
248
|
for (const key of Reflect.ownKeys(obj)) {
|
|
245
249
|
if (seen.has(key)) continue;
|
|
246
250
|
const descriptor = Reflect.getOwnPropertyDescriptor(obj, key);
|
|
247
|
-
if (typeof _optionalChain([descriptor, 'optionalAccess',
|
|
251
|
+
if (typeof _optionalChain([descriptor, 'optionalAccess', _2 => _2.value]) === "function") {
|
|
248
252
|
seen.add(key);
|
|
249
253
|
self[key] = self[key].bind(self);
|
|
250
254
|
}
|
|
@@ -344,7 +348,7 @@ var ThreadDB = class _ThreadDB {
|
|
|
344
348
|
/** Returns an existing thread by ID. Will never return a deleted thread. */
|
|
345
349
|
get(threadId) {
|
|
346
350
|
const thread = this.getEvenIfDeleted(threadId);
|
|
347
|
-
return _optionalChain([thread, 'optionalAccess',
|
|
351
|
+
return _optionalChain([thread, 'optionalAccess', _3 => _3.deletedAt]) ? void 0 : thread;
|
|
348
352
|
}
|
|
349
353
|
/** Returns the (possibly deleted) thread by ID. */
|
|
350
354
|
getEvenIfDeleted(threadId) {
|
|
@@ -470,7 +474,7 @@ var PaginatedResource = class {
|
|
|
470
474
|
}
|
|
471
475
|
async #fetchMore() {
|
|
472
476
|
const state = this.#signal.get();
|
|
473
|
-
if (!_optionalChain([state, 'access',
|
|
477
|
+
if (!_optionalChain([state, 'access', _4 => _4.data, 'optionalAccess', _5 => _5.cursor]) || state.data.isFetchingMore) {
|
|
474
478
|
return;
|
|
475
479
|
}
|
|
476
480
|
this.#patch({ isFetchingMore: true });
|
|
@@ -491,7 +495,7 @@ var PaginatedResource = class {
|
|
|
491
495
|
}
|
|
492
496
|
fetchMore() {
|
|
493
497
|
const state = this.#signal.get();
|
|
494
|
-
if (!_optionalChain([state, 'access',
|
|
498
|
+
if (!_optionalChain([state, 'access', _6 => _6.data, 'optionalAccess', _7 => _7.cursor])) return noop2;
|
|
495
499
|
if (!this.#pendingFetchMore) {
|
|
496
500
|
this.#pendingFetchMore = this.#fetchMore().finally(() => {
|
|
497
501
|
this.#pendingFetchMore = null;
|
|
@@ -716,6 +720,26 @@ function createStore_forPermissionHints() {
|
|
|
716
720
|
update
|
|
717
721
|
};
|
|
718
722
|
}
|
|
723
|
+
function createStore_forChannelsNotificationSettings(updates) {
|
|
724
|
+
const signal = new (0, _core.Signal)({});
|
|
725
|
+
function update(settings) {
|
|
726
|
+
signal.set((prevSettings) => {
|
|
727
|
+
return {
|
|
728
|
+
...prevSettings,
|
|
729
|
+
...settings
|
|
730
|
+
};
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
return {
|
|
734
|
+
signal: _core.DerivedSignal.from(
|
|
735
|
+
signal,
|
|
736
|
+
updates,
|
|
737
|
+
(base, updates2) => applyOptimisticUpdates_forChannelNotificationSettings(base, updates2)
|
|
738
|
+
),
|
|
739
|
+
// Mutations
|
|
740
|
+
update
|
|
741
|
+
};
|
|
742
|
+
}
|
|
719
743
|
function createStore_forOptimistic(client) {
|
|
720
744
|
const signal = new (0, _core.Signal)([]);
|
|
721
745
|
const syncSource = client[_core.kInternal].createSyncSource();
|
|
@@ -755,9 +779,11 @@ var UmbrellaStore = class {
|
|
|
755
779
|
// \ | | | | & notifications by ID
|
|
756
780
|
// | \ | | Apply | |
|
|
757
781
|
// | `-> OptimisticUpdates --+--+--> Optimistic --+-+--> Notification Settings (Part 2)
|
|
758
|
-
// \ | Updates
|
|
759
|
-
// `------- etc etc ---------+
|
|
760
|
-
// ^
|
|
782
|
+
// \ | Updates | |
|
|
783
|
+
// `------- etc etc ---------+ | +--> History Versions (Part 3)
|
|
784
|
+
// ^ |
|
|
785
|
+
// | +-----> Channels Notification Settings (Part 4)
|
|
786
|
+
// |
|
|
761
787
|
// |
|
|
762
788
|
// | ^ ^
|
|
763
789
|
// Signal | |
|
|
@@ -779,6 +805,7 @@ var UmbrellaStore = class {
|
|
|
779
805
|
|
|
780
806
|
|
|
781
807
|
|
|
808
|
+
|
|
782
809
|
//
|
|
783
810
|
// Output signals.
|
|
784
811
|
// (Readonly, clean, consistent. With optimistic updates applied.)
|
|
@@ -798,6 +825,8 @@ var UmbrellaStore = class {
|
|
|
798
825
|
#userThreadsLastRequestedAt = null;
|
|
799
826
|
// Room versions
|
|
800
827
|
#roomVersionsLastRequestedAtByRoom = /* @__PURE__ */ new Map();
|
|
828
|
+
// Channels Notification Settings
|
|
829
|
+
#channelsNotificationSettings;
|
|
801
830
|
constructor(client) {
|
|
802
831
|
this.#client = client[_core.kInternal].as();
|
|
803
832
|
this.optimisticUpdates = createStore_forOptimistic(this.#client);
|
|
@@ -813,6 +842,16 @@ var UmbrellaStore = class {
|
|
|
813
842
|
return nextCursor;
|
|
814
843
|
}
|
|
815
844
|
);
|
|
845
|
+
const channelsNotificationSettingsFetcher = async () => {
|
|
846
|
+
const result = await this.#client.getChannelsNotificationSettings();
|
|
847
|
+
this.channelNotificationSettings.update(result);
|
|
848
|
+
};
|
|
849
|
+
this.channelNotificationSettings = createStore_forChannelsNotificationSettings(
|
|
850
|
+
this.optimisticUpdates.signal
|
|
851
|
+
);
|
|
852
|
+
this.#channelsNotificationSettings = new SinglePageResource(
|
|
853
|
+
channelsNotificationSettingsFetcher
|
|
854
|
+
);
|
|
816
855
|
this.threads = new ThreadDB();
|
|
817
856
|
this.notifications = createStore_forNotifications();
|
|
818
857
|
this.roomNotificationSettings = createStore_forRoomNotificationSettings(
|
|
@@ -996,6 +1035,22 @@ var UmbrellaStore = class {
|
|
|
996
1035
|
return { signal, waitUntilLoaded: resource.waitUntilLoaded };
|
|
997
1036
|
}
|
|
998
1037
|
);
|
|
1038
|
+
const channelNotificationSettings = {
|
|
1039
|
+
signal: _core.DerivedSignal.from(
|
|
1040
|
+
() => {
|
|
1041
|
+
const result = this.#channelsNotificationSettings.get();
|
|
1042
|
+
if (result.isLoading || result.error) {
|
|
1043
|
+
return result;
|
|
1044
|
+
}
|
|
1045
|
+
return ASYNC_OK(
|
|
1046
|
+
"settings",
|
|
1047
|
+
_core.nn.call(void 0, this.channelNotificationSettings.signal.get())
|
|
1048
|
+
);
|
|
1049
|
+
},
|
|
1050
|
+
_core.shallow
|
|
1051
|
+
),
|
|
1052
|
+
waitUntilLoaded: this.#channelsNotificationSettings.waitUntilLoaded
|
|
1053
|
+
};
|
|
999
1054
|
this.outputs = {
|
|
1000
1055
|
threadifications,
|
|
1001
1056
|
threads,
|
|
@@ -1004,7 +1059,8 @@ var UmbrellaStore = class {
|
|
|
1004
1059
|
notifications,
|
|
1005
1060
|
loadingNotifications,
|
|
1006
1061
|
settingsByRoomId,
|
|
1007
|
-
versionsByRoomId
|
|
1062
|
+
versionsByRoomId,
|
|
1063
|
+
channelNotificationSettings
|
|
1008
1064
|
};
|
|
1009
1065
|
autobind(this);
|
|
1010
1066
|
}
|
|
@@ -1249,6 +1305,25 @@ var UmbrellaStore = class {
|
|
|
1249
1305
|
const result = await room.getNotificationSettings({ signal });
|
|
1250
1306
|
this.roomNotificationSettings.update(roomId, result);
|
|
1251
1307
|
}
|
|
1308
|
+
/**
|
|
1309
|
+
* Refresh Channels Notification Settings from poller
|
|
1310
|
+
*/
|
|
1311
|
+
async refreshChannelsNotificationSettings(signal) {
|
|
1312
|
+
const result = await this.#client.getChannelsNotificationSettings({
|
|
1313
|
+
signal
|
|
1314
|
+
});
|
|
1315
|
+
this.channelNotificationSettings.update(result);
|
|
1316
|
+
}
|
|
1317
|
+
/**
|
|
1318
|
+
* Updates channels notification settings with a new value, replacing the
|
|
1319
|
+
* corresponding optimistic update.
|
|
1320
|
+
*/
|
|
1321
|
+
updateChannelsNotificationSettings_confirmOptimisticUpdate(settings, optimisticUpdateId) {
|
|
1322
|
+
_core.batch.call(void 0, () => {
|
|
1323
|
+
this.optimisticUpdates.remove(optimisticUpdateId);
|
|
1324
|
+
this.channelNotificationSettings.update(settings);
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1252
1327
|
};
|
|
1253
1328
|
function applyOptimisticUpdates_forThreadifications(baseThreadsDB, notificationsLUT, optimisticUpdates) {
|
|
1254
1329
|
const threadsDB = baseThreadsDB.clone();
|
|
@@ -1423,6 +1498,33 @@ function applyOptimisticUpdates_forSettings(settingsLUT, optimisticUpdates) {
|
|
|
1423
1498
|
}
|
|
1424
1499
|
return settingsByRoomId;
|
|
1425
1500
|
}
|
|
1501
|
+
function applyOptimisticUpdates_forChannelNotificationSettings(baseChannelsNotificationSettings, optimisticUpdates) {
|
|
1502
|
+
const outcomingSettings = { ...baseChannelsNotificationSettings };
|
|
1503
|
+
for (const optimisticUpdate of optimisticUpdates) {
|
|
1504
|
+
switch (optimisticUpdate.type) {
|
|
1505
|
+
case "update-channels-notification-settings": {
|
|
1506
|
+
const incomingSettings = optimisticUpdate.settings;
|
|
1507
|
+
for (const channelKey of _core.keys.call(void 0, incomingSettings)) {
|
|
1508
|
+
const key = channelKey;
|
|
1509
|
+
const channelUpdates = incomingSettings[key];
|
|
1510
|
+
if (channelUpdates) {
|
|
1511
|
+
const realChannelUpdates = Object.fromEntries(
|
|
1512
|
+
_core.entries.call(void 0, channelUpdates).filter(
|
|
1513
|
+
([_, value]) => value !== void 0
|
|
1514
|
+
)
|
|
1515
|
+
);
|
|
1516
|
+
outcomingSettings[key] = {
|
|
1517
|
+
...outcomingSettings[key],
|
|
1518
|
+
...realChannelUpdates
|
|
1519
|
+
};
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
break;
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
return outcomingSettings;
|
|
1527
|
+
}
|
|
1426
1528
|
function compareInboxNotifications(inboxNotificationA, inboxNotificationB) {
|
|
1427
1529
|
if (inboxNotificationA.notifiedAt > inboxNotificationB.notifiedAt) {
|
|
1428
1530
|
return 1;
|
|
@@ -1472,7 +1574,7 @@ function applyUpsertComment(thread, comment) {
|
|
|
1472
1574
|
updatedAt: new Date(
|
|
1473
1575
|
Math.max(
|
|
1474
1576
|
thread.updatedAt.getTime(),
|
|
1475
|
-
_optionalChain([comment, 'access',
|
|
1577
|
+
_optionalChain([comment, 'access', _8 => _8.editedAt, 'optionalAccess', _9 => _9.getTime, 'call', _10 => _10()]) || comment.createdAt.getTime()
|
|
1476
1578
|
)
|
|
1477
1579
|
),
|
|
1478
1580
|
comments: updatedComments
|
|
@@ -1631,7 +1733,7 @@ function selectorFor_useUnreadInboxNotificationsCount(result) {
|
|
|
1631
1733
|
);
|
|
1632
1734
|
}
|
|
1633
1735
|
function selectorFor_useUser(state, userId) {
|
|
1634
|
-
if (state === void 0 || _optionalChain([state, 'optionalAccess',
|
|
1736
|
+
if (state === void 0 || _optionalChain([state, 'optionalAccess', _11 => _11.isLoading])) {
|
|
1635
1737
|
return _nullishCoalesce(state, () => ( { isLoading: true }));
|
|
1636
1738
|
}
|
|
1637
1739
|
if (state.error) {
|
|
@@ -1649,7 +1751,7 @@ function selectorFor_useUser(state, userId) {
|
|
|
1649
1751
|
};
|
|
1650
1752
|
}
|
|
1651
1753
|
function selectorFor_useRoomInfo(state, roomId) {
|
|
1652
|
-
if (state === void 0 || _optionalChain([state, 'optionalAccess',
|
|
1754
|
+
if (state === void 0 || _optionalChain([state, 'optionalAccess', _12 => _12.isLoading])) {
|
|
1653
1755
|
return _nullishCoalesce(state, () => ( { isLoading: true }));
|
|
1654
1756
|
}
|
|
1655
1757
|
if (state.error) {
|
|
@@ -1716,10 +1818,25 @@ function makeLiveblocksExtrasForClient(client) {
|
|
|
1716
1818
|
config.USER_THREADS_POLL_INTERVAL,
|
|
1717
1819
|
{ maxStaleTimeMs: config.USER_THREADS_MAX_STALE_TIME }
|
|
1718
1820
|
);
|
|
1821
|
+
const channelNotificationSettingsPoller = _core.makePoller.call(void 0,
|
|
1822
|
+
async (signal) => {
|
|
1823
|
+
try {
|
|
1824
|
+
return await store.refreshChannelsNotificationSettings(signal);
|
|
1825
|
+
} catch (err) {
|
|
1826
|
+
console.warn(
|
|
1827
|
+
`Polling new channel notification settings failed: ${String(err)}`
|
|
1828
|
+
);
|
|
1829
|
+
throw err;
|
|
1830
|
+
}
|
|
1831
|
+
},
|
|
1832
|
+
config.CHANNEL_NOTIFICATION_SETTINGS_INTERVAL,
|
|
1833
|
+
{ maxStaleTimeMs: config.CHANNEL_NOTIFICATION_SETTINGS_MAX_STALE_TIME }
|
|
1834
|
+
);
|
|
1719
1835
|
return {
|
|
1720
1836
|
store,
|
|
1721
1837
|
notificationsPoller,
|
|
1722
|
-
userThreadsPoller
|
|
1838
|
+
userThreadsPoller,
|
|
1839
|
+
channelNotificationSettingsPoller
|
|
1723
1840
|
};
|
|
1724
1841
|
}
|
|
1725
1842
|
function makeLiveblocksContextBundle(client) {
|
|
@@ -1728,6 +1845,7 @@ function makeLiveblocksContextBundle(client) {
|
|
|
1728
1845
|
const useMarkAllInboxNotificationsAsRead2 = () => useMarkAllInboxNotificationsAsRead_withClient(client);
|
|
1729
1846
|
const useDeleteInboxNotification2 = () => useDeleteInboxNotification_withClient(client);
|
|
1730
1847
|
const useDeleteAllInboxNotifications2 = () => useDeleteAllInboxNotifications_withClient(client);
|
|
1848
|
+
const useUpdateChannelsNotificationSettings2 = () => useUpdateChannelsNotificationSettings_withClient(client);
|
|
1731
1849
|
function LiveblocksProvider2(props) {
|
|
1732
1850
|
useEnsureNoLiveblocksProvider();
|
|
1733
1851
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ClientContext.Provider, { value: client, children: props.children });
|
|
@@ -1741,6 +1859,8 @@ function makeLiveblocksContextBundle(client) {
|
|
|
1741
1859
|
useMarkAllInboxNotificationsAsRead: useMarkAllInboxNotificationsAsRead2,
|
|
1742
1860
|
useDeleteInboxNotification: useDeleteInboxNotification2,
|
|
1743
1861
|
useDeleteAllInboxNotifications: useDeleteAllInboxNotifications2,
|
|
1862
|
+
useChannelsNotificationSettings: () => useChannelsNotificationSettings_withClient(client),
|
|
1863
|
+
useUpdateChannelsNotificationSettings: useUpdateChannelsNotificationSettings2,
|
|
1744
1864
|
useInboxNotificationThread: useInboxNotificationThread2,
|
|
1745
1865
|
useUserThreads_experimental,
|
|
1746
1866
|
...shared.classic,
|
|
@@ -1753,6 +1873,8 @@ function makeLiveblocksContextBundle(client) {
|
|
|
1753
1873
|
useDeleteInboxNotification: useDeleteInboxNotification2,
|
|
1754
1874
|
useDeleteAllInboxNotifications: useDeleteAllInboxNotifications2,
|
|
1755
1875
|
useInboxNotificationThread: useInboxNotificationThread2,
|
|
1876
|
+
useChannelsNotificationSettings: () => useChannelsNotificationSettingsSuspense_withClient(client),
|
|
1877
|
+
useUpdateChannelsNotificationSettings: useUpdateChannelsNotificationSettings2,
|
|
1756
1878
|
useUserThreads_experimental: useUserThreadsSuspense_experimental,
|
|
1757
1879
|
...shared.suspense
|
|
1758
1880
|
}
|
|
@@ -1915,6 +2037,57 @@ function useInboxNotificationThread_withClient(client, inboxNotificationId) {
|
|
|
1915
2037
|
)
|
|
1916
2038
|
);
|
|
1917
2039
|
}
|
|
2040
|
+
function useUpdateChannelsNotificationSettings_withClient(client) {
|
|
2041
|
+
return _react.useCallback.call(void 0,
|
|
2042
|
+
(settings) => {
|
|
2043
|
+
const { store } = getLiveblocksExtrasForClient(client);
|
|
2044
|
+
const optimisticUpdateId = store.optimisticUpdates.add({
|
|
2045
|
+
type: "update-channels-notification-settings",
|
|
2046
|
+
settings
|
|
2047
|
+
});
|
|
2048
|
+
client.updateChannelsNotificationSettings(settings).then(
|
|
2049
|
+
(settings2) => {
|
|
2050
|
+
store.updateChannelsNotificationSettings_confirmOptimisticUpdate(
|
|
2051
|
+
settings2,
|
|
2052
|
+
optimisticUpdateId
|
|
2053
|
+
);
|
|
2054
|
+
},
|
|
2055
|
+
() => {
|
|
2056
|
+
store.optimisticUpdates.remove(optimisticUpdateId);
|
|
2057
|
+
}
|
|
2058
|
+
);
|
|
2059
|
+
},
|
|
2060
|
+
[client]
|
|
2061
|
+
);
|
|
2062
|
+
}
|
|
2063
|
+
function useChannelsNotificationSettings_withClient(client) {
|
|
2064
|
+
const updateChannelsNotificationSettings = useUpdateChannelsNotificationSettings_withClient(client);
|
|
2065
|
+
const { store, channelNotificationSettingsPoller: poller } = getLiveblocksExtrasForClient(client);
|
|
2066
|
+
_react.useEffect.call(void 0, () => {
|
|
2067
|
+
void store.outputs.channelNotificationSettings.waitUntilLoaded();
|
|
2068
|
+
});
|
|
2069
|
+
_react.useEffect.call(void 0, () => {
|
|
2070
|
+
poller.inc();
|
|
2071
|
+
poller.pollNowIfStale();
|
|
2072
|
+
return () => {
|
|
2073
|
+
poller.dec();
|
|
2074
|
+
};
|
|
2075
|
+
}, [poller]);
|
|
2076
|
+
const settings = useSignal(store.outputs.channelNotificationSettings.signal);
|
|
2077
|
+
return _react.useMemo.call(void 0, () => {
|
|
2078
|
+
return [settings, updateChannelsNotificationSettings];
|
|
2079
|
+
}, [settings, updateChannelsNotificationSettings]);
|
|
2080
|
+
}
|
|
2081
|
+
function useChannelsNotificationSettingsSuspense_withClient(client) {
|
|
2082
|
+
const store = getLiveblocksExtrasForClient(client).store;
|
|
2083
|
+
use(store.outputs.channelNotificationSettings.waitUntilLoaded());
|
|
2084
|
+
const [settings, updateChannelsNotificationSettings] = useChannelsNotificationSettings_withClient(client);
|
|
2085
|
+
_core.assert.call(void 0, !settings.error, "Did not expect error");
|
|
2086
|
+
_core.assert.call(void 0, !settings.isLoading, "Did not expect loading");
|
|
2087
|
+
return _react.useMemo.call(void 0, () => {
|
|
2088
|
+
return [settings, updateChannelsNotificationSettings];
|
|
2089
|
+
}, [settings, updateChannelsNotificationSettings]);
|
|
2090
|
+
}
|
|
1918
2091
|
function useUser_withClient(client, userId) {
|
|
1919
2092
|
const usersStore = client[_core.kInternal].usersStore;
|
|
1920
2093
|
const getUserState = _react.useCallback.call(void 0,
|
|
@@ -2062,7 +2235,7 @@ function createSharedContext(client) {
|
|
|
2062
2235
|
}
|
|
2063
2236
|
function useEnsureNoLiveblocksProvider(options) {
|
|
2064
2237
|
const existing = useClientOrNull();
|
|
2065
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
2238
|
+
if (!_optionalChain([options, 'optionalAccess', _13 => _13.allowNesting]) && existing !== null) {
|
|
2066
2239
|
throw new Error(
|
|
2067
2240
|
"You cannot nest multiple LiveblocksProvider instances in the same React tree."
|
|
2068
2241
|
);
|
|
@@ -2176,6 +2349,15 @@ function useUnreadInboxNotificationsCount() {
|
|
|
2176
2349
|
function useUnreadInboxNotificationsCountSuspense() {
|
|
2177
2350
|
return useUnreadInboxNotificationsCountSuspense_withClient(useClient());
|
|
2178
2351
|
}
|
|
2352
|
+
function useChannelsNotificationSettings() {
|
|
2353
|
+
return useChannelsNotificationSettings_withClient(useClient());
|
|
2354
|
+
}
|
|
2355
|
+
function useChannelsNotificationSettingsSuspense() {
|
|
2356
|
+
return useChannelsNotificationSettingsSuspense_withClient(useClient());
|
|
2357
|
+
}
|
|
2358
|
+
function useUpdateChannelsNotificationSettings() {
|
|
2359
|
+
return useUpdateChannelsNotificationSettings_withClient(useClient());
|
|
2360
|
+
}
|
|
2179
2361
|
function useUser(userId) {
|
|
2180
2362
|
const client = useClient();
|
|
2181
2363
|
return useUser_withClient(client, userId);
|
|
@@ -2196,7 +2378,7 @@ var _useUserSuspense = useUserSuspense;
|
|
|
2196
2378
|
var _useUserThreads_experimental = useUserThreads_experimental;
|
|
2197
2379
|
var _useUserThreadsSuspense_experimental = useUserThreadsSuspense_experimental;
|
|
2198
2380
|
function useSyncStatus_withClient(client, options) {
|
|
2199
|
-
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2381
|
+
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _14 => _14.smooth]), () => ( false)));
|
|
2200
2382
|
if (smooth) {
|
|
2201
2383
|
return useSyncStatusSmooth_withClient(client);
|
|
2202
2384
|
} else {
|
|
@@ -2441,7 +2623,7 @@ function getCurrentUserId(client) {
|
|
|
2441
2623
|
}
|
|
2442
2624
|
function handleApiError(err) {
|
|
2443
2625
|
const message = `Request failed with status ${err.status}: ${err.message}`;
|
|
2444
|
-
if (_optionalChain([err, 'access',
|
|
2626
|
+
if (_optionalChain([err, 'access', _15 => _15.details, 'optionalAccess', _16 => _16.error]) === "FORBIDDEN") {
|
|
2445
2627
|
const detailedMessage = [message, err.details.suggestion, err.details.docs].filter(Boolean).join("\n");
|
|
2446
2628
|
_core.console.error(detailedMessage);
|
|
2447
2629
|
}
|
|
@@ -2830,7 +3012,7 @@ function useMentionSuggestionsCache() {
|
|
|
2830
3012
|
return client[_core.kInternal].mentionSuggestionsCache;
|
|
2831
3013
|
}
|
|
2832
3014
|
function useStorageStatus(options) {
|
|
2833
|
-
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
3015
|
+
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _17 => _17.smooth]), () => ( false)));
|
|
2834
3016
|
if (smooth) {
|
|
2835
3017
|
return useStorageStatusSmooth();
|
|
2836
3018
|
} else {
|
|
@@ -3160,7 +3342,7 @@ function useCreateRoomThread(roomId) {
|
|
|
3160
3342
|
thread: newThread,
|
|
3161
3343
|
roomId
|
|
3162
3344
|
});
|
|
3163
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3345
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _18 => _18.map, 'call', _19 => _19((attachment) => attachment.id)]);
|
|
3164
3346
|
client[_core.kInternal].httpClient.createThread({
|
|
3165
3347
|
roomId,
|
|
3166
3348
|
threadId,
|
|
@@ -3199,7 +3381,7 @@ function useDeleteRoomThread(roomId) {
|
|
|
3199
3381
|
const { store, onMutationFailure } = getRoomExtrasForClient(client);
|
|
3200
3382
|
const userId = getCurrentUserId(client);
|
|
3201
3383
|
const existing = store.outputs.threads.get().get(threadId);
|
|
3202
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
3384
|
+
if (_optionalChain([existing, 'optionalAccess', _20 => _20.comments, 'optionalAccess', _21 => _21[0], 'optionalAccess', _22 => _22.userId]) !== userId) {
|
|
3203
3385
|
throw new Error("Only the thread creator can delete the thread");
|
|
3204
3386
|
}
|
|
3205
3387
|
const optimisticId = store.optimisticUpdates.add({
|
|
@@ -3286,7 +3468,7 @@ function useCreateRoomComment(roomId) {
|
|
|
3286
3468
|
type: "create-comment",
|
|
3287
3469
|
comment
|
|
3288
3470
|
});
|
|
3289
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3471
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _23 => _23.map, 'call', _24 => _24((attachment) => attachment.id)]);
|
|
3290
3472
|
client[_core.kInternal].httpClient.createComment({ roomId, threadId, commentId, body, attachmentIds }).then(
|
|
3291
3473
|
(newComment) => {
|
|
3292
3474
|
store.createComment(newComment, optimisticId);
|
|
@@ -3341,7 +3523,7 @@ function useEditRoomComment(roomId) {
|
|
|
3341
3523
|
attachments: _nullishCoalesce(attachments, () => ( []))
|
|
3342
3524
|
}
|
|
3343
3525
|
});
|
|
3344
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3526
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _25 => _25.map, 'call', _26 => _26((attachment) => attachment.id)]);
|
|
3345
3527
|
client[_core.kInternal].httpClient.editComment({ roomId, threadId, commentId, body, attachmentIds }).then(
|
|
3346
3528
|
(editedComment) => {
|
|
3347
3529
|
store.editComment(threadId, optimisticId, editedComment);
|
|
@@ -3822,7 +4004,7 @@ function useThreadsSuspense(options = {}) {
|
|
|
3822
4004
|
return result;
|
|
3823
4005
|
}
|
|
3824
4006
|
function selectorFor_useAttachmentUrl(state) {
|
|
3825
|
-
if (state === void 0 || _optionalChain([state, 'optionalAccess',
|
|
4007
|
+
if (state === void 0 || _optionalChain([state, 'optionalAccess', _27 => _27.isLoading])) {
|
|
3826
4008
|
return _nullishCoalesce(state, () => ( { isLoading: true }));
|
|
3827
4009
|
}
|
|
3828
4010
|
if (state.error) {
|
|
@@ -4039,5 +4221,8 @@ var _useUpdateMyPresence = useUpdateMyPresence;
|
|
|
4039
4221
|
|
|
4040
4222
|
|
|
4041
4223
|
|
|
4042
|
-
|
|
4043
|
-
|
|
4224
|
+
|
|
4225
|
+
|
|
4226
|
+
|
|
4227
|
+
exports.RoomContext = RoomContext; exports.useRoomOrNull = useRoomOrNull; exports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector; exports.useSignal = useSignal; exports.ClientContext = ClientContext; exports.getUmbrellaStoreForClient = getUmbrellaStoreForClient; exports.useClientOrNull = useClientOrNull; exports.useClient = useClient; 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.useChannelsNotificationSettings = useChannelsNotificationSettings; exports.useChannelsNotificationSettingsSuspense = useChannelsNotificationSettingsSuspense; exports.useUpdateChannelsNotificationSettings = useUpdateChannelsNotificationSettings; exports.useRoomInfo = useRoomInfo; exports.useRoomInfoSuspense = useRoomInfoSuspense; exports._useInboxNotificationThread = _useInboxNotificationThread; exports._useUser = _useUser; exports._useUserSuspense = _useUserSuspense; exports._useUserThreads_experimental = _useUserThreads_experimental; exports._useUserThreadsSuspense_experimental = _useUserThreadsSuspense_experimental; exports.useSyncStatus = useSyncStatus; exports.CreateThreadError = CreateThreadError; exports.useStatus = useStatus; exports.useReportTextEditor = useReportTextEditor; exports.useYjsProvider = useYjsProvider; exports.useCreateTextMention = useCreateTextMention; exports.useDeleteTextMention = useDeleteTextMention; exports.useResolveMentionSuggestions = useResolveMentionSuggestions; exports.useMentionSuggestionsCache = useMentionSuggestionsCache; exports.useStorageStatus = useStorageStatus; exports.useBatch = useBatch; exports.useLostConnectionListener = useLostConnectionListener; exports.useErrorListener = useErrorListener; exports.useHistory = useHistory; exports.useUndo = useUndo; exports.useRedo = useRedo; exports.useCanUndo = useCanUndo; exports.useCanRedo = useCanRedo; exports.useOthersConnectionIds = useOthersConnectionIds; exports.useCommentsErrorListener = useCommentsErrorListener; 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.useThreadSubscription = useThreadSubscription; exports.useHistoryVersionData = useHistoryVersionData; exports.useUpdateRoomNotificationSettings = useUpdateRoomNotificationSettings; exports.useOthersConnectionIdsSuspense = useOthersConnectionIdsSuspense; exports.useStorageStatusSuspense = useStorageStatusSuspense; exports.useAttachmentUrl = useAttachmentUrl; exports.useRoomAttachmentUrl = useRoomAttachmentUrl; exports.useAttachmentUrlSuspense = useAttachmentUrlSuspense; exports.useRoomPermissions = useRoomPermissions; exports.createRoomContext = createRoomContext; exports._RoomProvider = _RoomProvider; exports._useBroadcastEvent = _useBroadcastEvent; exports._useOthersListener = _useOthersListener; exports._useRoom = _useRoom; exports._useIsInsideRoom = _useIsInsideRoom; exports._useAddReaction = _useAddReaction; exports._useMutation = _useMutation; exports._useCreateThread = _useCreateThread; exports._useDeleteThread = _useDeleteThread; exports._useEditThreadMetadata = _useEditThreadMetadata; exports._useEventListener = _useEventListener; exports._useMyPresence = _useMyPresence; exports._useOthersMapped = _useOthersMapped; exports._useOthersMappedSuspense = _useOthersMappedSuspense; exports._useThreads = _useThreads; exports._useThreadsSuspense = _useThreadsSuspense; exports._useRoomNotificationSettings = _useRoomNotificationSettings; exports._useRoomNotificationSettingsSuspense = _useRoomNotificationSettingsSuspense; 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;
|
|
4228
|
+
//# sourceMappingURL=chunk-22QRR3GV.js.map
|