@sendbird/ai-agent-messenger-react 1.34.3 → 1.35.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/index.cjs +75 -75
- package/dist/index.d.ts +8 -18
- package/dist/index.js +2802 -2887
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -5054,11 +5054,9 @@ declare class LiveMetricManager {
|
|
|
5054
5054
|
this.dispatch?.({ category, metricKey, data });
|
|
5055
5055
|
};
|
|
5056
5056
|
private readonly emitters: Record<MetricSource['type'], LiveMetricEmitter>;
|
|
5057
|
-
private isStarted = false;
|
|
5058
|
-
private registeredChatSDK?: ChatSDKType;
|
|
5059
5057
|
|
|
5060
|
-
constructor() {
|
|
5061
|
-
const getCurrentUserId = () => this.
|
|
5058
|
+
constructor(private readonly chatSDK: ChatSDKType) {
|
|
5059
|
+
const getCurrentUserId = () => this.chatSDK.currentUser?.userId;
|
|
5062
5060
|
this.emitters = {
|
|
5063
5061
|
connection: new ConnectionMetricEmitter(this.emit),
|
|
5064
5062
|
conversation: new ConversationMetricEmitter(this.emit),
|
|
@@ -5068,9 +5066,7 @@ declare class LiveMetricManager {
|
|
|
5068
5066
|
};
|
|
5069
5067
|
}
|
|
5070
5068
|
|
|
5071
|
-
start(
|
|
5072
|
-
if (this.isStarted) return;
|
|
5073
|
-
|
|
5069
|
+
start(): void {
|
|
5074
5070
|
const connectionHandler = new ConnectionHandler({
|
|
5075
5071
|
onConnected: (userId) => this.trackConnection('connected', userId),
|
|
5076
5072
|
onDisconnected: (userId) => this.trackConnection('disconnected', userId),
|
|
@@ -5095,10 +5091,8 @@ declare class LiveMetricManager {
|
|
|
5095
5091
|
onUserLeft: (channel) => this.track({ type: 'handoff', channel }),
|
|
5096
5092
|
});
|
|
5097
5093
|
|
|
5098
|
-
chatSDK.addConnectionHandler(this.id, connectionHandler);
|
|
5099
|
-
chatSDK.groupChannel.addGroupChannelHandler(this.id, channelHandler);
|
|
5100
|
-
this.registeredChatSDK = chatSDK;
|
|
5101
|
-
this.isStarted = true;
|
|
5094
|
+
this.chatSDK.addConnectionHandler(this.id, connectionHandler);
|
|
5095
|
+
this.chatSDK.groupChannel.addGroupChannelHandler(this.id, channelHandler);
|
|
5102
5096
|
}
|
|
5103
5097
|
|
|
5104
5098
|
/**
|
|
@@ -5114,15 +5108,11 @@ declare class LiveMetricManager {
|
|
|
5114
5108
|
}
|
|
5115
5109
|
|
|
5116
5110
|
dispose(): void {
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
this.registeredChatSDK.removeConnectionHandler(this.id);
|
|
5120
|
-
this.registeredChatSDK.groupChannel.removeGroupChannelHandler(this.id);
|
|
5121
|
-
this.registeredChatSDK = undefined;
|
|
5122
|
-
this.isStarted = false;
|
|
5111
|
+
this.chatSDK.removeConnectionHandler(this.id);
|
|
5112
|
+
this.chatSDK.groupChannel.removeGroupChannelHandler(this.id);
|
|
5123
5113
|
}
|
|
5124
5114
|
|
|
5125
|
-
private trackConnection(detail: ConnectionEventDetail, userId = this.
|
|
5115
|
+
private trackConnection(detail: ConnectionEventDetail, userId = this.chatSDK.currentUser?.userId): void {
|
|
5126
5116
|
if (userId) this.track({ type: 'connection', detail, userId });
|
|
5127
5117
|
}
|
|
5128
5118
|
}
|