@rpcbase/client 0.492.0 → 0.494.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.js CHANGED
@@ -1,8 +1,8 @@
1
- import { i as require_toString, m as __toESM, p as __commonJSMin, t as require_throttle } from "./throttle-BFr_Yc5g.js";
1
+ import { i as require_toString, m as __toESM, p as __commonJSMin, t as require_throttle } from "./throttle-BJaYdH4P.js";
2
2
  import { n as setClientExceptionReporter, t as reportClientException } from "./errorReporting-BaPe0tII.js";
3
- import { A as clearHydratedRtsQueryData, F as peekHydratedRtsQueryPageInfo, I as peekHydratedRtsQueryTotalCount, M as hydrateRtsFromWindow, N as peekHydratedRtsCount, O as RtsSsrRuntimeProvider, P as peekHydratedRtsQueryData, j as consumeHydratedRtsCount, k as STATIC_RPCBASE_RTS_HYDRATION_DATA_KEY, n as useQuery } from "./rts-C9lvbdZX.js";
3
+ import { A as clearHydratedRtsQueryData, F as peekHydratedRtsQueryPageInfo, I as peekHydratedRtsQueryTotalCount, M as hydrateRtsFromWindow, N as peekHydratedRtsCount, O as RtsSsrRuntimeProvider, P as peekHydratedRtsQueryData, j as consumeHydratedRtsCount, k as STATIC_RPCBASE_RTS_HYDRATION_DATA_KEY, n as useQuery } from "./rts-CAi9JFYq.js";
4
4
  import { c } from "react/compiler-runtime";
