@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
|
@@ -100,15 +100,12 @@ function useSignal(signal, selector, isEqual) {
|
|
|
100
100
|
// src/liveblocks.tsx
|
|
101
101
|
|
|
102
102
|
|
|
103
|
-
var _core = require('@liveblocks/core');
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
103
|
|
|
108
104
|
|
|
109
105
|
|
|
110
106
|
|
|
111
107
|
|
|
108
|
+
var _core = require('@liveblocks/core');
|
|
112
109
|
|
|
113
110
|
|
|
114
111
|
|
|
@@ -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
|
|
@@ -247,8 +242,6 @@ var use = (
|
|
|
247
242
|
|
|
248
243
|
|
|
249
244
|
|
|
250
|
-
|
|
251
|
-
|
|
252
245
|
// src/lib/autobind.ts
|
|
253
246
|
function autobind(self) {
|
|
254
247
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -258,7 +251,7 @@ function autobind(self) {
|
|
|
258
251
|
for (const key of Reflect.ownKeys(obj)) {
|
|
259
252
|
if (seen.has(key)) continue;
|
|
260
253
|
const descriptor = Reflect.getOwnPropertyDescriptor(obj, key);
|
|
261
|
-
if (typeof _optionalChain([descriptor, 'optionalAccess',
|
|
254
|
+
if (typeof _optionalChain([descriptor, 'optionalAccess', _ => _.value]) === "function") {
|
|
262
255
|
seen.add(key);
|
|
263
256
|
self[key] = self[key].bind(self);
|
|
264
257
|
}
|
|
@@ -358,7 +351,7 @@ var ThreadDB = class _ThreadDB {
|
|
|
358
351
|
/** Returns an existing thread by ID. Will never return a deleted thread. */
|
|
359
352
|
get(threadId) {
|
|
360
353
|
const thread = this.getEvenIfDeleted(threadId);
|
|
361
|
-
return _optionalChain([thread, 'optionalAccess',
|
|
354
|
+
return _optionalChain([thread, 'optionalAccess', _2 => _2.deletedAt]) ? void 0 : thread;
|
|
362
355
|
}
|
|
363
356
|
/** Returns the (possibly deleted) thread by ID. */
|
|
364
357
|
getEvenIfDeleted(threadId) {
|
|
@@ -484,7 +477,7 @@ var PaginatedResource = class {
|
|
|
484
477
|
}
|
|
485
478
|
async #fetchMore() {
|
|
486
479
|
const state = this.#signal.get();
|
|
487
|
-
if (!_optionalChain([state, 'access',
|
|
480
|
+
if (!_optionalChain([state, 'access', _3 => _3.data, 'optionalAccess', _4 => _4.cursor]) || state.data.isFetchingMore) {
|
|
488
481
|
return;
|
|
489
482
|
}
|
|
490
483
|
this.#patch({ isFetchingMore: true });
|
|
@@ -505,7 +498,7 @@ var PaginatedResource = class {
|
|
|
505
498
|
}
|
|
506
499
|
fetchMore() {
|
|
507
500
|
const state = this.#signal.get();
|
|
508
|
-
if (!_optionalChain([state, 'access',
|
|
501
|
+
if (!_optionalChain([state, 'access', _5 => _5.data, 'optionalAccess', _6 => _6.cursor])) return noop2;
|
|
509
502
|
if (!this.#pendingFetchMore) {
|
|
510
503
|
this.#pendingFetchMore = this.#fetchMore().finally(() => {
|
|
511
504
|
this.#pendingFetchMore = null;
|
|
@@ -730,26 +723,6 @@ function createStore_forPermissionHints() {
|
|
|
730
723
|
update
|
|
731
724
|
};
|
|
732
725
|
}
|
|
733
|
-
function createStore_forUserNotificationSettings(updates) {
|
|
734
|
-
const signal = new (0, _core.Signal)({});
|
|
735
|
-
function update(settings) {
|
|
736
|
-
signal.set((prevSettings) => {
|
|
737
|
-
return {
|
|
738
|
-
...prevSettings,
|
|
739
|
-
...settings
|
|
740
|
-
};
|
|
741
|
-
});
|
|
742
|
-
}
|
|
743
|
-
return {
|
|
744
|
-
signal: _core.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 (0, _core.Signal)([]);
|
|
755
728
|
const syncSource = client[_core.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 | |
|
|
@@ -815,7 +786,6 @@ var UmbrellaStore = class {
|
|
|
815
786
|
|
|
816
787
|
|
|
817
788
|
|
|
818
|
-
|
|
819
789
|
//
|
|
820
790
|
// Output signals.
|
|
821
791
|
// (Readonly, clean, consistent. With optimistic updates applied.)
|
|
@@ -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[_core.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: _core.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
|
-
_core.nn.call(void 0, this.userNotificationSettings.signal.get())
|
|
1051
|
-
);
|
|
1052
|
-
}, _core.shallow),
|
|
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
|
-
_core.batch.call(void 0, () => {
|
|
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 _core.keys.call(void 0, incomingSettings)) {
|
|
1509
|
-
const key = channelKey;
|
|
1510
|
-
const channelUpdates = incomingSettings[key];
|
|
1511
|
-
if (channelUpdates) {
|
|
1512
|
-
const realChannelUpdates = Object.fromEntries(
|
|
1513
|
-
_core.entries.call(void 0, 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;
|
|
@@ -1575,7 +1473,7 @@ function applyUpsertComment(thread, comment) {
|
|
|
1575
1473
|
updatedAt: new Date(
|
|
1576
1474
|
Math.max(
|
|
1577
1475
|
thread.updatedAt.getTime(),
|
|
1578
|
-
_optionalChain([comment, 'access',
|
|
1476
|
+
_optionalChain([comment, 'access', _7 => _7.editedAt, 'optionalAccess', _8 => _8.getTime, 'call', _9 => _9()]) || comment.createdAt.getTime()
|
|
1579
1477
|
)
|
|
1580
1478
|
),
|
|
1581
1479
|
comments: updatedComments
|
|
@@ -1734,7 +1632,7 @@ function selectorFor_useUnreadInboxNotificationsCount(result) {
|
|
|
1734
1632
|
);
|
|
1735
1633
|
}
|
|
1736
1634
|
function selectorFor_useUser(state, userId) {
|
|
1737
|
-
if (state === void 0 || _optionalChain([state, 'optionalAccess',
|
|
1635
|
+
if (state === void 0 || _optionalChain([state, 'optionalAccess', _10 => _10.isLoading])) {
|
|
1738
1636
|
return _nullishCoalesce(state, () => ( { isLoading: true }));
|
|
1739
1637
|
}
|
|
1740
1638
|
if (state.error) {
|
|
@@ -1752,7 +1650,7 @@ function selectorFor_useUser(state, userId) {
|
|
|
1752
1650
|
};
|
|
1753
1651
|
}
|
|
1754
1652
|
function selectorFor_useRoomInfo(state, roomId) {
|
|
1755
|
-
if (state === void 0 || _optionalChain([state, 'optionalAccess',
|
|
1653
|
+
if (state === void 0 || _optionalChain([state, 'optionalAccess', _11 => _11.isLoading])) {
|
|
1756
1654
|
return _nullishCoalesce(state, () => ( { isLoading: true }));
|
|
1757
1655
|
}
|
|
1758
1656
|
if (state.error) {
|
|
@@ -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 = _core.makePoller.call(void 0,
|
|
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__ */ _jsxruntime.jsx.call(void 0, 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 _react.useCallback.call(void 0,
|
|
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 _core.HttpError) {
|
|
2081
|
-
if (err.status === 422) {
|
|
2082
|
-
const msg = [_optionalChain([err, 'access', _13 => _13.details, 'optionalAccess', _14 => _14.error]), _optionalChain([err, 'access', _15 => _15.details, 'optionalAccess', _16 => _16.reason])].filter(Boolean).join("\n");
|
|
2083
|
-
console.error(msg);
|
|
2084
|
-
}
|
|
2085
|
-
client[_core.kInternal].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
|
-
_react.useEffect.call(void 0, () => {
|
|
2104
|
-
void store.outputs.userNotificationSettings.waitUntilLoaded();
|
|
2105
|
-
});
|
|
2106
|
-
_react.useEffect.call(void 0, () => {
|
|
2107
|
-
poller.inc();
|
|
2108
|
-
poller.pollNowIfStale();
|
|
2109
|
-
return () => {
|
|
2110
|
-
poller.dec();
|
|
2111
|
-
};
|
|
2112
|
-
}, [poller]);
|
|
2113
|
-
const result = useSignal(store.outputs.userNotificationSettings.signal);
|
|
2114
|
-
return _react.useMemo.call(void 0, () => {
|
|
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
|
-
_core.assert.call(void 0, !result.error, "Did not expect error");
|
|
2124
|
-
_core.assert.call(void 0, !result.isLoading, "Did not expect loading");
|
|
2125
|
-
return _react.useMemo.call(void 0, () => {
|
|
2126
|
-
return [result, updateNotificationSettings];
|
|
2127
|
-
}, [result, updateNotificationSettings]);
|
|
2128
|
-
}
|
|
2129
1941
|
function useUser_withClient(client, userId) {
|
|
2130
1942
|
const usersStore = client[_core.kInternal].usersStore;
|
|
2131
1943
|
const getUserState = _react.useCallback.call(void 0,
|
|
@@ -2275,7 +2087,7 @@ function createSharedContext(client) {
|
|
|
2275
2087
|
}
|
|
2276
2088
|
function useEnsureNoLiveblocksProvider(options) {
|
|
2277
2089
|
const existing = useClientOrNull();
|
|
2278
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
2090
|
+
if (!_optionalChain([options, 'optionalAccess', _12 => _12.allowNesting]) && existing !== null) {
|
|
2279
2091
|
throw new Error(
|
|
2280
2092
|
"You cannot nest multiple LiveblocksProvider instances in the same React tree."
|
|
2281
2093
|
);
|
|
@@ -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);
|
|
@@ -2419,7 +2223,7 @@ var _useUserSuspense = useUserSuspense;
|
|
|
2419
2223
|
var _useUserThreads_experimental = useUserThreads_experimental;
|
|
2420
2224
|
var _useUserThreadsSuspense_experimental = useUserThreadsSuspense_experimental;
|
|
2421
2225
|
function useSyncStatus_withClient(client, options) {
|
|
2422
|
-
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2226
|
+
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _13 => _13.smooth]), () => ( false)));
|
|
2423
2227
|
if (smooth) {
|
|
2424
2228
|
return useSyncStatusSmooth_withClient(client);
|
|
2425
2229
|
} else {
|
|
@@ -2597,8 +2401,8 @@ function makeRoomExtrasForClient(client) {
|
|
|
2597
2401
|
if (innerError.status === 403) {
|
|
2598
2402
|
const detailedMessage = [
|
|
2599
2403
|
innerError.message,
|
|
2600
|
-
_optionalChain([innerError, 'access',
|
|
2601
|
-
_optionalChain([innerError, 'access',
|
|
2404
|
+
_optionalChain([innerError, 'access', _14 => _14.details, 'optionalAccess', _15 => _15.suggestion]),
|
|
2405
|
+
_optionalChain([innerError, 'access', _16 => _16.details, 'optionalAccess', _17 => _17.docs])
|
|
2602
2406
|
].filter(Boolean).join("\n");
|
|
2603
2407
|
_core.console.error(detailedMessage);
|
|
2604
2408
|
}
|
|
@@ -2952,7 +2756,7 @@ function useMentionSuggestionsCache() {
|
|
|
2952
2756
|
return client[_core.kInternal].mentionSuggestionsCache;
|
|
2953
2757
|
}
|
|
2954
2758
|
function useStorageStatus(options) {
|
|
2955
|
-
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2759
|
+
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _18 => _18.smooth]), () => ( false)));
|
|
2956
2760
|
if (smooth) {
|
|
2957
2761
|
return useStorageStatusSmooth();
|
|
2958
2762
|
} else {
|
|
@@ -3266,7 +3070,7 @@ function useCreateRoomThread(roomId) {
|
|
|
3266
3070
|
thread: newThread,
|
|
3267
3071
|
roomId
|
|
3268
3072
|
});
|
|
3269
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3073
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _19 => _19.map, 'call', _20 => _20((attachment) => attachment.id)]);
|
|
3270
3074
|
client[_core.kInternal].httpClient.createThread({
|
|
3271
3075
|
roomId,
|
|
3272
3076
|
threadId,
|
|
@@ -3306,7 +3110,7 @@ function useDeleteRoomThread(roomId) {
|
|
|
3306
3110
|
const { store, onMutationFailure } = getRoomExtrasForClient(client);
|
|
3307
3111
|
const userId = getCurrentUserId(client);
|
|
3308
3112
|
const existing = store.outputs.threads.get().get(threadId);
|
|
3309
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
3113
|
+
if (_optionalChain([existing, 'optionalAccess', _21 => _21.comments, 'optionalAccess', _22 => _22[0], 'optionalAccess', _23 => _23.userId]) !== userId) {
|
|
3310
3114
|
throw new Error("Only the thread creator can delete the thread");
|
|
3311
3115
|
}
|
|
3312
3116
|
const optimisticId = store.optimisticUpdates.add({
|
|
@@ -3394,7 +3198,7 @@ function useCreateRoomComment(roomId) {
|
|
|
3394
3198
|
type: "create-comment",
|
|
3395
3199
|
comment
|
|
3396
3200
|
});
|
|
3397
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3201
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _24 => _24.map, 'call', _25 => _25((attachment) => attachment.id)]);
|
|
3398
3202
|
client[_core.kInternal].httpClient.createComment({ roomId, threadId, commentId, body, attachmentIds }).then(
|
|
3399
3203
|
(newComment) => {
|
|
3400
3204
|
store.createComment(newComment, optimisticId);
|
|
@@ -3450,7 +3254,7 @@ function useEditRoomComment(roomId) {
|
|
|
3450
3254
|
attachments: _nullishCoalesce(attachments, () => ( []))
|
|
3451
3255
|
}
|
|
3452
3256
|
});
|
|
3453
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3257
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _26 => _26.map, 'call', _27 => _27((attachment) => attachment.id)]);
|
|
3454
3258
|
client[_core.kInternal].httpClient.editComment({ roomId, threadId, commentId, body, attachmentIds }).then(
|
|
3455
3259
|
(editedComment) => {
|
|
3456
3260
|
store.editComment(threadId, optimisticId, editedComment);
|
|
@@ -3914,7 +3718,7 @@ function useThreadsSuspense(options = {}) {
|
|
|
3914
3718
|
return result;
|
|
3915
3719
|
}
|
|
3916
3720
|
function selectorFor_useAttachmentUrl(state) {
|
|
3917
|
-
if (state === void 0 || _optionalChain([state, 'optionalAccess',
|
|
3721
|
+
if (state === void 0 || _optionalChain([state, 'optionalAccess', _28 => _28.isLoading])) {
|
|
3918
3722
|
return _nullishCoalesce(state, () => ( { isLoading: true }));
|
|
3919
3723
|
}
|
|
3920
3724
|
if (state.error) {
|
|
@@ -4129,8 +3933,5 @@ var _useUpdateMyPresence = useUpdateMyPresence;
|
|
|
4129
3933
|
|
|
4130
3934
|
|
|
4131
3935
|
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
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.useNotificationSettings = useNotificationSettings; exports.useNotificationSettingsSuspense = useNotificationSettingsSuspense; exports.useUpdateNotificationSettings = useUpdateNotificationSettings; 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.useErrorListener = useErrorListener; 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.useHistory = useHistory; exports.useUndo = useUndo; exports.useRedo = useRedo; exports.useCanUndo = useCanUndo; exports.useCanRedo = useCanRedo; exports.useOthersConnectionIds = useOthersConnectionIds; exports.useCreateRoomThread = useCreateRoomThread; exports.useDeleteRoomThread = useDeleteRoomThread; exports.useEditRoomThreadMetadata = useEditRoomThreadMetadata; exports.useCreateComment = useCreateComment; exports.useCreateRoomComment = useCreateRoomComment; exports.useEditComment = useEditComment; exports.useEditRoomComment = useEditRoomComment; exports.useDeleteComment = useDeleteComment; exports.useDeleteRoomComment = useDeleteRoomComment; exports.useAddRoomCommentReaction = useAddRoomCommentReaction; exports.useRemoveReaction = useRemoveReaction; exports.useRemoveRoomCommentReaction = useRemoveRoomCommentReaction; exports.useMarkThreadAsRead = useMarkThreadAsRead; exports.useMarkRoomThreadAsRead = useMarkRoomThreadAsRead; exports.useMarkThreadAsResolved = useMarkThreadAsResolved; exports.useMarkRoomThreadAsResolved = useMarkRoomThreadAsResolved; exports.useMarkThreadAsUnresolved = useMarkThreadAsUnresolved; exports.useMarkRoomThreadAsUnresolved = useMarkRoomThreadAsUnresolved; exports.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;
|
|
4136
|
-
//# sourceMappingURL=chunk-HV3HU2RB.js.map
|
|
3936
|
+
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.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.useErrorListener = useErrorListener; 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.useHistory = useHistory; exports.useUndo = useUndo; exports.useRedo = useRedo; exports.useCanUndo = useCanUndo; exports.useCanRedo = useCanRedo; exports.useOthersConnectionIds = useOthersConnectionIds; exports.useCreateRoomThread = useCreateRoomThread; exports.useDeleteRoomThread = useDeleteRoomThread; exports.useEditRoomThreadMetadata = useEditRoomThreadMetadata; exports.useCreateComment = useCreateComment; exports.useCreateRoomComment = useCreateRoomComment; exports.useEditComment = useEditComment; exports.useEditRoomComment = useEditRoomComment; exports.useDeleteComment = useDeleteComment; exports.useDeleteRoomComment = useDeleteRoomComment; exports.useAddRoomCommentReaction = useAddRoomCommentReaction; exports.useRemoveReaction = useRemoveReaction; exports.useRemoveRoomCommentReaction = useRemoveRoomCommentReaction; exports.useMarkThreadAsRead = useMarkThreadAsRead; exports.useMarkRoomThreadAsRead = useMarkRoomThreadAsRead; exports.useMarkThreadAsResolved = useMarkThreadAsResolved; exports.useMarkRoomThreadAsResolved = useMarkRoomThreadAsResolved; exports.useMarkThreadAsUnresolved = useMarkThreadAsUnresolved; exports.useMarkRoomThreadAsUnresolved = useMarkRoomThreadAsUnresolved; exports.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;
|
|
3937
|
+
//# sourceMappingURL=chunk-J5ZDLMBE.js.map
|