@rpcbase/client 0.382.0 → 0.383.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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -15
- package/dist/index.js.map +1 -1
- package/dist/rts/index.d.ts +2 -2
- package/dist/rts/index.d.ts.map +1 -1
- package/dist/rts/index.js +8 -6
- package/dist/rts/queryKey.d.ts.map +1 -1
- package/dist/rts/ssrHydration.d.ts +4 -0
- package/dist/rts/ssrHydration.d.ts.map +1 -1
- package/dist/rts/useQuery.d.ts +5 -0
- package/dist/rts/useQuery.d.ts.map +1 -1
- package/dist/rts/wsClient.d.ts +12 -0
- package/dist/rts/wsClient.d.ts.map +1 -1
- package/dist/{useQuery-CalZ2p2a.js → useQuery-Ce_EmI2F.js} +353 -24
- package/dist/useQuery-Ce_EmI2F.js.map +1 -0
- package/package.json +1 -1
- package/dist/useQuery-CalZ2p2a.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ export * from './components/RouteErrorBoundary';
|
|
|
11
11
|
export * from './notifications';
|
|
12
12
|
export * from './notificationsRealtime';
|
|
13
13
|
export * from './errorReporting';
|
|
14
|
-
export { STATIC_RPCBASE_RTS_HYDRATION_DATA_KEY, RtsSsrRuntimeProvider, clearHydratedRtsQueryData, hydrateRtsFromWindow, peekHydratedRtsQueryData, type RtsSsrHydrationQueryData, type RtsSsrQueryRegistration, type RtsSsrRuntime, type StaticRpcbaseRtsHydrationData, } from './rts/ssrHydration';
|
|
14
|
+
export { STATIC_RPCBASE_RTS_HYDRATION_DATA_KEY, RtsSsrRuntimeProvider, clearHydratedRtsQueryData, hydrateRtsFromWindow, peekHydratedRtsQueryData, peekHydratedRtsQueryPageInfo, type RtsSsrHydrationQueryData, type RtsSsrQueryRegistration, type RtsSsrRuntime, type StaticRpcbaseRtsHydrationData, } from './rts/ssrHydration';
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,+BAA+B,CAAA;AAC7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,yBAAyB,CAAA;AACvC,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,qCAAqC,EACrC,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EAClB,KAAK,6BAA6B,GACnC,MAAM,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,+BAA+B,CAAA;AAC7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,yBAAyB,CAAA;AACvC,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,qCAAqC,EACrC,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,4BAA4B,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EAClB,KAAK,6BAA6B,GACnC,MAAM,oBAAoB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -5,8 +5,8 @@ import { getNavigationGuards, createRoutesFromElements, createBrowserRouter, Rou
|
|
|
5
5
|
import { hydrateRoot } from "react-dom/client";
|
|
6
6
|
import { r as reportClientException } from "./errorReporting-CVoUUKxW.js";
|
|
7
7
|
import { s } from "./errorReporting-CVoUUKxW.js";
|
|
8
|
-
import {
|
|
9
|
-
import { R, S,
|
|
8
|
+
import { n as hydrateRtsFromWindow, v as useQuery } from "./useQuery-Ce_EmI2F.js";
|
|
9
|
+
import { R, S, p, q, t } from "./useQuery-Ce_EmI2F.js";
|
|
10
10
|
const emptyUnsubscribe = () => {
|
|
11
11
|
};
|
|
12
12
|
const useMediaQuery = (query) => {
|
|
@@ -2267,10 +2267,10 @@ function NotificationsRealtimeProvider({
|
|
|
2267
2267
|
const notifications = useMemo(() => {
|
|
2268
2268
|
const raw = notificationsQuery.data;
|
|
2269
2269
|
if (!Array.isArray(raw)) return [];
|
|
2270
|
-
return raw.map((doc) => toNotificationItem(doc)).filter((
|
|
2270
|
+
return raw.map((doc) => toNotificationItem(doc)).filter((n) => Boolean(n));
|
|
2271
2271
|
}, [notificationsQuery.data]);
|
|
2272
|
-
const unreadCount = useMemo(() => notifications.reduce((acc,
|
|
2273
|
-
const unseenCount = useMemo(() => notifications.reduce((acc,
|
|
2272
|
+
const unreadCount = useMemo(() => notifications.reduce((acc, n) => acc + (n.readAt ? 0 : 1), 0), [notifications]);
|
|
2273
|
+
const unseenCount = useMemo(() => notifications.reduce((acc, n) => acc + (n.seenAt ? 0 : 1), 0), [notifications]);
|
|
2274
2274
|
const lastToastIds = useRef(/* @__PURE__ */ new Set());
|
|
2275
2275
|
const hasSeededToastIds = useRef(false);
|
|
2276
2276
|
const toastStartMs = useRef(Date.now());
|
|
@@ -2285,18 +2285,18 @@ function NotificationsRealtimeProvider({
|
|
|
2285
2285
|
if (notificationsQuery.loading) return;
|
|
2286
2286
|
if (!hasSeededToastIds.current) {
|
|
2287
2287
|
hasSeededToastIds.current = true;
|
|
2288
|
-
lastToastIds.current = new Set(notifications.map((
|
|
2288
|
+
lastToastIds.current = new Set(notifications.map((n) => n.id));
|
|
2289
2289
|
return;
|
|
2290
2290
|
}
|
|
2291
|
-
const nextNew = notifications.filter((
|
|
2291
|
+
const nextNew = notifications.filter((n) => !lastToastIds.current.has(n.id));
|
|
2292
2292
|
if (!nextNew.length) return;
|
|
2293
|
-
for (const
|
|
2294
|
-
lastToastIds.current.add(
|
|
2293
|
+
for (const n of nextNew) {
|
|
2294
|
+
lastToastIds.current.add(n.id);
|
|
2295
2295
|
}
|
|
2296
2296
|
const isTabActive = typeof document !== "undefined" && document.visibilityState === "visible";
|
|
2297
2297
|
if (!isTabActive) return;
|
|
2298
|
-
const eligible = nextNew.filter((
|
|
2299
|
-
const createdAtMs = Date.parse(
|
|
2298
|
+
const eligible = nextNew.filter((n) => {
|
|
2299
|
+
const createdAtMs = Date.parse(n.createdAt);
|
|
2300
2300
|
if (!Number.isFinite(createdAtMs)) return true;
|
|
2301
2301
|
return createdAtMs >= toastStartMs.current;
|
|
2302
2302
|
});
|
|
@@ -2305,8 +2305,8 @@ function NotificationsRealtimeProvider({
|
|
|
2305
2305
|
toast(`${eligible.length} new notifications`, { description: "Open the notifications drawer to view them." });
|
|
2306
2306
|
return;
|
|
2307
2307
|
}
|
|
2308
|
-
for (const
|
|
2309
|
-
toast(
|
|
2308
|
+
for (const n of eligible) {
|
|
2309
|
+
toast(n.title || "New notification", { description: n.body });
|
|
2310
2310
|
}
|
|
2311
2311
|
}, [canUseRts, notifications, notificationsQuery.loading, toastOnNew]);
|
|
2312
2312
|
const value = useMemo(() => ({
|
|
@@ -2332,7 +2332,7 @@ export {
|
|
|
2332
2332
|
SsrErrorFallback,
|
|
2333
2333
|
apiClient,
|
|
2334
2334
|
archiveNotification,
|
|
2335
|
-
|
|
2335
|
+
p as clearHydratedRtsQueryData,
|
|
2336
2336
|
consumeClientSsrErrorState,
|
|
2337
2337
|
getFeatureFlag,
|
|
2338
2338
|
getNotificationSettings,
|
|
@@ -2343,7 +2343,8 @@ export {
|
|
|
2343
2343
|
markAllNotificationsRead,
|
|
2344
2344
|
markNotificationRead,
|
|
2345
2345
|
peekClientSsrErrorState,
|
|
2346
|
-
|
|
2346
|
+
q as peekHydratedRtsQueryData,
|
|
2347
|
+
t as peekHydratedRtsQueryPageInfo,
|
|
2347
2348
|
reportClientException,
|
|
2348
2349
|
runNotificationDigest,
|
|
2349
2350
|
serializeSsrErrorState,
|