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
|
@@ -7522,7 +7522,10 @@ var _MessageComposer = class _MessageComposer extends WithSubscriptions {
|
|
|
7522
7522
|
return !!(!this.attachmentManager.uploadsInProgressCount && (!this.textComposer.textIsEmpty || this.attachmentManager.successfulUploadsCount > 0) || this.pollId || !!this.locationComposer.validLocation);
|
|
7523
7523
|
}
|
|
7524
7524
|
get compositionIsEmpty() {
|
|
7525
|
-
return !this.quotedMessage && this.
|
|
7525
|
+
return !this.quotedMessage && this.contentIsEmpty;
|
|
7526
|
+
}
|
|
7527
|
+
get contentIsEmpty() {
|
|
7528
|
+
return this.textComposer.textIsEmpty && !this.attachmentManager.attachments.length && !this.pollId && !this.locationComposer.validLocation;
|
|
7526
7529
|
}
|
|
7527
7530
|
get lastChangeOriginIsLocal() {
|
|
7528
7531
|
const initiatedWithoutDraft = this.lastChange.draftUpdate === null;
|
|
@@ -12373,8 +12376,8 @@ var NotificationManager = class {
|
|
|
12373
12376
|
add({ message, origin, options = {} }) {
|
|
12374
12377
|
const id = generateUUIDv4();
|
|
12375
12378
|
const now = Date.now();
|
|
12376
|
-
const severity = options.severity
|
|
12377
|
-
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);
|
|
12378
12381
|
const notification = {
|
|
12379
12382
|
id,
|
|
12380
12383
|
message,
|
|
@@ -12382,20 +12385,16 @@ var NotificationManager = class {
|
|
|
12382
12385
|
type: options?.type,
|
|
12383
12386
|
severity,
|
|
12384
12387
|
createdAt: now,
|
|
12385
|
-
|
|
12388
|
+
duration,
|
|
12386
12389
|
actions: options.actions,
|
|
12387
12390
|
metadata: options.metadata,
|
|
12391
|
+
tags: options.tags,
|
|
12388
12392
|
originalError: options.originalError
|
|
12389
12393
|
};
|
|
12394
|
+
const notifications = [...this.store.getLatestValue().notifications, notification];
|
|
12390
12395
|
this.store.partialNext({
|
|
12391
|
-
notifications: [...this.
|
|
12396
|
+
notifications: this.config.sortComparator ? [...notifications].sort(this.config.sortComparator) : notifications
|
|
12392
12397
|
});
|
|
12393
|
-
if (notification.expiresAt) {
|
|
12394
|
-
const timeout = setTimeout(() => {
|
|
12395
|
-
this.remove(id);
|
|
12396
|
-
}, options.duration || this.config.durations[notification.severity]);
|
|
12397
|
-
this.timeouts.set(id, timeout);
|
|
12398
|
-
}
|
|
12399
12398
|
return id;
|
|
12400
12399
|
}
|
|
12401
12400
|
addError({ message, origin, options }) {
|
|
@@ -12410,12 +12409,24 @@ var NotificationManager = class {
|
|
|
12410
12409
|
addSuccess({ message, origin, options }) {
|
|
12411
12410
|
return this.add({ message, origin, options: { ...options, severity: "success" } });
|
|
12412
12411
|
}
|
|
12413
|
-
|
|
12412
|
+
clearTimeout(id) {
|
|
12414
12413
|
const timeout = this.timeouts.get(id);
|
|
12415
|
-
if (timeout)
|
|
12416
|
-
|
|
12417
|
-
|
|
12418
|
-
|
|
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);
|
|
12419
12430
|
this.store.partialNext({
|
|
12420
12431
|
notifications: this.store.getLatestValue().notifications.filter((n) => n.id !== id)
|
|
12421
12432
|
});
|
|
@@ -15113,7 +15124,7 @@ var StreamChat = class _StreamChat {
|
|
|
15113
15124
|
if (this.userAgent) {
|
|
15114
15125
|
return this.userAgent;
|
|
15115
15126
|
}
|
|
15116
|
-
const version = "9.
|
|
15127
|
+
const version = "9.38.0";
|
|
15117
15128
|
const clientBundle = "browser-cjs";
|
|
15118
15129
|
let userAgentString = "";
|
|
15119
15130
|
if (this.sdkIdentifier) {
|