@rpcbase/client 0.459.0 → 0.461.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
@@ -373,7 +373,7 @@ const Toaster = () => {
373
373
  } else {
374
374
  t0 = $[0];
375
375
  }
376
- useEffect(_temp8, t0);
376
+ useEffect(_temp8$1, t0);
377
377
  const requested = useSyncExternalStore(subscribeToasterRequested, getToasterRequested, getToasterRequested);
378
378
  if (!requested) {
379
379
  return null;
@@ -416,23 +416,23 @@ function _temp4$1() {
416
416
  function _temp5$1() {
417
417
  return startToaster();
418
418
  }
419
- function _temp6() {
419
+ function _temp6$1() {
420
420
  return startToaster();
421
421
  }
422
- function _temp7() {
422
+ function _temp7$1() {
423
423
  if (typeof window.requestIdleCallback === "function") {
424
424
  window.requestIdleCallback(_temp5$1, {
425
425
  timeout: 2e3
426
426
  });
427
427
  return;
428
428
  }
429
- window.setTimeout(_temp6, 150);
429
+ window.setTimeout(_temp6$1, 150);
430
430
  }
431
- function _temp8() {
431
+ function _temp8$1() {
432
432
  if (typeof window === "undefined") {
433
433
  return;
434
434
  }
435
- const startDeferred = _temp7;
435
+ const startDeferred = _temp7$1;
436
436
  if (isPageLoaded()) {
437
437
  startDeferred();
438
438
  return;
@@ -2566,13 +2566,15 @@ const toIso = (value) => {
2566
2566
  return void 0;
2567
2567
  };
2568
2568
  const toNotificationItem = (doc) => {
2569
- const id = typeof doc._id === "string" ? doc._id : String(doc._id ?? "");
2569
+ const rawId = doc.notificationId ?? doc._id;
2570
+ const id = typeof rawId === "string" ? rawId : String(rawId ?? "");
2570
2571
  if (!id) return null;
2571
2572
  if (typeof doc.title !== "string") return null;
2572
2573
  return {
2573
2574
  id,
2574
2575
  topic: typeof doc.topic === "string" ? doc.topic : void 0,
2575
2576
  tag: typeof doc.tag === "string" ? doc.tag : void 0,
2577
+ deliveryId: typeof doc.deliveryId === "string" ? doc.deliveryId : void 0,
2576
2578
  title: doc.title,
2577
2579
  body: doc.body,
2578
2580
  image: doc.image,
@@ -2644,6 +2646,7 @@ const getScopedNotificationKey = (userId, appName) => `${encodeURIComponent(appN
2644
2646
  const getTabStateKey = (userId, appName) => `${TAB_STATE_KEY_PREFIX}${getScopedNotificationKey(userId, appName)}:${NOTIFICATION_TAB_ID}`;
2645
2647
  const getTabStateKeyPrefix = (userId, appName) => `${TAB_STATE_KEY_PREFIX}${getScopedNotificationKey(userId, appName)}:`;
2646
2648
  const getDeliveryKey = (userId, appName, mode, notificationId) => `${DELIVERY_KEY_PREFIX}${mode}:${getScopedNotificationKey(userId, appName)}:${encodeURIComponent(notificationId)}`;
2649
+ const getNotificationDeliveryId = (item) => item.deliveryId ?? `${item.id}:${item.createdAt}`;
2647
2650
  const getDeliveryLockName = (userId, appName) => `${DELIVERY_LOCK_PREFIX}${getScopedNotificationKey(userId, appName)}`;
2648
2651
  const getFallbackDeliveryLockKey = (userId, appName) => `${FALLBACK_DELIVERY_LOCK_KEY_PREFIX}${getScopedNotificationKey(userId, appName)}`;
2649
2652
  const getLocalStorage = () => {
@@ -2734,20 +2737,20 @@ const removeNotificationDeliveryMarkers = (items, userId, appName, mode) => {
2734
2737
  if (!storage) return;
2735
2738
  try {
2736
2739
  for (const item of items) {
2737
- storage.removeItem(getDeliveryKey(userId, appName, mode, item.id));
2740
+ storage.removeItem(getDeliveryKey(userId, appName, mode, getNotificationDeliveryId(item)));
2738
2741
  }
2739
2742
  } catch {
2740
2743
  return;
2741
2744
  }
2742
2745
  };
2743
- const filterNotificationsWithoutDelivery = (items, userId, appName, mode) => items.filter((item) => !hasRecentNotificationDelivery(userId, appName, mode, item.id));
2746
+ const filterNotificationsWithoutDelivery = (items, userId, appName, mode) => items.filter((item) => !hasRecentNotificationDelivery(userId, appName, mode, getNotificationDeliveryId(item)));
2744
2747
  const claimNotificationDeliveriesFromStorage = (items, userId, appName, mode) => {
2745
2748
  const storage = getLocalStorage();
2746
2749
  if (!storage) return items;
2747
2750
  const now = Date.now();
2748
2751
  const claimed = [];
2749
2752
  for (const item of items) {
2750
- const key = getDeliveryKey(userId, appName, mode, item.id);
2753
+ const key = getDeliveryKey(userId, appName, mode, getNotificationDeliveryId(item));
2751
2754
  const current = parseJsonRecord(storage.getItem(key));
2752
2755
  const deliveredAt = typeof current?.deliveredAt === "number" ? current.deliveredAt : 0;
2753
2756
  if (deliveredAt && now - deliveredAt < DELIVERY_TTL_MS) continue;
@@ -2838,7 +2841,7 @@ const claimNotificationDeliveries = async (items, userId, appName, mode) => {
2838
2841
  };
2839
2842
  const showCustomInAppNotification = (item, renderer) => {
2840
2843
  const action = getNotificationAction(item);
2841
- let toastId = item.tag ? `${NATIVE_NOTIFICATION_TAG_PREFIX}:${encodeURIComponent(item.tag)}` : void 0;
2844
+ let toastId;
2842
2845
  const controls = {
2843
2846
  dismiss: () => {
2844
2847
  if (toastId !== void 0) toast.dismiss(toastId);
@@ -2852,7 +2855,6 @@ const showCustomInAppNotification = (item, renderer) => {
2852
2855
  const content = renderer(item, controls);
2853
2856
  if (content === null || content === void 0) return false;
2854
2857
  toastId = toast.custom(() => /* @__PURE__ */ jsx(Fragment, { children: content }), {
2855
- id: toastId,
2856
2858
  position: "top-right"
2857
2859
  });
2858
2860
  return true;
@@ -2873,7 +2875,6 @@ const showInAppNotifications = (items, renderNotificationToast) => {
2873
2875
  if (renderNotificationToast && showCustomInAppNotification(item, renderNotificationToast)) continue;
2874
2876
  toast(item.title, {
2875
2877
  ...notificationToastOptions,
2876
- id: item.tag ? `${NATIVE_NOTIFICATION_TAG_PREFIX}:${encodeURIComponent(item.tag)}` : void 0,
2877
2878
  description: item.body
2878
2879
  });
2879
2880
  }
@@ -2894,7 +2895,7 @@ const getNativeNotificationOptions = (item) => {
2894
2895
  return {
2895
2896
  body: item.body,
2896
2897
  icon: item.image,
2897
- tag: `${NATIVE_NOTIFICATION_TAG_PREFIX}:${encodeURIComponent(item.tag ?? item.id)}`,
2898
+ tag: `${NATIVE_NOTIFICATION_TAG_PREFIX}:${encodeURIComponent(getNotificationDeliveryId(item))}`,
2898
2899
  data: {
2899
2900
  ...item.data,
2900
2901
  notificationId: item.id,
@@ -2972,12 +2973,12 @@ const flushPendingInAppToasts = (pendingInAppToastItems, userId, appName, render
2972
2973
  };
2973
2974
  const queuePendingInAppToasts = (pendingInAppToastItems, items, userId, appName, renderNotificationToast) => {
2974
2975
  for (const item of items) {
2975
- pendingInAppToastItems.current.set(item.id, item);
2976
+ pendingInAppToastItems.current.set(getNotificationDeliveryId(item), item);
2976
2977
  }
2977
2978
  flushPendingInAppToasts(pendingInAppToastItems, userId, appName, renderNotificationToast);
2978
2979
  };
2979
2980
  function NotificationsRealtimeProvider(t0) {
2980
- const $ = c(66);
2981
+ const $ = c(78);
2981
2982
  const {
2982
2983
  userId,
2983
2984
  appName,
@@ -2988,6 +2989,7 @@ function NotificationsRealtimeProvider(t0) {
2988
2989
  } = t0;
2989
2990
  const limit = t1 === void 0 ? 200 : t1;
2990
2991
  const toastOnNew = t2 === void 0 ? true : t2;
2992
+ const location = useLocation();
2991
2993
  let t3;
2992
2994
  if ($[0] !== userId) {
2993
2995
  t3 = typeof userId === "string" ? userId.trim() : "";
@@ -3116,99 +3118,168 @@ function NotificationsRealtimeProvider(t0) {
3116
3118
  }
3117
3119
  const notificationsQuery = useQuery("RBNotification", query, t10);
3118
3120
  let t11;
3121
+ if ($[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3122
+ t11 = {
3123
+ createdAt: -1
3124
+ };
3125
+ $[22] = t11;
3126
+ } else {
3127
+ t11 = $[22];
3128
+ }
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 {
3141
+ t12 = $[25];
3142
+ }
3143
+ const notificationDeliveriesQuery = useQuery("RBNotificationDelivery", query, t12);
3144
+ let t13;
3119
3145
  bb1: {
3120
3146
  const raw = notificationsQuery.data;
3121
3147
  if (!Array.isArray(raw)) {
3122
- let t123;
3123
- if ($[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3124
- t123 = [];
3125
- $[22] = t123;
3148
+ let t143;
3149
+ if ($[26] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3150
+ t143 = [];
3151
+ $[26] = t143;
3126
3152
  } else {
3127
- t123 = $[22];
3153
+ t143 = $[26];
3128
3154
  }
3129
- t11 = t123;
3155
+ t13 = t143;
3130
3156
  break bb1;
3131
3157
  }
3132
- let t122;
3133
- if ($[23] !== raw) {
3134
- t122 = raw.map(_temp).filter(_temp2);
3135
- $[23] = raw;
3136
- $[24] = t122;
3158
+ let t142;
3159
+ if ($[27] !== raw) {
3160
+ t142 = raw.map(_temp).filter(_temp2);
3161
+ $[27] = raw;
3162
+ $[28] = t142;
3137
3163
  } else {
3138
- t122 = $[24];
3164
+ t142 = $[28];
3139
3165
  }
3140
- t11 = t122;
3166
+ t13 = t142;
3141
3167
  }
3142
- const notifications = t11;
3143
- let t12;
3144
- if ($[25] !== notifications) {
3145
- t12 = notifications.reduce(_temp3, 0);
3146
- $[25] = notifications;
3147
- $[26] = t12;
3168
+ const notifications = t13;
3169
+ let t14;
3170
+ bb2: {
3171
+ const raw_0 = notificationDeliveriesQuery.data;
3172
+ if (!Array.isArray(raw_0)) {
3173
+ let t153;
3174
+ if ($[29] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3175
+ t153 = [];
3176
+ $[29] = t153;
3177
+ } else {
3178
+ t153 = $[29];
3179
+ }
3180
+ t14 = t153;
3181
+ break bb2;
3182
+ }
3183
+ let t152;
3184
+ if ($[30] !== raw_0) {
3185
+ t152 = raw_0.map(_temp3).filter(_temp4);
3186
+ $[30] = raw_0;
3187
+ $[31] = t152;
3188
+ } else {
3189
+ t152 = $[31];
3190
+ }
3191
+ t14 = t152;
3192
+ }
3193
+ const notificationDeliveries = t14;
3194
+ let t15;
3195
+ if ($[32] !== notifications) {
3196
+ t15 = notifications.reduce(_temp5, 0);
3197
+ $[32] = notifications;
3198
+ $[33] = t15;
3148
3199
  } else {
3149
- t12 = $[26];
3200
+ t15 = $[33];
3150
3201
  }
3151
- const unreadCount = t12;
3152
- let t13;
3153
- if ($[27] !== notifications) {
3154
- t13 = notifications.reduce(_temp4, 0);
3155
- $[27] = notifications;
3156
- $[28] = t13;
3202
+ const unreadCount = t15;
3203
+ let t16;
3204
+ if ($[34] !== notifications) {
3205
+ t16 = notifications.reduce(_temp6, 0);
3206
+ $[34] = notifications;
3207
+ $[35] = t16;
3157
3208
  } else {
3158
- t13 = $[28];
3209
+ t16 = $[35];
3159
3210
  }
3160
- const unseenCount = t13;
3161
- let t14;
3162
- if ($[29] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3163
- t14 = /* @__PURE__ */ new Set();
3164
- $[29] = t14;
3211
+ const unseenCount = t16;
3212
+ let t17;
3213
+ if ($[36] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3214
+ t17 = /* @__PURE__ */ new Set();
3215
+ $[36] = t17;
3165
3216
  } else {
3166
- t14 = $[29];
3217
+ t17 = $[36];
3167
3218
  }
3168
- const lastToastIds = useRef(t14);
3219
+ const lastToastDeliveryIds = useRef(t17);
3169
3220
  const hasSeededToastIds = useRef(false);
3170
- let t15;
3171
- if ($[30] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3172
- t15 = Date.now();
3173
- $[30] = t15;
3221
+ let t18;
3222
+ if ($[37] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3223
+ t18 = Date.now();
3224
+ $[37] = t18;
3174
3225
  } else {
3175
- t15 = $[30];
3226
+ t18 = $[37];
3176
3227
  }
3177
- const toastStartMs = useRef(t15);
3178
- let t16;
3179
- if ($[31] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3180
- t16 = /* @__PURE__ */ new Map();
3181
- $[31] = t16;
3228
+ const toastStartMs = useRef(t18);
3229
+ let t19;
3230
+ if ($[38] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3231
+ t19 = /* @__PURE__ */ new Map();
3232
+ $[38] = t19;
3182
3233
  } else {
3183
- t16 = $[31];
3234
+ t19 = $[38];
3184
3235
  }
3185
- const pendingInAppToastItems = useRef(t16);
3186
- let t17;
3187
- if ($[32] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3188
- t17 = () => {
3236
+ const pendingInAppToastItems = useRef(t19);
3237
+ let t20;
3238
+ let t21;
3239
+ if ($[39] !== canUseRts || $[40] !== location.pathname || $[41] !== location.search) {
3240
+ t20 = () => {
3241
+ if (!canUseRts) {
3242
+ return;
3243
+ }
3244
+ markNotificationsReadByUrl(`${location.pathname}${location.search}`).then(_temp7).catch(_temp8);
3245
+ };
3246
+ t21 = [canUseRts, location.pathname, location.search];
3247
+ $[39] = canUseRts;
3248
+ $[40] = location.pathname;
3249
+ $[41] = location.search;
3250
+ $[42] = t20;
3251
+ $[43] = t21;
3252
+ } else {
3253
+ t20 = $[42];
3254
+ t21 = $[43];
3255
+ }
3256
+ useEffect(t20, t21);
3257
+ let t22;
3258
+ if ($[44] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3259
+ t22 = () => {
3189
3260
  hasSeededToastIds.current = false;
3190
- lastToastIds.current = /* @__PURE__ */ new Set();
3261
+ lastToastDeliveryIds.current = /* @__PURE__ */ new Set();
3191
3262
  toastStartMs.current = Date.now();
3192
3263
  pendingInAppToastItems.current = /* @__PURE__ */ new Map();
3193
3264
  };
3194
- $[32] = t17;
3265
+ $[44] = t22;
3195
3266
  } else {
3196
- t17 = $[32];
3267
+ t22 = $[44];
3197
3268
  }
3198
- let t18;
3199
- if ($[33] !== normalizedAppName || $[34] !== trimmedUserId) {
3200
- t18 = [normalizedAppName, trimmedUserId];
3201
- $[33] = normalizedAppName;
3202
- $[34] = trimmedUserId;
3203
- $[35] = t18;
3269
+ let t23;
3270
+ if ($[45] !== normalizedAppName || $[46] !== trimmedUserId) {
3271
+ t23 = [normalizedAppName, trimmedUserId];
3272
+ $[45] = normalizedAppName;
3273
+ $[46] = trimmedUserId;
3274
+ $[47] = t23;
3204
3275
  } else {
3205
- t18 = $[35];
3276
+ t23 = $[47];
3206
3277
  }
3207
- useEffect(t17, t18);
3208
- let t19;
3209
- let t20;
3210
- if ($[36] !== canUseRts || $[37] !== normalizedAppName || $[38] !== trimmedUserId) {
3211
- t19 = () => {
3278
+ useEffect(t22, t23);
3279
+ let t24;
3280
+ let t25;
3281
+ if ($[48] !== canUseRts || $[49] !== normalizedAppName || $[50] !== trimmedUserId) {
3282
+ t24 = () => {
3212
3283
  if (!canUseRts) {
3213
3284
  return;
3214
3285
  }
@@ -3234,21 +3305,21 @@ function NotificationsRealtimeProvider(t0) {
3234
3305
  removeState();
3235
3306
  };
3236
3307
  };
3237
- t20 = [canUseRts, normalizedAppName, trimmedUserId];
3238
- $[36] = canUseRts;
3239
- $[37] = normalizedAppName;
3240
- $[38] = trimmedUserId;
3241
- $[39] = t19;
3242
- $[40] = t20;
3308
+ t25 = [canUseRts, normalizedAppName, trimmedUserId];
3309
+ $[48] = canUseRts;
3310
+ $[49] = normalizedAppName;
3311
+ $[50] = trimmedUserId;
3312
+ $[51] = t24;
3313
+ $[52] = t25;
3243
3314
  } else {
3244
- t19 = $[39];
3245
- t20 = $[40];
3315
+ t24 = $[51];
3316
+ t25 = $[52];
3246
3317
  }
3247
- useEffect(t19, t20);
3248
- let t21;
3249
- let t22;
3250
- if ($[41] !== canUseRts || $[42] !== normalizedAppName || $[43] !== renderNotificationToast || $[44] !== trimmedUserId) {
3251
- t21 = () => {
3318
+ useEffect(t24, t25);
3319
+ let t26;
3320
+ let t27;
3321
+ if ($[53] !== canUseRts || $[54] !== normalizedAppName || $[55] !== renderNotificationToast || $[56] !== trimmedUserId) {
3322
+ t26 = () => {
3252
3323
  if (!canUseRts) {
3253
3324
  return;
3254
3325
  }
@@ -3265,35 +3336,35 @@ function NotificationsRealtimeProvider(t0) {
3265
3336
  document.removeEventListener("visibilitychange", handlePendingInAppToastFlush);
3266
3337
  };
3267
3338
  };
3268
- t22 = [canUseRts, normalizedAppName, renderNotificationToast, trimmedUserId];
3269
- $[41] = canUseRts;
3270
- $[42] = normalizedAppName;
3271
- $[43] = renderNotificationToast;
3272
- $[44] = trimmedUserId;
3273
- $[45] = t21;
3274
- $[46] = t22;
3275
- } else {
3276
- t21 = $[45];
3277
- t22 = $[46];
3278
- }
3279
- useEffect(t21, t22);
3280
- let t23;
3281
- let t24;
3282
- if ($[47] !== canUseRts || $[48] !== normalizedAppName || $[49] !== notifications || $[50] !== notificationsQuery.loading || $[51] !== renderNotificationToast || $[52] !== toastOnNew || $[53] !== trimmedUserId) {
3283
- t23 = () => {
3339
+ t27 = [canUseRts, normalizedAppName, renderNotificationToast, trimmedUserId];
3340
+ $[53] = canUseRts;
3341
+ $[54] = normalizedAppName;
3342
+ $[55] = renderNotificationToast;
3343
+ $[56] = trimmedUserId;
3344
+ $[57] = t26;
3345
+ $[58] = t27;
3346
+ } else {
3347
+ t26 = $[57];
3348
+ t27 = $[58];
3349
+ }
3350
+ useEffect(t26, t27);
3351
+ let t28;
3352
+ let t29;
3353
+ if ($[59] !== canUseRts || $[60] !== normalizedAppName || $[61] !== notificationDeliveries || $[62] !== notificationDeliveriesQuery.loading || $[63] !== renderNotificationToast || $[64] !== toastOnNew || $[65] !== trimmedUserId) {
3354
+ t28 = () => {
3284
3355
  if (!toastOnNew) {
3285
3356
  return;
3286
3357
  }
3287
3358
  if (!canUseRts) {
3288
3359
  return;
3289
3360
  }
3290
- if (notificationsQuery.loading) {
3361
+ if (notificationDeliveriesQuery.loading) {
3291
3362
  return;
3292
3363
  }
3293
3364
  if (!hasSeededToastIds.current) {
3294
3365
  hasSeededToastIds.current = true;
3295
- lastToastIds.current = new Set(notifications.map(_temp5));
3296
- const eligible = notifications.filter((n_3) => {
3366
+ lastToastDeliveryIds.current = new Set(notificationDeliveries.map(getNotificationDeliveryId));
3367
+ const eligible = notificationDeliveries.filter((n_3) => {
3297
3368
  const createdAtMs = Date.parse(n_3.createdAt);
3298
3369
  if (!Number.isFinite(createdAtMs)) {
3299
3370
  return false;
@@ -3307,12 +3378,12 @@ function NotificationsRealtimeProvider(t0) {
3307
3378
  }
3308
3379
  return;
3309
3380
  }
3310
- const nextNew = notifications.filter((n_4) => !lastToastIds.current.has(n_4.id));
3381
+ const nextNew = notificationDeliveries.filter((n_4) => !lastToastDeliveryIds.current.has(getNotificationDeliveryId(n_4)));
3311
3382
  if (!nextNew.length) {
3312
3383
  return;
3313
3384
  }
3314
3385
  for (const n_5 of nextNew) {
3315
- lastToastIds.current.add(n_5.id);
3386
+ lastToastDeliveryIds.current.add(getNotificationDeliveryId(n_5));
3316
3387
  }
3317
3388
  const eligible_0 = nextNew.filter((n_6) => {
3318
3389
  const createdAtMs_0 = Date.parse(n_6.createdAt);
@@ -3328,70 +3399,80 @@ function NotificationsRealtimeProvider(t0) {
3328
3399
  queuePendingInAppToasts(pendingInAppToastItems, pending_0, trimmedUserId, normalizedAppName, renderNotificationToast);
3329
3400
  });
3330
3401
  };
3331
- t24 = [canUseRts, normalizedAppName, notifications, notificationsQuery.loading, renderNotificationToast, toastOnNew, trimmedUserId];
3332
- $[47] = canUseRts;
3333
- $[48] = normalizedAppName;
3334
- $[49] = notifications;
3335
- $[50] = notificationsQuery.loading;
3336
- $[51] = renderNotificationToast;
3337
- $[52] = toastOnNew;
3338
- $[53] = trimmedUserId;
3339
- $[54] = t23;
3340
- $[55] = t24;
3341
- } else {
3342
- t23 = $[54];
3343
- t24 = $[55];
3344
- }
3345
- useEffect(t23, t24);
3346
- let t25;
3347
- if ($[56] !== notifications || $[57] !== notificationsQuery.error || $[58] !== notificationsQuery.loading || $[59] !== unreadCount || $[60] !== unseenCount) {
3348
- t25 = {
3402
+ t29 = [canUseRts, normalizedAppName, notificationDeliveries, notificationDeliveriesQuery.loading, renderNotificationToast, toastOnNew, trimmedUserId];
3403
+ $[59] = canUseRts;
3404
+ $[60] = normalizedAppName;
3405
+ $[61] = notificationDeliveries;
3406
+ $[62] = notificationDeliveriesQuery.loading;
3407
+ $[63] = renderNotificationToast;
3408
+ $[64] = toastOnNew;
3409
+ $[65] = trimmedUserId;
3410
+ $[66] = t28;
3411
+ $[67] = t29;
3412
+ } else {
3413
+ t28 = $[66];
3414
+ t29 = $[67];
3415
+ }
3416
+ useEffect(t28, t29);
3417
+ let t30;
3418
+ if ($[68] !== notifications || $[69] !== notificationsQuery.error || $[70] !== notificationsQuery.loading || $[71] !== unreadCount || $[72] !== unseenCount) {
3419
+ t30 = {
3349
3420
  notifications,
3350
3421
  unreadCount,
3351
3422
  unseenCount,
3352
3423
  loading: notificationsQuery.loading,
3353
3424
  error: notificationsQuery.error
3354
3425
  };
3355
- $[56] = notifications;
3356
- $[57] = notificationsQuery.error;
3357
- $[58] = notificationsQuery.loading;
3358
- $[59] = unreadCount;
3359
- $[60] = unseenCount;
3360
- $[61] = t25;
3426
+ $[68] = notifications;
3427
+ $[69] = notificationsQuery.error;
3428
+ $[70] = notificationsQuery.loading;
3429
+ $[71] = unreadCount;
3430
+ $[72] = unseenCount;
3431
+ $[73] = t30;
3361
3432
  } else {
3362
- t25 = $[61];
3363
- }
3364
- const value = t25;
3365
- const t26 = canUseRts ? value : null;
3366
- let t27;
3367
- if ($[62] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3368
- t27 = /* @__PURE__ */ jsx("style", { children: notificationToastStyles });
3369
- $[62] = t27;
3433
+ t30 = $[73];
3434
+ }
3435
+ const value = t30;
3436
+ const t31 = canUseRts ? value : null;
3437
+ let t32;
3438
+ if ($[74] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3439
+ t32 = /* @__PURE__ */ jsx("style", { children: notificationToastStyles });
3440
+ $[74] = t32;
3370
3441
  } else {
3371
- t27 = $[62];
3442
+ t32 = $[74];
3372
3443
  }
3373
- let t28;
3374
- if ($[63] !== children || $[64] !== t26) {
3375
- t28 = /* @__PURE__ */ jsxs(NotificationsRealtimeContext.Provider, { value: t26, children: [
3376
- t27,
3444
+ let t33;
3445
+ if ($[75] !== children || $[76] !== t31) {
3446
+ t33 = /* @__PURE__ */ jsxs(NotificationsRealtimeContext.Provider, { value: t31, children: [
3447
+ t32,
3377
3448
  children
3378
3449
  ] });
3379
- $[63] = children;
3380
- $[64] = t26;
3381
- $[65] = t28;
3450
+ $[75] = children;
3451
+ $[76] = t31;
3452
+ $[77] = t33;
3382
3453
  } else {
3383
- t28 = $[65];
3454
+ t33 = $[77];
3455
+ }
3456
+ return t33;
3457
+ }
3458
+ function _temp8() {
3459
+ }
3460
+ function _temp7(result) {
3461
+ if (result.modifiedCount > 0) {
3462
+ window.dispatchEvent(new Event("rb-notifications-refresh"));
3384
3463
  }
3385
- return t28;
3386
3464
  }
3387
- function _temp5(n_2) {
3388
- return n_2.id;
3465
+ function _temp6(acc_0, n_2) {
3466
+ return acc_0 + (n_2.seenAt ? 0 : 1);
3467
+ }
3468
+ function _temp5(acc, n_1) {
3469
+ return acc + (n_1.readAt ? 0 : 1);
3389
3470
  }
3390
- function _temp4(acc_0, n_1) {
3391
- return acc_0 + (n_1.seenAt ? 0 : 1);
3471
+ function _temp4(n_0) {
3472
+ return Boolean(n_0);
3392
3473
  }
3393
- function _temp3(acc, n_0) {
3394
- return acc + (n_0.readAt ? 0 : 1);
3474
+ function _temp3(doc_0) {
3475
+ return toNotificationItem(doc_0);
3395
3476
  }
3396
3477
  function _temp2(n) {
3397
3478
  return Boolean(n);