@liveblocks/react 2.17.0-usrnotsettings3 → 2.17.0
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-M2B54KRP.mjs → chunk-4KNGHD4I.mjs} +13 -212
- package/dist/chunk-4KNGHD4I.mjs.map +1 -0
- package/dist/{chunk-HV3HU2RB.js → chunk-J5ZDLMBE.js} +30 -229
- package/dist/chunk-J5ZDLMBE.js.map +1 -0
- package/dist/{chunk-N7SHYNWS.js → chunk-K7QFAI6G.js} +2 -2
- package/dist/chunk-K7QFAI6G.js.map +1 -0
- package/dist/{chunk-L7XOVOE2.mjs → chunk-XHQ4VJ7B.mjs} +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -8
- package/dist/index.mjs.map +1 -1
- package/dist/{room-BDt2BfPN.d.mts → room-DVbQkoj3.d.mts} +4 -79
- package/dist/{room-BDt2BfPN.d.ts → room-DVbQkoj3.d.ts} +4 -79
- package/dist/suspense.d.mts +2 -2
- package/dist/suspense.d.ts +2 -2
- package/dist/suspense.js +4 -9
- package/dist/suspense.js.map +1 -1
- package/dist/suspense.mjs +3 -8
- package/dist/suspense.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-HV3HU2RB.js.map +0 -1
- package/dist/chunk-M2B54KRP.mjs.map +0 -1
- package/dist/chunk-N7SHYNWS.js.map +0 -1
- /package/dist/{chunk-L7XOVOE2.mjs.map → chunk-XHQ4VJ7B.mjs.map} +0 -0
package/dist/_private.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { 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 { 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-DVbQkoj3.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 { 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 { 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-DVbQkoj3.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
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _chunkJ5ZDLMBEjs = require('./chunk-J5ZDLMBE.js');
|
|
28
28
|
|
|
29
29
|
// src/lib/use-layout-effect.ts
|
|
30
30
|
var _react = require('react');
|
|
@@ -37,8 +37,8 @@ var MENTION_SUGGESTIONS_DEBOUNCE = 500;
|
|
|
37
37
|
function useMentionSuggestions(roomId, search) {
|
|
38
38
|
const [mentionSuggestions, setMentionSuggestions] = _react.useState.call(void 0, );
|
|
39
39
|
const lastInvokedAt = _react.useRef.call(void 0, );
|
|
40
|
-
const resolveMentionSuggestions =
|
|
41
|
-
const mentionSuggestionsCache =
|
|
40
|
+
const resolveMentionSuggestions = _chunkJ5ZDLMBEjs.useResolveMentionSuggestions.call(void 0, );
|
|
41
|
+
const mentionSuggestionsCache = _chunkJ5ZDLMBEjs.useMentionSuggestionsCache.call(void 0, );
|
|
42
42
|
_react.useEffect.call(void 0, () => {
|
|
43
43
|
if (search === void 0 || !resolveMentionSuggestions) {
|
|
44
44
|
return;
|
|
@@ -87,7 +87,7 @@ function useMentionSuggestions(roomId, search) {
|
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
function useSyncSource() {
|
|
90
|
-
const client =
|
|
90
|
+
const client = _chunkJ5ZDLMBEjs.useClient.call(void 0, );
|
|
91
91
|
const createSyncSource = client[_core.kInternal].createSyncSource;
|
|
92
92
|
const [syncSource, setSyncSource] = _react.useState.call(void 0, );
|
|
93
93
|
_react.useEffect.call(void 0, () => {
|
|
@@ -125,5 +125,5 @@ function useSyncSource() {
|
|
|
125
125
|
|
|
126
126
|
|
|
127
127
|
|
|
128
|
-
exports.getUmbrellaStoreForClient =
|
|
128
|
+
exports.getUmbrellaStoreForClient = _chunkJ5ZDLMBEjs.getUmbrellaStoreForClient; exports.useAddRoomCommentReaction = _chunkJ5ZDLMBEjs.useAddRoomCommentReaction; exports.useClientOrNull = _chunkJ5ZDLMBEjs.useClientOrNull; exports.useCreateRoomComment = _chunkJ5ZDLMBEjs.useCreateRoomComment; exports.useCreateRoomThread = _chunkJ5ZDLMBEjs.useCreateRoomThread; exports.useCreateTextMention = _chunkJ5ZDLMBEjs.useCreateTextMention; exports.useDeleteRoomComment = _chunkJ5ZDLMBEjs.useDeleteRoomComment; exports.useDeleteRoomThread = _chunkJ5ZDLMBEjs.useDeleteRoomThread; exports.useDeleteTextMention = _chunkJ5ZDLMBEjs.useDeleteTextMention; exports.useEditRoomComment = _chunkJ5ZDLMBEjs.useEditRoomComment; exports.useEditRoomThreadMetadata = _chunkJ5ZDLMBEjs.useEditRoomThreadMetadata; exports.useLayoutEffect = useLayoutEffect; exports.useMarkRoomThreadAsRead = _chunkJ5ZDLMBEjs.useMarkRoomThreadAsRead; exports.useMarkRoomThreadAsResolved = _chunkJ5ZDLMBEjs.useMarkRoomThreadAsResolved; exports.useMarkRoomThreadAsUnresolved = _chunkJ5ZDLMBEjs.useMarkRoomThreadAsUnresolved; exports.useMentionSuggestions = useMentionSuggestions; exports.useMentionSuggestionsCache = _chunkJ5ZDLMBEjs.useMentionSuggestionsCache; exports.useRemoveRoomCommentReaction = _chunkJ5ZDLMBEjs.useRemoveRoomCommentReaction; exports.useReportTextEditor = _chunkJ5ZDLMBEjs.useReportTextEditor; exports.useResolveMentionSuggestions = _chunkJ5ZDLMBEjs.useResolveMentionSuggestions; exports.useRoomAttachmentUrl = _chunkJ5ZDLMBEjs.useRoomAttachmentUrl; exports.useRoomOrNull = _chunkJ5ZDLMBEjs.useRoomOrNull; exports.useRoomPermissions = _chunkJ5ZDLMBEjs.useRoomPermissions; exports.useSignal = _chunkJ5ZDLMBEjs.useSignal; exports.useSyncExternalStoreWithSelector = _chunkJ5ZDLMBEjs.useSyncExternalStoreWithSelector; exports.useSyncSource = useSyncSource; exports.useYjsProvider = _chunkJ5ZDLMBEjs.useYjsProvider;
|
|
129
129
|
//# sourceMappingURL=_private.js.map
|
package/dist/_private.mjs
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
useSignal,
|
|
25
25
|
useSyncExternalStoreWithSelector,
|
|
26
26
|
useYjsProvider
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-4KNGHD4I.mjs";
|
|
28
28
|
|
|
29
29
|
// src/lib/use-layout-effect.ts
|
|
30
30
|
import { useEffect, useLayoutEffect as useOriginalLayoutEffect } from "react";
|
|
@@ -98,9 +98,6 @@ function useSignal(signal, selector, isEqual) {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
// src/liveblocks.tsx
|
|
101
|
-
import {
|
|
102
|
-
HttpError
|
|
103
|
-
} from "@liveblocks/core";
|
|
104
101
|
import {
|
|
105
102
|
assert,
|
|
106
103
|
createClient,
|
|
@@ -133,9 +130,7 @@ var config = {
|
|
|
133
130
|
HISTORY_VERSIONS_POLL_INTERVAL: 1 * MINUTES,
|
|
134
131
|
HISTORY_VERSIONS_MAX_STALE_TIME: 5 * SECONDS,
|
|
135
132
|
NOTIFICATION_SETTINGS_POLL_INTERVAL: 1 * MINUTES,
|
|
136
|
-
NOTIFICATION_SETTINGS_MAX_STALE_TIME: 5 * SECONDS
|
|
137
|
-
USER_NOTIFICATION_SETTINGS_INTERVAL: 5 * MINUTES,
|
|
138
|
-
USER_NOTIFICATION_SETTINGS_MAX_STALE_TIME: 1 * MINUTES
|
|
133
|
+
NOTIFICATION_SETTINGS_MAX_STALE_TIME: 5 * SECONDS
|
|
139
134
|
};
|
|
140
135
|
|
|
141
136
|
// src/lib/AsyncResult.ts
|
|
@@ -238,8 +233,6 @@ import {
|
|
|
238
233
|
console as console2,
|
|
239
234
|
DefaultMap,
|
|
240
235
|
DerivedSignal,
|
|
241
|
-
entries,
|
|
242
|
-
keys,
|
|
243
236
|
kInternal,
|
|
244
237
|
MutableSignal as MutableSignal2,
|
|
245
238
|
nanoid,
|
|
@@ -730,26 +723,6 @@ function createStore_forPermissionHints() {
|
|
|
730
723
|
update
|
|
731
724
|
};
|
|
732
725
|
}
|
|
733
|
-
function createStore_forUserNotificationSettings(updates) {
|
|
734
|
-
const signal = new Signal({});
|
|
735
|
-
function update(settings) {
|
|
736
|
-
signal.set((prevSettings) => {
|
|
737
|
-
return {
|
|
738
|
-
...prevSettings,
|
|
739
|
-
...settings
|
|
740
|
-
};
|
|
741
|
-
});
|
|
742
|
-
}
|
|
743
|
-
return {
|
|
744
|
-
signal: DerivedSignal.from(
|
|
745
|
-
signal,
|
|
746
|
-
updates,
|
|
747
|
-
(base, updates2) => applyOptimisticUpdates_forUserNotificationSettings(base, updates2)
|
|
748
|
-
),
|
|
749
|
-
// Mutations
|
|
750
|
-
update
|
|
751
|
-
};
|
|
752
|
-
}
|
|
753
726
|
function createStore_forOptimistic(client) {
|
|
754
727
|
const signal = new Signal([]);
|
|
755
728
|
const syncSource = client[kInternal].createSyncSource();
|
|
@@ -783,17 +756,15 @@ var UmbrellaStore = class {
|
|
|
783
756
|
//
|
|
784
757
|
// Mutate inputs... ...observe clean/consistent output!
|
|
785
758
|
//
|
|
786
|
-
// .-> Base ThreadDB ---------+ +----> Clean threads by ID
|
|
759
|
+
// .-> Base ThreadDB ---------+ +----> Clean threads by ID (Part 1)
|
|
787
760
|
// / | |
|
|
788
|
-
// mutate ----> Base Notifications --+ | | +--> Clean notifications
|
|
761
|
+
// mutate ----> Base Notifications --+ | | +--> Clean notifications (Part 1)
|
|
789
762
|
// \ | | | | & notifications by ID
|
|
790
763
|
// | \ | | Apply | |
|
|
791
|
-
// | `-> OptimisticUpdates --+--+--> Optimistic --+-+-->
|
|
792
|
-
// \ | Updates
|
|
793
|
-
// `------- etc etc ---------+
|
|
794
|
-
// ^
|
|
795
|
-
// | +-----> User Notification Settings (Part 4)
|
|
796
|
-
// |
|
|
764
|
+
// | `-> OptimisticUpdates --+--+--> Optimistic --+-+--> Notification Settings (Part 2)
|
|
765
|
+
// \ | Updates |
|
|
766
|
+
// `------- etc etc ---------+ +--> History Versions (Part 3)
|
|
767
|
+
// ^
|
|
797
768
|
// |
|
|
798
769
|
// | ^ ^
|
|
799
770
|
// Signal | |
|
|
@@ -814,7 +785,6 @@ var UmbrellaStore = class {
|
|
|
814
785
|
// prettier-ignore
|
|
815
786
|
historyVersions;
|
|
816
787
|
permissionHints;
|
|
817
|
-
userNotificationSettings;
|
|
818
788
|
optimisticUpdates;
|
|
819
789
|
//
|
|
820
790
|
// Output signals.
|
|
@@ -835,8 +805,6 @@ var UmbrellaStore = class {
|
|
|
835
805
|
#userThreadsLastRequestedAt = null;
|
|
836
806
|
// Room versions
|
|
837
807
|
#roomVersionsLastRequestedAtByRoom = /* @__PURE__ */ new Map();
|
|
838
|
-
// User Notification Settings
|
|
839
|
-
#userNotificationSettings;
|
|
840
808
|
constructor(client) {
|
|
841
809
|
this.#client = client[kInternal].as();
|
|
842
810
|
this.optimisticUpdates = createStore_forOptimistic(this.#client);
|
|
@@ -852,16 +820,6 @@ var UmbrellaStore = class {
|
|
|
852
820
|
return nextCursor;
|
|
853
821
|
}
|
|
854
822
|
);
|
|
855
|
-
const userNotificationSettingsFetcher = async () => {
|
|
856
|
-
const result = await this.#client.getNotificationSettings();
|
|
857
|
-
this.userNotificationSettings.update(result);
|
|
858
|
-
};
|
|
859
|
-
this.userNotificationSettings = createStore_forUserNotificationSettings(
|
|
860
|
-
this.optimisticUpdates.signal
|
|
861
|
-
);
|
|
862
|
-
this.#userNotificationSettings = new SinglePageResource(
|
|
863
|
-
userNotificationSettingsFetcher
|
|
864
|
-
);
|
|
865
823
|
this.threads = new ThreadDB();
|
|
866
824
|
this.notifications = createStore_forNotifications();
|
|
867
825
|
this.roomNotificationSettings = createStore_forRoomNotificationSettings(
|
|
@@ -1039,19 +997,6 @@ var UmbrellaStore = class {
|
|
|
1039
997
|
return { signal, waitUntilLoaded: resource.waitUntilLoaded };
|
|
1040
998
|
}
|
|
1041
999
|
);
|
|
1042
|
-
const userNotificationSettings = {
|
|
1043
|
-
signal: DerivedSignal.from(() => {
|
|
1044
|
-
const result = this.#userNotificationSettings.get();
|
|
1045
|
-
if (result.isLoading || result.error) {
|
|
1046
|
-
return result;
|
|
1047
|
-
}
|
|
1048
|
-
return ASYNC_OK(
|
|
1049
|
-
"settings",
|
|
1050
|
-
nn(this.userNotificationSettings.signal.get())
|
|
1051
|
-
);
|
|
1052
|
-
}, shallow3),
|
|
1053
|
-
waitUntilLoaded: this.#userNotificationSettings.waitUntilLoaded
|
|
1054
|
-
};
|
|
1055
1000
|
this.outputs = {
|
|
1056
1001
|
threadifications,
|
|
1057
1002
|
threads,
|
|
@@ -1060,8 +1005,7 @@ var UmbrellaStore = class {
|
|
|
1060
1005
|
notifications,
|
|
1061
1006
|
loadingNotifications,
|
|
1062
1007
|
settingsByRoomId,
|
|
1063
|
-
versionsByRoomId
|
|
1064
|
-
userNotificationSettings
|
|
1008
|
+
versionsByRoomId
|
|
1065
1009
|
};
|
|
1066
1010
|
autobind(this);
|
|
1067
1011
|
}
|
|
@@ -1306,25 +1250,6 @@ var UmbrellaStore = class {
|
|
|
1306
1250
|
const result = await room.getNotificationSettings({ signal });
|
|
1307
1251
|
this.roomNotificationSettings.update(roomId, result);
|
|
1308
1252
|
}
|
|
1309
|
-
/**
|
|
1310
|
-
* Refresh User Notification Settings from poller
|
|
1311
|
-
*/
|
|
1312
|
-
async refreshUserNotificationSettings(signal) {
|
|
1313
|
-
const result = await this.#client.getNotificationSettings({
|
|
1314
|
-
signal
|
|
1315
|
-
});
|
|
1316
|
-
this.userNotificationSettings.update(result);
|
|
1317
|
-
}
|
|
1318
|
-
/**
|
|
1319
|
-
* Updates user notification settings with a new value, replacing the
|
|
1320
|
-
* corresponding optimistic update.
|
|
1321
|
-
*/
|
|
1322
|
-
updateUserNotificationSettings_confirmOptimisticUpdate(settings, optimisticUpdateId) {
|
|
1323
|
-
batch2(() => {
|
|
1324
|
-
this.optimisticUpdates.remove(optimisticUpdateId);
|
|
1325
|
-
this.userNotificationSettings.update(settings);
|
|
1326
|
-
});
|
|
1327
|
-
}
|
|
1328
1253
|
};
|
|
1329
1254
|
function applyOptimisticUpdates_forThreadifications(baseThreadsDB, notificationsLUT, optimisticUpdates) {
|
|
1330
1255
|
const threadsDB = baseThreadsDB.clone();
|
|
@@ -1499,33 +1424,6 @@ function applyOptimisticUpdates_forSettings(settingsLUT, optimisticUpdates) {
|
|
|
1499
1424
|
}
|
|
1500
1425
|
return settingsByRoomId;
|
|
1501
1426
|
}
|
|
1502
|
-
function applyOptimisticUpdates_forUserNotificationSettings(baseSettings, optimisticUpdates) {
|
|
1503
|
-
const outcomingSettings = { ...baseSettings };
|
|
1504
|
-
for (const optimisticUpdate of optimisticUpdates) {
|
|
1505
|
-
switch (optimisticUpdate.type) {
|
|
1506
|
-
case "update-user-notification-settings": {
|
|
1507
|
-
const incomingSettings = optimisticUpdate.settings;
|
|
1508
|
-
for (const channelKey of keys(incomingSettings)) {
|
|
1509
|
-
const key = channelKey;
|
|
1510
|
-
const channelUpdates = incomingSettings[key];
|
|
1511
|
-
if (channelUpdates) {
|
|
1512
|
-
const realChannelUpdates = Object.fromEntries(
|
|
1513
|
-
entries(channelUpdates).filter(
|
|
1514
|
-
([_, value]) => value !== void 0
|
|
1515
|
-
)
|
|
1516
|
-
);
|
|
1517
|
-
outcomingSettings[key] = {
|
|
1518
|
-
...outcomingSettings[key],
|
|
1519
|
-
...realChannelUpdates
|
|
1520
|
-
};
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
break;
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
return outcomingSettings;
|
|
1528
|
-
}
|
|
1529
1427
|
function compareInboxNotifications(inboxNotificationA, inboxNotificationB) {
|
|
1530
1428
|
if (inboxNotificationA.notifiedAt > inboxNotificationB.notifiedAt) {
|
|
1531
1429
|
return 1;
|
|
@@ -1819,25 +1717,10 @@ function makeLiveblocksExtrasForClient(client) {
|
|
|
1819
1717
|
config.USER_THREADS_POLL_INTERVAL,
|
|
1820
1718
|
{ maxStaleTimeMs: config.USER_THREADS_MAX_STALE_TIME }
|
|
1821
1719
|
);
|
|
1822
|
-
const userNotificationSettingsPoller = makePoller(
|
|
1823
|
-
async (signal) => {
|
|
1824
|
-
try {
|
|
1825
|
-
return await store.refreshUserNotificationSettings(signal);
|
|
1826
|
-
} catch (err) {
|
|
1827
|
-
console.warn(
|
|
1828
|
-
`Polling new user notification settings failed: ${String(err)}`
|
|
1829
|
-
);
|
|
1830
|
-
throw err;
|
|
1831
|
-
}
|
|
1832
|
-
},
|
|
1833
|
-
config.USER_NOTIFICATION_SETTINGS_INTERVAL,
|
|
1834
|
-
{ maxStaleTimeMs: config.USER_NOTIFICATION_SETTINGS_MAX_STALE_TIME }
|
|
1835
|
-
);
|
|
1836
1720
|
return {
|
|
1837
1721
|
store,
|
|
1838
1722
|
notificationsPoller,
|
|
1839
|
-
userThreadsPoller
|
|
1840
|
-
userNotificationSettingsPoller
|
|
1723
|
+
userThreadsPoller
|
|
1841
1724
|
};
|
|
1842
1725
|
}
|
|
1843
1726
|
function makeLiveblocksContextBundle(client) {
|
|
@@ -1846,7 +1729,6 @@ function makeLiveblocksContextBundle(client) {
|
|
|
1846
1729
|
const useMarkAllInboxNotificationsAsRead2 = () => useMarkAllInboxNotificationsAsRead_withClient(client);
|
|
1847
1730
|
const useDeleteInboxNotification2 = () => useDeleteInboxNotification_withClient(client);
|
|
1848
1731
|
const useDeleteAllInboxNotifications2 = () => useDeleteAllInboxNotifications_withClient(client);
|
|
1849
|
-
const useUpdateNotificationSettings2 = () => useUpdateNotificationSettings_withClient(client);
|
|
1850
1732
|
function LiveblocksProvider2(props) {
|
|
1851
1733
|
useEnsureNoLiveblocksProvider();
|
|
1852
1734
|
return /* @__PURE__ */ jsx(ClientContext.Provider, { value: client, children: props.children });
|
|
@@ -1860,8 +1742,6 @@ function makeLiveblocksContextBundle(client) {
|
|
|
1860
1742
|
useMarkAllInboxNotificationsAsRead: useMarkAllInboxNotificationsAsRead2,
|
|
1861
1743
|
useDeleteInboxNotification: useDeleteInboxNotification2,
|
|
1862
1744
|
useDeleteAllInboxNotifications: useDeleteAllInboxNotifications2,
|
|
1863
|
-
useNotificationSettings: () => useNotificationSettings_withClient(client),
|
|
1864
|
-
useUpdateNotificationSettings: useUpdateNotificationSettings2,
|
|
1865
1745
|
useInboxNotificationThread: useInboxNotificationThread2,
|
|
1866
1746
|
useUserThreads_experimental,
|
|
1867
1747
|
...shared.classic,
|
|
@@ -1874,8 +1754,6 @@ function makeLiveblocksContextBundle(client) {
|
|
|
1874
1754
|
useDeleteInboxNotification: useDeleteInboxNotification2,
|
|
1875
1755
|
useDeleteAllInboxNotifications: useDeleteAllInboxNotifications2,
|
|
1876
1756
|
useInboxNotificationThread: useInboxNotificationThread2,
|
|
1877
|
-
useNotificationSettings: () => useNotificationSettingsSuspense_withClient(client),
|
|
1878
|
-
useUpdateNotificationSettings: useUpdateNotificationSettings2,
|
|
1879
1757
|
useUserThreads_experimental: useUserThreadsSuspense_experimental,
|
|
1880
1758
|
...shared.suspense
|
|
1881
1759
|
}
|
|
@@ -2060,72 +1938,6 @@ function useInboxNotificationThread_withClient(client, inboxNotificationId) {
|
|
|
2060
1938
|
)
|
|
2061
1939
|
);
|
|
2062
1940
|
}
|
|
2063
|
-
function useUpdateNotificationSettings_withClient(client) {
|
|
2064
|
-
return useCallback2(
|
|
2065
|
-
(settings) => {
|
|
2066
|
-
const { store } = getLiveblocksExtrasForClient(client);
|
|
2067
|
-
const optimisticUpdateId = store.optimisticUpdates.add({
|
|
2068
|
-
type: "update-user-notification-settings",
|
|
2069
|
-
settings
|
|
2070
|
-
});
|
|
2071
|
-
client.updateNotificationSettings(settings).then(
|
|
2072
|
-
(settings2) => {
|
|
2073
|
-
store.updateUserNotificationSettings_confirmOptimisticUpdate(
|
|
2074
|
-
settings2,
|
|
2075
|
-
optimisticUpdateId
|
|
2076
|
-
);
|
|
2077
|
-
},
|
|
2078
|
-
(err) => {
|
|
2079
|
-
store.optimisticUpdates.remove(optimisticUpdateId);
|
|
2080
|
-
if (err instanceof HttpError) {
|
|
2081
|
-
if (err.status === 422) {
|
|
2082
|
-
const msg = [err.details?.error, err.details?.reason].filter(Boolean).join("\n");
|
|
2083
|
-
console.error(msg);
|
|
2084
|
-
}
|
|
2085
|
-
client[kInternal2].emitError(
|
|
2086
|
-
{
|
|
2087
|
-
type: "UPDATE_USER_NOTIFICATION_SETTINGS_ERROR"
|
|
2088
|
-
},
|
|
2089
|
-
err
|
|
2090
|
-
);
|
|
2091
|
-
} else {
|
|
2092
|
-
throw err;
|
|
2093
|
-
}
|
|
2094
|
-
}
|
|
2095
|
-
);
|
|
2096
|
-
},
|
|
2097
|
-
[client]
|
|
2098
|
-
);
|
|
2099
|
-
}
|
|
2100
|
-
function useNotificationSettings_withClient(client) {
|
|
2101
|
-
const updateNotificationSettings = useUpdateNotificationSettings_withClient(client);
|
|
2102
|
-
const { store, userNotificationSettingsPoller: poller } = getLiveblocksExtrasForClient(client);
|
|
2103
|
-
useEffect3(() => {
|
|
2104
|
-
void store.outputs.userNotificationSettings.waitUntilLoaded();
|
|
2105
|
-
});
|
|
2106
|
-
useEffect3(() => {
|
|
2107
|
-
poller.inc();
|
|
2108
|
-
poller.pollNowIfStale();
|
|
2109
|
-
return () => {
|
|
2110
|
-
poller.dec();
|
|
2111
|
-
};
|
|
2112
|
-
}, [poller]);
|
|
2113
|
-
const result = useSignal(store.outputs.userNotificationSettings.signal);
|
|
2114
|
-
return useMemo2(() => {
|
|
2115
|
-
return [result, updateNotificationSettings];
|
|
2116
|
-
}, [result, updateNotificationSettings]);
|
|
2117
|
-
}
|
|
2118
|
-
function useNotificationSettingsSuspense_withClient(client) {
|
|
2119
|
-
ensureNotServerSide();
|
|
2120
|
-
const store = getLiveblocksExtrasForClient(client).store;
|
|
2121
|
-
use(store.outputs.userNotificationSettings.waitUntilLoaded());
|
|
2122
|
-
const [result, updateNotificationSettings] = useNotificationSettings_withClient(client);
|
|
2123
|
-
assert(!result.error, "Did not expect error");
|
|
2124
|
-
assert(!result.isLoading, "Did not expect loading");
|
|
2125
|
-
return useMemo2(() => {
|
|
2126
|
-
return [result, updateNotificationSettings];
|
|
2127
|
-
}, [result, updateNotificationSettings]);
|
|
2128
|
-
}
|
|
2129
1941
|
function useUser_withClient(client, userId) {
|
|
2130
1942
|
const usersStore = client[kInternal2].usersStore;
|
|
2131
1943
|
const getUserState = useCallback2(
|
|
@@ -2299,6 +2111,7 @@ function LiveblocksProvider(props) {
|
|
|
2299
2111
|
lostConnectionTimeout: useInitial(o.lostConnectionTimeout),
|
|
2300
2112
|
backgroundKeepAliveTimeout: useInitial(o.backgroundKeepAliveTimeout),
|
|
2301
2113
|
polyfills: useInitial(o.polyfills),
|
|
2114
|
+
largeMessageStrategy: useInitial(o.largeMessageStrategy),
|
|
2302
2115
|
unstable_fallbackToHTTP: useInitial(o.unstable_fallbackToHTTP),
|
|
2303
2116
|
unstable_streamData: useInitial(o.unstable_streamData),
|
|
2304
2117
|
preventUnsavedChanges: useInitial(o.preventUnsavedChanges),
|
|
@@ -2390,15 +2203,6 @@ function useUnreadInboxNotificationsCount() {
|
|
|
2390
2203
|
function useUnreadInboxNotificationsCountSuspense() {
|
|
2391
2204
|
return useUnreadInboxNotificationsCountSuspense_withClient(useClient());
|
|
2392
2205
|
}
|
|
2393
|
-
function useNotificationSettings() {
|
|
2394
|
-
return useNotificationSettings_withClient(useClient());
|
|
2395
|
-
}
|
|
2396
|
-
function useNotificationSettingsSuspense() {
|
|
2397
|
-
return useNotificationSettingsSuspense_withClient(useClient());
|
|
2398
|
-
}
|
|
2399
|
-
function useUpdateNotificationSettings() {
|
|
2400
|
-
return useUpdateNotificationSettings_withClient(useClient());
|
|
2401
|
-
}
|
|
2402
2206
|
function useUser(userId) {
|
|
2403
2207
|
const client = useClient();
|
|
2404
2208
|
return useUser_withClient(client, userId);
|
|
@@ -2476,7 +2280,7 @@ import {
|
|
|
2476
2280
|
createThreadId,
|
|
2477
2281
|
DefaultMap as DefaultMap2,
|
|
2478
2282
|
errorIf,
|
|
2479
|
-
HttpError
|
|
2283
|
+
HttpError,
|
|
2480
2284
|
kInternal as kInternal3,
|
|
2481
2285
|
makePoller as makePoller2,
|
|
2482
2286
|
ServerMsgCode
|
|
@@ -2593,7 +2397,7 @@ function makeRoomExtrasForClient(client) {
|
|
|
2593
2397
|
const store = getUmbrellaStoreForClient(client);
|
|
2594
2398
|
function onMutationFailure(optimisticId, context, innerError) {
|
|
2595
2399
|
store.optimisticUpdates.remove(optimisticId);
|
|
2596
|
-
if (innerError instanceof
|
|
2400
|
+
if (innerError instanceof HttpError) {
|
|
2597
2401
|
if (innerError.status === 403) {
|
|
2598
2402
|
const detailedMessage = [
|
|
2599
2403
|
innerError.message,
|
|
@@ -4046,9 +3850,6 @@ export {
|
|
|
4046
3850
|
useDeleteInboxNotification,
|
|
4047
3851
|
useUnreadInboxNotificationsCount,
|
|
4048
3852
|
useUnreadInboxNotificationsCountSuspense,
|
|
4049
|
-
useNotificationSettings,
|
|
4050
|
-
useNotificationSettingsSuspense,
|
|
4051
|
-
useUpdateNotificationSettings,
|
|
4052
3853
|
useRoomInfo,
|
|
4053
3854
|
useRoomInfoSuspense,
|
|
4054
3855
|
_useInboxNotificationThread,
|
|
@@ -4133,4 +3934,4 @@ export {
|
|
|
4133
3934
|
_useStorageRoot,
|
|
4134
3935
|
_useUpdateMyPresence
|
|
4135
3936
|
};
|
|
4136
|
-
//# sourceMappingURL=chunk-
|
|
3937
|
+
//# sourceMappingURL=chunk-4KNGHD4I.mjs.map
|