@rapidaai/react 1.1.33 → 1.1.35

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.mjs CHANGED
@@ -111,7 +111,7 @@ import {
111
111
  toTextContent,
112
112
  useObservableState,
113
113
  useSelectInputDeviceAgent
114
- } from "./chunk-WVE26DLV.mjs";
114
+ } from "./chunk-4BXVNAM6.mjs";
115
115
  import {
116
116
  MultibandAudioVisualizerComponent
117
117
  } from "./chunk-CVATR327.mjs";
@@ -36133,6 +36133,10 @@ var ConnectionConfig = class _ConnectionConfig {
36133
36133
  getClientOptions() {
36134
36134
  return { debug: this.debug };
36135
36135
  }
36136
+ /**
36137
+ * holding the callback
36138
+ */
36139
+ callbacks;
36136
36140
  constructor(endpoint = {
36137
36141
  assistant: ASSISTANT_API,
36138
36142
  web: WEB_API,
@@ -36272,6 +36276,45 @@ var ConnectionConfig = class _ConnectionConfig {
36272
36276
  if (debug !== void 0) this.debug = debug;
36273
36277
  return this;
36274
36278
  }
36279
+ /**
36280
+ * Configures connection callbacks for the TalkService clients.
36281
+ *
36282
+ * @param onConnect - A callback function to be executed when a connection is established.
36283
+ * @param onDisconnect - A callback function to be executed when the connection is terminated.
36284
+ * @param onError - A callback function to be executed when the connection is terminated.
36285
+ *
36286
+ * @returns - The current instance of `ConnectionConfig` for method chaining.
36287
+ *
36288
+ * @example
36289
+ * ```typescript
36290
+ * const connection = new ConnectionConfig(auth);
36291
+ * connection.withConnectionCallback(
36292
+ * () => { console.log("Connected to the TalkService"); },
36293
+ * () => { console.log("Disconnected from the TalkService"); }
36294
+ * );
36295
+ * ```
36296
+ */
36297
+ withConnectionCallback(cl) {
36298
+ this.callbacks = cl;
36299
+ return this;
36300
+ }
36301
+ /**
36302
+ *
36303
+ * @param connection
36304
+ * @returns
36305
+ */
36306
+ onConnectionChange(connection) {
36307
+ if (connection === "connected" /* Connected */) {
36308
+ if (this.callbacks && this.callbacks?.onConnect) {
36309
+ this.callbacks.onConnect();
36310
+ }
36311
+ return;
36312
+ }
36313
+ if (this.callbacks && this.callbacks?.onDisconnect) {
36314
+ this.callbacks.onDisconnect();
36315
+ }
36316
+ return;
36317
+ }
36275
36318
  };
36276
36319
 
36277
36320
  // src/types/agent-deployment.ts