stream-chat 9.37.0 → 9.38.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.
@@ -12376,8 +12376,8 @@ var NotificationManager = class {
12376
12376
  add({ message, origin, options = {} }) {
12377
12377
  const id = generateUUIDv4();
12378
12378
  const now = Date.now();
12379
- const severity = options.severity || "info";
12380
- const duration = options.duration ?? this.config.durations[severity];
12379
+ const severity = options.severity;
12380
+ const duration = options.duration ?? (severity ? this.config.durations[severity] : void 0);
12381
12381
  const notification = {
12382
12382
  id,
12383
12383
  message,
@@ -12385,20 +12385,16 @@ var NotificationManager = class {
12385
12385
  type: options?.type,
12386
12386
  severity,
12387
12387
  createdAt: now,
12388
- expiresAt: now + duration,
12388
+ duration,
12389
12389
  actions: options.actions,
12390
12390
  metadata: options.metadata,
12391
+ tags: options.tags,
12391
12392
  originalError: options.originalError
12392
12393
  };
12394
+ const notifications = [...this.store.getLatestValue().notifications, notification];
12393
12395
  this.store.partialNext({
12394
- notifications: [...this.store.getLatestValue().notifications, notification]
12396
+ notifications: this.config.sortComparator ? [...notifications].sort(this.config.sortComparator) : notifications
12395
12397
  });
12396
- if (notification.expiresAt) {
12397
- const timeout = setTimeout(() => {
12398
- this.remove(id);
12399
- }, options.duration || this.config.durations[notification.severity]);
12400
- this.timeouts.set(id, timeout);
12401
- }
12402
12398
  return id;
12403
12399
  }
12404
12400
  addError({ message, origin, options }) {
@@ -12413,12 +12409,24 @@ var NotificationManager = class {
12413
12409
  addSuccess({ message, origin, options }) {
12414
12410
  return this.add({ message, origin, options: { ...options, severity: "success" } });
12415
12411
  }
12416
- remove(id) {
12412
+ clearTimeout(id) {
12417
12413
  const timeout = this.timeouts.get(id);
12418
- if (timeout) {
12419
- clearTimeout(timeout);
12420
- this.timeouts.delete(id);
12421
- }
12414
+ if (!timeout) return;
12415
+ clearTimeout(timeout);
12416
+ this.timeouts.delete(id);
12417
+ }
12418
+ startTimeout(id, durationOverride) {
12419
+ const notification = this.store.getLatestValue().notifications.find((n) => n.id === id);
12420
+ const duration = durationOverride ?? notification?.duration;
12421
+ if (!notification || !duration) return;
12422
+ this.clearTimeout(id);
12423
+ const timeout = setTimeout(() => {
12424
+ this.remove(id);
12425
+ }, duration);
12426
+ this.timeouts.set(id, timeout);
12427
+ }
12428
+ remove(id) {
12429
+ this.clearTimeout(id);
12422
12430
  this.store.partialNext({
12423
12431
  notifications: this.store.getLatestValue().notifications.filter((n) => n.id !== id)
12424
12432
  });
@@ -15116,7 +15124,7 @@ var StreamChat = class _StreamChat {
15116
15124
  if (this.userAgent) {
15117
15125
  return this.userAgent;
15118
15126
  }
15119
- const version = "9.37.0";
15127
+ const version = "9.38.0";
15120
15128
  const clientBundle = "browser-cjs";
15121
15129
  let userAgentString = "";
15122
15130
  if (this.sdkIdentifier) {