5
- import { StrictMode, Suspense, createContext, lazy, useContext, useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
5
+ import { StrictMode, Suspense, createContext, lazy, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
7
  import env from "@rpcbase/env";
8
8
  import { RoutePrefetchProvider, RouterProvider, createBrowserRouter, createRoutesFromElements, getNavigationGuards, isRouteErrorResponse, matchRoutes, useLocation, useRouteError } from "@rpcbase/router";
@@ -37,9 +37,9 @@ var useMediaQuery = (query) => {
37
37
  $[2] = query;
38
38
  $[3] = t1;
39
39
  } else t1 = $[3];
40
- return useSyncExternalStore(subscribe, t1, _temp$3);
40
+ return useSyncExternalStore(subscribe, t1, _temp$2);
41
41
  };
42
- function _temp$3() {
42
+ function _temp$2() {
43
43
  return false;
44
44
  }
45
45
  //#endregion
@@ -262,7 +262,7 @@ var MountedLazyToaster = (props) => {
262
262
  t0 = [];
263
263
  $[0] = t0;
264
264
  } else t0 = $[0];
265
- useEffect(_temp2$1, t0);
265
+ useEffect(_temp2, t0);
266
266
  let t1;
267
267
  if ($[1] !== props) {
268
268
  t1 = /* @__PURE__ */ jsx(LazySonnerToaster, { ...props });
@@ -279,7 +279,7 @@ var ActiveToaster = () => {
279
279
  t0 = [];
280
280
  $[0] = t0;
281
281
  } else t0 = $[0];
282
- useEffect(_temp4$1, t0);
282
+ useEffect(_temp4, t0);
283
283
  let t1;
284
284
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
285
285
  t1 = /* @__PURE__ */ jsx("style", { children: toastContentStyles });
@@ -339,7 +339,7 @@ var Toaster = () => {
339
339
  t0 = [];
340
340
  $[0] = t0;
341
341
  } else t0 = $[0];
342
- useEffect(_temp8$1, t0);
342
+ useEffect(_temp8, t0);
343
343
  if (!useSyncExternalStore(subscribeToasterRequested, getToasterRequested, getToasterRequested)) return null;
344
344
  let t1;
345
345
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
@@ -348,21 +348,21 @@ var Toaster = () => {
348
348
  } else t1 = $[1];
349
349
  return t1;
350
350
  };
351
- function _temp$2() {
351
+ function _temp$1() {
352
352
  return setToasterMounted(false);
353
353
  }
354
- function _temp2$1() {
354
+ function _temp2() {
355
355
  setToasterMounted(true);
356
- return _temp$2;
356
+ return _temp$1;
357
357
  }
358
- function _temp3$1(event) {
358
+ function _temp3(event) {
359
359
  const target = event.target;
360
360
  if (!(target instanceof Element)) return;
361
361
  if (!target.closest("[data-sonner-toaster]")) return;
362
362
  event.preventDefault();
363
363
  }
364
- function _temp4$1() {
365
- const handler = _temp3$1;
364
+ function _temp4() {
365
+ const handler = _temp3;
366
366
  document.addEventListener("dismissableLayer.pointerDownOutside", handler, true);
367
367
  document.addEventListener("dismissableLayer.focusOutside", handler, true);
368
368
  return () => {
@@ -370,22 +370,22 @@ function _temp4$1() {
370
370
  document.removeEventListener("dismissableLayer.focusOutside", handler, true);
371
371
  };
372
372
  }
373
- function _temp5$1() {
373
+ function _temp5() {
374
374
  return startToaster();
375
375
  }
376
- function _temp6$1() {
376
+ function _temp6() {
377
377
  return startToaster();
378
378
  }
379
- function _temp7$1() {
379
+ function _temp7() {
380
380
  if (typeof window.requestIdleCallback === "function") {
381
- window.requestIdleCallback(_temp5$1, { timeout: 2e3 });
381
+ window.requestIdleCallback(_temp5, { timeout: 2e3 });
382
382
  return;
383
383
  }
384
- window.setTimeout(_temp6$1, 150);
384
+ window.setTimeout(_temp6, 150);
385
385
  }
386
- function _temp8$1() {
386
+ function _temp8() {
387
387
  if (typeof window === "undefined") return;
388
- const startDeferred = _temp7$1;
388
+ const startDeferred = _temp7;
389
389
  if (isPageLoaded()) {
390
390
  startDeferred();
391
391
  return;
@@ -790,95 +790,43 @@ var consumeClientSsrErrorState = () => {
790
790
  //#region src/components/SsrErrorFallback.tsx
791
791
  var DEFAULT_TITLE = "Something went wrong";
792
792
  var DEFAULT_MESSAGE = "We couldn't render this page. Please try again in a few seconds.";
793
- var SsrErrorFallback = (t0) => {
794
- const $ = c(19);
795
- const { state, renderErrorExtra } = t0;
796
- const { statusCode: t1, title: t2, message: t3, details } = state;
797
- const statusCode = t1 === void 0 ? 500 : t1;
798
- const title = t2 === void 0 ? DEFAULT_TITLE : t2;
799
- const message = t3 === void 0 ? DEFAULT_MESSAGE : t3;
800
- let t4;
801
- if ($[0] !== renderErrorExtra || $[1] !== state) {
802
- t4 = renderErrorExtra?.(state);
803
- $[0] = renderErrorExtra;
804
- $[1] = state;
805
- $[2] = t4;
806
- } else t4 = $[2];
807
- const extra = t4;
808
- let t5;
809
- if ($[3] !== statusCode) {
810
- t5 = /* @__PURE__ */ jsx("p", {
811
- className: "text-base font-semibold text-rose-600",
812
- children: statusCode
813
- });
814
- $[3] = statusCode;
815
- $[4] = t5;
816
- } else t5 = $[4];
817
- let t6;
818
- if ($[5] !== title) {
819
- t6 = /* @__PURE__ */ jsx("h1", {
820
- className: "mt-4 text-pretty text-4xl font-semibold tracking-tight text-gray-900 sm:text-5xl",
821
- children: title
822
- });
823
- $[5] = title;
824
- $[6] = t6;
825
- } else t6 = $[6];
826
- let t7;
827
- if ($[7] !== message) {
828
- t7 = /* @__PURE__ */ jsx("p", {
829
- className: "mt-6 text-lg text-gray-600 sm:text-xl/relaxed",
830
- children: message
831
- });
832
- $[7] = message;
833
- $[8] = t7;
834
- } else t7 = $[8];
835
- let t8;
836
- if ($[9] !== details) {
837
- t8 = details ? /* @__PURE__ */ jsxs("div", {
838
- className: "mt-10 w-full rounded-2xl bg-gray-900/95 p-5 text-left shadow-2xl",
839
- children: [/* @__PURE__ */ jsx("p", {
840
- className: "text-sm font-semibold uppercase tracking-wide text-gray-400",
841
- children: "Debug details"
842
- }), /* @__PURE__ */ jsx("pre", {
843
- className: "mt-3 max-h-64 overflow-auto whitespace-pre-wrap text-sm text-gray-100",
844
- children: details
845
- })]
846
- }) : null;
847
- $[9] = details;
848
- $[10] = t8;
849
- } else t8 = $[10];
850
- let t9;
851
- if ($[11] !== extra) {
852
- t9 = extra ? /* @__PURE__ */ jsx("div", {
853
- className: "mt-10 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-center",
854
- children: extra
855
- }) : null;
856
- $[11] = extra;
857
- $[12] = t9;
858
- } else t9 = $[12];
859
- let t10;
860
- if ($[13] !== t5 || $[14] !== t6 || $[15] !== t7 || $[16] !== t8 || $[17] !== t9) {
861
- t10 = /* @__PURE__ */ jsx("div", {
862
- className: "bg-white min-h-screen",
863
- children: /* @__PURE__ */ jsxs("main", {
864
- className: "mx-auto flex min-h-screen max-w-2xl flex-col items-center justify-center px-6 py-12 text-center sm:py-24",
865
- children: [
866
- t5,
867
- t6,
868
- t7,
869
- t8,
870
- t9
871
- ]
872
- })
873
- });
874
- $[13] = t5;
875
- $[14] = t6;
876
- $[15] = t7;
877
- $[16] = t8;
878
- $[17] = t9;
879
- $[18] = t10;
880
- } else t10 = $[18];
881
- return t10;
793
+ var SsrErrorFallback = ({ state, renderErrorExtra }) => {
794
+ const { statusCode = 500, title = DEFAULT_TITLE, message = DEFAULT_MESSAGE, details } = state;
795
+ const extra = renderErrorExtra?.(state);
796
+ return /* @__PURE__ */ jsx("div", {
797
+ className: "bg-white min-h-screen",
798
+ children: /* @__PURE__ */ jsxs("main", {
799
+ className: "mx-auto flex min-h-screen max-w-2xl flex-col items-center justify-center px-6 py-12 text-center sm:py-24",
800
+ children: [
801
+ /* @__PURE__ */ jsx("p", {
802
+ className: "text-base font-semibold text-rose-600",
803
+ children: statusCode
804
+ }),
805
+ /* @__PURE__ */ jsx("h1", {
806
+ className: "mt-4 text-pretty text-4xl font-semibold tracking-tight text-gray-900 sm:text-5xl",
807
+ children: title
808
+ }),
809
+ /* @__PURE__ */ jsx("p", {
810
+ className: "mt-6 text-lg text-gray-600 sm:text-xl/relaxed",
811
+ children: message
812
+ }),
813
+ details ? /* @__PURE__ */ jsxs("div", {
814
+ className: "mt-10 w-full rounded-2xl bg-gray-900/95 p-5 text-left shadow-2xl",
815
+ children: [/* @__PURE__ */ jsx("p", {
816
+ className: "text-sm font-semibold uppercase tracking-wide text-gray-400",
817
+ children: "Debug details"
818
+ }), /* @__PURE__ */ jsx("pre", {
819
+ className: "mt-3 max-h-64 overflow-auto whitespace-pre-wrap text-sm text-gray-100",
820
+ children: details
821
+ })]
822
+ }) : null,
823
+ extra ? /* @__PURE__ */ jsx("div", {
824
+ className: "mt-10 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-center",
825
+ children: extra
826
+ }) : null
827
+ ]
828
+ })
829
+ });
882
830
  };
883
831
  //#endregion
884
832
  //#region src/initWithRoutes.tsx
@@ -1067,7 +1015,7 @@ var initWithRoutes = async (routesElement, opts) => {
1067
1015
  };
1068
1016
  if (!isProduction && !env.SSR && isDesktopDevice() && !isPlaywrightTestEnvironment()) import("react-grab");
1069
1017
  //#endregion
1070
- //#region node_modules/lodash/_arrayReduce.js
1018
+ //#region ../../node_modules/lodash/_arrayReduce.js
1071
1019
  var require__arrayReduce = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1072
1020
  /**
1073
1021
  * A specialized version of `_.reduce` for arrays without support for
@@ -1090,7 +1038,7 @@ var require__arrayReduce = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1090
1038
  module.exports = arrayReduce;
1091
1039
  }));
1092
1040
  //#endregion
1093
- //#region node_modules/lodash/_basePropertyOf.js
1041
+ //#region ../../node_modules/lodash/_basePropertyOf.js
1094
1042
  var require__basePropertyOf = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1095
1043
  /**
1096
1044
  * The base implementation of `_.propertyOf` without support for deep paths.
@@ -1107,7 +1055,7 @@ var require__basePropertyOf = /* @__PURE__ */ __commonJSMin(((exports, module) =
1107
1055
  module.exports = basePropertyOf;
1108
1056
  }));
1109
1057
  //#endregion
1110
- //#region node_modules/lodash/_deburrLetter.js
1058
+ //#region ../../node_modules/lodash/_deburrLetter.js
1111
1059
  var require__deburrLetter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1112
1060
  module.exports = require__basePropertyOf()({
1113
1061
  "À": "A",
@@ -1303,7 +1251,7 @@ var require__deburrLetter = /* @__PURE__ */ __commonJSMin(((exports, module) =>
1303
1251
  });
1304
1252
  }));
1305
1253
  //#endregion
1306
- //#region node_modules/lodash/deburr.js
1254
+ //#region ../../node_modules/lodash/deburr.js
1307
1255
  var require_deburr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1308
1256
  var deburrLetter = require__deburrLetter();
1309
1257
  var toString = require_toString();
@@ -1339,7 +1287,7 @@ var require_deburr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1339
1287
  module.exports = deburr;
1340
1288
  }));
1341
1289
  //#endregion
1342
- //#region node_modules/lodash/_asciiWords.js
1290
+ //#region ../../node_modules/lodash/_asciiWords.js
1343
1291
  var require__asciiWords = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1344
1292
  /** Used to match words composed of alphanumeric characters. */
1345
1293
  var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
@@ -1356,7 +1304,7 @@ var require__asciiWords = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1356
1304
  module.exports = asciiWords;
1357
1305
  }));
1358
1306
  //#endregion
1359
- //#region node_modules/lodash/_hasUnicodeWord.js
1307
+ //#region ../../node_modules/lodash/_hasUnicodeWord.js
1360
1308
  var require__hasUnicodeWord = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1361
1309
  /** Used to detect strings that need a more robust regexp to match words. */
1362
1310
  var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
@@ -1373,7 +1321,7 @@ var require__hasUnicodeWord = /* @__PURE__ */ __commonJSMin(((exports, module) =
1373
1321
  module.exports = hasUnicodeWord;
1374
1322
  }));
1375
1323
  //#endregion
1376
- //#region node_modules/lodash/_unicodeWords.js
1324
+ //#region ../../node_modules/lodash/_unicodeWords.js
1377
1325
  var require__unicodeWords = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1378
1326
  /** Used to compose unicode character classes. */
1379
1327
  var rsAstralRange = "\\ud800-\\udfff";
@@ -1453,7 +1401,7 @@ var require__unicodeWords = /* @__PURE__ */ __commonJSMin(((exports, module) =>
1453
1401
  module.exports = unicodeWords;
1454
1402
  }));
1455
1403
  //#endregion
1456
- //#region node_modules/lodash/words.js
1404
+ //#region ../../node_modules/lodash/words.js
1457
1405
  var require_words = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1458
1406
  var asciiWords = require__asciiWords();
1459
1407
  var hasUnicodeWord = require__hasUnicodeWord();
@@ -1487,7 +1435,7 @@ var require_words = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1487
1435
  module.exports = words;
1488
1436
  }));
1489
1437
  //#endregion
1490
- //#region node_modules/lodash/_createCompounder.js
1438
+ //#region ../../node_modules/lodash/_createCompounder.js
1491
1439
  var require__createCompounder = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1492
1440
  var arrayReduce = require__arrayReduce();
1493
1441
  var deburr = require_deburr();
@@ -1779,7 +1727,8 @@ function createIsCircular(areItemsEqual) {
1779
1727
  * not enumerable and symbol properties.
1780
1728
  */
1781
1729
  function getStrictProperties(object) {
1782
- return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
1730
+ const symbols = getOwnPropertySymbols(object);
1731
+ return symbols.length ? getOwnPropertyNames(object).concat(symbols) : getOwnPropertyNames(object);
1783
1732
  }
1784
1733
  /**
1785
1734
  * Whether the object contains the property passed as an own property.
@@ -1852,7 +1801,7 @@ function areMapsEqual(a, b, state) {
1852
1801
  const size = a.size;
1853
1802
  if (size !== b.size) return false;
1854
1803
  if (!size) return true;
1855
- const matchedIndices = new Array(size);
1804
+ const matchedIndices = new Uint8Array(size);
1856
1805
  const aIterable = a.entries();
1857
1806
  let aResult;
1858
1807
  let bResult;
@@ -1860,7 +1809,7 @@ function areMapsEqual(a, b, state) {
1860
1809
  while (aResult = aIterable.next()) {
1861
1810
  if (aResult.done) break;
1862
1811
  const bIterable = b.entries();
1863
- let hasMatch = false;
1812
+ let hasMatch = 0;
1864
1813
  let matchIndex = 0;
1865
1814
  while (bResult = bIterable.next()) {
1866
1815
  if (bResult.done) break;
@@ -1871,7 +1820,7 @@ function areMapsEqual(a, b, state) {
1871
1820
  const aEntry = aResult.value;
1872
1821
  const bEntry = bResult.value;
1873
1822
  if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state) && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
1874
- hasMatch = matchedIndices[matchIndex] = true;
1823
+ hasMatch = matchedIndices[matchIndex] = 1;
1875
1824
  break;
1876
1825
  }
1877
1826
  matchIndex++;
@@ -1929,19 +1878,19 @@ function areSetsEqual(a, b, state) {
1929
1878
  const size = a.size;
1930
1879
  if (size !== b.size) return false;
1931
1880
  if (!size) return true;
1932
- const matchedIndices = new Array(size);
1881
+ const matchedIndices = new Uint8Array(size);
1933
1882
  const aIterable = a.values();
1934
1883
  let aResult;
1935
1884
  let bResult;
1936
1885
  while (aResult = aIterable.next()) {
1937
1886
  if (aResult.done) break;
1938
1887
  const bIterable = b.values();
1939
- let hasMatch = false;
1888
+ let hasMatch = 0;
1940
1889
  let matchIndex = 0;
1941
1890
  while (bResult = bIterable.next()) {
1942
1891
  if (bResult.done) break;
1943
1892
  if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
1944
- hasMatch = matchedIndices[matchIndex] = true;
1893
+ hasMatch = matchedIndices[matchIndex] = 1;
1945
1894
  break;
1946
1895
  }
1947
1896
  matchIndex++;
@@ -1954,8 +1903,8 @@ function areSetsEqual(a, b, state) {
1954
1903
  * Whether the TypedArray instances are equal in value.
1955
1904
  */
1956
1905
  function areTypedArraysEqual(a, b) {
1957
- let index = a.byteLength;
1958
- if (b.byteLength !== index || a.byteOffset !== b.byteOffset) return false;
1906
+ let index = a.length;
1907
+ if (b.length !== index || a.byteOffset !== b.byteOffset) return false;
1959
1908
  while (index-- > 0) if (a[index] !== b[index]) return false;
1960
1909
  return true;
1961
1910
  }
@@ -2232,7 +2181,7 @@ var useThrottledMeasure = (t0) => {
2232
2181
  const throttleDuration = t0 === void 0 ? DEFAULT_THROTTLE_TIME : t0;
2233
2182
  const hasInitialMeasure = useRef(false);
2234
2183
  const [ref, measuredRect] = useLocalMeasure();
2235
- const [rect, setRect] = useState(_temp$1);
2184
+ const [rect, setRect] = useState(_temp);
2236
2185
  let t1;
2237
2186
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2238
2187
  t1 = (newRect) => {
@@ -2283,7 +2232,7 @@ var useThrottledMeasure = (t0) => {
2283
2232
  } else t5 = $[9];
2284
2233
  return t5;
2285
2234
  };
2286
- function _temp$1() {
2235
+ function _temp() {
2287
2236
  return defaultRect;
2288
2237
  }
2289
2238
  //#endregion
@@ -2431,7 +2380,7 @@ var NEW_NOTIFICATION_START_TOLERANCE_MS = 5e3;
2431
2380
  var NATIVE_NOTIFICATION_TAG_PREFIX = "rb-notification";
2432
2381
  var ACTIVE_TAB_HEARTBEAT_MS = 5e3;
2433
2382
  var ACTIVE_TAB_TTL_MS = 15e3;
2434
- var DELIVERY_TTL_MS = 600 * 1e3;
2383
+ var DELIVERY_TTL_MS = 6e5;
2435
2384
  var FALLBACK_DELIVERY_LOCK_TTL_MS = 2e3;
2436
2385
  var ACTIVE_TAB_NATIVE_GRACE_MS = 350;
2437
2386
  var TAB_STATE_KEY_PREFIX = "rb:notifications:tab:";
@@ -3019,425 +2968,173 @@ var queuePendingInAppToasts = (pendingInAppToastItems, items, userId, appName, r
3019
2968
  for (const item of items) pendingInAppToastItems.current.set(getNotificationDeliveryId(item), item);
3020
2969
  flushPendingInAppToasts(pendingInAppToastItems, userId, appName, renderNotificationToast);
3021
2970
  };
3022
- function NotificationsRealtimeProvider(t0) {
3023
- const $ = c(78);
3024
- const { userId, appName, limit: t1, toastOnNew: t2, renderNotificationToast, children } = t0;
3025
- const limit = t1 === void 0 ? 200 : t1;
3026
- const toastOnNew = t2 === void 0 ? true : t2;
2971
+ function NotificationsRealtimeProvider({ userId, appName, limit = 200, toastOnNew = true, renderNotificationToast, children }) {
3027
2972
  const location = useLocation();
3028
- let t3;
3029
- if ($[0] !== userId) {
3030
- t3 = typeof userId === "string" ? userId.trim() : "";
3031
- $[0] = userId;
3032
- $[1] = t3;
3033
- } else t3 = $[1];
3034
- const trimmedUserId = t3;
3035
- let t4;
3036
- if ($[2] !== appName) {
3037
- t4 = getNormalizedNotificationAppName(appName);
3038
- $[2] = appName;
3039
- $[3] = t4;
3040
- } else t4 = $[3];
3041
- const normalizedAppName = t4;
2973
+ const trimmedUserId = typeof userId === "string" ? userId.trim() : "";
2974
+ const normalizedAppName = getNormalizedNotificationAppName(appName);
3042
2975
  const canUseRts = Boolean(trimmedUserId);
3043
- let t5;
3044
- if ($[4] !== canUseRts || $[5] !== trimmedUserId) {
3045
- t5 = canUseRts ? { userId: trimmedUserId } : {};
3046
- $[4] = canUseRts;
3047
- $[5] = trimmedUserId;
3048
- $[6] = t5;
3049
- } else t5 = $[6];
3050
- let t6;
3051
- if ($[7] !== canUseRts) {
3052
- t6 = {
3053
- key: "rb.notifications.settings",
3054
- limit: 1,
3055
- enabled: canUseRts
3056
- };
3057
- $[7] = canUseRts;
3058
- $[8] = t6;
3059
- } else t6 = $[8];
3060
- const settings = useQuery("RBNotificationSettings", t5, t6).data?.[0] ?? null;
3061
- let t7;
3062
- if ($[9] !== settings) {
3063
- t7 = buildDisabledTopics(settings);
3064
- $[9] = settings;
3065
- $[10] = t7;
3066
- } else t7 = $[10];
3067
- const disabledTopics = t7;
3068
- let t8;
3069
- bb0: {
3070
- if (!canUseRts) {
3071
- let t9;
3072
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
3073
- t9 = {};
3074
- $[11] = t9;
3075
- } else t9 = $[11];
3076
- t8 = t9;
3077
- break bb0;
3078
- }
3079
- let t9;
3080
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
3081
- t9 = { $exists: false };
3082
- $[12] = t9;
3083
- } else t9 = $[12];
3084
- let base;
3085
- if ($[13] !== disabledTopics || $[14] !== trimmedUserId) {
3086
- base = {
3087
- userId: trimmedUserId,
3088
- archivedAt: t9
3089
- };
3090
- if (disabledTopics.length > 0) {
3091
- let t10;
3092
- if ($[16] !== disabledTopics) {
3093
- t10 = { $nin: disabledTopics };
3094
- $[16] = disabledTopics;
3095
- $[17] = t10;
3096
- } else t10 = $[17];
3097
- base.topic = t10;
3098
- }
3099
- $[13] = disabledTopics;
3100
- $[14] = trimmedUserId;
3101
- $[15] = base;
3102
- } else base = $[15];
3103
- t8 = base;
3104
- }
3105
- const query = t8;
3106
- let t9;
3107
- if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
3108
- t9 = { createdAt: -1 };
3109
- $[18] = t9;
3110
- } else t9 = $[18];
3111
- let t10;
3112
- if ($[19] !== canUseRts || $[20] !== limit) {
3113
- t10 = {
3114
- key: "rb.notifications",
3115
- sort: t9,
3116
- limit,
3117
- enabled: canUseRts
2976
+ const settings = useQuery("RBNotificationSettings", useMemo(() => canUseRts ? { userId: trimmedUserId } : {}, [canUseRts, trimmedUserId]), useMemo(() => ({
2977
+ key: "rb.notifications.settings",
2978
+ limit: 1,
2979
+ enabled: canUseRts
2980
+ }), [canUseRts])).data?.[0] ?? null;
2981
+ const disabledTopics = useMemo(() => buildDisabledTopics(settings), [settings]);
2982
+ const query = useMemo(() => {
2983
+ if (!canUseRts) return {};
2984
+ const base = {
2985
+ userId: trimmedUserId,
2986
+ archivedAt: { $exists: false }
3118
2987
  };
3119
- $[19] = canUseRts;
3120
- $[20] = limit;
3121
- $[21] = t10;
3122
- } else t10 = $[21];
3123
- const notificationsQuery = useQuery("RBNotification", query, t10);
3124
- let t11;
3125
- if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
3126
- t11 = { createdAt: -1 };
3127
- $[22] = t11;
3128
- } else t11 = $[22];
3129
- let t12;
3130
- if ($[23] !== canUseRts || $[24] !== limit) {
3131
- t12 = {
3132
- key: "rb.notification-deliveries",
3133
- sort: t11,
3134
- limit,
3135
- enabled: canUseRts
3136
- };
3137
- $[23] = canUseRts;
3138
- $[24] = limit;
3139
- $[25] = t12;
3140
- } else t12 = $[25];
3141
- const notificationDeliveriesQuery = useQuery("RBNotificationDelivery", query, t12);
3142
- let t13;
3143
- bb1: {
2988
+ if (disabledTopics.length > 0) base.topic = { $nin: disabledTopics };
2989
+ return base;
2990
+ }, [
2991
+ canUseRts,
2992
+ disabledTopics,
2993
+ trimmedUserId
2994
+ ]);
2995
+ const notificationsQuery = useQuery("RBNotification", query, useMemo(() => ({
2996
+ key: "rb.notifications",
2997
+ sort: { createdAt: -1 },
2998
+ limit,
2999
+ enabled: canUseRts
3000
+ }), [canUseRts, limit]));
3001
+ const notificationDeliveriesQuery = useQuery("RBNotificationDelivery", query, useMemo(() => ({
3002
+ key: "rb.notification-deliveries",
3003
+ sort: { createdAt: -1 },
3004
+ limit,
3005
+ enabled: canUseRts
3006
+ }), [canUseRts, limit]));
3007
+ const notifications = useMemo(() => {
3144
3008
  const raw = notificationsQuery.data;
3145
- if (!Array.isArray(raw)) {
3146
- let t14;
3147
- if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
3148
- t14 = [];
3149
- $[26] = t14;
3150
- } else t14 = $[26];
3151
- t13 = t14;
3152
- break bb1;
3153
- }
3154
- let t14;
3155
- if ($[27] !== raw) {
3156
- t14 = raw.map(_temp).filter(_temp2);
3157
- $[27] = raw;
3158
- $[28] = t14;
3159
- } else t14 = $[28];
3160
- t13 = t14;
3161
- }
3162
- const notifications = t13;
3163
- let t14;
3164
- bb2: {
3009
+ if (!Array.isArray(raw)) return [];
3010
+ return raw.map((doc) => toNotificationItem(doc)).filter((n) => Boolean(n));
3011
+ }, [notificationsQuery.data]);
3012
+ const notificationDeliveries = useMemo(() => {
3165
3013
  const raw_0 = notificationDeliveriesQuery.data;
3166
- if (!Array.isArray(raw_0)) {
3167
- let t15;
3168
- if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
3169
- t15 = [];
3170
- $[29] = t15;
3171
- } else t15 = $[29];
3172
- t14 = t15;
3173
- break bb2;
3174
- }
3175
- let t15;
3176
- if ($[30] !== raw_0) {
3177
- t15 = raw_0.map(_temp3).filter(_temp4);
3178
- $[30] = raw_0;
3179
- $[31] = t15;
3180
- } else t15 = $[31];
3181
- t14 = t15;
3182
- }
3183
- const notificationDeliveries = t14;
3184
- let t15;
3185
- if ($[32] !== notifications) {
3186
- t15 = notifications.reduce(_temp5, 0);
3187
- $[32] = notifications;
3188
- $[33] = t15;
3189
- } else t15 = $[33];
3190
- const unreadCount = t15;
3191
- let t16;
3192
- if ($[34] !== notifications) {
3193
- t16 = notifications.reduce(_temp6, 0);
3194
- $[34] = notifications;
3195
- $[35] = t16;
3196
- } else t16 = $[35];
3197
- const unseenCount = t16;
3198
- let t17;
3199
- if ($[36] === Symbol.for("react.memo_cache_sentinel")) {
3200
- t17 = /* @__PURE__ */ new Set();
3201
- $[36] = t17;
3202
- } else t17 = $[36];
3203
- const lastToastDeliveryIds = useRef(t17);
3014
+ if (!Array.isArray(raw_0)) return [];
3015
+ return raw_0.map((doc_0) => toNotificationItem(doc_0)).filter((n_0) => Boolean(n_0));
3016
+ }, [notificationDeliveriesQuery.data]);
3017
+ const unreadCount = useMemo(() => notifications.reduce((acc, n_1) => acc + (n_1.readAt ? 0 : 1), 0), [notifications]);
3018
+ const unseenCount = useMemo(() => notifications.reduce((acc_0, n_2) => acc_0 + (n_2.seenAt ? 0 : 1), 0), [notifications]);
3019
+ const lastToastDeliveryIds = useRef(/* @__PURE__ */ new Set());
3204
3020
  const hasSeededToastIds = useRef(false);
3205
- let t18;
3206
- if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
3207
- t18 = Date.now();
3208
- $[37] = t18;
3209
- } else t18 = $[37];
3210
- const toastStartMs = useRef(t18);
3211
- let t19;
3212
- if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
3213
- t19 = /* @__PURE__ */ new Map();
3214
- $[38] = t19;
3215
- } else t19 = $[38];
3216
- const pendingInAppToastItems = useRef(t19);
3217
- let t20;
3218
- let t21;
3219
- if ($[39] !== canUseRts || $[40] !== location.pathname || $[41] !== location.search) {
3220
- t20 = () => {
3221
- if (!canUseRts) return;
3222
- markNotificationsReadByUrl(`${location.pathname}${location.search}`).then(_temp7).catch(_temp8);
3223
- };
3224
- t21 = [
3225
- canUseRts,
3226
- location.pathname,
3227
- location.search
3228
- ];
3229
- $[39] = canUseRts;
3230
- $[40] = location.pathname;
3231
- $[41] = location.search;
3232
- $[42] = t20;
3233
- $[43] = t21;
3234
- } else {
3235
- t20 = $[42];
3236
- t21 = $[43];
3237
- }
3238
- useEffect(t20, t21);
3239
- let t22;
3240
- if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
3241
- t22 = () => {
3242
- hasSeededToastIds.current = false;
3243
- lastToastDeliveryIds.current = /* @__PURE__ */ new Set();
3244
- toastStartMs.current = Date.now();
3245
- pendingInAppToastItems.current = /* @__PURE__ */ new Map();
3021
+ const toastStartMs = useRef(Date.now());
3022
+ const pendingInAppToastItems = useRef(/* @__PURE__ */ new Map());
3023
+ useEffect(() => {
3024
+ if (!canUseRts) return;
3025
+ markNotificationsReadByUrl(`${location.pathname}${location.search}`).then((result) => {
3026
+ if (result.modifiedCount > 0) window.dispatchEvent(new Event("rb-notifications-refresh"));
3027
+ }).catch(() => {});
3028
+ }, [
3029
+ canUseRts,
3030
+ location.pathname,
3031
+ location.search
3032
+ ]);
3033
+ useEffect(() => {
3034
+ hasSeededToastIds.current = false;
3035
+ lastToastDeliveryIds.current = /* @__PURE__ */ new Set();
3036
+ toastStartMs.current = Date.now();
3037
+ pendingInAppToastItems.current = /* @__PURE__ */ new Map();
3038
+ }, [normalizedAppName, trimmedUserId]);
3039
+ useEffect(() => {
3040
+ if (!canUseRts) return;
3041
+ if (typeof window === "undefined" || typeof document === "undefined") return;
3042
+ const writeState = () => writeNotificationTabState(trimmedUserId, normalizedAppName);
3043
+ const removeState = () => removeNotificationTabState(trimmedUserId, normalizedAppName);
3044
+ writeState();
3045
+ const intervalId = window.setInterval(writeState, ACTIVE_TAB_HEARTBEAT_MS);
3046
+ window.addEventListener("focus", writeState);
3047
+ window.addEventListener("blur", writeState);
3048
+ window.addEventListener("pageshow", writeState);
3049
+ window.addEventListener("pagehide", removeState);
3050
+ document.addEventListener("visibilitychange", writeState);
3051
+ return () => {
3052
+ window.clearInterval(intervalId);
3053
+ window.removeEventListener("focus", writeState);
3054
+ window.removeEventListener("blur", writeState);
3055
+ window.removeEventListener("pageshow", writeState);
3056
+ window.removeEventListener("pagehide", removeState);
3057
+ document.removeEventListener("visibilitychange", writeState);
3058
+ removeState();
3246
3059
  };
3247
- $[44] = t22;
3248
- } else t22 = $[44];
3249
- let t23;
3250
- if ($[45] !== normalizedAppName || $[46] !== trimmedUserId) {
3251
- t23 = [normalizedAppName, trimmedUserId];
3252
- $[45] = normalizedAppName;
3253
- $[46] = trimmedUserId;
3254
- $[47] = t23;
3255
- } else t23 = $[47];
3256
- useEffect(t22, t23);
3257
- let t24;
3258
- let t25;
3259
- if ($[48] !== canUseRts || $[49] !== normalizedAppName || $[50] !== trimmedUserId) {
3260
- t24 = () => {
3261
- if (!canUseRts) return;
3262
- if (typeof window === "undefined" || typeof document === "undefined") return;
3263
- const writeState = () => writeNotificationTabState(trimmedUserId, normalizedAppName);
3264
- const removeState = () => removeNotificationTabState(trimmedUserId, normalizedAppName);
3265
- writeState();
3266
- const intervalId = window.setInterval(writeState, ACTIVE_TAB_HEARTBEAT_MS);
3267
- window.addEventListener("focus", writeState);
3268
- window.addEventListener("blur", writeState);
3269
- window.addEventListener("pageshow", writeState);
3270
- window.addEventListener("pagehide", removeState);
3271
- document.addEventListener("visibilitychange", writeState);
3272
- return () => {
3273
- window.clearInterval(intervalId);
3274
- window.removeEventListener("focus", writeState);
3275
- window.removeEventListener("blur", writeState);
3276
- window.removeEventListener("pageshow", writeState);
3277
- window.removeEventListener("pagehide", removeState);
3278
- document.removeEventListener("visibilitychange", writeState);
3279
- removeState();
3280
- };
3060
+ }, [
3061
+ canUseRts,
3062
+ normalizedAppName,
3063
+ trimmedUserId
3064
+ ]);
3065
+ useEffect(() => {
3066
+ if (!canUseRts) return;
3067
+ if (typeof window === "undefined" || typeof document === "undefined") return;
3068
+ const handlePendingInAppToastFlush = () => {
3069
+ flushPendingInAppToasts(pendingInAppToastItems, trimmedUserId, normalizedAppName, renderNotificationToast);
3281
3070
  };
3282
- t25 = [
3283
- canUseRts,
3284
- normalizedAppName,
3285
- trimmedUserId
3286
- ];
3287
- $[48] = canUseRts;
3288
- $[49] = normalizedAppName;
3289
- $[50] = trimmedUserId;
3290
- $[51] = t24;
3291
- $[52] = t25;
3292
- } else {
3293
- t24 = $[51];
3294
- t25 = $[52];
3295
- }
3296
- useEffect(t24, t25);
3297
- let t26;
3298
- let t27;
3299
- if ($[53] !== canUseRts || $[54] !== normalizedAppName || $[55] !== renderNotificationToast || $[56] !== trimmedUserId) {
3300
- t26 = () => {
3301
- if (!canUseRts) return;
3302
- if (typeof window === "undefined" || typeof document === "undefined") return;
3303
- const handlePendingInAppToastFlush = () => {
3304
- flushPendingInAppToasts(pendingInAppToastItems, trimmedUserId, normalizedAppName, renderNotificationToast);
3305
- };
3306
- window.addEventListener("focus", handlePendingInAppToastFlush);
3307
- document.addEventListener("visibilitychange", handlePendingInAppToastFlush);
3308
- return () => {
3309
- window.removeEventListener("focus", handlePendingInAppToastFlush);
3310
- document.removeEventListener("visibilitychange", handlePendingInAppToastFlush);
3311
- };
3071
+ window.addEventListener("focus", handlePendingInAppToastFlush);
3072
+ document.addEventListener("visibilitychange", handlePendingInAppToastFlush);
3073
+ return () => {
3074
+ window.removeEventListener("focus", handlePendingInAppToastFlush);
3075
+ document.removeEventListener("visibilitychange", handlePendingInAppToastFlush);
3312
3076
  };
3313
- t27 = [
3314
- canUseRts,
3315
- normalizedAppName,
3316
- renderNotificationToast,
3317
- trimmedUserId
3318
- ];
3319
- $[53] = canUseRts;
3320
- $[54] = normalizedAppName;
3321
- $[55] = renderNotificationToast;
3322
- $[56] = trimmedUserId;
3323
- $[57] = t26;
3324
- $[58] = t27;
3325
- } else {
3326
- t26 = $[57];
3327
- t27 = $[58];
3328
- }
3329
- useEffect(t26, t27);
3330
- let t28;
3331
- let t29;
3332
- if ($[59] !== canUseRts || $[60] !== normalizedAppName || $[61] !== notificationDeliveries || $[62] !== notificationDeliveriesQuery.loading || $[63] !== renderNotificationToast || $[64] !== toastOnNew || $[65] !== trimmedUserId) {
3333
- t28 = () => {
3334
- if (!toastOnNew) return;
3335
- if (!canUseRts) return;
3336
- if (notificationDeliveriesQuery.loading) return;
3337
- if (!hasSeededToastIds.current) {
3338
- hasSeededToastIds.current = true;
3339
- lastToastDeliveryIds.current = new Set(notificationDeliveries.map(getNotificationDeliveryId));
3340
- const eligible = notificationDeliveries.filter((n_3) => {
3341
- const createdAtMs = Date.parse(n_3.createdAt);
3342
- if (!Number.isFinite(createdAtMs)) return false;
3343
- return createdAtMs >= toastStartMs.current - NEW_NOTIFICATION_START_TOLERANCE_MS;
3344
- });
3345
- if (eligible.length) showNotificationsForCurrentFocusState(eligible, trimmedUserId, normalizedAppName, renderNotificationToast).then((pending) => {
3346
- queuePendingInAppToasts(pendingInAppToastItems, pending, trimmedUserId, normalizedAppName, renderNotificationToast);
3347
- });
3348
- return;
3349
- }
3350
- const nextNew = notificationDeliveries.filter((n_4) => !lastToastDeliveryIds.current.has(getNotificationDeliveryId(n_4)));
3351
- if (!nextNew.length) return;
3352
- for (const n_5 of nextNew) lastToastDeliveryIds.current.add(getNotificationDeliveryId(n_5));
3353
- const eligible_0 = nextNew.filter((n_6) => {
3354
- const createdAtMs_0 = Date.parse(n_6.createdAt);
3355
- if (!Number.isFinite(createdAtMs_0)) return true;
3356
- return createdAtMs_0 >= toastStartMs.current;
3077
+ }, [
3078
+ canUseRts,
3079
+ normalizedAppName,
3080
+ renderNotificationToast,
3081
+ trimmedUserId
3082
+ ]);
3083
+ useEffect(() => {
3084
+ if (!toastOnNew) return;
3085
+ if (!canUseRts) return;
3086
+ if (notificationDeliveriesQuery.loading) return;
3087
+ if (!hasSeededToastIds.current) {
3088
+ hasSeededToastIds.current = true;
3089
+ lastToastDeliveryIds.current = new Set(notificationDeliveries.map(getNotificationDeliveryId));
3090
+ const eligible = notificationDeliveries.filter((n_3) => {
3091
+ const createdAtMs = Date.parse(n_3.createdAt);
3092
+ if (!Number.isFinite(createdAtMs)) return false;
3093
+ return createdAtMs >= toastStartMs.current - NEW_NOTIFICATION_START_TOLERANCE_MS;
3357
3094
  });
3358
- if (!eligible_0.length) return;
3359
- showNotificationsForCurrentFocusState(eligible_0, trimmedUserId, normalizedAppName, renderNotificationToast).then((pending_0) => {
3360
- queuePendingInAppToasts(pendingInAppToastItems, pending_0, trimmedUserId, normalizedAppName, renderNotificationToast);
3095
+ if (eligible.length) showNotificationsForCurrentFocusState(eligible, trimmedUserId, normalizedAppName, renderNotificationToast).then((pending) => {
3096
+ queuePendingInAppToasts(pendingInAppToastItems, pending, trimmedUserId, normalizedAppName, renderNotificationToast);
3361
3097
  });
3362
- };
3363
- t29 = [
3364
- canUseRts,
3365
- normalizedAppName,
3366
- notificationDeliveries,
3367
- notificationDeliveriesQuery.loading,
3368
- renderNotificationToast,
3369
- toastOnNew,
3370
- trimmedUserId
3371
- ];
3372
- $[59] = canUseRts;
3373
- $[60] = normalizedAppName;
3374
- $[61] = notificationDeliveries;
3375
- $[62] = notificationDeliveriesQuery.loading;
3376
- $[63] = renderNotificationToast;
3377
- $[64] = toastOnNew;
3378
- $[65] = trimmedUserId;
3379
- $[66] = t28;
3380
- $[67] = t29;
3381
- } else {
3382
- t28 = $[66];
3383
- t29 = $[67];
3384
- }
3385
- useEffect(t28, t29);
3386
- let t30;
3387
- if ($[68] !== notifications || $[69] !== notificationsQuery.error || $[70] !== notificationsQuery.loading || $[71] !== unreadCount || $[72] !== unseenCount) {
3388
- t30 = {
3389
- notifications,
3390
- unreadCount,
3391
- unseenCount,
3392
- loading: notificationsQuery.loading,
3393
- error: notificationsQuery.error
3394
- };
3395
- $[68] = notifications;
3396
- $[69] = notificationsQuery.error;
3397
- $[70] = notificationsQuery.loading;
3398
- $[71] = unreadCount;
3399
- $[72] = unseenCount;
3400
- $[73] = t30;
3401
- } else t30 = $[73];
3402
- const t31 = canUseRts ? t30 : null;
3403
- let t32;
3404
- if ($[74] === Symbol.for("react.memo_cache_sentinel")) {
3405
- t32 = /* @__PURE__ */ jsx("style", { children: notificationToastStyles });
3406
- $[74] = t32;
3407
- } else t32 = $[74];
3408
- let t33;
3409
- if ($[75] !== children || $[76] !== t31) {
3410
- t33 = /* @__PURE__ */ jsxs(NotificationsRealtimeContext.Provider, {
3411
- value: t31,
3412
- children: [t32, children]
3098
+ return;
3099
+ }
3100
+ const nextNew = notificationDeliveries.filter((n_4) => !lastToastDeliveryIds.current.has(getNotificationDeliveryId(n_4)));
3101
+ if (!nextNew.length) return;
3102
+ for (const n_5 of nextNew) lastToastDeliveryIds.current.add(getNotificationDeliveryId(n_5));
3103
+ const eligible_0 = nextNew.filter((n_6) => {
3104
+ const createdAtMs_0 = Date.parse(n_6.createdAt);
3105
+ if (!Number.isFinite(createdAtMs_0)) return true;
3106
+ return createdAtMs_0 >= toastStartMs.current;
3413
3107
  });
3414
- $[75] = children;
3415
- $[76] = t31;
3416
- $[77] = t33;
3417
- } else t33 = $[77];
3418
- return t33;
3419
- }
3420
- function _temp8() {}
3421
- function _temp7(result) {
3422
- if (result.modifiedCount > 0) window.dispatchEvent(new Event("rb-notifications-refresh"));
3423
- }
3424
- function _temp6(acc_0, n_2) {
3425
- return acc_0 + (n_2.seenAt ? 0 : 1);
3426
- }
3427
- function _temp5(acc, n_1) {
3428
- return acc + (n_1.readAt ? 0 : 1);
3429
- }
3430
- function _temp4(n_0) {
3431
- return Boolean(n_0);
3432
- }
3433
- function _temp3(doc_0) {
3434
- return toNotificationItem(doc_0);
3435
- }
3436
- function _temp2(n) {
3437
- return Boolean(n);
3438
- }
3439
- function _temp(doc) {
3440
- return toNotificationItem(doc);
3108
+ if (!eligible_0.length) return;
3109
+ showNotificationsForCurrentFocusState(eligible_0, trimmedUserId, normalizedAppName, renderNotificationToast).then((pending_0) => {
3110
+ queuePendingInAppToasts(pendingInAppToastItems, pending_0, trimmedUserId, normalizedAppName, renderNotificationToast);
3111
+ });
3112
+ }, [
3113
+ canUseRts,
3114
+ normalizedAppName,
3115
+ notificationDeliveries,
3116
+ notificationDeliveriesQuery.loading,
3117
+ renderNotificationToast,
3118
+ toastOnNew,
3119
+ trimmedUserId
3120
+ ]);
3121
+ const value = useMemo(() => ({
3122
+ notifications,
3123
+ unreadCount,
3124
+ unseenCount,
3125
+ loading: notificationsQuery.loading,
3126
+ error: notificationsQuery.error
3127
+ }), [
3128
+ notifications,
3129
+ notificationsQuery.error,
3130
+ notificationsQuery.loading,
3131
+ unreadCount,
3132
+ unseenCount
3133
+ ]);
3134
+ return /* @__PURE__ */ jsxs(NotificationsRealtimeContext.Provider, {
3135
+ value: canUseRts ? value : null,
3136
+ children: [/* @__PURE__ */ jsx("style", { children: notificationToastStyles }), children]
3137
+ });
3441
3138
  }
3442
3139
  var useNotificationsRealtime = () => {
3443
3140
  return useContext(NotificationsRealtimeContext);