@sendbird/ai-agent-messenger-react 1.34.2 → 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.d.ts CHANGED
@@ -2909,7 +2909,11 @@ declare type IncomingMessageBodyProps<T extends MessageType = MessageType> = Inc
2909
2909
  bubbleContentColor?: string;
2910
2910
  bubbleBackgroundColor?: string;
2911
2911
  };
2912
- surface?: 'bubble' | 'plain';
2912
+ /**
2913
+ * @deprecated The default layout no longer provides this value.
2914
+ * Render `children` in custom `MessageBody` components instead of branching on `surface`.
2915
+ */
2916
+ surface?: unknown;
2913
2917
  };
2914
2918
 
2915
2919
  export declare const IncomingMessageLayout: {
@@ -5050,11 +5054,9 @@ declare class LiveMetricManager {
5050
5054
  this.dispatch?.({ category, metricKey, data });
5051
5055
  };
5052
5056
  private readonly emitters: Record<MetricSource['type'], LiveMetricEmitter>;
5053
- private isStarted = false;
5054
- private registeredChatSDK?: ChatSDKType;
5055
5057
 
5056
- constructor() {
5057
- const getCurrentUserId = () => this.registeredChatSDK?.currentUser?.userId;
5058
+ constructor(private readonly chatSDK: ChatSDKType) {
5059
+ const getCurrentUserId = () => this.chatSDK.currentUser?.userId;
5058
5060
  this.emitters = {
5059
5061
  connection: new ConnectionMetricEmitter(this.emit),
5060
5062
  conversation: new ConversationMetricEmitter(this.emit),
@@ -5064,9 +5066,7 @@ declare class LiveMetricManager {
5064
5066
  };
5065
5067
  }
5066
5068
 
5067
- start(chatSDK: ChatSDKType): void {
5068
- if (this.isStarted) return;
5069
-
5069
+ start(): void {
5070
5070
  const connectionHandler = new ConnectionHandler({
5071
5071
  onConnected: (userId) => this.trackConnection('connected', userId),
5072
5072
  onDisconnected: (userId) => this.trackConnection('disconnected', userId),
@@ -5091,10 +5091,8 @@ declare class LiveMetricManager {
5091
5091
  onUserLeft: (channel) => this.track({ type: 'handoff', channel }),
5092
5092
  });
5093
5093
 
5094
- chatSDK.addConnectionHandler(this.id, connectionHandler);
5095
- chatSDK.groupChannel.addGroupChannelHandler(this.id, channelHandler);
5096
- this.registeredChatSDK = chatSDK;
5097
- this.isStarted = true;
5094
+ this.chatSDK.addConnectionHandler(this.id, connectionHandler);
5095
+ this.chatSDK.groupChannel.addGroupChannelHandler(this.id, channelHandler);
5098
5096
  }
5099
5097
 
5100
5098
  /**
@@ -5110,15 +5108,11 @@ declare class LiveMetricManager {
5110
5108
  }
5111
5109
 
5112
5110
  dispose(): void {
5113
- if (!this.isStarted || !this.registeredChatSDK) return;
5114
-
5115
- this.registeredChatSDK.removeConnectionHandler(this.id);
5116
- this.registeredChatSDK.groupChannel.removeGroupChannelHandler(this.id);
5117
- this.registeredChatSDK = undefined;
5118
- this.isStarted = false;
5111
+ this.chatSDK.removeConnectionHandler(this.id);
5112
+ this.chatSDK.groupChannel.removeGroupChannelHandler(this.id);
5119
5113
  }
5120
5114
 
5121
- private trackConnection(detail: ConnectionEventDetail, userId = this.registeredChatSDK?.currentUser?.userId): void {
5115
+ private trackConnection(detail: ConnectionEventDetail, userId = this.chatSDK.currentUser?.userId): void {
5122
5116
  if (userId) this.track({ type: 'connection', detail, userId });
5123
5117
  }
5124
5118
  }