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.
@@ -12187,8 +12187,8 @@ var NotificationManager = class {
12187
12187
  add({ message, origin, options = {} }) {
12188
12188
  const id = generateUUIDv4();
12189
12189
  const now = Date.now();
12190
- const severity = options.severity || "info";
12191
- const duration = options.duration ?? this.config.durations[severity];
12190
+ const severity = options.severity;
12191
+ const duration = options.duration ?? (severity ? this.config.durations[severity] : void 0);
12192
12192
  const notification = {
12193
12193
  id,
12194
12194
  message,
@@ -12196,20 +12196,16 @@ var NotificationManager = class {
12196
12196
  type: options?.type,
12197
12197
  severity,
12198
12198
  createdAt: now,
12199
- expiresAt: now + duration,
12199
+ duration,
12200
12200
  actions: options.actions,
12201
12201
  metadata: options.metadata,
12202
+ tags: options.tags,
12202
12203
  originalError: options.originalError
12203
12204
  };
12205
+ const notifications = [...this.store.getLatestValue().notifications, notification];
12204
12206
  this.store.partialNext({
12205
- notifications: [...this.store.getLatestValue().notifications, notification]
12207
+ notifications: this.config.sortComparator ? [...notifications].sort(this.config.sortComparator) : notifications
12206
12208
  });
12207
- if (notification.expiresAt) {
12208
- const timeout = setTimeout(() => {
12209
- this.remove(id);
12210
- }, options.duration || this.config.durations[notification.severity]);
12211
- this.timeouts.set(id, timeout);
12212
- }
12213
12209
  return id;
12214
12210
  }
12215
12211
  addError({ message, origin, options }) {
@@ -12224,12 +12220,24 @@ var NotificationManager = class {
12224
12220
  addSuccess({ message, origin, options }) {
12225
12221
  return this.add({ message, origin, options: { ...options, severity: "success" } });
12226
12222
  }
12227
- remove(id) {
12223
+ clearTimeout(id) {
12228
12224
  const timeout = this.timeouts.get(id);
12229
- if (timeout) {
12230
- clearTimeout(timeout);
12231
- this.timeouts.delete(id);
12232
- }
12225
+ if (!timeout) return;
12226
+ clearTimeout(timeout);
12227
+ this.timeouts.delete(id);
12228
+ }
12229
+ startTimeout(id, durationOverride) {
12230
+ const notification = this.store.getLatestValue().notifications.find((n) => n.id === id);
12231
+ const duration = durationOverride ?? notification?.duration;
12232
+ if (!notification || !duration) return;
12233
+ this.clearTimeout(id);
12234
+ const timeout = setTimeout(() => {
12235
+ this.remove(id);
12236
+ }, duration);
12237
+ this.timeouts.set(id, timeout);
12238
+ }
12239
+ remove(id) {
12240
+ this.clearTimeout(id);
12233
12241
  this.store.partialNext({
12234
12242
  notifications: this.store.getLatestValue().notifications.filter((n) => n.id !== id)
12235
12243
  });
@@ -14927,7 +14935,7 @@ var StreamChat = class _StreamChat {
14927
14935
  if (this.userAgent) {
14928
14936
  return this.userAgent;
14929
14937
  }
14930
- const version = "9.37.0";
14938
+ const version = "9.38.0";
14931
14939
  const clientBundle = "browser-esm";
14932
14940
  let userAgentString = "";
14933
14941
  if (this.sdkIdentifier) {