stream-chat 9.47.1 → 9.49.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 +54 -25
- package/dist/cjs/index.browser.js.map +2 -2
- package/dist/cjs/index.node.js +54 -25
- package/dist/cjs/index.node.js.map +2 -2
- package/dist/esm/index.mjs +54 -25
- package/dist/esm/index.mjs.map +2 -2
- package/dist/types/channel.d.ts +2 -2
- package/dist/types/client.d.ts +4 -2
- package/dist/types/custom_types.d.ts +2 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/thread.d.ts +2 -0
- package/dist/types/types.d.ts +55 -14
- package/package.json +1 -1
- package/src/channel.ts +2 -2
- package/src/client.ts +46 -28
- package/src/custom_types.ts +1 -0
- package/src/index.ts +1 -0
- package/src/thread.ts +29 -0
- package/src/thread_manager.ts +1 -0
- package/src/types.ts +66 -14
|
@@ -7650,6 +7650,7 @@ var Thread = class extends WithSubscriptions {
|
|
|
7650
7650
|
this.addUnsubscribeFunction(this.subscribeMarkThreadStale());
|
|
7651
7651
|
this.addUnsubscribeFunction(this.subscribeNewReplies());
|
|
7652
7652
|
this.addUnsubscribeFunction(this.subscribeRepliesRead());
|
|
7653
|
+
this.addUnsubscribeFunction(this.subscribeRepliesUnread());
|
|
7653
7654
|
this.addUnsubscribeFunction(this.subscribeMessageDeleted());
|
|
7654
7655
|
this.addUnsubscribeFunction(this.subscribeMessageUpdated());
|
|
7655
7656
|
};
|
|
@@ -7691,6 +7692,26 @@ var Thread = class extends WithSubscriptions {
|
|
|
7691
7692
|
}
|
|
7692
7693
|
this.state.partialNext({ isStateStale: true });
|
|
7693
7694
|
}).unsubscribe;
|
|
7695
|
+
this.subscribeRepliesUnread = () => this.client.on("notification.mark_unread", (event) => {
|
|
7696
|
+
if (!event.user || !event.created_at || !event.thread_id) return;
|
|
7697
|
+
if (event.thread_id !== this.id) return;
|
|
7698
|
+
const userId = event.user.id;
|
|
7699
|
+
const createdAt = event.created_at;
|
|
7700
|
+
const user = event.user;
|
|
7701
|
+
this.state.next((current) => ({
|
|
7702
|
+
...current,
|
|
7703
|
+
read: {
|
|
7704
|
+
...current.read,
|
|
7705
|
+
[userId]: {
|
|
7706
|
+
...current.read[userId],
|
|
7707
|
+
lastReadAt: typeof event.last_read_at !== "undefined" ? new Date(event.last_read_at) : new Date(createdAt),
|
|
7708
|
+
user,
|
|
7709
|
+
firstUnreadMessageId: event.first_unread_message_id,
|
|
7710
|
+
unreadMessageCount: event.unread_messages ?? 0
|
|
7711
|
+
}
|
|
7712
|
+
}
|
|
7713
|
+
}));
|
|
7714
|
+
}).unsubscribe;
|
|
7694
7715
|
this.subscribeNewReplies = () => this.client.on("message.new", (event) => {
|
|
7695
7716
|
if (!this.client.userID || event.message?.parent_id !== this.id) {
|
|
7696
7717
|
return;
|
|
@@ -12618,6 +12639,7 @@ var ThreadManager = class extends WithSubscriptions {
|
|
|
12618
12639
|
const unsubscribeFunctions = [
|
|
12619
12640
|
"health.check",
|
|
12620
12641
|
"notification.mark_read",
|
|
12642
|
+
"notification.mark_unread",
|
|
12621
12643
|
"notification.thread_message_new",
|
|
12622
12644
|
"notification.channel_deleted"
|
|
12623
12645
|
].map(
|
|
@@ -14805,6 +14827,31 @@ var StreamChat = class _StreamChat {
|
|
|
14805
14827
|
* @return {Promise<APIResponse>}
|
|
14806
14828
|
*/
|
|
14807
14829
|
this.markAllRead = this.markChannelsRead;
|
|
14830
|
+
this.getUserAgent = () => {
|
|
14831
|
+
if (this.userAgent) {
|
|
14832
|
+
return this.userAgent;
|
|
14833
|
+
}
|
|
14834
|
+
if (!this.cachedUserAgent) {
|
|
14835
|
+
const version = "9.49.0";
|
|
14836
|
+
const { name: sdkName, version: sdkVersion } = this.sdkIdentifier ?? {};
|
|
14837
|
+
const { name: appName, version: appVersion } = this.appIdentifier ?? {};
|
|
14838
|
+
const { os, model: deviceModel } = this.deviceIdentifier ?? {};
|
|
14839
|
+
const head = sdkName ? `stream-chat-${sdkName}-v${sdkVersion}-llc-v${version}` : `stream-chat-js-v${version}-${this.node ? "node" : "browser"}`;
|
|
14840
|
+
this.cachedUserAgent = [
|
|
14841
|
+
head,
|
|
14842
|
+
// reports the host app, the device OS, the device model, and the picked
|
|
14843
|
+
// exports bundle, each only when a value is present
|
|
14844
|
+
...Object.entries({
|
|
14845
|
+
app: appName,
|
|
14846
|
+
app_version: appVersion,
|
|
14847
|
+
os,
|
|
14848
|
+
device_model: deviceModel,
|
|
14849
|
+
client_bundle: "browser-cjs"
|
|
14850
|
+
}).filter(([, value]) => value && value.length > 0).map(([key, value]) => `${key}=${value}`)
|
|
14851
|
+
].join("|");
|
|
14852
|
+
}
|
|
14853
|
+
return this.cachedUserAgent;
|
|
14854
|
+
};
|
|
14808
14855
|
/**
|
|
14809
14856
|
* _isUsingServerAuth - Returns true if we're using server side auth
|
|
14810
14857
|
*/
|
|
@@ -15257,6 +15304,13 @@ var StreamChat = class _StreamChat {
|
|
|
15257
15304
|
delete this.activeChannels[cid];
|
|
15258
15305
|
});
|
|
15259
15306
|
}
|
|
15307
|
+
if (event.type === "notification.removed_from_channel" && event.cid) {
|
|
15308
|
+
const { cid } = event;
|
|
15309
|
+
this.activeChannels[cid]?._disconnect();
|
|
15310
|
+
postListenerCallbacks.push(() => {
|
|
15311
|
+
delete this.activeChannels[cid];
|
|
15312
|
+
});
|
|
15313
|
+
}
|
|
15260
15314
|
return postListenerCallbacks;
|
|
15261
15315
|
}
|
|
15262
15316
|
_muteStatus(cid) {
|
|
@@ -16748,31 +16802,6 @@ var StreamChat = class _StreamChat {
|
|
|
16748
16802
|
partialThreadObject
|
|
16749
16803
|
);
|
|
16750
16804
|
}
|
|
16751
|
-
getUserAgent() {
|
|
16752
|
-
if (this.userAgent) {
|
|
16753
|
-
return this.userAgent;
|
|
16754
|
-
}
|
|
16755
|
-
const version = "9.47.1";
|
|
16756
|
-
const clientBundle = "browser-cjs";
|
|
16757
|
-
let userAgentString = "";
|
|
16758
|
-
if (this.sdkIdentifier) {
|
|
16759
|
-
userAgentString = `stream-chat-${this.sdkIdentifier.name}-v${this.sdkIdentifier.version}-llc-v${version}`;
|
|
16760
|
-
} else {
|
|
16761
|
-
userAgentString = `stream-chat-js-v${version}-${this.node ? "node" : "browser"}`;
|
|
16762
|
-
}
|
|
16763
|
-
const { os, model } = this.deviceIdentifier ?? {};
|
|
16764
|
-
return [
|
|
16765
|
-
// reports the device OS, if provided
|
|
16766
|
-
["os", os],
|
|
16767
|
-
// reports the device model, if provided
|
|
16768
|
-
["device_model", model],
|
|
16769
|
-
// reports which bundle is being picked from the exports
|
|
16770
|
-
["client_bundle", clientBundle]
|
|
16771
|
-
].reduce(
|
|
16772
|
-
(withArguments, [key, value]) => value && value.length > 0 ? withArguments.concat(`|${key}=${value}`) : withArguments,
|
|
16773
|
-
userAgentString
|
|
16774
|
-
);
|
|
16775
|
-
}
|
|
16776
16805
|
/**
|
|
16777
16806
|
* @deprecated use sdkIdentifier instead
|
|
16778
16807
|
* @param userAgent
|