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.
- package/dist/cjs/index.browser.js +24 -16
- package/dist/cjs/index.browser.js.map +2 -2
- package/dist/cjs/index.node.js +24 -16
- package/dist/cjs/index.node.js.map +2 -2
- package/dist/esm/index.mjs +24 -16
- package/dist/esm/index.mjs.map +2 -2
- package/dist/types/notifications/NotificationManager.d.ts +2 -0
- package/dist/types/notifications/types.d.ts +14 -7
- package/package.json +1 -1
- package/src/notifications/NotificationManager.ts +37 -17
- package/src/notifications/types.ts +18 -7
package/dist/cjs/index.node.js
CHANGED
|
@@ -12355,8 +12355,8 @@ var NotificationManager = class {
|
|
|
12355
12355
|
add({ message, origin, options = {} }) {
|
|
12356
12356
|
const id = generateUUIDv4();
|
|
12357
12357
|
const now = Date.now();
|
|
12358
|
-
const severity = options.severity
|
|
12359
|
-
const duration = options.duration ?? this.config.durations[severity];
|
|
12358
|
+
const severity = options.severity;
|
|
12359
|
+
const duration = options.duration ?? (severity ? this.config.durations[severity] : void 0);
|
|
12360
12360
|
const notification = {
|
|
12361
12361
|
id,
|
|
12362
12362
|
message,
|
|
@@ -12364,20 +12364,16 @@ var NotificationManager = class {
|
|
|
12364
12364
|
type: options?.type,
|
|
12365
12365
|
severity,
|
|
12366
12366
|
createdAt: now,
|
|
12367
|
-
|
|
12367
|
+
duration,
|
|
12368
12368
|
actions: options.actions,
|
|
12369
12369
|
metadata: options.metadata,
|
|
12370
|
+
tags: options.tags,
|
|
12370
12371
|
originalError: options.originalError
|
|
12371
12372
|
};
|
|
12373
|
+
const notifications = [...this.store.getLatestValue().notifications, notification];
|
|
12372
12374
|
this.store.partialNext({
|
|
12373
|
-
notifications: [...this.
|
|
12375
|
+
notifications: this.config.sortComparator ? [...notifications].sort(this.config.sortComparator) : notifications
|
|
12374
12376
|
});
|
|
12375
|
-
if (notification.expiresAt) {
|
|
12376
|
-
const timeout = setTimeout(() => {
|
|
12377
|
-
this.remove(id);
|
|
12378
|
-
}, options.duration || this.config.durations[notification.severity]);
|
|
12379
|
-
this.timeouts.set(id, timeout);
|
|
12380
|
-
}
|
|
12381
12377
|
return id;
|
|
12382
12378
|
}
|
|
12383
12379
|
addError({ message, origin, options }) {
|
|
@@ -12392,12 +12388,24 @@ var NotificationManager = class {
|
|
|
12392
12388
|
addSuccess({ message, origin, options }) {
|
|
12393
12389
|
return this.add({ message, origin, options: { ...options, severity: "success" } });
|
|
12394
12390
|
}
|
|
12395
|
-
|
|
12391
|
+
clearTimeout(id) {
|
|
12396
12392
|
const timeout = this.timeouts.get(id);
|
|
12397
|
-
if (timeout)
|
|
12398
|
-
|
|
12399
|
-
|
|
12400
|
-
|
|
12393
|
+
if (!timeout) return;
|
|
12394
|
+
clearTimeout(timeout);
|
|
12395
|
+
this.timeouts.delete(id);
|
|
12396
|
+
}
|
|
12397
|
+
startTimeout(id, durationOverride) {
|
|
12398
|
+
const notification = this.store.getLatestValue().notifications.find((n) => n.id === id);
|
|
12399
|
+
const duration = durationOverride ?? notification?.duration;
|
|
12400
|
+
if (!notification || !duration) return;
|
|
12401
|
+
this.clearTimeout(id);
|
|
12402
|
+
const timeout = setTimeout(() => {
|
|
12403
|
+
this.remove(id);
|
|
12404
|
+
}, duration);
|
|
12405
|
+
this.timeouts.set(id, timeout);
|
|
12406
|
+
}
|
|
12407
|
+
remove(id) {
|
|
12408
|
+
this.clearTimeout(id);
|
|
12401
12409
|
this.store.partialNext({
|
|
12402
12410
|
notifications: this.store.getLatestValue().notifications.filter((n) => n.id !== id)
|
|
12403
12411
|
});
|
|
@@ -15095,7 +15103,7 @@ var StreamChat = class _StreamChat {
|
|
|
15095
15103
|
if (this.userAgent) {
|
|
15096
15104
|
return this.userAgent;
|
|
15097
15105
|
}
|
|
15098
|
-
const version = "9.
|
|
15106
|
+
const version = "9.38.0";
|
|
15099
15107
|
const clientBundle = "node-cjs";
|
|
15100
15108
|
let userAgentString = "";
|
|
15101
15109
|
if (this.sdkIdentifier) {
|