@rpcbase/client 0.460.0 → 0.462.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;
@@ -419,7 +419,7 @@ function _temp5$1() {
419
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
@@ -428,11 +428,11 @@ function _temp7() {
428
428
  }
429
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;
@@ -2978,7 +2978,7 @@ const queuePendingInAppToasts = (pendingInAppToastItems, items, userId, appName,
2978
2978
  flushPendingInAppToasts(pendingInAppToastItems, userId, appName, renderNotificationToast);
2979
2979
  };
2980
2980
  function NotificationsRealtimeProvider(t0) {
2981
- const $ = c(73);
2981
+ const $ = c(78);
2982
2982
  const {
2983
2983
  userId,
2984
2984
  appName,
@@ -2989,6 +2989,7 @@ function NotificationsRealtimeProvider(t0) {
2989
2989
  } = t0;
2990
2990
  const limit = t1 === void 0 ? 200 : t1;
2991
2991
  const toastOnNew = t2 === void 0 ? true : t2;
2992
+ const location = useLocation();
2992
2993
  let t3;
2993
2994
  if ($[0] !== userId) {
2994
2995
  t3 = typeof userId === "string" ? userId.trim() : "";
@@ -3234,31 +3235,51 @@ function NotificationsRealtimeProvider(t0) {
3234
3235
  }
3235
3236
  const pendingInAppToastItems = useRef(t19);
3236
3237
  let t20;
3237
- if ($[39] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3238
+ let t21;
3239
+ if ($[39] !== canUseRts || $[40] !== location.pathname || $[41] !== location.search) {
3238
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 = () => {
3239
3260
  hasSeededToastIds.current = false;
3240
3261
  lastToastDeliveryIds.current = /* @__PURE__ */ new Set();
3241
3262
  toastStartMs.current = Date.now();
3242
3263
  pendingInAppToastItems.current = /* @__PURE__ */ new Map();
3243
3264
  };
3244
- $[39] = t20;
3265
+ $[44] = t22;
3245
3266
  } else {
3246
- t20 = $[39];
3267
+ t22 = $[44];
3247
3268
  }
3248
- let t21;
3249
- if ($[40] !== normalizedAppName || $[41] !== trimmedUserId) {
3250
- t21 = [normalizedAppName, trimmedUserId];
3251
- $[40] = normalizedAppName;
3252
- $[41] = trimmedUserId;
3253
- $[42] = t21;
3269
+ let t23;
3270
+ if ($[45] !== normalizedAppName || $[46] !== trimmedUserId) {
3271
+ t23 = [normalizedAppName, trimmedUserId];
3272
+ $[45] = normalizedAppName;
3273
+ $[46] = trimmedUserId;
3274
+ $[47] = t23;
3254
3275
  } else {
3255
- t21 = $[42];
3276
+ t23 = $[47];
3256
3277
  }
3257
- useEffect(t20, t21);
3258
- let t22;
3259
- let t23;
3260
- if ($[43] !== canUseRts || $[44] !== normalizedAppName || $[45] !== trimmedUserId) {
3261
- t22 = () => {
3278
+ useEffect(t22, t23);
3279
+ let t24;
3280
+ let t25;
3281
+ if ($[48] !== canUseRts || $[49] !== normalizedAppName || $[50] !== trimmedUserId) {
3282
+ t24 = () => {
3262
3283
  if (!canUseRts) {
3263
3284
  return;
3264
3285
  }
@@ -3284,21 +3305,21 @@ function NotificationsRealtimeProvider(t0) {
3284
3305
  removeState();
3285
3306
  };
3286
3307
  };
3287
- t23 = [canUseRts, normalizedAppName, trimmedUserId];
3288
- $[43] = canUseRts;
3289
- $[44] = normalizedAppName;
3290
- $[45] = trimmedUserId;
3291
- $[46] = t22;
3292
- $[47] = t23;
3308
+ t25 = [canUseRts, normalizedAppName, trimmedUserId];
3309
+ $[48] = canUseRts;
3310
+ $[49] = normalizedAppName;
3311
+ $[50] = trimmedUserId;
3312
+ $[51] = t24;
3313
+ $[52] = t25;
3293
3314
  } else {
3294
- t22 = $[46];
3295
- t23 = $[47];
3315
+ t24 = $[51];
3316
+ t25 = $[52];
3296
3317
  }
3297
- useEffect(t22, t23);
3298
- let t24;
3299
- let t25;
3300
- if ($[48] !== canUseRts || $[49] !== normalizedAppName || $[50] !== renderNotificationToast || $[51] !== trimmedUserId) {
3301
- t24 = () => {
3318
+ useEffect(t24, t25);
3319
+ let t26;
3320
+ let t27;
3321
+ if ($[53] !== canUseRts || $[54] !== normalizedAppName || $[55] !== renderNotificationToast || $[56] !== trimmedUserId) {
3322
+ t26 = () => {
3302
3323
  if (!canUseRts) {
3303
3324
  return;
3304
3325
  }
@@ -3315,22 +3336,22 @@ function NotificationsRealtimeProvider(t0) {
3315
3336
  document.removeEventListener("visibilitychange", handlePendingInAppToastFlush);
3316
3337
  };
3317
3338
  };
3318
- t25 = [canUseRts, normalizedAppName, renderNotificationToast, trimmedUserId];
3319
- $[48] = canUseRts;
3320
- $[49] = normalizedAppName;
3321
- $[50] = renderNotificationToast;
3322
- $[51] = trimmedUserId;
3323
- $[52] = t24;
3324
- $[53] = t25;
3339
+ t27 = [canUseRts, normalizedAppName, renderNotificationToast, trimmedUserId];
3340
+ $[53] = canUseRts;
3341
+ $[54] = normalizedAppName;
3342
+ $[55] = renderNotificationToast;
3343
+ $[56] = trimmedUserId;
3344
+ $[57] = t26;
3345
+ $[58] = t27;
3325
3346
  } else {
3326
- t24 = $[52];
3327
- t25 = $[53];
3347
+ t26 = $[57];
3348
+ t27 = $[58];
3328
3349
  }
3329
- useEffect(t24, t25);
3330
- let t26;
3331
- let t27;
3332
- if ($[54] !== canUseRts || $[55] !== normalizedAppName || $[56] !== notificationDeliveries || $[57] !== notificationDeliveriesQuery.loading || $[58] !== renderNotificationToast || $[59] !== toastOnNew || $[60] !== trimmedUserId) {
3333
- t26 = () => {
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 = () => {
3334
3355
  if (!toastOnNew) {
3335
3356
  return;
3336
3357
  }
@@ -3378,61 +3399,68 @@ function NotificationsRealtimeProvider(t0) {
3378
3399
  queuePendingInAppToasts(pendingInAppToastItems, pending_0, trimmedUserId, normalizedAppName, renderNotificationToast);
3379
3400
  });
3380
3401
  };
3381
- t27 = [canUseRts, normalizedAppName, notificationDeliveries, notificationDeliveriesQuery.loading, renderNotificationToast, toastOnNew, trimmedUserId];
3382
- $[54] = canUseRts;
3383
- $[55] = normalizedAppName;
3384
- $[56] = notificationDeliveries;
3385
- $[57] = notificationDeliveriesQuery.loading;
3386
- $[58] = renderNotificationToast;
3387
- $[59] = toastOnNew;
3388
- $[60] = trimmedUserId;
3389
- $[61] = t26;
3390
- $[62] = t27;
3391
- } else {
3392
- t26 = $[61];
3393
- t27 = $[62];
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];
3394
3415
  }
3395
- useEffect(t26, t27);
3396
- let t28;
3397
- if ($[63] !== notifications || $[64] !== notificationsQuery.error || $[65] !== notificationsQuery.loading || $[66] !== unreadCount || $[67] !== unseenCount) {
3398
- t28 = {
3416
+ useEffect(t28, t29);
3417
+ let t30;
3418
+ if ($[68] !== notifications || $[69] !== notificationsQuery.error || $[70] !== notificationsQuery.loading || $[71] !== unreadCount || $[72] !== unseenCount) {
3419
+ t30 = {
3399
3420
  notifications,
3400
3421
  unreadCount,
3401
3422
  unseenCount,
3402
3423
  loading: notificationsQuery.loading,
3403
3424
  error: notificationsQuery.error
3404
3425
  };
3405
- $[63] = notifications;
3406
- $[64] = notificationsQuery.error;
3407
- $[65] = notificationsQuery.loading;
3408
- $[66] = unreadCount;
3409
- $[67] = unseenCount;
3410
- $[68] = t28;
3426
+ $[68] = notifications;
3427
+ $[69] = notificationsQuery.error;
3428
+ $[70] = notificationsQuery.loading;
3429
+ $[71] = unreadCount;
3430
+ $[72] = unseenCount;
3431
+ $[73] = t30;
3411
3432
  } else {
3412
- t28 = $[68];
3413
- }
3414
- const value = t28;
3415
- const t29 = canUseRts ? value : null;
3416
- let t30;
3417
- if ($[69] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3418
- t30 = /* @__PURE__ */ jsx("style", { children: notificationToastStyles });
3419
- $[69] = t30;
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;
3420
3441
  } else {
3421
- t30 = $[69];
3442
+ t32 = $[74];
3422
3443
  }
3423
- let t31;
3424
- if ($[70] !== children || $[71] !== t29) {
3425
- t31 = /* @__PURE__ */ jsxs(NotificationsRealtimeContext.Provider, { value: t29, children: [
3426
- t30,
3444
+ let t33;
3445
+ if ($[75] !== children || $[76] !== t31) {
3446
+ t33 = /* @__PURE__ */ jsxs(NotificationsRealtimeContext.Provider, { value: t31, children: [
3447
+ t32,
3427
3448
  children
3428
3449
  ] });
3429
- $[70] = children;
3430
- $[71] = t29;
3431
- $[72] = t31;
3450
+ $[75] = children;
3451
+ $[76] = t31;
3452
+ $[77] = t33;
3432
3453
  } else {
3433
- t31 = $[72];
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"));
3434
3463
  }
3435
- return t31;
3436
3464
  }
3437
3465
  function _temp6(acc_0, n_2) {
3438
3466
  return acc_0 + (n_2.seenAt ? 0 : 1);