stream-chat 9.36.2 → 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 +28 -17
- package/dist/cjs/index.browser.js.map +2 -2
- package/dist/cjs/index.node.js +28 -17
- package/dist/cjs/index.node.js.map +2 -2
- package/dist/esm/index.mjs +28 -17
- package/dist/esm/index.mjs.map +2 -2
- package/dist/types/messageComposer/messageComposer.d.ts +1 -0
- 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/messageComposer/messageComposer.ts +4 -1
- package/src/notifications/NotificationManager.ts +37 -17
- package/src/notifications/types.ts +18 -7
package/dist/cjs/index.node.js
CHANGED
|
@@ -7501,7 +7501,10 @@ var _MessageComposer = class _MessageComposer extends WithSubscriptions {
|
|
|
7501
7501
|
return !!(!this.attachmentManager.uploadsInProgressCount && (!this.textComposer.textIsEmpty || this.attachmentManager.successfulUploadsCount > 0) || this.pollId || !!this.locationComposer.validLocation);
|
|
7502
7502
|
}
|
|
7503
7503
|
get compositionIsEmpty() {
|
|
7504
|
-
return !this.quotedMessage && this.
|
|
7504
|
+
return !this.quotedMessage && this.contentIsEmpty;
|
|
7505
|
+
}
|
|
7506
|
+
get contentIsEmpty() {
|
|
7507
|
+
return this.textComposer.textIsEmpty && !this.attachmentManager.attachments.length && !this.pollId && !this.locationComposer.validLocation;
|
|
7505
7508
|
}
|
|
7506
7509
|
get lastChangeOriginIsLocal() {
|
|
7507
7510
|
const initiatedWithoutDraft = this.lastChange.draftUpdate === null;
|
|
@@ -12352,8 +12355,8 @@ var NotificationManager = class {
|
|
|
12352
12355
|
add({ message, origin, options = {} }) {
|
|
12353
12356
|
const id = generateUUIDv4();
|
|
12354
12357
|
const now = Date.now();
|
|
12355
|
-
const severity = options.severity
|
|
12356
|
-
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);
|
|
12357
12360
|
const notification = {
|
|
12358
12361
|
id,
|
|
12359
12362
|
message,
|
|
@@ -12361,20 +12364,16 @@ var NotificationManager = class {
|
|
|
12361
12364
|
type: options?.type,
|
|
12362
12365
|
severity,
|
|
12363
12366
|
createdAt: now,
|
|
12364
|
-
|
|
12367
|
+
duration,
|
|
12365
12368
|
actions: options.actions,
|
|
12366
12369
|
metadata: options.metadata,
|
|
12370
|
+
tags: options.tags,
|
|
12367
12371
|
originalError: options.originalError
|
|
12368
12372
|
};
|
|
12373
|
+
const notifications = [...this.store.getLatestValue().notifications, notification];
|
|
12369
12374
|
this.store.partialNext({
|
|
12370
|
-
notifications: [...this.
|
|
12375
|
+
notifications: this.config.sortComparator ? [...notifications].sort(this.config.sortComparator) : notifications
|
|
12371
12376
|
});
|
|
12372
|
-
if (notification.expiresAt) {
|
|
12373
|
-
const timeout = setTimeout(() => {
|
|
12374
|
-
this.remove(id);
|
|
12375
|
-
}, options.duration || this.config.durations[notification.severity]);
|
|
12376
|
-
this.timeouts.set(id, timeout);
|
|
12377
|
-
}
|
|
12378
12377
|
return id;
|
|
12379
12378
|
}
|
|
12380
12379
|
addError({ message, origin, options }) {
|
|
@@ -12389,12 +12388,24 @@ var NotificationManager = class {
|
|
|
12389
12388
|
addSuccess({ message, origin, options }) {
|
|
12390
12389
|
return this.add({ message, origin, options: { ...options, severity: "success" } });
|
|
12391
12390
|
}
|
|
12392
|
-
|
|
12391
|
+
clearTimeout(id) {
|
|
12393
12392
|
const timeout = this.timeouts.get(id);
|
|
12394
|
-
if (timeout)
|
|
12395
|
-
|
|
12396
|
-
|
|
12397
|
-
|
|
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);
|
|
12398
12409
|
this.store.partialNext({
|
|
12399
12410
|
notifications: this.store.getLatestValue().notifications.filter((n) => n.id !== id)
|
|
12400
12411
|
});
|
|
@@ -15092,7 +15103,7 @@ var StreamChat = class _StreamChat {
|
|
|
15092
15103
|
if (this.userAgent) {
|
|
15093
15104
|
return this.userAgent;
|
|
15094
15105
|
}
|
|
15095
|
-
const version = "9.
|
|
15106
|
+
const version = "9.38.0";
|
|
15096
15107
|
const clientBundle = "node-cjs";
|
|
15097
15108
|
let userAgentString = "";
|
|
15098
15109
|
if (this.sdkIdentifier) {
|