@rpcbase/client 0.377.0 → 0.379.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 CHANGED
@@ -11,4 +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, resolveRtsHydrationIdentityFromStaticRouterData, type RtsSsrHydrationQueryData, type RtsSsrIdentity, type RtsSsrQueryRegistration, type RtsSsrRuntime, type StaticRpcbaseRtsHydrationData, } from './rts/ssrHydration';
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -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"}
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,+CAA+C,EAC/C,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EAClB,KAAK,6BAA6B,GACnC,MAAM,oBAAoB,CAAA"}
package/dist/index.js CHANGED
@@ -5,7 +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 { m as useQuery } from "./useQuery-DnrhB9w2.js";
8
+ import { m as hydrateRtsFromWindow, q as resolveRtsHydrationIdentityFromStaticRouterData, t as useQuery } from "./useQuery-Bz5cpWp4.js";
9
+ import { R, S, n, p } from "./useQuery-Bz5cpWp4.js";
9
10
  const emptyUnsubscribe = () => {
10
11
  };
11
12
  const useMediaQuery = (query) => {
@@ -636,6 +637,7 @@ const initWithRoutes = async (routesElement, opts) => {
636
637
  await initApiClient();
637
638
  cleanupURL();
638
639
  handleServerErrors();
640
+ hydrateRtsFromWindow(resolveRtsHydrationIdentityFromStaticRouterData());
639
641
  const routes = createRoutesFromElements(routesElement);
640
642
  applyLoaderTimeouts(routes);
641
643
  const router = createBrowserRouter(routes, {});
@@ -2259,10 +2261,10 @@ function NotificationsRealtimeProvider({
2259
2261
  const notifications = useMemo(() => {
2260
2262
  const raw = notificationsQuery.data;
2261
2263
  if (!Array.isArray(raw)) return [];
2262
- return raw.map((doc) => toNotificationItem(doc)).filter((n) => Boolean(n));
2264
+ return raw.map((doc) => toNotificationItem(doc)).filter((n2) => Boolean(n2));
2263
2265
  }, [notificationsQuery.data]);
2264
- const unreadCount = useMemo(() => notifications.reduce((acc, n) => acc + (n.readAt ? 0 : 1), 0), [notifications]);
2265
- const unseenCount = useMemo(() => notifications.reduce((acc, n) => acc + (n.seenAt ? 0 : 1), 0), [notifications]);
2266
+ const unreadCount = useMemo(() => notifications.reduce((acc, n2) => acc + (n2.readAt ? 0 : 1), 0), [notifications]);
2267
+ const unseenCount = useMemo(() => notifications.reduce((acc, n2) => acc + (n2.seenAt ? 0 : 1), 0), [notifications]);
2266
2268
  const lastToastIds = useRef(/* @__PURE__ */ new Set());
2267
2269
  const hasSeededToastIds = useRef(false);
2268
2270
  const toastStartMs = useRef(Date.now());
@@ -2277,18 +2279,18 @@ function NotificationsRealtimeProvider({
2277
2279
  if (notificationsQuery.loading) return;
2278
2280
  if (!hasSeededToastIds.current) {
2279
2281
  hasSeededToastIds.current = true;
2280
- lastToastIds.current = new Set(notifications.map((n) => n.id));
2282
+ lastToastIds.current = new Set(notifications.map((n2) => n2.id));
2281
2283
  return;
2282
2284
  }
2283
- const nextNew = notifications.filter((n) => !lastToastIds.current.has(n.id));
2285
+ const nextNew = notifications.filter((n2) => !lastToastIds.current.has(n2.id));
2284
2286
  if (!nextNew.length) return;
2285
- for (const n of nextNew) {
2286
- lastToastIds.current.add(n.id);
2287
+ for (const n2 of nextNew) {
2288
+ lastToastIds.current.add(n2.id);
2287
2289
  }
2288
2290
  const isTabActive = typeof document !== "undefined" && document.visibilityState === "visible";
2289
2291
  if (!isTabActive) return;
2290
- const eligible = nextNew.filter((n) => {
2291
- const createdAtMs = Date.parse(n.createdAt);
2292
+ const eligible = nextNew.filter((n2) => {
2293
+ const createdAtMs = Date.parse(n2.createdAt);
2292
2294
  if (!Number.isFinite(createdAtMs)) return true;
2293
2295
  return createdAtMs >= toastStartMs.current;
2294
2296
  });
@@ -2297,8 +2299,8 @@ function NotificationsRealtimeProvider({
2297
2299
  toast(`${eligible.length} new notifications`, { description: "Open the notifications drawer to view them." });
2298
2300
  return;
2299
2301
  }
2300
- for (const n of eligible) {
2301
- toast(n.title || "New notification", { description: n.body });
2302
+ for (const n2 of eligible) {
2303
+ toast(n2.title || "New notification", { description: n2.body });
2302
2304
  }
2303
2305
  }, [canUseRts, notifications, notificationsQuery.loading, toastOnNew]);
2304
2306
  const value = useMemo(() => ({
@@ -2318,20 +2320,26 @@ export {
2318
2320
  NotificationsRealtimeProvider,
2319
2321
  RootProvider,
2320
2322
  RouteErrorBoundary,
2323
+ R as RtsSsrRuntimeProvider,
2321
2324
  SSR_ERROR_STATE_GLOBAL_KEY,
2325
+ S as STATIC_RPCBASE_RTS_HYDRATION_DATA_KEY,
2322
2326
  SsrErrorFallback,
2323
2327
  apiClient,
2324
2328
  archiveNotification,
2329
+ n as clearHydratedRtsQueryData,
2325
2330
  consumeClientSsrErrorState,
2326
2331
  getFeatureFlag,
2327
2332
  getNotificationSettings,
2333
+ hydrateRtsFromWindow,
2328
2334
  initApiClient,
2329
2335
  initWithRoutes,
2330
2336
  listNotifications,
2331
2337
  markAllNotificationsRead,
2332
2338
  markNotificationRead,
2333
2339
  peekClientSsrErrorState,
2340
+ p as peekHydratedRtsQueryData,
2334
2341
  reportClientException,
2342
+ resolveRtsHydrationIdentityFromStaticRouterData,
2335
2343
  runNotificationDigest,
2336
2344
  serializeSsrErrorState,
2337
2345
  s as setClientExceptionReporter,