@liveblocks/react 2.17.0-usrnotsettings2 → 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-X2FQ2FNK.mjs → chunk-4KNGHD4I.mjs} +11 -193
- package/dist/chunk-4KNGHD4I.mjs.map +1 -0
- package/dist/{chunk-CTSQGLA4.js → chunk-J5ZDLMBE.js} +29 -211
- package/dist/chunk-J5ZDLMBE.js.map +1 -0
- package/dist/{chunk-QJATV7TB.js → chunk-K7QFAI6G.js} +2 -2
- package/dist/chunk-K7QFAI6G.js.map +1 -0
- package/dist/{chunk-D5P6PENM.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-DlI0Yrzf.d.mts → room-DVbQkoj3.d.mts} +4 -75
- package/dist/{room-DlI0Yrzf.d.ts → room-DVbQkoj3.d.ts} +4 -75
- 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-CTSQGLA4.js.map +0 -1
- package/dist/chunk-QJATV7TB.js.map +0 -1
- package/dist/chunk-X2FQ2FNK.mjs.map +0 -1
- /package/dist/{chunk-D5P6PENM.mjs.map → chunk-XHQ4VJ7B.mjs.map} +0 -0
|
@@ -130,9 +130,7 @@ 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
|
|
134
|
-
USER_NOTIFICATION_SETTINGS_INTERVAL: 5 * MINUTES,
|
|
135
|
-
USER_NOTIFICATION_SETTINGS_MAX_STALE_TIME: 1 * MINUTES
|
|
133
|
+
NOTIFICATION_SETTINGS_MAX_STALE_TIME: 5 * SECONDS
|
|
136
134
|
};
|
|
137
135
|
|
|
138
136
|
// src/lib/AsyncResult.ts
|
|
@@ -244,8 +242,6 @@ var use = (
|
|
|
244
242
|
|
|
245
243
|
|
|
246
244
|
|
|
247
|
-
|
|
248
|
-
|
|
249
245
|
// src/lib/autobind.ts
|
|
250
246
|
function autobind(self) {
|
|
251
247
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -255,7 +251,7 @@ function autobind(self) {
|
|
|
255
251
|
for (const key of Reflect.ownKeys(obj)) {
|
|
256
252
|
if (seen.has(key)) continue;
|
|
257
253
|
const descriptor = Reflect.getOwnPropertyDescriptor(obj, key);
|
|
258
|
-
if (typeof _optionalChain([descriptor, 'optionalAccess',
|
|
254
|
+
if (typeof _optionalChain([descriptor, 'optionalAccess', _ => _.value]) === "function") {
|
|
259
255
|
seen.add(key);
|
|
260
256
|
self[key] = self[key].bind(self);
|
|
261
257
|
}
|
|
@@ -355,7 +351,7 @@ var ThreadDB = class _ThreadDB {
|
|
|
355
351
|
/** Returns an existing thread by ID. Will never return a deleted thread. */
|
|
356
352
|
get(threadId) {
|
|
357
353
|
const thread = this.getEvenIfDeleted(threadId);
|
|
358
|
-
return _optionalChain([thread, 'optionalAccess',
|
|
354
|
+
return _optionalChain([thread, 'optionalAccess', _2 => _2.deletedAt]) ? void 0 : thread;
|
|
359
355
|
}
|
|
360
356
|
/** Returns the (possibly deleted) thread by ID. */
|
|
361
357
|
getEvenIfDeleted(threadId) {
|
|
@@ -481,7 +477,7 @@ var PaginatedResource = class {
|
|
|
481
477
|
}
|
|
482
478
|
async #fetchMore() {
|
|
483
479
|
const state = this.#signal.get();
|
|
484
|
-
if (!_optionalChain([state, 'access',
|
|
480
|
+
if (!_optionalChain([state, 'access', _3 => _3.data, 'optionalAccess', _4 => _4.cursor]) || state.data.isFetchingMore) {
|
|
485
481
|
return;
|
|
486
482
|
}
|
|
487
483
|
this.#patch({ isFetchingMore: true });
|
|
@@ -502,7 +498,7 @@ var PaginatedResource = class {
|
|
|
502
498
|
}
|
|
503
499
|
fetchMore() {
|
|
504
500
|
const state = this.#signal.get();
|
|
505
|
-
if (!_optionalChain([state, 'access',
|
|
501
|
+
if (!_optionalChain([state, 'access', _5 => _5.data, 'optionalAccess', _6 => _6.cursor])) return noop2;
|
|
506
502
|
if (!this.#pendingFetchMore) {
|
|
507
503
|
this.#pendingFetchMore = this.#fetchMore().finally(() => {
|
|
508
504
|
this.#pendingFetchMore = null;
|
|
@@ -727,26 +723,6 @@ function createStore_forPermissionHints() {
|
|
|
727
723
|
update
|
|
728
724
|
};
|
|
729
725
|
}
|
|
730
|
-
function createStore_forUserNotificationSettings(updates) {
|
|
731
|
-
const signal = new (0, _core.Signal)({});
|
|
732
|
-
function update(settings) {
|
|
733
|
-
signal.set((prevSettings) => {
|
|
734
|
-
return {
|
|
735
|
-
...prevSettings,
|
|
736
|
-
...settings
|
|
737
|
-
};
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
return {
|
|
741
|
-
signal: _core.DerivedSignal.from(
|
|
742
|
-
signal,
|
|
743
|
-
updates,
|
|
744
|
-
(base, updates2) => applyOptimisticUpdates_forUserNotificationSettings(base, updates2)
|
|
745
|
-
),
|
|
746
|
-
// Mutations
|
|
747
|
-
update
|
|
748
|
-
};
|
|
749
|
-
}
|
|
750
726
|
function createStore_forOptimistic(client) {
|
|
751
727
|
const signal = new (0, _core.Signal)([]);
|
|
752
728
|
const syncSource = client[_core.kInternal].createSyncSource();
|
|
@@ -780,17 +756,15 @@ var UmbrellaStore = class {
|
|
|
780
756
|
//
|
|
781
757
|
// Mutate inputs... ...observe clean/consistent output!
|
|
782
758
|
//
|
|
783
|
-
// .-> Base ThreadDB ---------+ +----> Clean threads by ID
|
|
759
|
+
// .-> Base ThreadDB ---------+ +----> Clean threads by ID (Part 1)
|
|
784
760
|
// / | |
|
|
785
|
-
// mutate ----> Base Notifications --+ | | +--> Clean notifications
|
|
761
|
+
// mutate ----> Base Notifications --+ | | +--> Clean notifications (Part 1)
|
|
786
762
|
// \ | | | | & notifications by ID
|
|
787
763
|
// | \ | | Apply | |
|
|
788
|
-
// | `-> OptimisticUpdates --+--+--> Optimistic --+-+-->
|
|
789
|
-
// \ | Updates
|
|
790
|
-
// `------- etc etc ---------+
|
|
791
|
-
// ^
|
|
792
|
-
// | +-----> User Notification Settings (Part 4)
|
|
793
|
-
// |
|
|
764
|
+
// | `-> OptimisticUpdates --+--+--> Optimistic --+-+--> Notification Settings (Part 2)
|
|
765
|
+
// \ | Updates |
|
|
766
|
+
// `------- etc etc ---------+ +--> History Versions (Part 3)
|
|
767
|
+
// ^
|
|
794
768
|
// |
|
|
795
769
|
// | ^ ^
|
|
796
770
|
// Signal | |
|
|
@@ -812,7 +786,6 @@ var UmbrellaStore = class {
|
|
|
812
786
|
|
|
813
787
|
|
|
814
788
|
|
|
815
|
-
|
|
816
789
|
//
|
|
817
790
|
// Output signals.
|
|
818
791
|
// (Readonly, clean, consistent. With optimistic updates applied.)
|
|
@@ -832,8 +805,6 @@ var UmbrellaStore = class {
|
|
|
832
805
|
#userThreadsLastRequestedAt = null;
|
|
833
806
|
// Room versions
|
|
834
807
|
#roomVersionsLastRequestedAtByRoom = /* @__PURE__ */ new Map();
|
|
835
|
-
// User Notification Settings
|
|
836
|
-
#userNotificationSettings;
|
|
837
808
|
constructor(client) {
|
|
838
809
|
this.#client = client[_core.kInternal].as();
|
|
839
810
|
this.optimisticUpdates = createStore_forOptimistic(this.#client);
|
|
@@ -849,16 +820,6 @@ var UmbrellaStore = class {
|
|
|
849
820
|
return nextCursor;
|
|
850
821
|
}
|
|
851
822
|
);
|
|
852
|
-
const userNotificationSettingsFetcher = async () => {
|
|
853
|
-
const result = await this.#client.getNotificationSettings();
|
|
854
|
-
this.userNotificationSettings.update(result);
|
|
855
|
-
};
|
|
856
|
-
this.userNotificationSettings = createStore_forUserNotificationSettings(
|
|
857
|
-
this.optimisticUpdates.signal
|
|
858
|
-
);
|
|
859
|
-
this.#userNotificationSettings = new SinglePageResource(
|
|
860
|
-
userNotificationSettingsFetcher
|
|
861
|
-
);
|
|
862
823
|
this.threads = new ThreadDB();
|
|
863
824
|
this.notifications = createStore_forNotifications();
|
|
864
825
|
this.roomNotificationSettings = createStore_forRoomNotificationSettings(
|
|
@@ -1036,19 +997,6 @@ var UmbrellaStore = class {
|
|
|
1036
997
|
return { signal, waitUntilLoaded: resource.waitUntilLoaded };
|
|
1037
998
|
}
|
|
1038
999
|
);
|
|
1039
|
-
const userNotificationSettings = {
|
|
1040
|
-
signal: _core.DerivedSignal.from(() => {
|
|
1041
|
-
const result = this.#userNotificationSettings.get();
|
|
1042
|
-
if (result.isLoading || result.error) {
|
|
1043
|
-
return result;
|
|
1044
|
-
}
|
|
1045
|
-
return ASYNC_OK(
|
|
1046
|
-
"settings",
|
|
1047
|
-
_core.nn.call(void 0, this.userNotificationSettings.signal.get())
|
|
1048
|
-
);
|
|
1049
|
-
}, _core.shallow),
|
|
1050
|
-
waitUntilLoaded: this.#userNotificationSettings.waitUntilLoaded
|
|
1051
|
-
};
|
|
1052
1000
|
this.outputs = {
|
|
1053
1001
|
threadifications,
|
|
1054
1002
|
threads,
|
|
@@ -1057,8 +1005,7 @@ var UmbrellaStore = class {
|
|
|
1057
1005
|
notifications,
|
|
1058
1006
|
loadingNotifications,
|
|
1059
1007
|
settingsByRoomId,
|
|
1060
|
-
versionsByRoomId
|
|
1061
|
-
userNotificationSettings
|
|
1008
|
+
versionsByRoomId
|
|
1062
1009
|
};
|
|
1063
1010
|
autobind(this);
|
|
1064
1011
|
}
|
|
@@ -1303,25 +1250,6 @@ var UmbrellaStore = class {
|
|
|
1303
1250
|
const result = await room.getNotificationSettings({ signal });
|
|
1304
1251
|
this.roomNotificationSettings.update(roomId, result);
|
|
1305
1252
|
}
|
|
1306
|
-
/**
|
|
1307
|
-
* Refresh User Notification Settings from poller
|
|
1308
|
-
*/
|
|
1309
|
-
async refreshUserNotificationSettings(signal) {
|
|
1310
|
-
const result = await this.#client.getNotificationSettings({
|
|
1311
|
-
signal
|
|
1312
|
-
});
|
|
1313
|
-
this.userNotificationSettings.update(result);
|
|
1314
|
-
}
|
|
1315
|
-
/**
|
|
1316
|
-
* Updates user notification settings with a new value, replacing the
|
|
1317
|
-
* corresponding optimistic update.
|
|
1318
|
-
*/
|
|
1319
|
-
updateUserNotificationSettings_confirmOptimisticUpdate(settings, optimisticUpdateId) {
|
|
1320
|
-
_core.batch.call(void 0, () => {
|
|
1321
|
-
this.optimisticUpdates.remove(optimisticUpdateId);
|
|
1322
|
-
this.userNotificationSettings.update(settings);
|
|
1323
|
-
});
|
|
1324
|
-
}
|
|
1325
1253
|
};
|
|
1326
1254
|
function applyOptimisticUpdates_forThreadifications(baseThreadsDB, notificationsLUT, optimisticUpdates) {
|
|
1327
1255
|
const threadsDB = baseThreadsDB.clone();
|
|
@@ -1496,33 +1424,6 @@ function applyOptimisticUpdates_forSettings(settingsLUT, optimisticUpdates) {
|
|
|
1496
1424
|
}
|
|
1497
1425
|
return settingsByRoomId;
|
|
1498
1426
|
}
|
|
1499
|
-
function applyOptimisticUpdates_forUserNotificationSettings(baseSettings, optimisticUpdates) {
|
|
1500
|
-
const outcomingSettings = { ...baseSettings };
|
|
1501
|
-
for (const optimisticUpdate of optimisticUpdates) {
|
|
1502
|
-
switch (optimisticUpdate.type) {
|
|
1503
|
-
case "update-user-notification-settings": {
|
|
1504
|
-
const incomingSettings = optimisticUpdate.settings;
|
|
1505
|
-
for (const channelKey of _core.keys.call(void 0, incomingSettings)) {
|
|
1506
|
-
const key = channelKey;
|
|
1507
|
-
const channelUpdates = incomingSettings[key];
|
|
1508
|
-
if (channelUpdates) {
|
|
1509
|
-
const realChannelUpdates = Object.fromEntries(
|
|
1510
|
-
_core.entries.call(void 0, channelUpdates).filter(
|
|
1511
|
-
([_, value]) => value !== void 0
|
|
1512
|
-
)
|
|
1513
|
-
);
|
|
1514
|
-
outcomingSettings[key] = {
|
|
1515
|
-
...outcomingSettings[key],
|
|
1516
|
-
...realChannelUpdates
|
|
1517
|
-
};
|
|
1518
|
-
}
|
|
1519
|
-
}
|
|
1520
|
-
break;
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
return outcomingSettings;
|
|
1525
|
-
}
|
|
1526
1427
|
function compareInboxNotifications(inboxNotificationA, inboxNotificationB) {
|
|
1527
1428
|
if (inboxNotificationA.notifiedAt > inboxNotificationB.notifiedAt) {
|
|
1528
1429
|
return 1;
|
|
@@ -1572,7 +1473,7 @@ function applyUpsertComment(thread, comment) {
|
|
|
1572
1473
|
updatedAt: new Date(
|
|
1573
1474
|
Math.max(
|
|
1574
1475
|
thread.updatedAt.getTime(),
|
|
1575
|
-
_optionalChain([comment, 'access',
|
|
1476
|
+
_optionalChain([comment, 'access', _7 => _7.editedAt, 'optionalAccess', _8 => _8.getTime, 'call', _9 => _9()]) || comment.createdAt.getTime()
|
|
1576
1477
|
)
|
|
1577
1478
|
),
|
|
1578
1479
|
comments: updatedComments
|
|
@@ -1731,7 +1632,7 @@ function selectorFor_useUnreadInboxNotificationsCount(result) {
|
|
|
1731
1632
|
);
|
|
1732
1633
|
}
|
|
1733
1634
|
function selectorFor_useUser(state, userId) {
|
|
1734
|
-
if (state === void 0 || _optionalChain([state, 'optionalAccess',
|
|
1635
|
+
if (state === void 0 || _optionalChain([state, 'optionalAccess', _10 => _10.isLoading])) {
|
|
1735
1636
|
return _nullishCoalesce(state, () => ( { isLoading: true }));
|
|
1736
1637
|
}
|
|
1737
1638
|
if (state.error) {
|
|
@@ -1749,7 +1650,7 @@ function selectorFor_useUser(state, userId) {
|
|
|
1749
1650
|
};
|
|
1750
1651
|
}
|
|
1751
1652
|
function selectorFor_useRoomInfo(state, roomId) {
|
|
1752
|
-
if (state === void 0 || _optionalChain([state, 'optionalAccess',
|
|
1653
|
+
if (state === void 0 || _optionalChain([state, 'optionalAccess', _11 => _11.isLoading])) {
|
|
1753
1654
|
return _nullishCoalesce(state, () => ( { isLoading: true }));
|
|
1754
1655
|
}
|
|
1755
1656
|
if (state.error) {
|
|
@@ -1816,25 +1717,10 @@ function makeLiveblocksExtrasForClient(client) {
|
|
|
1816
1717
|
config.USER_THREADS_POLL_INTERVAL,
|
|
1817
1718
|
{ maxStaleTimeMs: config.USER_THREADS_MAX_STALE_TIME }
|
|
1818
1719
|
);
|
|
1819
|
-
const userNotificationSettingsPoller = _core.makePoller.call(void 0,
|
|
1820
|
-
async (signal) => {
|
|
1821
|
-
try {
|
|
1822
|
-
return await store.refreshUserNotificationSettings(signal);
|
|
1823
|
-
} catch (err) {
|
|
1824
|
-
console.warn(
|
|
1825
|
-
`Polling new user notification settings failed: ${String(err)}`
|
|
1826
|
-
);
|
|
1827
|
-
throw err;
|
|
1828
|
-
}
|
|
1829
|
-
},
|
|
1830
|
-
config.USER_NOTIFICATION_SETTINGS_INTERVAL,
|
|
1831
|
-
{ maxStaleTimeMs: config.USER_NOTIFICATION_SETTINGS_MAX_STALE_TIME }
|
|
1832
|
-
);
|
|
1833
1720
|
return {
|
|
1834
1721
|
store,
|
|
1835
1722
|
notificationsPoller,
|
|
1836
|
-
userThreadsPoller
|
|
1837
|
-
userNotificationSettingsPoller
|
|
1723
|
+
userThreadsPoller
|
|
1838
1724
|
};
|
|
1839
1725
|
}
|
|
1840
1726
|
function makeLiveblocksContextBundle(client) {
|
|
@@ -1843,7 +1729,6 @@ function makeLiveblocksContextBundle(client) {
|
|
|
1843
1729
|
const useMarkAllInboxNotificationsAsRead2 = () => useMarkAllInboxNotificationsAsRead_withClient(client);
|
|
1844
1730
|
const useDeleteInboxNotification2 = () => useDeleteInboxNotification_withClient(client);
|
|
1845
1731
|
const useDeleteAllInboxNotifications2 = () => useDeleteAllInboxNotifications_withClient(client);
|
|
1846
|
-
const useUpdateNotificationSettings2 = () => useUpdateNotificationSettings_withClient(client);
|
|
1847
1732
|
function LiveblocksProvider2(props) {
|
|
1848
1733
|
useEnsureNoLiveblocksProvider();
|
|
1849
1734
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ClientContext.Provider, { value: client, children: props.children });
|
|
@@ -1857,8 +1742,6 @@ function makeLiveblocksContextBundle(client) {
|
|
|
1857
1742
|
useMarkAllInboxNotificationsAsRead: useMarkAllInboxNotificationsAsRead2,
|
|
1858
1743
|
useDeleteInboxNotification: useDeleteInboxNotification2,
|
|
1859
1744
|
useDeleteAllInboxNotifications: useDeleteAllInboxNotifications2,
|
|
1860
|
-
useNotificationSettings: () => useNotificationSettings_withClient(client),
|
|
1861
|
-
useUpdateNotificationSettings: useUpdateNotificationSettings2,
|
|
1862
1745
|
useInboxNotificationThread: useInboxNotificationThread2,
|
|
1863
1746
|
useUserThreads_experimental,
|
|
1864
1747
|
...shared.classic,
|
|
@@ -1871,8 +1754,6 @@ function makeLiveblocksContextBundle(client) {
|
|
|
1871
1754
|
useDeleteInboxNotification: useDeleteInboxNotification2,
|
|
1872
1755
|
useDeleteAllInboxNotifications: useDeleteAllInboxNotifications2,
|
|
1873
1756
|
useInboxNotificationThread: useInboxNotificationThread2,
|
|
1874
|
-
useNotificationSettings: () => useNotificationSettingsSuspense_withClient(client),
|
|
1875
|
-
useUpdateNotificationSettings: useUpdateNotificationSettings2,
|
|
1876
1757
|
useUserThreads_experimental: useUserThreadsSuspense_experimental,
|
|
1877
1758
|
...shared.suspense
|
|
1878
1759
|
}
|
|
@@ -2057,58 +1938,6 @@ function useInboxNotificationThread_withClient(client, inboxNotificationId) {
|
|
|
2057
1938
|
)
|
|
2058
1939
|
);
|
|
2059
1940
|
}
|
|
2060
|
-
function useUpdateNotificationSettings_withClient(client) {
|
|
2061
|
-
return _react.useCallback.call(void 0,
|
|
2062
|
-
(settings) => {
|
|
2063
|
-
const { store } = getLiveblocksExtrasForClient(client);
|
|
2064
|
-
const optimisticUpdateId = store.optimisticUpdates.add({
|
|
2065
|
-
type: "update-user-notification-settings",
|
|
2066
|
-
settings
|
|
2067
|
-
});
|
|
2068
|
-
client.updateNotificationSettings(settings).then(
|
|
2069
|
-
(settings2) => {
|
|
2070
|
-
store.updateUserNotificationSettings_confirmOptimisticUpdate(
|
|
2071
|
-
settings2,
|
|
2072
|
-
optimisticUpdateId
|
|
2073
|
-
);
|
|
2074
|
-
},
|
|
2075
|
-
() => {
|
|
2076
|
-
store.optimisticUpdates.remove(optimisticUpdateId);
|
|
2077
|
-
}
|
|
2078
|
-
);
|
|
2079
|
-
},
|
|
2080
|
-
[client]
|
|
2081
|
-
);
|
|
2082
|
-
}
|
|
2083
|
-
function useNotificationSettings_withClient(client) {
|
|
2084
|
-
const updateNotificationSettings = useUpdateNotificationSettings_withClient(client);
|
|
2085
|
-
const { store, userNotificationSettingsPoller: poller } = getLiveblocksExtrasForClient(client);
|
|
2086
|
-
_react.useEffect.call(void 0, () => {
|
|
2087
|
-
void store.outputs.userNotificationSettings.waitUntilLoaded();
|
|
2088
|
-
});
|
|
2089
|
-
_react.useEffect.call(void 0, () => {
|
|
2090
|
-
poller.inc();
|
|
2091
|
-
poller.pollNowIfStale();
|
|
2092
|
-
return () => {
|
|
2093
|
-
poller.dec();
|
|
2094
|
-
};
|
|
2095
|
-
}, [poller]);
|
|
2096
|
-
const settings = useSignal(store.outputs.userNotificationSettings.signal);
|
|
2097
|
-
return _react.useMemo.call(void 0, () => {
|
|
2098
|
-
return [settings, updateNotificationSettings];
|
|
2099
|
-
}, [settings, updateNotificationSettings]);
|
|
2100
|
-
}
|
|
2101
|
-
function useNotificationSettingsSuspense_withClient(client) {
|
|
2102
|
-
ensureNotServerSide();
|
|
2103
|
-
const store = getLiveblocksExtrasForClient(client).store;
|
|
2104
|
-
use(store.outputs.userNotificationSettings.waitUntilLoaded());
|
|
2105
|
-
const [settings, updateNotificationSettings] = useNotificationSettings_withClient(client);
|
|
2106
|
-
_core.assert.call(void 0, !settings.error, "Did not expect error");
|
|
2107
|
-
_core.assert.call(void 0, !settings.isLoading, "Did not expect loading");
|
|
2108
|
-
return _react.useMemo.call(void 0, () => {
|
|
2109
|
-
return [settings, updateNotificationSettings];
|
|
2110
|
-
}, [settings, updateNotificationSettings]);
|
|
2111
|
-
}
|
|
2112
1941
|
function useUser_withClient(client, userId) {
|
|
2113
1942
|
const usersStore = client[_core.kInternal].usersStore;
|
|
2114
1943
|
const getUserState = _react.useCallback.call(void 0,
|
|
@@ -2258,7 +2087,7 @@ function createSharedContext(client) {
|
|
|
2258
2087
|
}
|
|
2259
2088
|
function useEnsureNoLiveblocksProvider(options) {
|
|
2260
2089
|
const existing = useClientOrNull();
|
|
2261
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
2090
|
+
if (!_optionalChain([options, 'optionalAccess', _12 => _12.allowNesting]) && existing !== null) {
|
|
2262
2091
|
throw new Error(
|
|
2263
2092
|
"You cannot nest multiple LiveblocksProvider instances in the same React tree."
|
|
2264
2093
|
);
|
|
@@ -2282,6 +2111,7 @@ function LiveblocksProvider(props) {
|
|
|
2282
2111
|
lostConnectionTimeout: useInitial(o.lostConnectionTimeout),
|
|
2283
2112
|
backgroundKeepAliveTimeout: useInitial(o.backgroundKeepAliveTimeout),
|
|
2284
2113
|
polyfills: useInitial(o.polyfills),
|
|
2114
|
+
largeMessageStrategy: useInitial(o.largeMessageStrategy),
|
|
2285
2115
|
unstable_fallbackToHTTP: useInitial(o.unstable_fallbackToHTTP),
|
|
2286
2116
|
unstable_streamData: useInitial(o.unstable_streamData),
|
|
2287
2117
|
preventUnsavedChanges: useInitial(o.preventUnsavedChanges),
|
|
@@ -2373,15 +2203,6 @@ function useUnreadInboxNotificationsCount() {
|
|
|
2373
2203
|
function useUnreadInboxNotificationsCountSuspense() {
|
|
2374
2204
|
return useUnreadInboxNotificationsCountSuspense_withClient(useClient());
|
|
2375
2205
|
}
|
|
2376
|
-
function useNotificationSettings() {
|
|
2377
|
-
return useNotificationSettings_withClient(useClient());
|
|
2378
|
-
}
|
|
2379
|
-
function useNotificationSettingsSuspense() {
|
|
2380
|
-
return useNotificationSettingsSuspense_withClient(useClient());
|
|
2381
|
-
}
|
|
2382
|
-
function useUpdateNotificationSettings() {
|
|
2383
|
-
return useUpdateNotificationSettings_withClient(useClient());
|
|
2384
|
-
}
|
|
2385
2206
|
function useUser(userId) {
|
|
2386
2207
|
const client = useClient();
|
|
2387
2208
|
return useUser_withClient(client, userId);
|
|
@@ -2402,7 +2223,7 @@ var _useUserSuspense = useUserSuspense;
|
|
|
2402
2223
|
var _useUserThreads_experimental = useUserThreads_experimental;
|
|
2403
2224
|
var _useUserThreadsSuspense_experimental = useUserThreadsSuspense_experimental;
|
|
2404
2225
|
function useSyncStatus_withClient(client, options) {
|
|
2405
|
-
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2226
|
+
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _13 => _13.smooth]), () => ( false)));
|
|
2406
2227
|
if (smooth) {
|
|
2407
2228
|
return useSyncStatusSmooth_withClient(client);
|
|
2408
2229
|
} else {
|
|
@@ -2580,8 +2401,8 @@ function makeRoomExtrasForClient(client) {
|
|
|
2580
2401
|
if (innerError.status === 403) {
|
|
2581
2402
|
const detailedMessage = [
|
|
2582
2403
|
innerError.message,
|
|
2583
|
-
_optionalChain([innerError, 'access',
|
|
2584
|
-
_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])
|
|
2585
2406
|
].filter(Boolean).join("\n");
|
|
2586
2407
|
_core.console.error(detailedMessage);
|
|
2587
2408
|
}
|
|
@@ -2935,7 +2756,7 @@ function useMentionSuggestionsCache() {
|
|
|
2935
2756
|
return client[_core.kInternal].mentionSuggestionsCache;
|
|
2936
2757
|
}
|
|
2937
2758
|
function useStorageStatus(options) {
|
|
2938
|
-
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2759
|
+
const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _18 => _18.smooth]), () => ( false)));
|
|
2939
2760
|
if (smooth) {
|
|
2940
2761
|
return useStorageStatusSmooth();
|
|
2941
2762
|
} else {
|
|
@@ -3249,7 +3070,7 @@ function useCreateRoomThread(roomId) {
|
|
|
3249
3070
|
thread: newThread,
|
|
3250
3071
|
roomId
|
|
3251
3072
|
});
|
|
3252
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3073
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _19 => _19.map, 'call', _20 => _20((attachment) => attachment.id)]);
|
|
3253
3074
|
client[_core.kInternal].httpClient.createThread({
|
|
3254
3075
|
roomId,
|
|
3255
3076
|
threadId,
|
|
@@ -3289,7 +3110,7 @@ function useDeleteRoomThread(roomId) {
|
|
|
3289
3110
|
const { store, onMutationFailure } = getRoomExtrasForClient(client);
|
|
3290
3111
|
const userId = getCurrentUserId(client);
|
|
3291
3112
|
const existing = store.outputs.threads.get().get(threadId);
|
|
3292
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
3113
|
+
if (_optionalChain([existing, 'optionalAccess', _21 => _21.comments, 'optionalAccess', _22 => _22[0], 'optionalAccess', _23 => _23.userId]) !== userId) {
|
|
3293
3114
|
throw new Error("Only the thread creator can delete the thread");
|
|
3294
3115
|
}
|
|
3295
3116
|
const optimisticId = store.optimisticUpdates.add({
|
|
@@ -3377,7 +3198,7 @@ function useCreateRoomComment(roomId) {
|
|
|
3377
3198
|
type: "create-comment",
|
|
3378
3199
|
comment
|
|
3379
3200
|
});
|
|
3380
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3201
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _24 => _24.map, 'call', _25 => _25((attachment) => attachment.id)]);
|
|
3381
3202
|
client[_core.kInternal].httpClient.createComment({ roomId, threadId, commentId, body, attachmentIds }).then(
|
|
3382
3203
|
(newComment) => {
|
|
3383
3204
|
store.createComment(newComment, optimisticId);
|
|
@@ -3433,7 +3254,7 @@ function useEditRoomComment(roomId) {
|
|
|
3433
3254
|
attachments: _nullishCoalesce(attachments, () => ( []))
|
|
3434
3255
|
}
|
|
3435
3256
|
});
|
|
3436
|
-
const attachmentIds = _optionalChain([attachments, 'optionalAccess',
|
|
3257
|
+
const attachmentIds = _optionalChain([attachments, 'optionalAccess', _26 => _26.map, 'call', _27 => _27((attachment) => attachment.id)]);
|
|
3437
3258
|
client[_core.kInternal].httpClient.editComment({ roomId, threadId, commentId, body, attachmentIds }).then(
|
|
3438
3259
|
(editedComment) => {
|
|
3439
3260
|
store.editComment(threadId, optimisticId, editedComment);
|
|
@@ -3897,7 +3718,7 @@ function useThreadsSuspense(options = {}) {
|
|
|
3897
3718
|
return result;
|
|
3898
3719
|
}
|
|
3899
3720
|
function selectorFor_useAttachmentUrl(state) {
|
|
3900
|
-
if (state === void 0 || _optionalChain([state, 'optionalAccess',
|
|
3721
|
+
if (state === void 0 || _optionalChain([state, 'optionalAccess', _28 => _28.isLoading])) {
|
|
3901
3722
|
return _nullishCoalesce(state, () => ( { isLoading: true }));
|
|
3902
3723
|
}
|
|
3903
3724
|
if (state.error) {
|
|
@@ -4112,8 +3933,5 @@ var _useUpdateMyPresence = useUpdateMyPresence;
|
|
|
4112
3933
|
|
|
4113
3934
|
|
|
4114
3935
|
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
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;
|
|
4119
|
-
//# sourceMappingURL=chunk-CTSQGLA4.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
|